@paratro/sdk
v1.4.0
Published
Official TypeScript SDK for Paratro MPC Wallet Gateway
Downloads
338
Maintainers
Readme
@paratro/sdk
Official TypeScript SDK for Paratro MPC Wallet Gateway — enterprise multi-party computation wallet infrastructure with native x402 payment protocol support.
Features
- Full TypeScript — Complete type definitions for all request/response models
- Multi-Chain — Ethereum, BSC, Polygon, Avalanche, Arbitrum, Optimism, Tron, Bitcoin, Solana
- JWT Auto-Refresh — Automatic token management with 5-minute pre-expiry refresh
- ESM + CJS — Dual module output, works in Node.js, Deno, Bun and bundlers
- Zero Dependencies — Uses native
fetch(Node.js 18+) - x402 Payments — Native support for HTTP 402 payment protocol transactions
Installation
npm install @paratro/sdkQuick Start
import { MPCClient, Sandbox } from '@paratro/sdk';
const client = new MPCClient('your-api-key', 'your-api-secret', Sandbox);
// Create wallet
const wallet = await client.createWallet({
wallet_name: 'My Wallet',
description: 'Primary treasury wallet',
});
// Create account (wait until wallet status=ACTIVE, key_status=ACTIVE first)
const account = await client.createAccount({
wallet_id: wallet.wallet_id,
chain: 'ethereum',
label: 'Hot Wallet',
});
console.log(`Address: ${account.address}`);
// Add asset
const asset = await client.createAsset({
account_id: account.account_id,
symbol: 'USDC',
chain: 'ethereum',
});
// Transfer funds
const tx = await client.createTransfer({
from_address: account.address,
to_address: '0xRecipient...',
chain: 'ethereum',
token_symbol: 'USDC',
amount: '100.50',
});
console.log(`TX: ${tx.tx_id} (${tx.status})`);
// List transactions
const resp = await client.listTransactions({
wallet_id: wallet.wallet_id,
page: 1,
page_size: 20,
});
for (const t of resp.items) {
console.log(`${t.tx_hash} ${t.amount} ${t.token_symbol} (${t.status})`);
}
await client.logout();Configuration
import { Sandbox, Production, Custom } from '@paratro/sdk';
// Sandbox (testnet)
new MPCClient(key, secret, Sandbox);
// Production
new MPCClient(key, secret, Production);
// Custom endpoint
new MPCClient(key, secret, Custom('https://your-api.example.com'));API Methods
| Category | Method | Description |
|----------|--------|-------------|
| Wallet | createWallet(req) | Create a new MPC wallet |
| | getWallet(id) | Get wallet by ID |
| | listWallets(req?) | List wallets with pagination |
| Account | createAccount(req) | Create a blockchain account |
| | getAccount(id) | Get account by ID |
| | listAccounts(req?) | List accounts with pagination |
| Asset | createAsset(req) | Add a token to an account |
| | getAsset(id) | Get asset by ID |
| | listAssets(req?) | List assets with pagination |
| Transaction | getTransaction(id) | Get transaction by ID |
| | listTransactions(req?) | List transactions with pagination |
| Transfer | createTransfer(req) | Send funds to an address |
| Auth | logout() | Invalidate JWT token |
Error Handling
import { APIError, isNotFound, isAuthError, isRateLimited } from '@paratro/sdk';
try {
await client.getWallet('nonexistent');
} catch (err) {
if (err instanceof APIError) {
console.log(`HTTP ${err.httpStatus}: [${err.code}] ${err.message}`);
if (isNotFound(err)) { /* 404 */ }
if (isAuthError(err)) { /* 401/403 */ }
if (isRateLimited(err)) { /* 429 */ }
}
}Supported Chains
| Chain | Value | Type |
|-------|-------|------|
| Ethereum | ethereum | EVM |
| BNB Smart Chain | bsc | EVM |
| Polygon | polygon | EVM |
| Avalanche | avalanche | EVM |
| Arbitrum | arbitrum | EVM |
| Optimism | optimism | EVM |
| Tron | tron | TVM |
| Bitcoin | bitcoin | UTXO |
| Solana | solana | SVM |
Related SDKs
| Language | Package | |----------|---------| | Go | paratro-sdk-go | | Rust | paratro-sdk-rust | | Python | paratro-sdk-python |
Links
License
MIT
