@unifold/core
v0.1.20
Published
Unifold Core SDK - Core types, API client, and business logic
Readme
@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
