Before you start, you need a portal account with at least one active account type and credentials set up (SIWE domain for frontend, API key for server).
- Frontend
- Server
1
Install the SDK
2
Initialize the SDK
blend.ts
signMessage function connects your wallet adapter. If you use wagmi, pass signMessageAsync from the useSignMessage hook. Only the frontend SDK needs the paymaster registry. SDK 3.0.1 gets gas pricing from the bundler configured in that registry.3
Sign in the user
sign-in.ts
chainId, the SDK uses Ethereum mainnet (1) in the SIWE message.The chainId here is for the SIWE challenge message, not for Safe deployment. Check session.chainsDeployed to see where the Safe is live. If the deposit chain isn’t listed, request deployment first. See Safe deployment.4
Discover chains and tokens
discover.ts
depositChains() returns all supported deposit chains. depositTokens() returns tokens on that chain. Pass the user’s address to see their balances. Sign in before calling discovery methods. Frontend API operations outside the SIWE challenge and verification calls require the active SIWE session.5
Quote the deposit
quote.ts
quoteDeposit again - the SDK reuses the same session.6
Execute the deposit
execute.ts
deriveSigner is called once for deposits. Return clients for the requested chain and attach an account whose address matches signerAddress. Add every chain your account type supports to chainsById. For smart wallets such as Coinbase Wallet, set isContractSigner: true.7
Check the balance
balance.ts
8
Handle errors
errors.ts
SdkError gives you a machine-readable code, a getUserMessage() for displaying to users, and isRetryable() for handling transient failures like rate limits and server errors.What just happened
Your deposit followed this path:- The SDK created a session and requested a quote from Blend’s API.
- Blend calculated the optimal route, including any bridge steps for cross-chain deposits.
- The transaction was submitted on-chain. Gas was sponsored through the configured frontend bundler or paid by your server signer.
- Funds landed in the user’s Safe and were allocated to vaults based on your account type’s allocation.
What to watch out for
Don’t create a new session for every quote. CallquoteDeposit again on the same OPEN session to update the amount, token, or chain. Use forceReset: true only when you want to discard the active session, including when switching from a deposit to a withdrawal.
Don’t skip error handling. Quotes expire, flow plans can conflict with deposits, and wallets can reject signatures. Check error.isRetryable() before retrying.
Don’t hard-code chain IDs or token addresses. Use discover.depositChains() and discover.depositTokens() to build your UI dynamically.
Go-live checklist
1
Verify your SIWE domain
Confirm the domain in Settings > Credentials matches your production URL. Not your staging URL. Not localhost.
2
Rotate credentials
Create fresh API keys for production. Don’t reuse development keys. Deactivate any test keys.
3
Test end-to-end
Make a real deposit and withdrawal on each supported chain. Verify balances update correctly. Test with amounts under $1 to keep costs low.
4
Confirm allocations
Check that your account type’s vault config is Active (not Pending or Provisioning). Deposits to an account type without active infrastructure will fail.
5
Set flow plan mode
Decide whether to auto-approve flow plans or review them manually. Auto-approve is simpler but gives you less control over rebalancing timing.
6
Verify error handling
Test your app’s behavior for expired quotes, rejected wallet signatures, and
FLOWPLAN_CONFLICT errors. Users should see helpful messages, not stack traces.Once you’ve completed the checklist, your integration is production-ready. Deposits, withdrawals, and rebalancing will work end-to-end.
Frontend SDK reference
Full method reference for quoting, execution, and account data.
Server SDK reference
Full method reference for account management and session lifecycle.
Deposits and withdrawals
Cross-chain routing, re-quoting, and withdrawal coordination.
Best practices
Credential security, session management, and error recovery patterns.