Forest Docs
DevelopersForest Playkit

RPC Reference

Forest RPC request, response, and exposed method reference.

This is the reference home for the HTML SDK transport: the request and response envelopes, the result.stage progress values, the full list of exposed RPC methods, and the signed REST endpoints your backend calls. Topic-specific request and response shapes live on each topic page.

RPC Request Format

All Forest RPC calls use this request envelope:

JavaScript
{
  type: "FOREST_RPC_REQUEST",
  version: 1,
  id: "unique-request-id",
  method: "forest.swap.quote",
  params: {}
}
FieldRequiredDescription
typeyesAlways FOREST_RPC_REQUEST.
versionyesUse 1.
idyesUnique request id. Responses use the same id.
methodyesForest method name.
paramsyesMethod-specific params. Use {} if there are none.

RPC Response Format

Forest replies with:

JavaScript
{
  type: "FOREST_RPC_RESPONSE",
  version: 1,
  id: "same-request-id",
  status: "pending",
  result: {},
  error: undefined
}
StatusMeaning
pendingForest accepted the request and is preparing, quoting, or submitting.
hashA transaction hash is available, but the transaction is not confirmed yet.
successThe request completed. For swaps, the transaction receipt has confirmed.
errorThe request failed. Read error.code and error.message.

Error codes are documented centrally

On an error status, read error.code and error.message. Every code, what causes it, and how to recover is listed in the Errors and Security reference.

Progress stages

Swap and session responses may include a result.stage value while Forest is preparing or submitting work. Treat these as progress updates — the request is done only on the final success (or error) response.

Prop

Type

Session hash responses additionally carry one of these *_submitted stages so you can tell which transaction the hash belongs to:

result.stageTransaction the hash belongs to
approval_submittedToken approval for the session.
create_submittedThe session (createSession) transaction.
revoke_submittedThe session revoke transaction.

Exposed RPC Methods

MethodWallet transactionPurpose
forest.swap.quotenoRead a swap quote and token-page snapshot.
forest.swap.buyyesBuy Project Token through the connected wallet.
forest.swap.sellyesSell Project Token through the connected wallet.
forest.swap.session.createyesAsk the user to enable an auto-swap session.
forest.swap.session.currentnoRead the latest active auto-swap session.
forest.swap.session.getnoRead a confirmed auto-swap session.
forest.swap.session.revokeyesAsk the user to revoke an active auto-swap session.
forest.game.balancenoRead the current player's Game Balance.
forest.game.deposityesMove wallet-held Project Token into Game Balance.
forest.game.withdrawyesMove Game Balance back to the connected wallet.
forest.game.burnyesTransfer wallet-held Project Token on-chain to the signed sink (dead address by default); returns the txHash.
forest.game.burnsnoList the current player's recorded burns (paginated).
forest.game.burns.summarynoRead the current player's burn totals, grouped by reason.
forest.game.transactionsnoList the current player's Game Balance / Vault activity (deposits, claims, funding).
forest.game.action.authorizenoAuthorize one trusted-backend-settled game action.
forest.identity.codenoIssue a single-use code to resolve verified identity.

REST endpoints

Signed/relayed endpoints under /campaigns/{projectId}/html. Full request and response detail lives on each topic page.

MethodPathCallerDocumented in
POST/action-authorizationsiframe (session)Game Actions
POST/settlementsbackend (HMAC v1=)Game Actions
POST/burnsbackend (HMAC v1=)Burns
POST/identity/codesiframe (session)Player Identity
POST/identity/redeembackend (HMAC v1=)Player Identity
POST/swap-sessions/{sessionId}/executionsbackend (HMAC v1=)Swap Sessions