This is a sample repo that used expo to get started and integrates with Account Kit
- First create a new expo project (we used
yarn
):
yarn create expo-app --template
This project used a Blank (typescript)
template.
- 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
- Install shims for crypto libraries
yarn expo install node-libs-react-native crypto-browserify stream-browserify react-native-get-random-values
- 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;
- Import global shims in
App.tsx
:
import "node-libs-react-native/globals.js";
import "react-native-get-random-values";
// rest of App.tsx
- 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