When the user’s funds are on a different chain, the SDK automatically selects the right bridge:
Copy
// User has USDC on Ethereum, strategy is on Baseconst plan = await client.actions.deposit( { address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", symbol: "USDC", decimals: 6, chainId: 1 }, strategies[0], // Base strategy 1_000_000n, 100, // 1% slippage for cross-chain);// SDK uses LiFi for EVM-to-EVM routes, Garden for Botanix routes
// Get user's current balance for a specific strategyconst balance = await client.strategy.getCurrentBalance(strategy);console.log("Safe:", balance.safeAddress);console.log("Balance:", balance.formattedBalance);// Get TVL for your integrationconst tvl = await client.strategy.getIntegrationTvl(Integrations.USX);console.log("Total TVL:", tvl.formattedValue);
import { SdkError } from "@blend-money/sdk-core";try { const plan = await client.actions.deposit(inputToken, strategy, amount, slippage);} catch (error) { if (error instanceof SdkError) { // Show user-friendly message console.error("Deposit failed:", error.getUserMessage()); console.error("Error code:", error.code); } else { console.error("Unexpected error:", error); }}
For production integrations, always use Decimal.js for financial calculations and validate all amounts before submitting transactions. See the SDK best practices for details.