# SDK reference

The planned interface of the `@noderr/sdk` package.

> **Not yet published.** The `@noderr/sdk` package does not exist on npm yet. These APIs are subject to change before publication.

## What to use today

- **AI agents:** the [Agent Protocol REST API](../for-ai-agents/api-reference.md) at `https://agent.noderr.xyz`. No contract interaction is required. The API handles onchain transactions server side.
- **dApp developers:** [viem](https://viem.sh) or [ethers.js v6](https://docs.ethers.org/v6/) with the contract ABIs and the addresses in [Contract Addresses](../protocol/smart-contracts/contract-addresses.md). See [Integrate with the Contracts](./smart-contract-integration/README.md) for examples.

## Planned installation

```bash
npm install @noderr/sdk
# or
yarn add @noderr/sdk
# or
pnpm add @noderr/sdk
```

## Planned quick start

```typescript
import { NoderrClient } from '@noderr/sdk';

const client = new NoderrClient({
  chainId: 84532, // Base Sepolia
  rpcUrl: 'https://sepolia.base.org',
});

// Get all vaults
const vaults = await client.vaults.getAll();

// Get vault details
const vault = await client.vaults.get('0x49f747BBac988Cd628a5D79AAdF865EBaDe6a34f');
console.log(`TVL: ${vault.tvlUsd}`);
```

## Planned modules

### Vaults

```typescript
// Get all vaults
const vaults = await client.vaults.getAll();

// Get vault by address
const vault = await client.vaults.get(address);

// Get user position in vault
const position = await client.vaults.getUserPosition(vaultAddress, userAddress);
```

### ERC-7540 operations

```typescript
// Request deposit (ERC-7540 async flow)
const requestId = await client.vaults.requestDeposit(
  vaultAddress,
  amount, // in wei
  receiverAddress
);

// Claim deposit (receive shares after fulfillment)
const shares = await client.vaults.claimDeposit(vaultAddress, receiverAddress);

// Request redeem
const redeemRequestId = await client.vaults.requestRedeem(
  vaultAddress,
  shares,
  receiverAddress,
  ownerAddress
);

// Claim redeem (receive assets)
const assets = await client.vaults.claimRedeem(vaultAddress, receiverAddress);
```

### Strategies

```typescript
// Get all strategies
const strategies = await client.strategies.getAll();

// Get strategy by ID
const strategy = await client.strategies.get(strategyId);
```

### Governance

```typescript
// Get all proposals
const proposals = await client.governance.getProposals();

// Vote on proposal
await client.governance.vote(proposalId, support, reason);
```

## Planned types

```typescript
interface Vault {
  address: string;
  name: string;
  symbol: string;
  tvl: bigint;
  tvlUsd: number;
  totalShares: bigint;
  pricePerShare: bigint;
  apy: {
    current: number;
    day7: number;
    day30: number;
    inception: number;
  };
  fees: {
    management: number;
    performance: number;
    hurdle: number;
  };
  riskLevel: 'conservative' | 'moderate' | 'aggressive';
  isERC7540: boolean;
  fulfillmentDelay?: number;
}

interface Strategy {
  id: string;
  name: string;
  status: 'shadow' | 'paper_trading' | 'live' | 'terminated';
  riskScore: number;
  sharpeRatio: number;
  maxDrawdown: number;
  allocation: bigint;
}

interface UserPosition {
  vault: Vault;
  shares: bigint;
  value: bigint;
  pnl: bigint;
  pnlPercent: number;
}
```

*Last updated: February 2026*
