Mobile (WalletConnect)

WalletConnect is an open source protocol for connecting dApps to mobile wallets with QR code scanning or deep linking, basically it's a websocket JSON-RPC channel.

There are two common ways to integrate: Standalone Client and Web3Model (Web3 Provider)

Standalone Client

Trust extends WalletConnect 1.x with aditional JSON-RPC methods to support multi-chain dApps. Currently, you can get all accounts and sign transactions for any blockchain implements signJSON method in wallet core.

Supported Coins

  • Binance Chain

  • Ethereum and forks

  • Cosmos, Kava and other sdk based chains

  • Tezos

  • Nano

  • Filecoin

  • Harmony

  • Solana

  • Zilliqa

Installation

npm install --save @walletconnect/client @walletconnect/qrcode-modal

Initiate Connection

Before you can sign transactions, you have to initiate a connection to a WalletConnect bridge server, and handle all possible states:

code snippet above is copied from https://docs.walletconnect.org/quick-start/dapps/client#initiate-connection, please check out the original link for standard methods.

Get multiple chain accounts from Trust

Once you have walletconnect client set up, you will be able to get user's accounts:

The result is an array with following structure:

Sign multi chain transaction

Once you have the account list, you will be able to sign a transaction, please note that the json structure is based on WalletCore's proto messages, we suggest using protobuf.js or @trustwallet/wallet-core to generate it properly.

The result can be either a string JSON or an HEX encoded string. For Atom, the result is JSON:

Web3Modal

Web3Modal is an easy-to-use library to help developers add support for multiple providers (including WalletConnect) in their apps with a simple customizable configuration.

Installation

Customize chain id

Sample code for configuring WalletConnect with Binance Smart Chain

Last updated

Was this helpful?