Skip to main content
Scalar API reference · Balances, cost and returns · Valuation and harvest reporting · Data API patterns This guide provides end-to-end operational recipes for institutional partners and finance teams to reconcile daily statements, prove audit numbers, and verify yield using the SuperEarn Data API (https://api.superearn.io). All queries in this walkthrough use real production data from the Kaia Super Vault and an institutional partner router account.

Scenario 1: Daily Ledger Reconciliation

Objective

Reconcile your internal accounting ledger against on-chain fund flows and net earned interest at period boundaries, under both deposit-only and redemption (realized gain) conditions.

Case 1-A: Inflows and Accrued Interest (No Redemptions)

When users only deposit and no shares are liquidated, all earned interest increases unrealized PnL, and realized PnL remains zero.

1. Query /v1/earnings for the 24-hour cycle

Actual API Response

2. Validate Ledger Invariant

Plugging in the actual response values:
Because outflows = 0, realizedPnl = 0 and unrealizedPnlChange = pnl = $1,522.04.

Case 1-B: Redemptions and Realized Capital Gains (With Outflows & Realized PnL)

When vault shares are redeemed or transferred out, the cost basis of those disposed shares is removed from the book, and the difference between redemption proceeds and acquisition cost crystallizes as Realized PnL (realizedPnl).

1. Query /v1/earnings for the active redemption period

Actual API Response

2. Validate Dual PnL and Ledger Invariants

Invariant A: Total PnL Decomposition
Plugging in the response values:
Invariant B: Master Ledger Balance Equation
Plugging in the response values:
Invariant C: Cost Basis Derecognition
When $166,430.95 was redeemed, the cost basis of those specific shares was derecognized:

3. Accounting Journal Entries for Redemptions

  1. User Outflows & Capital Gain:
    • (Debit) User Deposit Liabilities / Cash Paid: $166,430.95
    • (Credit) Custody Vault Shares (Cost Basis): $164,036.98
    • (Credit) Realized Investment Gain (PnL): $2,393.98
  2. Remaining Retained Shares:
    • Unrealized gain on retained shares increased by $1,335.14 ($145,083.63 -> $146,418.77).

Scenario 2: Audit Locked-Profit Reconciliation

Objective

Provide financial auditors with evidence reconciling the difference between the statutory claimable balance (totalValue / positionValue) and the smart contract total assets (reportedPositionValue).

Step 1: Query /v1/balances with include=reconciliation

Actual API Response (Block #226797199)

Step 2: Validate the Asset Reconciliation Invariant

Plugging in the response values:

Step 3: Multi-Party Pro-Rata Verification

To prove to auditors that the locked profit allocation is fair and pro-rata across all vault participants, query the entire vault at the exact same block by omitting account:

Scenario 3: Trailing Yield & Performance Verification

Objective

Reconcile marketing/displayed vault APY against actual position returns to address partner inquiries regarding rate consistency.

Step 1: Query the 7-day trailing observed APY (/v1/apy)

  • Observed Vault APY: 5.64% over the trailing 7 days.
  • Consistency with Ledger: In Case 1-A, the 1-day time-weighted return (return.apy) was 5.78%, and in Case 1-B the 3-day time-weighted return was 4.53%, consistent with the vault’s floating yield range.

Step 2: Rate Distinction Reference


Automation Script for Daily Cron Jobs

You can automate daily balance reconciliation using this lightweight shell script: