7N7D SDK
The official SDK for programmatic integration with the 7N7D Protocol.
Coming Soon
The SDK is currently in development. This documentation describes the planned API design.
What is the SDK?
The 7N7D SDK allows developers and institutions to:
- Deposit and withdraw USDC programmatically
- Monitor vault performance and positions
- Build custom interfaces and integrations
- Automate investment strategies
Use Cases
For Developers
- Build custom dashboards
- Create mobile applications
- Integrate with portfolio trackers
For Institutions
- Automate treasury management
- Connect to existing systems
- Implement compliance workflows
For Traders
- Programmatic deposits based on signals
- Automated rebalancing
- Multi-account management
Quick Example
import { SevenNSevenD } from '@7n7d/sdk';
// Initialize client
const client = new SevenNSevenD({
rpcUrl: 'https://arb1.arbitrum.io/rpc',
privateKey: process.env.PRIVATE_KEY,
});
// Deposit USDC
const deposit = await client.vault.deposit('1000');
console.log(`Deposited! TX: ${deposit.hash}`);
// Check balance
const balance = await client.vault.getBalance();
console.log(`Vault shares: ${balance.shares}`);
console.log(`Value: $${balance.usdcValue}`);
// Check earnings
const earnings = await client.vault.getEarnings();
console.log(`Total earned: $${earnings.total}`);
// Withdraw
const withdraw = await client.vault.withdraw('500');
console.log(`Withdrew $500! TX: ${withdraw.hash}`);
SDK Features
Core Functions
| Function | Description |
|---|---|
vault.deposit() | Add USDC to vault |
vault.withdraw() | Remove USDC from vault |
vault.getBalance() | Check your position |
vault.getEarnings() | View profit/loss |
vault.getSharePrice() | Current share value |
Read Functions
| Function | Description |
|---|---|
vault.getTVL() | Total value locked |
vault.getAPY() | Current yield |
vault.getPerformance() | Historical returns |
vault.getPositions() | Current AI positions |
Utility Functions
| Function | Description |
|---|---|
utils.formatUSDC() | Format USDC amounts |
utils.parseUSDC() | Parse USDC strings |
utils.estimateGas() | Estimate transaction cost |
Supported Environments
Node.js
npm install @7n7d/sdk
Browser
<script src="https://cdn.7n7d.com/sdk.min.js"></script>
React / Next.js
import { useSevenNSevenD } from '@7n7d/sdk/react';
function MyComponent() {
const { vault, isConnected } = useSevenNSevenD();
// ...
}
Architecture
┌─────────────────────────────────────────────────────────┐
│ Your Application │
├─────────────────────────────────────────────────────────┤
│ @7n7d/sdk │
│ ┌────────────┐ ┌────────────┐ ┌────────────────────┐ │
│ │ Vault │ │ Staking │ │ Governance │ │
│ │ Module │ │ Module │ │ Module │ │
│ └─────┬──────┘ └─────┬──────┘ └──────────┬─────────┘ │
│ │ │ │ │
│ └───────────────┴─────────────────────┘ │
│ │ │
│ ┌─────────▼─────────┐ │
│ │ ethers.js │ │
│ │ Contract Layer │ │
│ └─────────┬─────────┘ │
└────────────────────────┼────────────────────────────────┘
│
▼
┌──────────────────────┐
│ Arbitrum Network │
│ Smart Contracts │
└──────────────────────┘
Security Considerations
Private Key Handling
- Never expose private keys in client-side code
- Use environment variables
- Consider using a signer abstraction
Transaction Signing
- All transactions require signing
- SDK supports multiple signer types
- Hardware wallet compatible
Rate Limiting
- RPC endpoints may have limits
- SDK includes retry logic
- Use your own RPC for production
Getting Started
Ready to integrate?
- Installation & Setup - Install and configure
- Depositing USDC - Add funds programmatically
- Withdrawing - Remove funds
- Checking Balances - Monitor positions
- API Reference - Complete function list
Next: Getting Started with installation.