A demo app to help developers integrate Sequence WaaS (Embedded wallet) into their React Native apps.
- Clone the repo
- Run
yarn install
to install dependencies - Run
yarn ios
oryarn android
to run the app on device/simulator
Follow this guide to get your project access key and other credentials/keys: https://docs.sequence.xyz/solutions/builder/embedded-wallet/
- @0xsequence/waas
- @0xsequence/react-native
-
ethers (5.7.2)
-
ethersproject/shims
-
expo
-
react-native-quick-crypto
-
react-native-mmkv
-
react-native-keychain
-
babel-plugin-module-resolver (as dev dependency)
- expo-web-browser
- expo-auth-session
- @invertase/react-native-apple-authentication (use the forked version specified in the package.json)
- react-native-url-polyfill
- web-streams-polyfill
Firstly, make sure to do this step as early in your apps lifecycle as possible. In this demo these are imported and set at the top in App.tsx
.
import { install } from "react-native-quick-crypto";
install();
import "@ethersproject/shims";
import "react-native-url-polyfill/auto";
import { ReadableStream } from "web-streams-polyfill";
globalThis.ReadableStream = ReadableStream;
Secondly, we need to set aliases for the shims, in babel.config.js
with help of the dev dependency babel-plugin-module-resolver
, and also we need to make sure to use pbkdf2
from react-native-quick-crypto
. This helps us speed up the random value generation. See babel.config.js
for the code snippet to update the aliases.
(See ethers-io/ethers.js#2250 (comment) for more details on react-native-quick-crypto alias setup)
export const sequenceWaas = new SequenceWaaS(
{
network: initialNetwork,
projectAccessKey: projectAccessKey,
waasConfigKey: waasConfigKey,
},
localStorage,
null,
new KeychainSecureStoreBackend()
);
(Check waasSetup.ts
file to see for more details)
Once you have an initialized Sequence WaaS instance, you can use it to sign in with email, Google or Apple. Check the App.tsx
file for more details.
Once signed in, you can use the sequenceWaas
instance to perform wallet operations like sending transactions, signing messages, etc. Check the App.tsx
file for more details.
Set CFBundleURLSchemes and GIDClientID in the Info.plist file for Google sign in.
Set the intent-filter in the AndroidManifest.xml file for Google sign in.