Skip to main content
The server SDK (@blend-money/node) manages accounts and sessions from your backend. It does not sign transactions itself.

Quick-start flow

  1. Install @blend-money/node
  2. Create a BlendServerSdk instance with your API key
  3. Look up or create an account with sdk.lookupAccount(address)
  4. Scope operations with sdk.forAccount(accountId)
  5. Create and quote a session, then run it with client.sessions.execute()

Install

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.
Returns a SafeAccountResponse:
chainsDeployed only lists chains where the Safe has been deployed. A new account starts with no chains. To deploy on a chain, call safe.request() after lookup. See Safe deployment.

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().
Safe deployment is asynchronous. The chain may not appear in chainsDeployed right away. Use safe.resolve() to confirm before your first transaction on that chain.
If you need the Safe on more chains, request each one:
See Safe deployment for the full resolve-then-request pattern.

forAccount

Returns a scoped BlendClient for a specific account. The client has discover, account, and sessions modules.
All session and account operations go through this scoped client.

Session lifecycle

The server SDK does not sign transactions. Prefer client.sessions.execute(), which manages the session lifecycle around your submitActionPlan callback. Use the manual methods only when you need direct lifecycle control.

createSession

Creates or retrieves an active session for the scoped account.
Pass 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. Uses inputAssetAddress (not tokenAddress).

quoteWithdraw

Quotes a withdrawal on an open session.
When 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 the SessionResult, 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 accept RequestOptions as their final argument. Pass an AbortSignal when a caller needs to discard a stale request.
Aborting the HTTP request does not cancel or reset the session.

Action plans

Quoted server sessions already expose actionPlan 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 single ActionPlan with deployType: "direct".

withdrawCalldataToActionPlans

Converts a raw withdrawal API response to an ActionPlan[] (one per source chain) with deployType: "multisend".

combineActionPlans

Merges plans on the same chainId. "multisend" takes priority over "direct".

Discovery

Available on the SDK instance without account scoping.
See SDK Reference for response shapes.

Account data

Available on the scoped client after forAccount().
See SDK Reference for response shapes.

What to watch out for

Don’t try to call sdk.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.
Last modified on July 24, 2026