@blend-money/node) manages accounts and sessions from your backend. It does not sign transactions itself.
Quick-start flow
- Install
@blend-money/node - Create a
BlendServerSdkinstance with your API key - Look up or create an account with
sdk.lookupAccount(address) - Scope operations with
sdk.forAccount(accountId) - Create and quote a session, then run it with
client.sessions.execute()
Install
- Frontend
- Server
- pnpm
- npm
- yarn
Configuration
Account management
lookupAccount
Resolves an account by wallet address. Creates the account if it doesn’t exist yet. Does not request Safe deployment on any chain.SafeAccountResponse:
Deploy a Safe
lookupAccount creates the account but does not deploy a Safe. To deploy on a chain, scope the account with forAccount and call safe.request().
chainsDeployed right away. Use safe.resolve() to confirm before your first transaction on that chain.
forAccount
Returns a scopedBlendClient for a specific account. The client has discover, account, and sessions modules.
Session lifecycle
createSession
Creates or retrieves an active session for the scoped account.forceReset: true only when you intend to discard an active session before creating a fresh one. Re-quoting an OPEN session does not require a reset.
quoteDeposit
Quotes a deposit on an open session. UsesinputAssetAddress (not tokenAddress).
quoteWithdraw
Quotes a withdrawal on an open session.isMaxWithdraw is true, the quote redeems every source-chain position. For any source chain that differs from the destination, regardless of isMaxWithdraw, Vault embeds Relay bridge calldata in the atomic withdrawal transaction. The returned step list may omit a separate bridge step even though execution still routes the funds to the destination.
execute
Prefer the high-level orchestrator. It locks the quoted session, passes each action plan to your callback, submits the returned hashes, and resumes from the current state after a retry.
For current sessions, submit moves the session directly from
LOCKED to SETTLED. SETTLED means the server recorded the transaction hashes. It does not mean the transactions were confirmed on-chain, and the session service does not verify receipts. Replaying the same hash and chain ID pairs returns the settled session. Read balances and positions for indexer-backed money state.
Manual lifecycle
When you need direct control, quote first, narrow theSessionResult, check that its action plan is available, lock the session, execute on-chain, and submit the hashes.
cancel
Cancels a session from any non-terminal state.get / list
Retrieve a session by ID or list sessions.Abort an in-flight request
Session methods acceptRequestOptions as their final argument. Pass an AbortSignal when a caller needs to discard a stale request.
Action plans
Quoted server sessions already exposeactionPlan or actionPlans after you narrow on type. Use these utilities only when you need to convert a raw payload yourself.
depositQuoteToActionPlan
Converts a raw deposit API response to a singleActionPlan with deployType: "direct".
withdrawCalldataToActionPlans
Converts a raw withdrawal API response to anActionPlan[] (one per source chain) with deployType: "multisend".
combineActionPlans
Merges plans on the samechainId. "multisend" takes priority over "direct".
Discovery
Available on the SDK instance without account scoping.Account data
Available on the scoped client afterforAccount().
What to watch out for
Don’t try to callsdk.execute() on the root BlendServerSdk instance. Execution lives on the account-scoped session module. Use client.sessions.execute() with a submitActionPlan callback, or manage the lock/submit lifecycle manually.
Don’t expose your API key (sk_live_) in client code, logs, or version control. It grants full access to your organization’s accounts.
Don’t skip forAccount(). Account-scoped operations like sessions and balances require a scoped client. Calling them on the root SDK will fail.
Don’t forget that quoteDeposit uses inputAssetAddress on the server, not tokenAddress. The frontend SDK uses tokenAddress - the signatures differ.
Deposits & Withdrawals
Full deposit and withdrawal flows with cross-chain routing.
SDK Reference
Auth, accounts, balances, error codes, and types.