> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trustware.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Update the deposit destination at runtime

> Use Trustware.setDestinationAddress(), setDestinationChain(), and setDestinationToken() to update the route target dynamically after the provider has mounted.

The deposit destination (chain, token, and recipient address) can be set upfront in your config or updated at runtime without remounting the provider. This is useful when the values aren't known until after a user logs in, selects a target network, or an async lookup resolves.

## Setting values in config at initialization

If all destination values are known when you create your config, set them directly in the `routes` object:

```ts theme={null}
import { type TrustwareConfigOptions } from "@trustware/sdk";

const trustwareConfig = {
  apiKey: process.env.NEXT_PUBLIC_TRUSTWARE_API_KEY!,
  routes: {
    toChain: "8453",
    toToken: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
    toAddress: "0xYourDestinationAddress",
  },
} satisfies TrustwareConfigOptions;
```

## 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.toAddress` blank 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.toAddress` at runtime with `Trustware.setDestinationAddress()` once the wallet is available, typically right after sign-in. See [use Trustware with embedded wallets](/guides/embedded-wallets) for the full deposit pattern.

## Updating destination values at runtime

Three methods let you update the destination without remounting the provider. All return `Trustware` for chaining.

### `setDestinationAddress`

Updates `routes.toAddress`. Pass `null` or `undefined` to clear a previously set address.

```ts theme={null}
import { Trustware } from "@trustware/sdk";

Trustware.setDestinationAddress("0xDestination...");

// Clear it:
Trustware.setDestinationAddress(null);
```

### `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).

```ts theme={null}
Trustware.setDestinationChain("42161"); // Arbitrum
```

### `setDestinationToken`

Updates `routes.toToken`. Use this when the target token is determined at runtime.

```ts theme={null}
Trustware.setDestinationToken("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"); // USDC on Arbitrum
```

### Chaining all three

The three setters can be chained in a single expression:

```ts theme={null}
Trustware
  .setDestinationChain("42161")
  .setDestinationToken("0xaf88d065e77c8cC2239327C5EDb3A432268e5831")
  .setDestinationAddress("0xYourAddress...");
```

## 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)`        |

<Note>
  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.
</Note>
