github.com/limitless-labs-group/limitless-exchange-go-sdk v1.3.0 or later. Read the Partner Packs workflow for account ownership, durable retries, amounts, and recovery rules.
Configure a server-side client
The following snippets belong to the same Go package:trading and delegated_signing scopes, plus account_creation for allowances. Reuse the client and do not configure a global x-on-behalf-of header.
Browse and check approval
client.Packs.List(ctx), Search(ctx, "football"), or Get(ctx, packID) to browse. If approval is missing, call client.PartnerAccounts.RetryAllowances(ctx, profileID) and poll CheckAllowances with a bounded wait until the vault is confirmed. Repair uses the unlimited-approval policy.
Prepare once, then submit the saved request
PackBuyParams before submission, using encoding/json and your application store. Associate the record with its environment, partner, and managed account. On restart, reload it; do not call preparation again for the same purchase.
WaitForPosition continues through position FAILED and stops on VAULT_REVERTED. It polls up to 60 times at 5-second intervals; the context can cancel the wait. On timeout or an ambiguous response, retain and replay the saved request unchanged, including its deadline. See explicit renewal signals.
Read positions and claim
ListPositions(ctx, profileID, 20, 0) to list purchases, ClaimOnce(ctx, profileID, positionID) for one claim step, and ConfirmClaim(ctx, profileID, positionID, redemptionTxHash) to recover a lost submission response with the mined redemption receipt.
After claiming, the position remains WON; verify ClaimTxHash or the claim response’s CLAIMED status. Log position.Wallet to identify the managed recipient.
Classify errors
limitless.ClassifyPackError(err) returns typed PackErrorDetails. Its Kind is one of PackErrorAllowanceRequired, PackErrorNotSubmitted, PackErrorPriceDrifted, PackErrorIntentExpired, PackErrorWalletBusy, PackErrorRateLimited, PackErrorSubmissionUnknown, PackErrorTransactionReverted, or PackErrorOther.
The result includes TokenAddress, Spender, RequiredAllowance, SubmissionState, ParlayID, and Recovery when supplied by the API. Classification does not retry.
The claim helper surfaces API errors. Back off on rate limits and wallet-busy conflicts, then resume the same position. For PackErrorSubmissionUnknown, reconcile the mined redemption transaction and use ConfirmClaim; do not blindly resubmit.