Skip to main content

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.

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:
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;

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.
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.
Trustware.setDestinationChain("42161"); // Arbitrum

setDestinationToken

Updates routes.toToken. Use this when the target token is determined at runtime.
Trustware.setDestinationToken("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"); // USDC on Arbitrum

Chaining all three

The three setters can be chained in a single expression:
Trustware
  .setDestinationChain("42161")
  .setDestinationToken("0xaf88d065e77c8cC2239327C5EDb3A432268e5831")
  .setDestinationAddress("0xYourAddress...");

When to use each approach

SituationRecommended approach
All values known at app initializationroutes object in config
Address fetched after login or session setupTrustware.setDestinationAddress() at runtime
User selects a destination networkTrustware.setDestinationChain() at runtime
User selects a destination tokenTrustware.setDestinationToken() at runtime
Need to clear a previously set addressTrustware.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.