Skip to main content

toMultichainNexusAccount

Creates a multichain Nexus smart account that can operate across multiple chains with the same address.
const account = await toMultichainNexusAccount(options);

Parameters

ParameterTypeRequiredDescription
signerAccount | WalletClientYesThe EOA signer that owns the account
chainConfigurationsChainConfiguration[]YesArray of chain configs

ChainConfiguration

PropertyTypeRequiredDescription
chainChainYesViem chain object
transportTransportYesRPC transport
versionMeeVersionConfigYesMEE version config
accountAddressAddressNoOverride for EIP-7702 mode

Returns

MultichainSmartAccount

Example

import { toMultichainNexusAccount, getMEEVersion, MEEVersion } from "@biconomy/abstractjs";
import { http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { base, optimism } from "viem/chains";

const signer = privateKeyToAccount("0x...");

const account = await toMultichainNexusAccount({
  signer,
  chainConfigurations: [
    { chain: base, transport: http(), version: getMEEVersion(MEEVersion.V2_1_0) },
    { chain: optimism, transport: http(), version: getMEEVersion(MEEVersion.V2_1_0) }
  ]
});

EIP-7702 Mode

For embedded wallets, set accountAddress to the EOA address:
const account = await toMultichainNexusAccount({
  signer,
  chainConfigurations: [
    { 
      chain: base, 
      transport: http(), 
      version: getMEEVersion(MEEVersion.V2_1_0),
      accountAddress: signer.address  // Use EOA directly
    }
  ]
});

MultichainSmartAccount Methods

addressOn

Get the account address on a specific chain.
const address = account.addressOn(chainId, strict?);
ParameterTypeRequiredDescription
chainIdnumberYesChain ID
strictbooleanNoEnable strict mode—throws if chain is not in chainConfigurations
Both calls return the same address. The strict flag is a safety check that throws an error if the requested chain was not defined in your chainConfigurations, helping catch configuration mistakes early.

Example

const baseAddress = account.addressOn(8453);
const strictAddress = account.addressOn(8453, true);
// Both return the same address
// `true` throws if chain 8453 is not configured

buildComposable

Build a composable instruction with support for runtime injection.
const instruction = await account.buildComposable(options);
See Instructions for full documentation.

build

Build a simple instruction without composability features.
const instruction = await account.build(options);
See Instructions for full documentation.

deployments

Access individual chain deployments.
for (const deployment of account.deployments) {
  const isDeployed = await deployment.isDeployed();
  console.log(`Chain ${deployment.chain.id}: ${isDeployed}`);
}

toNexusAccount

Creates a single-chain Nexus account. Use for bundler-based flows without MEE.
const account = await toNexusAccount(options);

Parameters

ParameterTypeRequiredDescription
signerAccountYesThe EOA signer
chainConfigurationChainConfigurationYesSingle chain config

Example

import { toNexusAccount, getMEEVersion, MEEVersion } from "@biconomy/abstractjs";

const account = await toNexusAccount({
  signer,
  chainConfiguration: {
    chain: base,
    transport: http(),
    version: getMEEVersion(MEEVersion.V2_1_0)
  }
});