Installation
- Web
- iOS
- Android
- React Native
- Flutter
- Unity
Add packages (NPM)
Copy
Ask AI
npm install @walletconnect/modal
Add packages (CDN)
WalletConnectModal uses unpkg as its official CDN provider. Instead of using the npm package, you can simply import it from their CDN and use it in the same way.Copy
Ask AI
<script type="module">
import { WalletConnectModal } from "https://unpkg.com/@walletconnect/modal";
</script>
The WalletConnectModal SDK is currently in Alpha and is not production-ready.It’s public API and associated documentation may still see significant and breaking changes.
SwiftPackageManager
You can add a WalletConnect SDK to your project with Swift Package Manager. In order to do that:- Open XCode
- Go to File -> Add Packages
- Paste the repo GitHub url: https://github.com/reown-com/reown-swift
- Tap Add Package
- Choose the WalletConnectV2 products that you want installed in your app.
Alternatively, add WalletConnectModal to a Package.swift manifest
To integrate via a Package.swift manifest instead of Xcode, you can add
WalletConnectModal to the dependencies array of your package:Copy
Ask AI
dependencies: [
.package(
name: "WalletConnectV2",
url: "https://github.com/WalletConnectV2/WalletConnectSwiftV2.git",
.upToNextMajor(from: "1.6.4")
),
// Any other dependencies you have...
],
dependencies
array of that target:Copy
Ask AI
.target(
name: "MyTargetName",
dependencies: [
// The product(s) you want (e.g. WalletConnectModal).
.product(name: "WalletConnectModal", package: "WalletConnectV2"),
]
),
The WalletConnectModal SDK is currently in Alpha and is not production-ready.It’s public API and associated documentation may still see significant and breaking changes.
Requirements
- Android min SDK 23
- Java 11
Installation
root/build.gradle.kts:Copy
Ask AI
allprojects {
repositories {
mavenCentral()
maven { url "https://jitpack.io" }
}
}
Copy
Ask AI
implementation(platform("com.walletconnect:android-bom:$BOM_VERSION"))
implementation("com.walletconnect:android-core")
implementation("com.walletconnect:walletconnect-modal")
- React Native CLI
- Expo
Copy
Ask AI
npm install @walletconnect/modal-react-native
Copy
Ask AI
npm install @react-native-async-storage/async-storage react-native-get-random-values react-native-modal react-native-svg @react-native-community/netinfo @walletconnect/react-native-compat
Copy
Ask AI
npx pod-install
(Optional) Enable Wallet Detection
To enable WalletConnectModal to detect wallets installed on the device, you need to make specific changes to the native code of your project.For iOS:
- Open your
Info.plistfile. - Locate the
<key>LSApplicationQueriesSchemes</key>section. - Add the desired wallet schemes as string entries within the
<array>. These schemes represent the wallets you want to detect. - Refer to our Info.plist example file for a detailed illustration.
Copy
Ask AI
<key>LSApplicationQueriesSchemes</key>
<array>
<string>metamask</string>
<string>trust</string>
<string>safe</string>
<string>rainbow</string>
<string>uniswap</string>
<!-- Add other wallet schemes names here -->
</array>
For Android:
- Open your
AndroidManifest.xmlfile. - Locate the
<queries>section. - Add the desired wallet package names as
<package>entries within the<queries>. These package names correspond to the wallets you want to detect. - Refer to our AndroidManifest.xml example file for detailed guidance.
Copy
Ask AI
<queries>
<package android:name="io.metamask"/>
<package android:name="com.wallet.crypto.trustapp"/>
<package android:name="io.gnosis.safe"/>
<package android:name="me.rainbow"/>
<!-- Add other wallet package names here -->
</queries>
Copy
Ask AI
npx expo install @walletconnect/modal-react-native
Copy
Ask AI
npx expo install @react-native-async-storage/async-storage react-native-get-random-values react-native-modal react-native-svg @react-native-community/netinfo @walletconnect/react-native-compat
Additional setup for Expo SDK 48 only
Additional setup for Expo SDK 48 only
If you are using Expo SDK 48, you also need to polyfill
crypto with expo-crypto library.- Add
expo-crypto
Copy
Ask AI
npx expo install expo-crypto
- Create a file named
crypto-polyfill.js
Copy
Ask AI
// src/crypto-polyfill.js
// Apply only with Expo SDK 48
import { getRandomValues as expoCryptoGetRandomValues } from "expo-crypto";
class Crypto {
getRandomValues = expoCryptoGetRandomValues;
}
// eslint-disable-next-line no-undef
const webCrypto = typeof crypto !== "undefined" ? crypto : new Crypto();
(() => {
if (typeof crypto === "undefined") {
Object.defineProperty(window, "crypto", {
configurable: true,
enumerable: true,
get: () => webCrypto,
});
}
})();
- Import
crypto-polyfill.jsin your App root file
Copy
Ask AI
import './crypto-polyfill.js'
...
import { useWalletConnectModal } from '@walletconnect/modal-react-native';
(Optional) Enable Wallet Detection (iOS Only)
To enable WalletConnectModal to detect wallets installed on the device in your Expo project for iOS, follow these steps:- Open your
app.json(orapp.config.js) file. - Locate the ios section within the configuration.
- Add the
infoPlistobject if it doesn’t exist, and within it, include theLSApplicationQueriesSchemesarray. This array will contain the desired wallet schemes you want to detect. - Add the wallet schemes to the
LSApplicationQueriesSchemesarray.
Copy
Ask AI
{
"expo": {
"ios": {
"bundleIdentifier": "com.your.app",
"infoPlist": {
"LSApplicationQueriesSchemes": [
"metamask",
"trust",
"safe",
"rainbow",
"uniswap"
// Add other wallet schemes names here
]
}
}
}
}
Install the WalletConnect Modal package.
Copy
Ask AI
flutter pub add walletconnect_modal_flutter
Prerequisites
- Unity 2021.3 or above
- IL2CPP code stripping level: Minimal (or lower)
- OpenUPM CLI
- Package Manager with OpenUPM
- Package Manager with Git URL
To install packages via OpenUPM, you need to have Node.js and openupm-cli installed. Once you have them installed, you can run the following commands:
Copy
Ask AI
openupm add com.walletconnect.modal
- Open
Advanced Project Settingsfrom the gear ⚙ menu located at the top right of the Package Manager’s toolbar - Add a new scoped registry with the following details:
- Name:
OpenUPM - URL:
https://package.openupm.com - Scope(s):
com.walletconnect
- Name:
- Press plus ➕ and then
Savebuttons - In the Package Manager windows open the add ➕ menu from the toolbar
- Select
Add package by name... - Enter the package name:
com.walletconnect.modal
- Press
Addbutton
- Open the add ➕ menu in the Package Manager’s toolbar
- Select
Add package from git URL... - Enter the package URL. You will need to install 3 packages in the following order:
Copy
Ask AI
https://github.com/WalletConnect/WalletConnectUnity.git?path=Packages/com.walletconnect.core
Copy
Ask AI
https://github.com/WalletConnect/WalletConnectUnity.git?path=Packages/com.walletconnect.ui
Copy
Ask AI
https://github.com/WalletConnect/WalletConnectUnity.git?path=Packages/com.walletconnect.modal
- Press
Addbutton
(Optional) Installed Wallet Detection
To enable WalletConnect Modal to detect wallets installed on the device, you need to make specific changes to the native sides of the project.- Android
- iOS
- In Unity override Android Manifest.
- Add your
<queries>...</queries>schemes outside of<application />scope in the manifest file. - Refer to Android Specs for more information.
Copy
Ask AI
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<queries>
<package android:name="io.metamask"/>
<package android:name="com.wallet.crypto.trustapp"/>
<package android:name="io.gnosis.safe"/>
<package android:name="me.rainbow"/>
<!-- Add other wallet schemes names here -->
</queries>
<application>
...
</application>
</manifest>
Wallet detection may produce inaccurate results on iOS Simulator. It is recommended to test on a real device.
- Make an iOS build.
- In the generated Xcode project, find
Info.plistfile and open it with a external editor (i.e. not Xcode). - Locate or create
<key>LSApplicationQueriesSchemes</key>section. - Add the desired wallet schemes as string entries within the
<array>. These schemes represent the wallets you want to detect.
Copy
Ask AI
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
...
<key>LSApplicationQueriesSchemes</key>
<array>
<string>metamask</string>
<string>trust</string>
<string>safe</string>
<string>rainbow</string>
<string>uniswap</string>
<string>zerion</string>
<string>imtokenv2</string>
<string>spot</string>
<string>omni</string>
<string>dfw</string>
<string>tpoutside</string>
<string>robinhood-wallet</string>
</array>
...
</dict>
</plist>