What the SDK does for you
The flow
-
Read the descriptors. Call
GET /v1/perps/providers. Each entry insetupandactionsdeclaressigner,signingMethod, andrelay. See Provider Fields. -
Create the step. Call
POST /v1/perps/createActionwith the descriptortypeasaction. The response lists the staged steps. -
Sign each step according to the descriptor
signingMethod: -
Send the signed step according to the descriptor
relay:API: post the signed steps toPOST /v1/perps/executeAction.CLIENT: send the step to the venue yourself. Nothing reaches LI.FI. Seerelay: CLIENT.
signer: USER needs the user’s wallet or consent. A step that has signer: SDK needs no user interaction, but you must still produce its signature or call yourself.
relay: API
Post the signed steps to the same perps API base that served createAction. Send the steps in the same shape and order that createAction returned. Copy each staged field, such as typedData, from the createAction step without a change. In the example, the value "<from createAction>" stands for that original field.
Lighter deposit acknowledgement
deposit is an evmTx action with relay: API. The user’s wallet broadcasts each leg. executeAction does not broadcast anything. It receives the signed steps as the acknowledgement of the deposit.
createAction returns one step per leg: an ERC-20 approve, then the bridge deposit.
txHash of its transaction. Do not change txParams. LI.FI matches the steps against the staged action.
orderId field carries the txHash:
args, to, and the asset index are placeholders. Use the values from your createAction response.
relay: CLIENT
The client sends these steps to the venue itself. LI.FI does not receive them, and you never call executeAction for them.
Each row gives the venue endpoint, the method, the authentication, and the staged-step fields that make up the body.
Lighter
Send Lighter steps to the REST base of the provider instance:
Both steps are form posts. Send
Content-Type: application/x-www-form-urlencoded. Put a Lighter auth token in the Authorization header, without a prefix. Make the token with the Lighter signer’s CreateAuthToken function. Use the API key that registerApiKey registered and a short deadline. The SDK uses five minutes.
The staged step is a WasmBlobActionStep, but it has no signed blob. Read the body fields from its wasmSignParams.
The response body carries a
code. 200 means success. Any other code is a venue rejection. For setReferrer, code 41003 means the account already has a referral code. Treat it as settled.
Ondo
Send Ondo steps tohttps://api.ondoperps.xyz. The sandbox base is https://api.ondoperps-sandbox.xyz. Every response is an envelope, { success, result }. Read the value from result.
Except siweLogin, each step authenticates with the session token from siweLogin, sent as Authorization: Bearer <token>. All bodies are JSON.
An Ondo account holds at most 10 API keys. See Ondo Setup for how the SDK reclaims a slot.
Decide whether a step is satisfied
Run the steps in ascendingsequence. A step can depend on every lower step being satisfied. For example, Lighter setReferrer uses the API key that registerApiKey registers.
Steps with relay: API and no options. Call createAction for the step type. Use the descriptor params, which are empty for most steps. An empty actions array means the step is satisfied. A non-empty array means you must sign and submit the staged steps. For Lighter registerApiKey, pass knownPublicKey (the public key you hold locally) so the backend can tell that the key at its slot is yours.
Steps with relay: CLIENT. LI.FI cannot see the venue state for these steps. Read it from the venue:
Choice steps. A step with
options is satisfied when the account’s current value matches one option. Read the current value from the venue:
A step is satisfied when the value you read matches an option, for example
plus or premium for the Lighter accountType step. If no option matches, the step is not satisfied.
For a choice step, the option with default: true is the recommended option. It is only a suggestion. Nothing is changed until you execute an option. To execute an option, call createAction with the option type and params. Then sign the staged step, and send it according to the descriptor relay.
WasmBlobActionStep. Read account_index and new_tier from its wasmSignParams, and post them to /api/v1/changeAccountTier as described above.
Revoke a setup step
A satisfied step can carry arevoke value. It names an entry in actions. To undo the step, call createAction with that type and empty params, except revokeSessionAgent, which takes agentAddress. Sign the staged steps and send them according to the relay of that entry. An empty actions array means there is nothing to revoke. The step becomes unsatisfied, so it stages again.
Errors
Lighter accepts integrator approvals and integrator-routed orders only from Plus or Premium accounts. OtherwiseexecuteAction returns SetupRequired (2070). A relay: CLIENT call that you send to Lighter yourself gets the raw venue code 21520. Set the tier with the accountType step, then retry.
See Error Codes for the codes that createAction and executeAction return.