Mobile (WalletConnect)

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

WalletConnect 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 API directly for more control, or use a higher-level library like Wagmi that simplifies the integration.

Wagmi

Wagmi provides React Hooks for WalletConnect with built-in Trust Wallet support, it also supports Vue and vanilla JavaScript. See their documentation 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 Cloud:

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

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 for mobile-to-mobile connections.

  • 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 specs.

Last updated

Was this helpful?