@rfy-strategy-vaults/vaults-sdk
v0.2.0
Published
TypeScript SDK for the RFY Strategy Vaults API
Downloads
62
Readme
@rfy-strategy-vaults/vaults-sdk
TypeScript SDK for the RFY Strategy Vaults API. Zero dependencies — uses native fetch.
Install
npm install @rfy-strategy-vaults/vaults-sdk
# or
pnpm add @rfy-strategy-vaults/vaults-sdkQuick Start
import { VaultsClient } from "@rfy-strategy-vaults/vaults-sdk";
const client = new VaultsClient({
baseUrl: "https://your-vaults-api.example.com",
chainId: 42161, // optional default chain (Arbitrum)
});
// Get all vaults
const { vaults } = await client.getVaultsSummary();
console.log(vaults.map((v) => `${v.name}: TVL $${v.tvlUsd}`));
// Get vault detail
const detail = await client.getVaultDetail(
"0x5cbe2cde999d80f9699000bebc07f1d04f2b1dc0",
1776 // override chain per-call
);
console.log(detail.epochMetrics);
// Get user positions (omit chainId to query all chains)
const positions = await client.getUserPositions("0xUserWalletAddress");
console.log(`Total PnL: $${positions.totalPnlUsd}`);API
new VaultsClient(config)
| Option | Type | Required | Description |
| --------- | ----------------------- | -------- | ---------------------------------------------------- |
| baseUrl | string | yes | Vaults API base URL |
| chainId | 1776 \| 3637 \| 42161 | no | Default chain ID for calls that require one |
| fetch | typeof fetch | no | Custom fetch implementation (e.g. for SSR/Node < 18) |
Methods
| Method | Returns | Description |
| ----------------------------------------- | ----------------------- | ------------------------------------- |
| getVaultsSummary() | VaultsSummaryResponse | All vaults with display-ready metrics |
| getVaultDetail(address, chainId?) | VaultDetailResponse | Full vault detail with epoch metrics |
| getUserPositions(userAddress, chainId?) | UserPositionsResponse | User positions with PnL and points |
Error Handling
import { VaultsSDKError } from "@rfy-strategy-vaults/vaults-sdk";
try {
const detail = await client.getVaultDetail("0x...", 42161);
} catch (err) {
if (err instanceof VaultsSDKError) {
console.error(err.status, err.body);
}
}Types
All API response types are exported for use in your application:
import type {
VaultSummaryItem,
VaultDetailResponse,
UserPositionItem,
ChartDataPoint,
EpochPerformanceData,
EpochStatus,
} from "@rfy-strategy-vaults/vaults-sdk";Supported Chains
| Chain ID | Network |
| -------- | --------- |
| 1 | Ethereum |
| 1776 | Injective |
| 3637 | Botanix |
| 42161 | Arbitrum |
Build
cd sdk
pnpm install
pnpm buildPublish
cd sdk
pnpm publish --access public