Skip to content

Latest commit

 

History

History
60 lines (41 loc) · 1.63 KB

README.md

File metadata and controls

60 lines (41 loc) · 1.63 KB

Account Kit RN Example using Expo

This is a sample repo that used expo to get started and integrates with Account Kit

image

How it was made

  1. First create a new expo project (we used yarn):
yarn create expo-app --template

This project used a Blank (typescript) template.

  1. Upgrade to the latest beta version of expo. This is needed because react native 0.74+ includes native support for TextEncoder
yarn expo install expo@next --fix
  1. Install shims for crypto libraries
yarn expo install node-libs-react-native crypto-browserify stream-browserify react-native-get-random-values
  1. Add shims to metro.config.js:
// Learn more https://docs.expo.io/guides/customizing-metro
const { getDefaultConfig } = require("expo/metro-config");

/** @type {import('expo/metro-config').MetroConfig} */
const config = getDefaultConfig(__dirname);
config.resolver.extraNodeModules = {
  ...config.resolver.extraNodeModules,
  ...require("node-libs-react-native"),
  crypto: require.resolve("crypto-browserify"),
  stream: require.resolve("stream-browserify"),
};

module.exports = config;
  1. Import global shims in App.tsx:
import "node-libs-react-native/globals.js";
import "react-native-get-random-values";

// rest of App.tsx
  1. Install Account Kit Packages. At this point you're ready to use the aa-sdk in your project.
yarn add viem@2.8.6 @alchemy/aa-alchemy @alchemy/aa-core @alchemy/aa-accounts