Requirements
- Node.js 22 or higher
- npm, yarn, pnpm, or bun
Install the SDK
- pnpm
- npm
- yarn
- bun
Install Peer Dependencies
The SDK works with various wallet libraries. Install the dependencies for your chosen stack:- Privy
- Wagmi
- Viem Only
Environment Variables
Create.env.local (ignored by Vite by default):
Initialize the SDK
CallinitAmplifySDK() 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:Recommended Directory Structure
.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
| Layer | Directory | Purpose |
|---|---|---|
| Providers | src/app/providers.tsx | Initialize Privy, React Query, and the Amplify SDK once. |
| Hooks | src/hooks/ | Wrap SDK helpers with domain-specific logic and query invalidation. |
| Components | src/components/ | Pure UI components that receive prepared data plus callbacks for execution. |
| Lib | src/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 pointserver/clients/amplify.ts–initAmplifySDKand helper wrappersserver/services/deposits.ts– orchestrates approvals, permits, or withdrawals
Next Steps
- Follow the Deposits guide to implement your first deposit flow
- See initAmplifySDK for full API reference
- Check Logging for debug configuration