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.
This quickstart covers the React SDK integration path. For server-side or backend integrations, start with the API Overview.
Install the package
Add The SDK requires React 18.2+ or React 19. Install the peer dependencies if you haven’t already:
@trustware/sdk to your project using your preferred package manager:react and react-dom are marked as optional peer dependencies — if your app already has them installed, no extra step is needed. viem is required.Get an API key
apiKey is a required field in TrustwareConfigOptions. Contact Trustware to obtain your API key, then store it as an environment variable:Configure TrustwareConfigOptions
Create a config object that satisfies
See configuration overview for the full reference of every field.
TrustwareConfigOptions. The routes.toChain and routes.toToken fields are required — everything else is optional:| Field | Required | Description |
|---|---|---|
apiKey | Yes | Your Trustware API key |
routes.toChain | Yes | Destination chain ID as a string |
routes.toToken | Yes | Destination token address |
routes.toAddress | No | Recipient address. Can be updated at runtime via Trustware.setDestinationAddress |
routes.defaultSlippage | No | Slippage percentage. Defaults to 1 |
routes.routeType | No | "swap", "deposit", "withdraw", or "cross". Defaults to "swap" |
routes.options | No | Refresh and amount-constraint settings — routeRefreshMs, fixedFromAmount, minAmountOut, maxAmountOut |
autoDetectProvider | No | Enable SDK-managed wallet discovery. Defaults to false |
messages | No | Override widget title and description copy |
theme | No | Widget color and radius overrides |
walletConnect | No | WalletConnect connector overrides |
retry | No | Rate-limit retry behavior |
features | No | Feature flags — tokensPagination, balanceStreaming, shouldAllowGA4 |
onError, onSuccess, onEvent | No | Lifecycle callbacks |
Wrap your app with TrustwareProvider
Mount All
TrustwareProvider once near the root of your component tree and pass in your config:TrustwareWidget instances and useTrustware calls within the tree share this config and wallet state.Full working example
Here’s the complete setup in a single file, copied directly from the SDK README:Next steps
- Bring your own wallet — if your app already manages wallet connection through Wagmi or viem, see Host wallet bridge.
- Control the widget programmatically — open and close the widget from your own UI with Controlled widget.
- Build a custom UI — skip the widget entirely and use the Headless core API.
- Customize appearance — adjust colors, radius, and copy in Configuration.
