react-native-walletconnect
⚛️ 👛 This is an unofficial package which supports integrating WalletConnect with React Native without requiring linking. This is basically achieved using a WebView.
If your project supports using Native Modules, I strongly recommend you use the official @walletconnect/react-native library.
Compatible with Android, iOS, Web and Expo.
🔥 Features
- Supports the complete WalletConnect Client Interface.
- Persists connected wallets between executions.
🚀 Getting Started
Using Yarn:
yarn add react-native-webview react-native-walletconnect
✍️ Usage
First you need to wrap the graphical root of your application with the <WalletConnectProvider />
. Once this is done, you can make a call to the useWalletConnect
hook to utilize the complete WalletConnect Client API within your app.
;; ; const WalletConnectExample = { const createSession killSession session signTransaction = ; const hasWallet = !!sessionlength; return <> !hasWallet && <Button title="Connect" onPress=createSession /> !!hasWallet && <Button title="Sign Transaction" onPress= /> !!hasWallet && <Button title="Disconnect" onPress=killSession /> </> ;}; { return <WalletConnectProvider> <WalletConnectExample /> </WalletConnectProvider> ;}
useWalletConnect
The useWalletConnect
hook provides the following functionality:
createSession
- Requests the creation of a new session via the presentation of the QR Modal.
killSession
- Terminates the active session, equivalent to logging out.
sendTransaction
- Makes an Ethereum transaction.
signTransaction
- Signs an Ethereum transaction, but does not send it.
signPersonalMessage
- Signs a personal message.
signMessage
- Signs an arbitrary message.
signTypedData
- Signs Typed Data.
sendCustomRequest
- Sends a custom request, where you can specify custom configuration options such as
jrpcProvider
.
- Sends a custom request, where you can specify custom configuration options such as
session
- Returns an array of the active session. These are the connected wallets with details such as
address
es andchain
s they are assigned to.
- Returns an array of the active session. These are the connected wallets with details such as