Skip to main content
Version: 1.0.2 | View on npm React Native SDK for Grid - authentication, smart accounts, and payments.

Installation

npm install @sqds/grid-react-native

Required Polyfills

IMPORTANT: Configure polyfills at your app’s entry point before importing any other code.

1. Install Dependencies

npm install text-encoding react-native-get-random-values buffer @ethersproject/shims

2. Configure Polyfills

Create a file entrypoint.js:
import 'text-encoding';
import 'react-native-get-random-values';

import { Buffer } from 'buffer';
global.Buffer = Buffer;

import '@ethersproject/shims';

import 'expo-router/entry';
Set this as your entry point in package.json:
{
  "name": "your-app-name",
  "main": "entrypoint.js"
}

Quick Start

import { GridClient } from '@sqds/grid-react-native';

const gridClient = new GridClient({
  environment: 'sandbox',
  apiKey: '<your api key>'
});

try {
  const sessionSecrets = await gridClient.generateSessionSecrets();

  await gridClient.createAccount({
    email: 'user@example.com'
  });

  const otpCode = '123456';

  const response = await gridClient.completeAuthAndCreateAccount({
    email: 'user@example.com',
    code: otpCode,
    sessionSecrets
  });

  console.log('Authentication successful:', response.data);
} catch (error) {
  console.error('Authentication failed:', error.message);
}
Note: After calling createAccount, an OTP code will be sent to the user’s email. The user must enter this code, which you then pass to completeAuthAndCreateAccount to complete the authentication flow.

License

MIT