@blend-money/fe) handles wallet authentication, deposit/withdrawal quoting, and on-chain execution in the browser.
Quick-start flow
- Install
@blend-money/feandviem - Create a
BlendSdkinstance with your publishable key and paymaster - Sign in with
sdk.signIn() - Quote with
sdk.quoteDeposit()orsdk.quoteWithdraw() - Execute with
sdk.execute(quote, { deriveSigner })
Install
- Frontend
- Server
- pnpm
- npm
- yarn
Configuration
Use an Alchemy Gas Manager policy for Alchemy-backed chains:
VALIDATION_ERROR if the registry has no entry for a required chain.
SDK 3.0.1 gets gas prices from the configured bundler. It does not call a Blend gas-price method.
Authentication
signIn
Signs the user in with SIWE. The first sign-in creates the account record and deterministic Safe address. It does not deploy the Safe on-chain.chainId defaults to 1. It sets the SIWE message chain and does not deploy the Safe.
Returns an AuthSession:
Check
chainsDeployed to see where the Safe is live. If you need the Safe on a chain that isn’t listed, request deployment:
signOut
Revokes the JWT server-side and clears local state.isSignedIn
Read-only boolean.true if a session is active.
session
Returns the currentAuthSession. Throws SdkError with code AUTH_NOT_SIGNED_IN if not authenticated.
exportSession / restoreSession
Persist and restore sessions across page reloads.Quoting
quoteDeposit
Quotes a deposit. Creates a session automatically if one doesn’t exist.
Returns a
DepositQuote:
quoteWithdraw
Quotes a withdrawal. Blend picks which chains to pull funds from.isMaxWithdraw: true and amount: "0":
destinationChainId, Vault embeds Relay bridge calldata inside the atomic withdrawal transaction. The returned step list may not contain a separate bridge step, but the execution still routes those funds to the requested destination.
Returns a WithdrawQuote:
Execution
execute
Locks the quote, submits transactions through the user’s Safe, and records their hashes. New sessions settle as soon as the API accepts the hashes. LegacySUBMITTED sessions can still require polling.
deriveSigner is called once per action plan. For deposits, that means once. For withdrawals, once per source chain.
Return clients configured for the requested chain. The wallet client must have an attached account whose address matches signerAddress.
DeriveSignerResult:
ExecuteResult:
Discovery
These methods are available onsdk.discover after sign-in. Every frontend route outside challenge and verify requires the SIWE bearer session.
Account data
These methods are available onsdk.account after sign-in.
Cancel in-flight requests
Every async HTTP method acceptsRequestOptions as its last argument. Pass an AbortSignal when a user changes an input during live quoting.
Error handling
Every SDK method can throwSdkError. Catch it to get structured error info.
What to watch out for
Don’t create a new session to change the amount, token, or chain. Call the same quote method again while the session isOPEN. To switch between a deposit and withdrawal in the high-level frontend SDK, pass forceReset: true; this discards the opposite-type active session and starts a new one.
Don’t store sessions in localStorage. Use sessionStorage and clear it when the wallet disconnects.
Don’t treat onStatusChange as the final result. SDK 3.0.1 can emit the legacy-compatible "confirming" callback even when the API settles directly. Use the returned ExecuteResult, then use balances and positions to confirm indexed activity.
Don’t ignore isContractSigner. If your users connect smart wallets (Coinbase Wallet, Safe), set it to true or signing will fail.
Deposits & Withdrawals
Full deposit and withdrawal flows with cross-chain routing.
SDK Reference
Auth, accounts, balances, error codes, and types.