Skip to content

alchemyplatform/aa-sdk-rn-expo

Repository files navigation

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

About

Example repo using aa-sdk with react native and expo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published