@polygonlabs/staking-api-client 1.6.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,67 @@
1
1
  # @polygonlabs/staking-api-client
2
2
 
3
+ ## 1.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#348](https://github.com/0xPolygon/staking-api/pull/348) [`9fc15fd`](https://github.com/0xPolygon/staking-api/commit/9fc15fd4438b3bb36906cba882da1afe6f2a7d47) Thanks [@shan8851](https://github.com/shan8851)! - The v3 delegator, checkpoints-signed, delegations-by-user and unbonds responses are now fully typed in the OpenAPI spec and the generated client instead of untyped objects.
8
+
9
+ - Delegator list and cursor-page rows, checkpoints-signed rows (offset and cursor), delegations-by-user positions (including `liquidRewards`) and unbond records (including `withdrawEpoch`) now declare every field, including which of them can be `null` or absent.
10
+ - `GET /api/v3/delegators/{address}` is now typed as a plain array of positions. An address with no delegations returns `[]`, as before.
11
+ - The JSON returned is unchanged.
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [[`9fc15fd`](https://github.com/0xPolygon/staking-api/commit/9fc15fd4438b3bb36906cba882da1afe6f2a7d47)]:
16
+ - @polygonlabs/staking-api-schemas@1.8.0
17
+
18
+ ## 1.7.0
19
+
20
+ ### Minor Changes
21
+
22
+ - [#327](https://github.com/0xPolygon/staking-api/pull/327) [`c5bd959`](https://github.com/0xPolygon/staking-api/commit/c5bd95983e96645a661cbda4847c1b0f07960135) Thanks [@adamdossa](https://github.com/adamdossa)! - Correct `/api/v2/rewards/current-apr` and add `/api/v2/rewards/current-spol-apy`.
23
+
24
+ `current-apr` understated the delegator rate by about a third. It assumed 8 reward intervals a day and applied an extra 10% reduction. It now uses the live checkpoint block interval and the measured Bor block time. It still returns the annual rate a delegator earns per POL staked, in percent: after the proposer bonus, before validator commission, not compounded.
25
+
26
+ `current-spol-apy` returns the annual yield of holding sPOL, in percent. It takes the delegator rate, subtracts the commission of the pool's validators (weighted by the pool's stake on each) and the sPOL reward fee, then compounds daily.
27
+
28
+ Both endpoints return an in-band `{ success: false }` until the indexer has cached their inputs. The indexer reads the sPOL controller from the new `SPOL_CONTROLLER_CONTRACT_ADDRESS` env var, which defaults to the mainnet controller.
29
+
30
+ - [#343](https://github.com/0xPolygon/staking-api/pull/343) [`1edc263`](https://github.com/0xPolygon/staking-api/commit/1edc263a5a67228ae4b784f1fb418229e3312515) Thanks [@shan8851](https://github.com/shan8851)! - Add cursor-paginated delegator list routes, whose pages cost the same at any depth
31
+
32
+ ## New routes
33
+ - `GET /api/v2/delegators/page` (`getAllDelegatorsPageV2`)
34
+ - `GET /api/v3/delegators/page` (`getAllDelegatorsPageV3`)
35
+ - `GET /api/v2/validators/{validatorId}/delegators/page` (`getValidatorDelegatorsPageV2`)
36
+ - `GET /api/v3/validators/{validatorId}/delegators/page` (`getValidatorDelegatorsPageV3`)
37
+
38
+ Each returns the same delegators as its offset-paginated counterpart, largest stake first, with
39
+ the same row shape. Pass `pagination.nextCursor` back as `cursor` to fetch the next page; it is
40
+ `null` on the last page. Every page carries `pagination: { limit, nextCursor }` and no `total`.
41
+
42
+ `limit` must be one of 20, 50, 100 or 500 (default 20). Other values, and cursors the API did not
43
+ issue, are rejected with a 400.
44
+
45
+ Stakes change as delegators bond and unbond, so these pages are served with the same 60-second
46
+ `Cache-Control` as other responses, not the long-lived header of the checkpoint and notification
47
+ cursor pages. For the same reason a walk can skip or repeat a delegator whose stake changes
48
+ between two page requests.
49
+
50
+ Unlike `offset`, a cursor does not get slower or more expensive the deeper you page, so prefer
51
+ these routes for walking the delegator list. The offset routes are unchanged.
52
+
53
+ ## Schemas and client
54
+
55
+ `@polygonlabs/staking-api-schemas` exports the `DelegatorsCursorQuery`,
56
+ `TotallessCursorPagination`, `DelegatorsCursorV2Response` and `DelegatorsCursorV3Response`
57
+ schemas. The client adds the four operations above, and their TanStack Query `Options` /
58
+ `QueryKey` factories under `/react`.
59
+
60
+ ### Patch Changes
61
+
62
+ - Updated dependencies [[`c5bd959`](https://github.com/0xPolygon/staking-api/commit/c5bd95983e96645a661cbda4847c1b0f07960135), [`1edc263`](https://github.com/0xPolygon/staking-api/commit/1edc263a5a67228ae4b784f1fb418229e3312515)]:
63
+ - @polygonlabs/staking-api-schemas@1.7.0
64
+
3
65
  ## 1.6.0
4
66
 
5
67
  ### Minor Changes