Skip to main content

Requirements

  • Node.js 22 or higher
  • npm, yarn, pnpm, or bun

Install the SDK

Install Peer Dependencies

The SDK works with various wallet libraries. Install the dependencies for your chosen stack:

Environment Variables

Create .env.local (ignored by Vite by default):
Never commit .env.local. Provide an .env.example without secrets for teammates.

Initialize the SDK

Call initAmplifySDK() once at application startup before using any other SDK functions.

Basic

With Custom RPCs

For the best user experience and reliability, use your own RPC endpoints:

With All Options

React Integration Hook

Create a hook to initialize the SDK once and expose ready state:

Verify Installation

Test that everything is working:

Package Exports

The SDK supports focused imports for tree-shaking:

Global Providers

Set up React Query and your wallet provider:
Wire the providers in your entry point:
.env.local
package.json
src
app
App.tsx
providers.tsx
components
DepositForm.tsx
WithdrawForm.tsx
hooks
useAmplify.ts
useBalances.ts
lib
privy.ts
viem.ts
pages
styles
main.tsx
LayerDirectoryPurpose
Providerssrc/app/providers.tsxInitialize Privy, React Query, and the Amplify SDK once.
Hookssrc/hooks/Wrap SDK helpers with domain-specific logic and query invalidation.
Componentssrc/components/Pure UI components that receive prepared data plus callbacks for execution.
Libsrc/lib/Interaction helpers for viem, Privy, or analytics that should not depend on React state.

Server-Side Usage

If you execute transactions from a backend service, mirror the same separation:
  • server/app.ts – Express/Fastify entry point
  • server/clients/amplify.tsinitAmplifySDK and helper wrappers
  • server/services/deposits.ts – orchestrates approvals, permits, or withdrawals

Next Steps