Skip to main content

Installation

Add the library to your project:
yarn add @solana/spl-token

Polyfills

The following polyfills are needed:

Install getRandomValues

Add the react-native-get-random-values library to your project.
yarn add react-native-get-random-values
Then, add this resolver to your project’s metro.config.js
config.resolver.extraNodeModules.crypto = require.resolve(
  "react-native-get-random-values"
);
This configures the Metro bundler to replace instances of require('crypto') with react-native-get-random-values, thus polyfilling getRandomValues.
TIPAlternatively, you can use the expo-crypto library to polyfill crypto.getRandomValues. View this sample app for a reference of how to polyfill the crypto class.

Example

Last modified on February 10, 2026