0.1.67 • Published 6d ago
@unifold/core
Licence
MIT
Version
0.1.67
Deps
1
Size
198 kB
Vulns
0
Weekly
2.5K
@unifold/core
Core SDK for Unifold platform containing types, API client, and business logic.
Features
- TypeScript-first API client
- Tree-shakeable exports
- Type-safe API calls
- i18n support
- React hooks for common operations
Installation
npm install @unifold/core
# or
pnpm add @unifold/coreUsage
API Client
import { createDepositAddress, getWalletByChainType, setApiConfig } from "@unifold/core";
// Configure API
setApiConfig({
baseUrl: "https://api.unifold.io",
apiKey: "your-api-key",
});
// Create wallet
const response = await createDepositAddress({
userId: "user123",
chain: "ethereum",
});
// Get wallet by chain
const wallet = await getWalletByChainType({
userId: "user123",
chainType: "evm",
});React Hooks
import { useUserIp } from "@unifold/core";
function MyComponent() {
const { data: ipInfo, isLoading } = useUserIp();
if (isLoading) return <div>Loading...</div>;
return <div>Country: {ipInfo?.country}</div>;
}Internationalization
import { i18n } from "@unifold/core";
// Use translations
console.log(i18n.t("deposit.title"));
console.log(i18n.t("deposit.description"));API Reference
See the TypeScript types for full API documentation.
License
MIT