Installation
To get started with the Notify API, choose the programming language you'll be using to build your project. The SDK is available in JavaScript, Swift, and Kotlin.
- iOS
- Android
- React Native
Notify API is available via Swift Package Manager or Cocoapods.
- SwiftPackageManager
- Cocoapods
You can add the WalletConnect Notify package to your project with the Swift Package Manager. In order to do that:
- Open XCode
- Go to File -> Add Packages
- Paste the repo GitHub URL: https://github.com/WalletConnect/WalletConnectSwiftV2
- Tap Add Package
- Select
WalletConnectNotify
check mark
- Update Cocoapods spec repos. Type in terminal
pod repo update
- Initialize Podfile if needed with
pod init
- Add pod to your Podfile:
pod 'WalletConnectSwiftV2/WalletConnectNotify'
- Install pods with
pod install
If you encounter any problems during package installation, you can specify the exact path to the repository
pod 'WalletConnectSwiftV2/WalletConnectNotify', :git => 'https://github.com/WalletConnect/WalletConnectSwiftV2.git', :tag => '1.8.0'
Add the jitpack.io
Maven repository to your root/build.gradle.kts
file. For example:
allprojects {
repositories {
mavenCentral()
maven { url "https://jitpack.io" }
}
}
In app/build.gradle.kts
add the notify package and its dependencies:
implementation(platform("com.walletconnect:android-bom:release_version"))
implementation("com.walletconnect:android-core")
implementation("com.walletconnect:notify")
Requirements​
- Android API level minimum 23
- Java minimum version 11
Install the WalletConnect NotifyClient package.
- npm
- Yarn
- Bun
- pnpm
npm install @walletconnect/notify-client @walletconnect/react-native-compat
yarn add @walletconnect/notify-client @walletconnect/react-native-compat
bun add @walletconnect/notify-client @walletconnect/react-native-compat
pnpm add @walletconnect/notify-client @walletconnect/react-native-compat
You will need to polyfill crypto depending on your environment. See instructions below.
- Expo
- React Native CLI
- npm
- Yarn
- Bun
- pnpm
npm i expo-crypto
yarn add expo-crypto
bun a expo-crypto
pnpm add expo-crypto
- Create a file called
expo-crypto-shim.js
at the root of your project - Go to
expo-crypto-shim.js
and paste the following snippet into it.
import { digest } from 'expo-crypto'
// eslint-disable-next-line no-undef
const webCrypto = typeof crypto !== 'undefined' ? crypto : new Crypto()
webCrypto.subtle = {
digest: (algo, data) => {
const buf = Buffer.from(data)
return digest(algo, buf)
}
}
;(() => {
if (typeof crypto === 'undefined') {
Object.defineProperty(window, 'crypto', {
configurable: true,
enumerable: true,
get: () => webCrypto
})
}
})()
- Then head over your
index.js
file at the root of your project and add the following imports.
import '@walletconnect/react-native-compat'
import './expo-crypto-shim.js'
- npm
- Yarn
- Bun
- pnpm
npm i react-native-quick-crypto react-native-quick-base64 stream-browserify @craftzdog/react-native-buffer babel-plugin-module-resolver
yarn add react-native-quick-crypto react-native-quick-base64 stream-browserify @craftzdog/react-native-buffer babel-plugin-module-resolver
bun a react-native-quick-crypto react-native-quick-base64 stream-browserify @craftzdog/react-native-buffer babel-plugin-module-resolver
pnpm add react-native-quick-crypto react-native-quick-base64 stream-browserify @craftzdog/react-native-buffer babel-plugin-module-resolver
For iOS only
cd ios && pod install
- Go to your
index.js
file at the root of your project and add the following polyfill
import { AppRegistry } from 'react-native'
import App from './App'
import { name as appName } from './app.json'
import crypto from 'react-native-quick-crypto'
const polyfillDigest = async (algorithm, data) => {
const algo = algorithm.replace('-', '').toLowerCase()
const hash = crypto.createHash(algo)
hash.update(data)
return hash.digest()
}
globalThis.crypto = crypto
globalThis.crypto.subtle = {
digest: polyfillDigest
}
AppRegistry.registerComponent(appName, () => App)
- Update your
babel.config.js
with the following configuration
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: [
[
'module-resolver',
{
alias: {
'crypto': 'react-native-quick-crypto',
'stream': 'stream-browserify',
'buffer': '@craftzdog/react-native-buffer',
},
},
],
...
],
};
Next Steps​
Now that you've installed WalletConnect Notify, you're ready to start integrating it. The next section will walk you through the process of setting up your project to use the Notify API.
Was this helpful?