Mobile (WalletConnect)

Trust Wallet supports WalletConnect v2.0 with multi-chain capabilities. You can connect to multiple blockchains simultaneously and sign transactions.

WalletConnectarrow-up-right is an open source protocol for connecting dApps to mobile wallets with QR code scanning or deep linking.

Supported Networks

  • Ethereum and all EVM chains

  • Solana

Note: We are currently working on adding more network support.

Dapp Integration

There are two common ways to integrate WalletConnect: you can use the low-level library Sign APIarrow-up-right directly for more control, or use a higher-level library like Wagmiarrow-up-right that simplifies the integration.

Wagmi

Wagmiarrow-up-right provides React Hooks for WalletConnect with built-in Trust Wallet support, it also supports Vue and vanilla JavaScript. See their documentationarrow-up-right for integration guides.

Sign API

Installation

npm install --save-exact @walletconnect/sign-client

Initiate Connection

WalletConnect v2 uses the Sign API. You'll need to initialize the client with your project ID from WalletConnect Cloudarrow-up-right:

WalletConnect v2 follows the CAIP-25arrow-up-right protocol for establishing sessions. To connect with different networks, refer to the WalletConnect namespaces specificationarrow-up-right.

The connect function will return two variables:

  • uri: A string used to establish the session. You can use it to generate a QR Code that wallets can scan, or pass it via deep link to connect from a mobile browser or mobile dApp to the Trust Wallet mobile app.

  • approval: A function that returns a promise which resolves once the session proposal has been either accepted or rejected by the wallet.

Important: On iOS Safari, window.open() must be called synchronously in response to a user action (like a button click). Calling it inside an async function or after an await will be blocked by the popup blocker.

or

Finally, we wait for the user's approval

For more details, check the WalletConnect v2 Sign API specsarrow-up-right.

Last updated