Skip to content

API Clients

ArkonixAPIClient

Standalone access to the Arkonix backend (the same data the financial-data hooks consume). All endpoints are public GET, no authentication. The client normalizes the backend's snake_case JSON into the camelCase types.

Constructor

import { ArkonixAPIClient } from "@arkonix.xyz/arkonix-vault-sdk";

const api = new ArkonixAPIClient({ baseUrl: "https://api.arkonix.xyz", timeout: 30000 });

The constructor throws 'ArkonixAPIClient requires a baseUrl' if baseUrl is missing; trailing slashes on baseUrl are normalized away. timeout defaults to 30000 ms.

Methods and endpoints

Method HTTP endpoint Returns
getVaultFinancials(vaultAddress) GET /public/vaults/{vault_address} VaultFinancials
getReturnHistory(shareClassId, { days? }) GET /public/share-classes/{id}/apy-history?days= ReturnHistory
getTvlHistory(shareClassId, { days? }) GET /public/share-classes/{id}/tvl-history?days= TvlHistory
getSharePriceHistory(vaultAddress) GET /public/vaults/{vault_address}/share-price-history SharePriceHistory
getVaultTransactions(vaultAddress, params?) GET /public/vaults/{vault_address}/transactions?user_address=&transaction_type=&limit=&offset= VaultTransactions
getAssetDistribution(shareClassId) GET /public/share-classes/{id}/holdings VaultAssetDistribution
getShareClassFees(shareClassId) GET /public/share-classes/{id}/fees ShareClassFees

Path naming quirk: /apy-history

The return-history endpoint path is still /apy-history for backward compatibility, even though every SDK-level name says "return". Only the SDK surface and JSON field names were renamed in 2.2.0. Do not be surprised by the path in network logs.

Error behavior

All methods throw Error with these messages:

Condition Message
404 "Arkonix API: not found ({path})"
400 "Arkonix API: bad request — check the identifier format ({path})"
other non-2xx "Arkonix API error {status} for {path}"
timeout (AbortController) "Arkonix API request timeout after {ms}ms ({path})"

Example: full financial read

import { ArkonixAPIClient } from "@arkonix.xyz/arkonix-vault-sdk";

const api = new ArkonixAPIClient({ baseUrl: "https://api.arkonix.xyz" });

const fin = await api.getVaultFinancials("0xVault…");
const history = await api.getReturnHistory(fin.shareClassId, { days: 30 });
const activity = await api.getVaultTransactions("0xVault…", { userAddress: "0xUser…" });
const distribution = await api.getAssetDistribution(fin.shareClassId);
const fees = await api.getShareClassFees(fin.shareClassId);

CentrifugeAPIClient (GraphQL)

Used for vault discovery across the ecosystem and legacy holdings queries.

const client = new CentrifugeAPIClient({ apiUrl: "https://api.centrifuge.io", timeout: 30000 });
// both config fields optional; these are the defaults
Method Purpose Status
getVaults(params?: VaultsQueryParams) Query vaults (filter by poolId, tokenId, centrifugeId, id = vault address, isActive, assetAddress; limit default 100, orderBy/orderDirection) active
getHoldings(params?: HoldingsQueryParams) Base holdings filter query active
getVaultHoldings(poolId, tokenId) Holdings for one vault deprecated → ArkonixAPIClient.getAssetDistribution
getPoolHoldings(poolId) All holdings in a pool deprecated → ArkonixAPIClient.getAssetDistribution

Deprecated holdings methods

getVaultHoldings and getPoolHoldings are deprecated since 2.3.0 (removal planned v3.0.0). Replace with ArkonixAPIClient.getAssetDistribution(shareClassId) — note the key, return shape, and backend all change. See Migration.