Account actions govern everything outside the order book: how much leverage an account uses, which delegate wallets may trade on its behalf, and how USDC moves between the exchange and Solana. Some of these actions are fully user-controlled; others — particularly those that touch on-chain bridge events — are restricted to authorized relayer signers. Type signatures are drawn directly fromDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Proof-labs/trading-sdk/llms.txt
Use this file to discover all available pages before exploring further.
src/types.ts. Each section below indicates whether the action is user-signed or relayer-only.
SetUserMarketLeverage
User-signed.
owner must equal the envelope signer’s derived address.max(market.imBps, userImBps) on every IM check, so users can only deleverage relative to the market floor — they cannot exceed the market’s own IM requirement. Setting userImBps to 0 clears any existing override and reverts to the market default.
20-byte account address picking the override. Must equal the envelope signer’s derived address.
Market identifier the override applies to.
Initial margin override in basis points.
0 clears the override and reverts to the market default. Any non-zero value must be >= market.imBps; the engine rejects lower values with UserLeverageBelowMarketIm (error code 38).ApproveAgent
User-signed. Signed by the delegating account owner.
20-byte account address granting the delegation.
Ed25519 public key of the agent wallet (32 bytes). The engine derives a 20-byte address from this key and records it as the authorized agent.
RevokeAgent
User-signed. Signed by the delegating account owner.
20-byte account address revoking the delegation.
Ed25519 public key of the agent wallet to revoke (32 bytes). Must match the key passed to the corresponding
ApproveAgent action.WithdrawRequest
User-signed. Initiates the two-step withdrawal flow.
Pending withdrawal record. The relayer then picks up the record, executes the Solana transfer, and calls either ConfirmWithdrawal or FailWithdrawal.
20-byte account address requesting the withdrawal.
Withdrawal amount in microUSDC (6 decimal places). For example,
100_000_000n = $100.00 USDC.Solana destination public key (Ed25519, 32 bytes). This is the raw public key bytes — not a base58 address string.
WithdrawalRecord and WithdrawalStatus
These types are returned byqueryWithdrawal and mirror the engine’s WithdrawalRecord struct field-for-field.
| Field | Type | Description |
|---|---|---|
id | bigint | Engine-assigned withdrawal ID used in ConfirmWithdrawal and FailWithdrawal |
owner | Address | 20-byte address that requested the withdrawal |
amount | bigint | Requested amount in microUSDC |
solanaDestination | Uint8Array | 32-byte Solana destination public key |
status | WithdrawalStatus | "Pending" → "Completed" or "Pending" → "Failed"; never reverses |
requestHeight | bigint | Block height at which the WithdrawRequest was admitted |
ConfirmDeposit
Relayer-only. The envelope signer’s derived address must equal
signer and be on the relayer allowlist.solanaTxSig field acts as an idempotency key — re-submitting the same signature is a no-op. This is the preferred production deposit path; use Deposit only for dev/bootstrap scenarios.
20-byte account address to credit.
Deposit amount in microUSDC (6 decimal places).
Solana transaction signature (typically 64 bytes) used for idempotency. Duplicate signatures are ignored.
Authorized relayer signer address (20 bytes). Must match the envelope signer’s derived address and be on the relayer allowlist.
ConfirmWithdrawal
Relayer-only. The envelope signer must match
signer and be on the relayer allowlist.Pending withdrawal as Completed after the USDC transfer was sent on Solana. This transitions WithdrawalRecord.status to "Completed" and records the Solana transaction signature.
Engine-assigned withdrawal ID (from
WithdrawalRecord.id).Solana transaction signature for the completed transfer (typically 64 bytes).
Authorized relayer signer address (20 bytes).
FailWithdrawal
Relayer-only. The envelope signer must match
signer and be on the relayer allowlist.Pending withdrawal as permanently Failed and refund the debited balance back to the account. This transitions WithdrawalRecord.status to "Failed".
Engine-assigned withdrawal ID (from
WithdrawalRecord.id).Human-readable reason for the failure. Stored in the withdrawal record and surfaced to clients.
Authorized relayer signer address (20 bytes).
Deposit
Relayer-only. Legacy credit action — prefer
ConfirmDeposit for production flows tied to Solana bridge events.signer, and signer must be on the on-chain relayer allowlist. Clients outside the allowlist receive UnauthorizedRelayer.
20-byte account address to credit.
Deposit amount in microUSDC (6 decimal places). For example,
100_000_000n = $100.00 USDC.Authorized relayer signer address (20 bytes). Must match the envelope signer’s derived address and be on the relayer allowlist.
Withdraw
Relayer-only. Prefer
WithdrawRequest + ConfirmWithdrawal for the standard two-step user withdrawal flow.Deposit.
20-byte account address to debit.
Withdrawal amount in microUSDC (6 decimal places).
Authorized relayer signer address (20 bytes). Must match the envelope signer’s derived address and be on the relayer allowlist.
Authorization Summary
| Action | Signer Requirement |
|---|---|
SetUserMarketLeverage | Owner (user-signed; owner == envelope signer) |
ApproveAgent | Owner |
RevokeAgent | Owner |
WithdrawRequest | Owner |
ConfirmDeposit | Relayer allowlist |
ConfirmWithdrawal | Relayer allowlist |
FailWithdrawal | Relayer allowlist |
Deposit | Relayer allowlist |
Withdraw | Relayer allowlist |