For the complete documentation index, see llms.txt. This page is also available as markdown.

Migrating from v0.2.1

This guide covers what changed between Smart Routing Address v0.2.1 and v1, and how to update your code. Most integrations only need a few small edits. The v0.2.1 docs remain available for reference.

Breaking changes:

New (non-breaking):


Breaking changes

version is now required

Pass the Smart Routing Address version constant exported by the SDK, so your address is pinned to a known version. The latest is SMART_ROUTING_ADDRESS_V1_0_0.

import {
  createSmartRoutingAddress,
  SMART_ROUTING_ADDRESS_V1_0_0, 
} from "@zerodev/smart-routing-address";

const { smartRoutingAddress } = await createSmartRoutingAddress({
  owner,
  destChain,
  srcTokens,
  actions,
  version: SMART_ROUTING_ADDRESS_V1_0_0, 
});

projectId is now a top-level parameter

Previously you passed your project ID by hand-building config.baseUrl (and only for sponsorship). In v1, projectId is a required, first-class parameter, and the SDK builds the request URL for you. Grab your ID from the dashboard.

// Before
const { smartRoutingAddress } = await createSmartRoutingAddress({ 
  owner, 
  destChain, 
  actions, 
  srcTokens, 
  config: { 
    baseUrl: `${SMART_ROUTING_ADDRESS_SERVER_URL}/${ZERODEV_PROJECT_ID}`, 
  }, 
}); 

// After
const { smartRoutingAddress } = await createSmartRoutingAddress({ 
  owner, 
  projectId: ZERODEV_PROJECT_ID, 
  destChain, 
  actions, 
  srcTokens, 
  version: SMART_ROUTING_ADDRESS_V1_0_0, 
}); 

Fee sponsorship otherwise works exactly as before — toggle sponsored tokens in the dashboard. See Fee Sponsorship docs for the full walkthrough.

fallBack has been removed from actions

Actions no longer take a fallBack array. Each action is just { action: [...] }.

const { smartRoutingAddress } = await createSmartRoutingAddress({
  owner,
  projectId,
  destChain,
  actions: {
    USDC: {
      action: [erc20Call],
      fallBack: [erc20Call], 
    },
  },
  srcTokens,
  version: SMART_ROUTING_ADDRESS_V1_0_0,
});

actions is now optional (direct mode)

actions used to be required. In v1 it's optional — omit it and pass a recipient to use the new direct mode. If you keep passing actions (execute mode), nothing changes other than dropping fallBack.


What's new

New: Direct mode

You no longer need to define actions just to move funds to an address. Pass a recipient and the SDK bridges funds straight there — cheaper, since there's no custom logic to run on the destination chain.

const { smartRoutingAddress } = await createSmartRoutingAddress({
  owner,
  projectId,
  destChain: arbitrum,
  recipient: owner, 
  srcTokens,
  version: SMART_ROUTING_ADDRESS_V1_0_0,
});

Keep using execute mode (actions) when you need to run logic on arrival. See Deposit Modes for the full comparison.

New: allowPartialRoutes

When you list many source chains, one temporarily-unavailable route used to fail the whole call. Set allowPartialRoutes: true to create the address anyway and simply drop the routes that aren't available.

const { smartRoutingAddress } = await createSmartRoutingAddress({
  owner,
  projectId,
  destChain,
  recipient: owner,
  srcTokens,
  allowPartialRoutes: true, 
  version: SMART_ROUTING_ADDRESS_V1_0_0,
});

New: Same-chain deposits without sponsorship

Depositing when the source chain and destination chain are the same no longer requires fee sponsorship. Same-chain flows now work out of the box, sponsored or not.

New: More chains and tokens

v1 adds:

  • USDG on Robinhood
  • ETH, WETH, and USDT on MegaETH

See the full list on Supported Chains & Tokens. Need a chain or token that isn't listed? Get in touch.

On this page