getGaslessWalletAddress
Read the deterministic address of one of an owner’s GaslessWallets from the GaslessLayer — a pure CREATE2 view, safe to display before any transaction exists.
import { getGaslessWalletAddress } from "@symmio/trading-core";
const original = await getGaslessWalletAddress(config, { owner }); // wallet 0
const depositWallet = await getGaslessWalletAddress(config, { owner, walletId: 1n });A GaslessWallet is identified by (owner, walletId), where owner is the owner’s address, never a GaslessWallet address. Wallet 0 is the original wallet: upgrading a GaslessLayer to the multi-wallet interface keeps its address, balances and nonce stream. Every positive id derives its own independent address. Wallets deploy lazily on first use, and collateral can arrive before that.
Each address plays two roles for its wallet: it is the deposit address for gasless onboarding (bridge collateral there, then settle), and the target of the wallet’s execute operations, which can call any contract from it with the relayer paying the gas (see gaslessWalletExecute). Custody is bound by construction: collateral at the address can only ever reach a sub-account owned by owner.
Neither the contract nor the service allocates, registers or lists wallet ids. Which id holds what is an application
convention, for example id 1 for deposits and id 2 for withdrawals. Persist your assignment per environment,
protocol instance, owner and wallet id, and track funds by that identity: wallets of the same owner never share
balances.
Responses from gasless services come back lowercased; compare addresses case-insensitively (isAddressEqual).
Parameters
ownerAddressrequiredThe owner the wallet belongs to. Pass the owner’s address, never a GaslessWallet address.
walletIdbigintdefault 0noptionalWhich of the owner’s wallets to read, from 0n through 2^256 - 1. 0n is the original wallet.
chainIdnumberoptionalTarget chain id. Defaults to the config’s defaultChainId.
Returns
Promise<Address>Query options
import { getGaslessWalletAddressQueryOptions } from "@symmio/trading-core";
import { useQuery } from "@tanstack/react-query";
useQuery(getGaslessWalletAddressQueryOptions(config, { owner, walletId: 1n }));An omitted walletId keys the same as 0n, so { owner } and { owner, walletId: 0n } share one cache entry. React consumers use useGaslessWalletAddress.
Throws
SymmError("validation", "GASLESS_WALLET_ID_INVALID")—walletIdis not abigintfrom0nthrough2^256 - 1(a JavaScriptnumberincluded). Thrown before any RPC call.SymmError("config", "GASLESS_NOT_CONFIGURED")/("config", "GASLESS_UNSUPPORTED_CONTRACTS_VERSION").SymmError("api", "GASLESS_WALLET_UNAVAILABLE")— the gateway returned the zero address (an unwired deployment answers0x0instead of reverting; the guard is load-bearing). The message names the wallet id and the owner.- Viem read errors. A GaslessLayer that has not been upgraded to the multi-wallet interface reverts with empty data.