# Installation

Get started with MoonPay Wallets in your React or Next.js application by installing the React SDK.

<Info>
  The React SDK targets web browsers. Building a native iOS or Android app? Use the [React Native SDK](/get-started/frontend-sdks/react-native/installation) instead.
</Info>

## Requirements

Before installing the MoonPay Wallets React SDK, ensure your project meets these requirements:

* **React 18 or higher**: The SDK uses modern React features including hooks and concurrent rendering
* **TypeScript 5 or higher**: For TypeScript projects (recommended but optional)

## Install the SDK

Add the MoonPay Wallets React SDK to your project using your preferred package manager:

:::code-group

```bash [npm]
npm install @moon-x/react-sdk@0.26.0
```

```bash [pnpm]
pnpm add @moon-x/react-sdk@0.26.0
```

```bash [yarn]
yarn add @moon-x/react-sdk@0.26.0
```

:::

## Additional dependencies

The [quickstart](/get-started/frontend-sdks/react/quick-start) and refreshed wallet examples target the published SDK 0.26.0 types. Pin versions while reproducing an example, then validate the target version's contract before upgrading. Solana examples also require a compatible Web3.js version (the SDK peer range is `^1.87.0`).

### Solana support

If your application needs to support Solana wallets and transactions, install the Solana Web3.js library:

:::code-group

```bash [npm]
npm install @solana/web3.js
```

```bash [pnpm]
pnpm install @solana/web3.js
```

```bash [yarn]
yarn add @solana/web3.js
```

:::

<Info>
  Solana dependencies are only required if you plan to create Solana wallets or execute Solana transactions. Applications without Solana can skip this step.
</Info>

### Tron transaction support

If your application needs to build or broadcast Tron transactions, install TronWeb:

:::code-group

```bash [npm]
npm install tronweb
```

```bash [pnpm]
pnpm install tronweb
```

```bash [yarn]
yarn add tronweb
```

:::

<Info>
  TronWeb is used by your app to build unsigned Tron transactions and broadcast signed transactions. The MoonPay Wallets React SDK signs the TronWeb transaction object with the user's embedded Tron wallet.
</Info>

### Bitcoin transaction tooling

MoonPay Wallets accepts base64- or hex-encoded PSBT v0 transactions. If your app needs to construct those PSBTs, install a Bitcoin library such as `bitcoinjs-lib`:

:::code-group

```bash [npm]
npm install bitcoinjs-lib
```

```bash [pnpm]
pnpm install bitcoinjs-lib
```

```bash [yarn]
yarn add bitcoinjs-lib
```

:::

<Info>
  A Bitcoin transaction library is optional. You do not need one when your backend or another service supplies the PSBT for MoonPay Wallets to sign.
</Info>

### Next.js configuration

If you're using Next.js with webpack (not Turbopack), you may need to add polyfills for Node.js modules. Add the following to your `next.config.js`:

```js [next.config.js]
module.exports = {
  webpack: (config, { isServer }) => {
    if (!isServer) {
      config.resolve.fallback = {
        ...config.resolve.fallback,
        fs: false,
        net: false,
        tls: false,
      };
    }
    return config;
  },
};
```

<Tip>
  Next.js 13+ with Turbopack handles these polyfills automatically. This configuration is only needed for webpack-based builds.
</Tip>

## Verify installation

After installation, verify the SDK is working by importing it in your code:

```tsx
import { MoonXProvider } from '@moon-x/react-sdk';
```

If the import succeeds without errors, the SDK is installed correctly and you're ready to configure it.

## Next steps

Now that you've installed the MoonPay Wallets React SDK, continue to:

* [Configure the MoonPay Wallets provider](/get-started/frontend-sdks/react/configuration) to initialize the SDK
* [Add authentication](/get-started/frontend-sdks/react/quick-start) to your application
* [Create embedded wallets](/wallets/embedded-wallets/create-a-wallet/overview) for your users
