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.
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 target token is determined at runtime.
Chaining all three
The three setters can be chained in a single expression:When to use each approach
| Situation | Recommended approach |
|---|---|
| All values known at app initialization | routes object in config |
| Address fetched after login or session setup | Trustware.setDestinationAddress() at runtime |
| User selects a destination network | Trustware.setDestinationChain() at runtime |
| User selects a destination token | Trustware.setDestinationToken() at runtime |
| Need to clear a previously set address | Trustware.setDestinationAddress(null) |
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.
