- Flow-level failures are expected outcomes. The on-chain flows (
executeSwap,executeTokenSale,authorizeWallet) return a tagged result rather than throwing, so you handle them with a branch, not acatch. - Thrown errors are for genuinely exceptional conditions, such as calling an authenticated method without a session.
Wallet errors
WalletError is the shared vocabulary for anything the user’s wallet does. It appears as the cause on any step that asked the wallet to sign or send.
If you drive a wallet yourself,
classifyWalletError(error, { hash }) turns a raw thrown wallet error into a typed WalletError. Pass hash when you are awaiting a receipt so a timeout can be reported against the right transaction.
Swap errors
executeSwap returns SwapExecutionError, tagged by step.
The wallet is only asked to sign after all read-only checks pass, so a user never signs a transaction the swap would revert on for a reason the SDK could have caught first.
Token sale errors
executeTokenSale returns TokenSaleExecutionError.
Allowance resets
Theallowance-reset steps only occur when the wallet already holds a non-zero allowance that must be set to zero first. USDT-style tokens reject a non-zero to non-zero approve(), so the SDK resets before re-approving. This means those users see two wallet prompts instead of one, which is worth reflecting in your loading copy.
Wallet authorization errors
authorizeWallet returns WalletAuthorizationError. See Allowlist a wallet for the full table and the progress phases.
Wallet connection errors
ConnectWalletError carries a code, a message, and a retryable flag. Respect retryable when deciding whether to offer a retry button.
OAuth errors
useCompleteOAuth fails with a CompleteOAuthFailureReason, which is either complete_request_failed or one of the client-side reasons below.
KYC token errors
useKycToken fails with not-authenticated when there is no session, or generic-error for everything else.
Thrown errors
Next steps
Allowlist a wallet
Wallet authorization, its phases, and its error steps.
Package overview
Entry points and what each one exports.