> ## Documentation Index
> Fetch the complete documentation index at: https://developers.squads.so/llms.txt
> Use this file to discover all available pages before exploring further.

# React Native SDK Quickstart

> ## Installation

**Version:** 1.0.3 | [View on npm](https:/www.npmjs.com/package/@sqds/grid-react-native)

React Native SDK for Grid - authentication, smart accounts, and payments.

## Installation

```bash theme={null}
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

```bash theme={null}
npm install text-encoding react-native-get-random-values buffer @ethersproject/shims
```

### 2. Configure Polyfills

Create a file `entrypoint.js`:

```js theme={null}
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`:

```json theme={null}
{
  "name": "your-app-name",
  "main": "entrypoint.js"
}
```

## Quick Start

```typescript theme={null}
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
