Setting values in config at initialization
If all destination values are known when you create your config, set them directly in theroutes object:
EOA vs embedded wallets
The right approach depends on the wallet type your app integrates with.- EOA wallets (MetaMask, Phantom, Coinbase Wallet, etc.) expose a public address as soon as they connect. If you leave
routes.toAddressblank in your config, the connected wallet address is used as the destination automatically. - Embedded wallets provisioned after login do not have a known address at app boot. Set
routes.toAddressat runtime withTrustware.setDestinationAddress()once the wallet is available, typically right after sign-in. See use Trustware with embedded wallets for the full deposit pattern.
Updating destination values at runtime
Three methods let you update the destination without remounting the provider. All returnTrustware for chaining.
setDestinationAddress
Updates routes.toAddress. Pass null or undefined to clear a previously set address.
setDestinationChain
Updates routes.toChain. Use this when the target network is selected dynamically (for example, when a user picks a destination chain from a dropdown).
setDestinationToken
Updates routes.toToken. Use this when the destination token is determined at runtime.
Chaining all three
The three setters can be chained in a single expression:When to use each approach
The widget reads the resolved config when the user reaches the confirm step. You do not need to set these values before the widget mounts; setting them before the user confirms is sufficient.
These setters change where funds are delivered. They do not configure a
contract call on the destination chain. If you need a contract call to run once
funds arrive, pass
hooks.postHook on each Trustware.buildRoute() request.
Set toAddress to the recipient address for the route; the destination
contract call is controlled separately by postHook.target. See
vault destinations.