Coming Soon: The Developers section is under active development. Documentation will be available soon.
Installation
Copy
npm install @centuari/sdk
Quick Start
Copy
import { Centuari } from '@centuari/sdk';
const client = new Centuari({
chainId: 42161,
signer: yourSigner
});
// Lend
const position = await client.lend({
asset: 'USDC',
amount: '10000',
rate: 0.08,
maturity: '90d'
});
// Borrow
const loan = await client.borrow({
collateral: { asset: 'ETH', amount: '5' },
borrowAsset: 'USDC',
borrowAmount: '8000'
});
Core Methods
Lending
Copy
// Easy mode (auto-optimized)
await client.easyLend({ asset: 'USDC', amount: '10000' });
// Advanced mode
await client.lend({
asset: 'USDC',
amount: '10000',
rate: 0.085,
maturity: '2025-06-01',
autoRollover: false
});
Borrowing
Copy
await client.depositCollateral({ asset: 'ETH', amount: '5' });
await client.borrow({
borrowAsset: 'USDC',
borrowAmount: '8000',
maxRate: 0.09,
maturity: '90d'
});
Position Management
Copy
// Get position
const position = await client.getPosition('pos_123');
// List positions
const { positions } = await client.listPositions({ status: 'active' });
// Cancel order
await client.cancelOrder('order_123');
Market Data
Copy
const rates = await client.getRates();
const orderBook = await client.getOrderBook({ asset: 'USDC', maturity: '90d' });
Events
Copy
client.on('positionMatched', (event) => {
console.log(`Matched at ${event.rate}`);
});
await client.startListening();
Error Handling
Copy
import { InsufficientFundsError } from '@centuari/sdk';
try {
await client.lend({ ... });
} catch (error) {
if (error instanceof InsufficientFundsError) {
console.log(`Need ${error.required}, have ${error.available}`);
}
}
Full SDK Documentation
Complete SDK reference