Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.blend.money/llms.txt

Use this file to discover all available pages before exploring further.

Install the SDK, make your first deposit, and verify the balance. Under 30 minutes from zero to working code.
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).
1

Install the SDK

pnpm add @blend-money/fe viem
The frontend SDK depends on viem for wallet interactions and chain management.
2

Initialize the SDK

blend.ts
import { BlendSdk } from "@blend-money/fe";
import { getPimlicoPaymasterUrl } from "@blend-money/core";

const sdk = new BlendSdk({
  publishableKey: "pk_live_a1b2c3d4e5f6...",
  signMessage: (message) => wallet.signMessage({ message }),
  paymasterUrl: getPimlicoPaymasterUrl("your-pimlico-key"),
});
The signMessage function connects your wallet adapter. If you use wagmi, pass signMessageAsync from the useSignMessage hook.
3

Sign in the user

sign-in.ts
import { BlendSdk } from "@blend-money/fe";

const session = await sdk.signIn({
  address: "0x1234...abcd",
  chainId: 8453,
});

console.log(session.accountId);    // "acc_..."
console.log(session.safeAddress);  // "0x..."
This starts a SIWE flow. The user’s wallet signs a challenge message, and Blend returns a session with their account ID and Safe address. Sessions last 1 hour and auto-refresh.
4

Discover chains and tokens

discover.ts
import { BlendSdk } from "@blend-money/fe";

const chains = await sdk.discover.depositChains();
const tokens = await sdk.discover.depositTokens(8453, {
  eoa: "0x1234...abcd",
});
depositChains() returns all supported deposit chains. depositTokens() returns tokens on that chain. Pass the user’s address to see their balances.
5

Quote the deposit

quote.ts
import { BlendSdk } from "@blend-money/fe";
import { parseAmount } from "@blend-money/core";

const quote = await sdk.quoteDeposit({
  chainId: 8453,
  tokenAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
  amount: parseAmount("100", 6),
});
The quote shows input/output amounts, fees, and estimated time. It expires after a few minutes. If you need to change the amount, call quoteDeposit again - the SDK reuses the same session.
Use parseAmount from @blend-money/core to convert human-readable amounts to the smallest unit. USDC has 6 decimals, so parseAmount("100", 6) returns "100000000".
6

Execute the deposit

execute.ts
import { BlendSdk } from "@blend-money/fe";
import { createWalletClient, createPublicClient, http } from "viem";
import { base } from "viem/chains";

const result = await sdk.execute(quote, {
  signerAddress: "0x1234...abcd",
  deriveSigner: async (chainId) => ({
    signer: createWalletClient({ chain: base, transport: http() }),
    publicClient: createPublicClient({ chain: base, transport: http() }),
  }),
});
The SDK locks the session, builds the transaction, and submits it. deriveSigner is called once for deposits. It returns a viem WalletClient and PublicClient for the target chain. For smart wallets (like Coinbase Wallet), set isContractSigner: true.
7

Check the balance

balance.ts
import { BlendSdk } from "@blend-money/fe";

const balance = await sdk.account.balance();
console.log(balance.total); // { USD: 100.05, EUR: 92.12 }
The balance reflects the deposit after settlement. This usually takes under a minute for same-chain deposits.
8

Handle errors

errors.ts
import { SdkError } from "@blend-money/core";

try {
  const quote = await sdk.quoteDeposit({ /* ... */ });
} catch (error) {
  if (error instanceof SdkError) {
    console.error(error.code);            // "FLOWPLAN_CONFLICT"
    console.error(error.getUserMessage()); // user-friendly text
    if (error.isRetryable()) { /* retry with backoff */ }
  }
}
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:
  1. The SDK created a session and requested a quote from Blend’s API.
  2. Blend calculated the optimal route, including any bridge steps for cross-chain deposits.
  3. The transaction was executed on-chain. Gas was sponsored by the paymaster (frontend) or your signer (server).
  4. Funds landed in the user’s Safe and were allocated to vaults based on your account type’s allocation.
The user’s Safe is a real Gnosis Safe. Only whitelisted modules can move funds. The user retains ownership at all times.

What to watch out for

Don’t create a new session for every quote. Call quoteDeposit again on the same session to update the amount or token. Use forceReset: true only when starting a completely new flow. 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.
Last modified on May 7, 2026