@limitless-exchange/sdk 1.3.0 or later. Read the Partner Packs workflow for account ownership, durable retries, amounts, and recovery rules.
Configure a server-side client
trading and delegated_signing scopes, plus account_creation for allowance preflight. Do not configure a global x-on-behalf-of header.
Browse and check approval
client.partnerAccounts.retryAllowances(profileId) and poll checkAllowances with a bounded wait until the vault is confirmed. Repair uses the unlimited-approval policy. Complete this before creating the short-lived intent.
Prepare once, then submit the saved request
preparePurchase before calling submitSavedPurchase. On restart, load that record; do not call preparation again for the same intended purchase. Associate the record with the environment, partner, and managed account.
waitForPosition continues through position FAILED and stops on VAULT_REVERTED. On timeout or an ambiguous buy response, retain and replay the saved request unchanged, even if its deadline has passed. Only explicit rejection signals permit renewal.
Read positions and claim
claimOnce(profileId, positionId) for one workflow step. Polling options also accept an AbortSignal. After claiming, the position remains WON; verify claimTxHash or the claim response’s CLAIMED status.
Classify errors
tokenAddress, spender, and requiredAllowance. For pre-broadcast failures it exposes submissionState, parlayId, and recovery. The classifier does not retry.
The claim helper surfaces API errors. Back off on rate limits and wallet-busy conflicts, then resume the same position. For SUBMISSION_UNKNOWN, reconcile the mined redemption transaction and use confirmClaim; do not blindly resubmit.