Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
6bd2e17
fix(governance): strict-majority tie semantics + yield list state der…
lcamargof Jul 14, 2026
6950a89
fix(governance): derive stale-PENDING outcomes past deadline; chain t…
lcamargof Jul 14, 2026
102d000
fix(index-dtf): platform fee fails loud on zero denominator
lcamargof Jul 14, 2026
b0bbbe1
feat(index-dtf): type the exposure API contract (ytd period, underlyi…
lcamargof Jul 14, 2026
4a29ca5
fix(index-dtf): price-history interval accepts 5m (the 24h chart gran…
lcamargof Jul 15, 2026
7480fb2
fix(rebalance): completed-rebalance detail read works end-to-end (Z30)
lcamargof Jul 15, 2026
536e809
fix(governance): index-dtf stale-PENDING past deadline derives the vo…
lcamargof Jul 20, 2026
c51c120
chore: per-change changesets; minor bump for the 0.4.x breaking surface
lcamargof Jul 20, 2026
1df9528
feat(index-dtf): brand maps to the display-ready single shape
lcamargof Jul 20, 2026
0453499
feat(index-dtf): status is a sync catalog lookup
lcamargof Jul 20, 2026
49aeb87
feat(react-sdk): useIndexDtfPerformance — deduped history + live poin…
lcamargof Jul 20, 2026
1baaff1
feat: account balance PnL — snapshot read + useAccountBalancePnl
lcamargof Jul 20, 2026
6f9009f
style: oxfmt on the new pnl/performance modules
lcamargof Jul 20, 2026
e44ec05
fix(react-sdk): performance point carries required marketCap/totalSup…
lcamargof Jul 20, 2026
f1ee8f5
refactor: three-tier boundary — snapshot primitive hook, PnL semantic…
lcamargof Jul 21, 2026
869bd8c
fix: 0.5.0 release-audit corrections
lcamargof Jul 23, 2026
0419eee
ci: publish workflow runs the complete release gate; codegen freshnes…
lcamargof Jul 23, 2026
3b0fbfb
docs: sync SDK docs and wiki with the 0.5.0 surface
lcamargof Jul 23, 2026
bccf54e
docs: scope the select-option claim and the proposal-state bullets (c…
lcamargof Jul 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/account-balance-pnl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@reserve-protocol/sdk": minor
"@reserve-protocol/react-sdk": minor
---

Account-balance snapshot primitives: `getIndexDtfAccountBalanceSnapshot` (carry-forward daily balance at a mark) on the namespace and bound ref, with `selectPriceAtMark(points, mark?)` selecting the latest positive timestamped price at or before an optional mark while preserving its one-argument behavior. The read is exposed through `useIndexDtfAccountBalanceSnapshot`, plus `usePrefetchIndexDtfPriceHistory` lets apps warm sibling price-history windows without touching the SDK client. Product metrics (e.g. a week-ago PnL) compose these app-side — the SDK deliberately ships no PnL semantics.
5 changes: 5 additions & 0 deletions .changeset/brand-display-shape.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@reserve-protocol/sdk": minor
---

Breaking: `IndexDtfBrand` is now the display-ready shape consumers can store directly — `{ hidden, dtf: { icon, cover, mobileCover, video, description, notesFromCreator, prospectus, files, tags, basketType }, creator, curator, socials }`. Every field is always present: absent API values coerce to `""`, `files` is always `{ url, name }[]`, `tags` always `string[]`, and `basketType` narrows to `"percentage-based" | "unit-based"` (defaulting `"percentage-based"`). App-side brand mapping layers are no longer needed.
5 changes: 5 additions & 0 deletions .changeset/exposure-api-types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@reserve-protocol/sdk": minor
---

Typed the Index DTF exposure API contract to match the live response: `period` accepts `ytd`, `underlyingMarketCap` is exposed, and native/bridge metadata is fully typed instead of `unknown` — no more consumer-side casts.
5 changes: 5 additions & 0 deletions .changeset/index-dtf-performance-hook.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@reserve-protocol/react-sdk": minor
---

`useIndexDtfPerformance` — price history composed for display: deduped by timestamp, with a live point appended when `currentPrice` + `currentTotalSupply` are provided (marketCap derived). The cache entry stays the raw point array under the canonical price-history key; composition happens after the cache, so other consumers of the key keep the raw contract.
5 changes: 5 additions & 0 deletions .changeset/platform-fee-invalid-response.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@reserve-protocol/sdk": minor
---

Breaking: `getIndexDtfPlatformFee` now throws `SdkError` (`INVALID_RESPONSE`) when the DAO fee registry returns a zero denominator, instead of fabricating a confident 0% fee. A real 0% (zero numerator over a positive denominator) is unaffected; consumers should treat the error as "fee unavailable".
5 changes: 5 additions & 0 deletions .changeset/price-history-5m-interval.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@reserve-protocol/sdk": minor
---

`getIndexDtfPriceHistory` interval accepts `"5m"`, the granularity the API serves for the 24h range — previously the union only declared `1h | 1d` and forced a cast.
5 changes: 5 additions & 0 deletions .changeset/rebalance-detail-contract.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@reserve-protocol/sdk": minor
---

Breaking: `ReserveApiIndexDtfRebalanceDetail.auctions` is now required (`[]` when no auctions ran); a truly-absent field is treated as a malformed response and fails loud. Completed-rebalance detail reads now work end-to-end: the single-element-array envelope from `/dtf/rebalance` is normalized inside the client (`RECORD_NOT_FOUND` on empty), and `IndexDtfCompletedRebalanceDetail` carries the analytics fields the detail surface renders (avgPriceImpactPercent, totalPriceImpactUsd, marketCapRebalanceImpact, tracking/native basket deviation).
5 changes: 5 additions & 0 deletions .changeset/stale-pending-outcomes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@reserve-protocol/sdk": patch
---

A proposal stuck in subgraph PENDING past its vote deadline now derives the vote outcome (DEFEATED / QUORUM_NOT_REACHED / SUCCEEDED) like a stale ACTIVE, matching Governor.state() semantics — it is never reported as EXPIRED. Applies to both Index DTF (`getProposalState`) and Yield DTF (`getYieldDtfProposalState`). Yield proposal reads also derive the current timepoint from the chain (block timestamp or number per governor version) instead of the consumer machine's clock.
6 changes: 6 additions & 0 deletions .changeset/status-sync-catalog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@reserve-protocol/sdk": minor
"@reserve-protocol/react-sdk": minor
---

Breaking: `getIndexDtfStatus` is now a synchronous catalog lookup — `getIndexDtfStatus({ address, chainId }): DtfStatus` validates the address and reads `@reserve-protocol/dtf-catalog` directly (case-insensitive address match, absent entries are `active`) instead of scanning the `/discover/dtfs` endpoint. The plural `getIndexDtfStatuses` remains an asynchronous Reserve API discovery projection for bulk/list screens. `useIndexDtfStatus({ address, chainId })` returns the singular status directly with no react-query involved; `indexDtfStatusQueryOptions` and the `dtfQueryKeys.index.status` key are removed.
5 changes: 5 additions & 0 deletions .changeset/strict-tie-semantics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@reserve-protocol/sdk": minor
---

Match OZ Governor strict-majority semantics in Index DTF proposal state derivation (a for/against tie is now DEFEATED, not SUCCEEDED) and derive lagging Yield DTF proposal list states (ACTIVE past the vote deadline now resolves to DEFEATED/QUORUM_NOT_REACHED/SUCCEEDED) via the new getYieldDtfProposalState. Breaking: the `YieldDtfProposalState` union gained `"QUORUM_NOT_REACHED"` — exhaustive switches over it must handle the new member.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ jobs:
- name: Format Check
run: pnpm format:check

- name: GraphQL Codegen Check
run: pnpm graphql:codegen:check

- name: Documentation Links
run: pnpm docs:links

Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,9 @@ jobs:
- name: Install Dependencies
run: pnpm install --frozen-lockfile

- name: Validate Manual Release
if: ${{ github.event_name == 'workflow_dispatch' }}
- name: Validate Release
run: pnpm release:ci

- name: Build Release Artifacts
if: ${{ github.event_name != 'workflow_dispatch' }}
run: pnpm build

- name: Changeset Release
id: changesets
uses: changesets/action@v1
Expand Down
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 ABC Labs

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pnpm docs:links
pnpm release:ci
```

`pnpm release:ci` runs typecheck, tests, builds (including the docs site), local documentation-link checks, and package dry-runs for the publishable packages.
`pnpm release:ci` runs typecheck, lint/format, live-schema GraphQL codegen freshness, tests, builds (including the docs site and SDK bundle budget), documentation/catalog checks, and package dry-runs for all publishable packages.

## Quick Example

Expand Down
3 changes: 2 additions & 1 deletion apps/docs/src/pages/protocol/data-sources.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ Reserve integrations should use the right source for each kind of data.
| Active auction | RPC | Must be real-time for bidding. |
| Proposal state | RPC plus subgraph | Subgraph indexes events; RPC owns live terminal state. |
| Prices | Reserve API | Aggregated current and historical price data. |
| Discovery | Reserve API or catalog | Product listing and curated status. |
| Discovery and bulk status | Reserve API | Current product list and batch status rows. |
| Single-DTF status | `@reserve-protocol/dtf-catalog` | Synchronous curated route status; unknown is active. |
| Governance metadata | Index subgraph | Historical proposal/config metadata. |
| Holders and transactions | Index subgraph/API-backed surfaces | Indexed history. |
| Vote-lock DAO stats | Reserve API | Aggregated DAO/vote-lock position data. |
Expand Down
86 changes: 46 additions & 40 deletions apps/docs/src/pages/react-sdk/index-dtf-hooks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,18 @@ const dtfs = useDiscoverDtfs({

## DTF Detail

| Hook | Core SDK method |
| ------------------------- | --------------------------- |
| `useIndexDtf` | `sdk.index.get` |
| `useIndexDtfBasket` | `sdk.index.getBasket` |
| `useIndexDtfVersion` | `sdk.index.getVersion` |
| `useIndexDtfBrand` | `sdk.index.getBrand` |
| `useIndexDtfMandate` | `sdk.index.getMandate` |
| `useIndexDtfTotalSupply` | `sdk.index.getTotalSupply` |
| `useIndexDtfTotalAssets` | `sdk.index.getTotalAssets` |
| `useIndexDtfPrice` | `sdk.index.getPrice` |
| `useIndexDtfPriceHistory` | `sdk.index.getPriceHistory` |
| Hook | Core SDK method |
| ------------------------- | ------------------------------------ |
| `useIndexDtf` | `sdk.index.get` |
| `useIndexDtfBasket` | `sdk.index.getBasket` |
| `useIndexDtfVersion` | `sdk.index.getVersion` |
| `useIndexDtfBrand` | `sdk.index.getBrand` |
| `useIndexDtfMandate` | `sdk.index.getMandate` |
| `useIndexDtfTotalSupply` | `sdk.index.getTotalSupply` |
| `useIndexDtfTotalAssets` | `sdk.index.getTotalAssets` |
| `useIndexDtfPrice` | `sdk.index.getPrice` |
| `useIndexDtfPriceHistory` | `sdk.index.getPriceHistory` |
| `useIndexDtfPerformance` | composed `sdk.index.getPriceHistory` |

```tsx
const basket = useIndexDtfBasket({ address, chainId });
Expand All @@ -39,34 +40,37 @@ const price = useIndexDtfPrice({ address, chainId });

## Product And Analytics Reads

| Hook | Core SDK method |
| ---------------------------------- | ------------------------------------ |
| `useIndexDtfStatus` | `sdk.index.getStatus` |
| `useIndexDtfExposure` | `sdk.index.getExposure` |
| `useIndexDtfHolders` | `sdk.index.getHolders` |
| `useIndexDtfTransactions` | `sdk.index.getTransactions` |
| `useIndexDtfRevenue` | `sdk.index.getRevenue` |
| `useIndexDtfPlatformFee` | `sdk.index.getPlatformFee` |
| `useIndexDtfPendingFeeShares` | `sdk.index.getPendingFeeShares` |
| `useIndexDtfApprovedRevenueTokens` | `sdk.index.getApprovedRevenueTokens` |
| `useIndexDtfIssuanceState` | `sdk.index.getIssuanceState` |
| `useIndexDtfBidsEnabled` | `sdk.index.getBidsEnabled` |
| `useIndexDtfRebalanceControl` | `sdk.index.getRebalanceControl` |
| `useIndexDtfRebalances` | `sdk.index.getRebalances` |
| `useIndexDtfRebalance` | `sdk.index.getRebalance` |
| `useIndexDtfCurrentRebalance` | `sdk.index.getCurrentRebalance` |
| `useIndexDtfRebalanceLiquidity` | `sdk.index.getRebalanceLiquidity` |
| `useIndexDtfRebalanceAuctions` | `sdk.index.getRebalanceAuctions` |
| `useIndexDtfActiveAuction` | `sdk.index.getActiveAuction` |
| `useIndexDtfLatestAuction` | `sdk.index.getLatestAuction` |
| `useIndexDtfBidQuote` | `sdk.index.getBidQuote` |
| `useIndexDtfCompletedRebalance` | `sdk.index.getCompletedRebalance` |
| `useIndexDtfCompletedRebalances` | `sdk.index.getCompletedRebalances` |
| `useIndexDtfVoteLockState` | `sdk.index.getVoteLockState` |
| `useIndexDtfVoteLockVaultState` | `sdk.index.getVoteLockVaultState` |
| `useAccountPortfolio` | `sdk.portfolio.get` |
| `useAccountPortfolioHistory` | `sdk.portfolio.getHistory` |
| `useAccountPortfolioTransactions` | `sdk.portfolio.getTransactions` |
| Hook | Core SDK method |
| ----------------------------------- | ------------------------------------- |
| `useIndexDtfStatus` | `sdk.index.getStatus` |
| `useIndexDtfExposure` | `sdk.index.getExposure` |
| `useIndexDtfHolders` | `sdk.index.getHolders` |
| `useIndexDtfAccountBalanceSnapshot` | `sdk.index.getAccountBalanceSnapshot` |
| `useIndexDtfTransactions` | `sdk.index.getTransactions` |
| `useIndexDtfRevenue` | `sdk.index.getRevenue` |
| `useIndexDtfPlatformFee` | `sdk.index.getPlatformFee` |
| `useIndexDtfPendingFeeShares` | `sdk.index.getPendingFeeShares` |
| `useIndexDtfApprovedRevenueTokens` | `sdk.index.getApprovedRevenueTokens` |
| `useIndexDtfIssuanceState` | `sdk.index.getIssuanceState` |
| `useIndexDtfBidsEnabled` | `sdk.index.getBidsEnabled` |
| `useIndexDtfRebalanceControl` | `sdk.index.getRebalanceControl` |
| `useIndexDtfRebalances` | `sdk.index.getRebalances` |
| `useIndexDtfRebalance` | `sdk.index.getRebalance` |
| `useIndexDtfCurrentRebalance` | `sdk.index.getCurrentRebalance` |
| `useIndexDtfRebalanceLiquidity` | `sdk.index.getRebalanceLiquidity` |
| `useIndexDtfRebalanceAuctions` | `sdk.index.getRebalanceAuctions` |
| `useIndexDtfActiveAuction` | `sdk.index.getActiveAuction` |
| `useIndexDtfLatestAuction` | `sdk.index.getLatestAuction` |
| `useIndexDtfBidQuote` | `sdk.index.getBidQuote` |
| `useIndexDtfCompletedRebalance` | `sdk.index.getCompletedRebalance` |
| `useIndexDtfCompletedRebalances` | `sdk.index.getCompletedRebalances` |
| `useIndexDtfVoteLockState` | `sdk.index.getVoteLockState` |
| `useIndexDtfVoteLockVaultState` | `sdk.index.getVoteLockVaultState` |
| `useAccountPortfolio` | `sdk.portfolio.get` |
| `useAccountPortfolioHistory` | `sdk.portfolio.getHistory` |
| `useAccountPortfolioTransactions` | `sdk.portfolio.getTransactions` |

`useIndexDtfStatus` is synchronous and returns the catalog status directly. Query-backed hooks accept TanStack Query options; `useIndexDtfPerformance` reserves `select` for its raw-cache-preserving composition. Use `usePrefetchIndexDtfPriceHistory` to warm canonical price-history keys.
Comment thread
coderabbitai[bot] marked this conversation as resolved.

```tsx
const issuance = useIndexDtfIssuanceState(
Expand Down Expand Up @@ -96,7 +100,9 @@ Use them for previewing proposal payloads before submit.

## Select Option

All hooks support `select`.
Ordinary query hooks support `select`. Two exceptions: `useIndexDtfStatus` is a
synchronous catalog lookup (no query options), and `useIndexDtfPerformance`
reserves `select` for its own live-point composition.

```tsx
const symbol = useIndexDtf(
Expand Down
39 changes: 21 additions & 18 deletions apps/docs/src/pages/sdk/index-dtf.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const dtf = sdk.index.ref({ address, chainId });
| `sdk.index.list(params?)` | `@reserve-protocol/dtf-catalog` | Curated static catalog |
| `sdk.index.getCatalogEntries(params?)` | catalog | Raw catalog entries |
| `sdk.index.resolveAlias(params)` | catalog | Resolve ticker/name/address-like aliases |
| `sdk.index.getStatus(params)` | Reserve API discovery | Product listing status |
| `sdk.index.getStatus(params)` | `@reserve-protocol/dtf-catalog` | Synchronous route/product status |
| `sdk.index.getStatuses(params?)` | Reserve API discovery | Bulk status map |

```ts
Expand All @@ -30,23 +30,26 @@ const dtfs = await sdk.index.discover({

## DTF Reads

| Method | Use |
| ------------------- | ----------------------------------------------------------------------- |
| `get` | Full product-shaped view with market, basket, platform fee, and status. |
| `getDtf` | Subgraph DTF metadata. |
| `getBasket` | Live RPC basket from `totalAssets()`. |
| `getBasketSnapshot` | Reserve API current or block snapshot basket. |
| `getVersion` | DTF version from contract. |
| `getTotalSupply` | Live total supply. Includes pending fee shares. |
| `getTotalAssets` | Live total assets. |
| `getBrand` | Product brand metadata. |
| `getMandate` | DTF mandate string. |
| `getPrice` | Current Reserve API price. |
| `getPrices` | Batch current prices. |
| `getPriceHistory` | Historical Reserve API price points. |
| `getExposure` | Exposure/analytics data. |
| `getHolders` | Holder data. |
| `getTransactions` | Transaction history. |
| Method | Use |
| --------------------------- | ----------------------------------------------------------------------- |
| `get` | Full product-shaped view with market, basket, platform fee, and status. |
| `getDtf` | Subgraph DTF metadata. |
| `getBasket` | Live RPC basket from `totalAssets()`. |
| `getBasketSnapshot` | Reserve API current or block snapshot basket. |
| `getVersion` | DTF version from contract. |
| `getTotalSupply` | Live total supply. Includes pending fee shares. |
| `getTotalAssets` | Live total assets. |
| `getBrand` | Product brand metadata. |
| `getMandate` | DTF mandate string. |
| `getPrice` | Current Reserve API price. |
| `getPrices` | Batch current prices. |
| `getPriceHistory` | Historical Reserve API price points. |
| `getExposure` | Exposure/analytics data. |
| `getHolders` | Holder data. |
| `getAccountBalanceSnapshot` | Latest indexed account balance at or before a mark. |
| `getTransactions` | Transaction history. |

`getStatus` validates its address, reads the chain-scoped catalog, and treats DTFs absent from the catalog as active. `getStatuses` remains an asynchronous Reserve API discovery projection for bulk/list screens.

`getBrand` preserves overview media metadata, including `video` and downloadable `files`, in addition to covers, descriptions, profiles, tags, and social links.

Expand Down
Loading