Installation
Install the SDK
Pick your package manager:
npm install @one_deploy/sdk@1.1.0
yarn add @one_deploy/sdk@1.1.0
pnpm add @one_deploy/sdk@1.1.0
Peer Dependencies
The SDK has a small set of peer dependencies. Only react is strictly required; the others are optional and depend on which features you use.
| Package | Version | Required? | When needed |
|---|---|---|---|
react | >=18.0.0 | Yes | Always (hooks, providers, components) |
react-dom | >=18.0.0 | Only for web | Web widgets (connect button, payment widgets, NFT gallery) |
react-native | >=0.72.0 | Only for RN | AI trading and forex React Native components |
thirdweb | >=5.0.0 | Optional | Smart wallet connect, on-chain reads/writes via OneThirdwebProvider |
Install the optional peers you need:
npm install react react-dom thirdweb
npm install react react-native
npm install react
# react is still needed because hooks are typed against it,
# but no DOM or RN runtime is required.
Package Exports Map
@one_deploy/sdk uses the exports field in package.json to expose 8 entry points. Each entry point is independently tree-shakable.
| Import path | What it contains |
|---|---|
@one_deploy/sdk | Re-exports everything (barrel). Fine for prototyping; prefer specific paths for production. |
@one_deploy/sdk/services | OneEngineClient, PriceService, SupabaseService, UsageService, forexSimulationEngine, botSimulationEngine |
@one_deploy/sdk/types | All TypeScript interfaces and type aliases |
@one_deploy/sdk/utils | Helper functions (formatting, validation, chain helpers) |
@one_deploy/sdk/config | Default config constants, chain definitions, contract addresses |
@one_deploy/sdk/providers | OneProvider, OneThirdwebProvider |
@one_deploy/sdk/hooks | All 27+ hooks (useOne, useOneAuth, useWalletBalance, useAIStrategies, etc.) |
@one_deploy/sdk/components | Web-only widgets (connect button, pay widget, onramp, offramp, swap, NFT gallery, balance display) |
@one_deploy/sdk/react-native | React Native-only components (AI trading selectors, forex cards) |
Example -- targeted imports
// Only pulls in the engine client, nothing else
import { OneEngineClient } from "@one_deploy/sdk/services";
// Only pulls in the swap hook
import { useOneSwap } from "@one_deploy/sdk/hooks";
// Only pulls in TypeScript types (zero runtime cost)
import type { OneConfig, SwapQuote } from "@one_deploy/sdk/types";
Tree-Shaking
The SDK ships ESM and CommonJS builds. Modern bundlers (Vite, Next.js, esbuild, webpack 5) will automatically tree-shake unused code when you use the specific entry points listed above.
For the best bundle size:
- Import from sub-paths instead of the barrel
@one_deploy/sdk. - Use
import typefor anything that is only needed at compile time. - Avoid importing
@one_deploy/sdk/react-nativein web builds (and vice versa) -- your bundler will warn if platform-specific code leaks across targets.
Bundle impact (approximate)
| What you import | Gzipped size |
|---|---|
OneEngineClient only | ~8 kB |
| All hooks | ~12 kB |
| Web providers + hooks + components | ~34 kB |
| Full barrel import | ~52 kB |
TypeScript
The SDK ships first-class TypeScript declarations for every export. No @types/* package is needed. Minimum TypeScript version: 5.0.
{
"compilerOptions": {
"moduleResolution": "bundler", // or "node16" / "nodenext"
"target": "ES2020",
"strict": true
}
}
If you use moduleResolution: "node" (legacy), the sub-path exports will still resolve, but "bundler" or "node16" is recommended.
Verify the Installation
import { OneEngineClient } from "@one_deploy/sdk/services";
import type { OneConfig } from "@one_deploy/sdk/types";
const config: OneConfig = {
clientId: process.env.ONE_CLIENT_ID!,
engineUrl: process.env.ONE_ENGINE_URL!,
};
const engine = new OneEngineClient({
baseUrl: config.engineUrl,
clientId: config.clientId,
});
console.log("ONE SDK installed. Engine target:", config.engineUrl);
Next Steps
- Provider Setup (Web) -- wrap your React DOM app with
OneProvider. - React Native Setup -- configure the RN-specific entry point.