@gearbox-protocol/sdk 18.2.0-next.1 → 18.2.0-next.11

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.
Files changed (135) hide show
  1. package/dist/cjs/abi/compressors/subcompressors/liquidation/treehouseLiquidationSubcompressor.js +179 -0
  2. package/dist/cjs/abi/compressors/subcompressors/withdrawal/treehouseWithdrawalSubcompressor.js +534 -0
  3. package/dist/cjs/abi/router/treehouseWorker.js +885 -0
  4. package/dist/cjs/dev/AccountOpener.js +1 -1
  5. package/dist/cjs/dev/withdrawalUtils.js +1 -1
  6. package/dist/cjs/history/trace/extractTransfers.js +1 -1
  7. package/dist/cjs/onchain/accounts/CreditAccountsServiceV310.js +2 -2
  8. package/dist/cjs/onchain/accounts/liquidations/LiquidationsService.js +1 -1
  9. package/dist/cjs/onchain/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +1 -2
  10. package/dist/cjs/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +1 -2
  11. package/dist/cjs/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +1 -2
  12. package/dist/cjs/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +1 -1
  13. package/dist/cjs/onchain/base/TokensMeta.js +3 -3
  14. package/dist/cjs/onchain/core/createAddressProvider.js +1 -1
  15. package/dist/cjs/onchain/market/adapters/abi/actionAbi.js +1 -0
  16. package/dist/cjs/onchain/market/adapters/abi/conctructorAbi.js +3 -0
  17. package/dist/cjs/onchain/market/adapters/contracts/AccountMigratorAdapterContract.js +1 -1
  18. package/dist/cjs/onchain/market/adapters/contracts/ERC4626AdapterContract.js +1 -1
  19. package/dist/cjs/onchain/market/adapters/types.js +3 -0
  20. package/dist/cjs/onchain/market/credit/CreditFacadeV310BaseContract.js +1 -1
  21. package/dist/cjs/onchain/market/pool/PoolV310Contract.js +1 -1
  22. package/dist/cjs/onchain/market/rwa/createDegenNFT.js +1 -1
  23. package/dist/cjs/onchain/market/zapper/IETHZapperContract.js +1 -2
  24. package/dist/cjs/onchain/market/zapper/ZapperContract.js +1 -1
  25. package/dist/cjs/onchain/preview/preview/previewPoolPositionOperation.js +2 -2
  26. package/dist/cjs/onchain/utils/viem/simulateWithPriceUpdates.js +1 -1
  27. package/dist/cjs/permissionless/api/index.js +26 -0
  28. package/dist/cjs/permissionless/api/oracles/PermissionlessOracles.js +585 -47
  29. package/dist/cjs/permissionless/api/oracles/enrich.js +99 -0
  30. package/dist/cjs/permissionless/api/oracles/index.js +28 -0
  31. package/dist/cjs/permissionless/api/oracles/schemas.js +102 -35
  32. package/dist/cjs/permissionless/api/oracles/score/formula.js +99 -0
  33. package/dist/cjs/permissionless/api/oracles/score/index.js +8 -0
  34. package/dist/cjs/permissionless/api/oracles/score/run.js +88 -0
  35. package/dist/cjs/permissionless/api/oracles/score/types.js +1 -0
  36. package/dist/cjs/permissionless/api/oracles/stress/classify.js +258 -0
  37. package/dist/cjs/permissionless/api/oracles/stress/index.js +22 -0
  38. package/dist/cjs/permissionless/api/oracles/stress/override.js +125 -0
  39. package/dist/cjs/permissionless/api/oracles/stress/run.js +432 -0
  40. package/dist/cjs/permissionless/api/oracles/stress/score.js +98 -0
  41. package/dist/cjs/permissionless/api/oracles/stress/types.js +1 -0
  42. package/dist/cjs/permissionless/api/schemas.js +0 -3
  43. package/dist/cjs/permissionless/bindings/index.js +1 -1
  44. package/dist/cjs/permissionless/index.js +29 -1
  45. package/dist/cjs/permissionless/utils/index.js +2 -0
  46. package/dist/cjs/permissionless/utils/price-update/get-prices.js +64 -0
  47. package/dist/cjs/permissionless/utils/price-update/index.js +2 -0
  48. package/dist/cjs/testnets/TestnetsAPI.js +179 -0
  49. package/dist/cjs/testnets/errors/TestnetNotFoundError.js +15 -0
  50. package/dist/cjs/testnets/errors/TestnetRequestFailedError.js +24 -0
  51. package/dist/cjs/testnets/errors/TestnetStatusError.js +19 -0
  52. package/dist/cjs/testnets/errors/TestnetValidationError.js +24 -0
  53. package/dist/cjs/testnets/errors/TestnetWaitTimeoutError.js +30 -0
  54. package/dist/cjs/testnets/errors/TestnetsError.js +34 -0
  55. package/dist/cjs/testnets/errors/index.js +13 -0
  56. package/dist/cjs/testnets/index.js +32 -0
  57. package/dist/cjs/testnets/package.json +1 -0
  58. package/dist/cjs/testnets/schemas.js +242 -0
  59. package/dist/cjs/testnets/types.js +1 -0
  60. package/dist/esm/abi/compressors/subcompressors/liquidation/treehouseLiquidationSubcompressor.js +178 -0
  61. package/dist/esm/abi/compressors/subcompressors/withdrawal/treehouseWithdrawalSubcompressor.js +533 -0
  62. package/dist/esm/abi/router/treehouseWorker.js +884 -0
  63. package/dist/esm/onchain/market/adapters/abi/actionAbi.js +1 -0
  64. package/dist/esm/onchain/market/adapters/abi/conctructorAbi.js +3 -0
  65. package/dist/esm/onchain/market/adapters/types.js +3 -0
  66. package/dist/esm/permissionless/api/index.js +7 -1
  67. package/dist/esm/permissionless/api/oracles/PermissionlessOracles.js +587 -49
  68. package/dist/esm/permissionless/api/oracles/enrich.js +94 -0
  69. package/dist/esm/permissionless/api/oracles/index.js +10 -1
  70. package/dist/esm/permissionless/api/oracles/schemas.js +95 -35
  71. package/dist/esm/permissionless/api/oracles/score/formula.js +96 -0
  72. package/dist/esm/permissionless/api/oracles/score/index.js +4 -0
  73. package/dist/esm/permissionless/api/oracles/score/run.js +87 -0
  74. package/dist/esm/permissionless/api/oracles/score/types.js +1 -0
  75. package/dist/esm/permissionless/api/oracles/stress/classify.js +256 -0
  76. package/dist/esm/permissionless/api/oracles/stress/index.js +6 -0
  77. package/dist/esm/permissionless/api/oracles/stress/override.js +119 -0
  78. package/dist/esm/permissionless/api/oracles/stress/run.js +427 -0
  79. package/dist/esm/permissionless/api/oracles/stress/score.js +95 -0
  80. package/dist/esm/permissionless/api/oracles/stress/types.js +1 -0
  81. package/dist/esm/permissionless/api/schemas.js +2 -4
  82. package/dist/esm/permissionless/bindings/index.js +1 -1
  83. package/dist/esm/permissionless/index.js +9 -3
  84. package/dist/esm/permissionless/utils/index.js +2 -2
  85. package/dist/esm/permissionless/utils/price-update/get-prices.js +63 -1
  86. package/dist/esm/permissionless/utils/price-update/index.js +2 -2
  87. package/dist/esm/testnets/TestnetsAPI.js +178 -0
  88. package/dist/esm/testnets/errors/TestnetNotFoundError.js +14 -0
  89. package/dist/esm/testnets/errors/TestnetRequestFailedError.js +23 -0
  90. package/dist/esm/testnets/errors/TestnetStatusError.js +18 -0
  91. package/dist/esm/testnets/errors/TestnetValidationError.js +23 -0
  92. package/dist/esm/testnets/errors/TestnetWaitTimeoutError.js +29 -0
  93. package/dist/esm/testnets/errors/TestnetsError.js +33 -0
  94. package/dist/esm/testnets/errors/index.js +7 -0
  95. package/dist/esm/testnets/index.js +11 -0
  96. package/dist/esm/testnets/package.json +1 -0
  97. package/dist/esm/testnets/schemas.js +228 -0
  98. package/dist/esm/testnets/types.js +1 -0
  99. package/dist/types/abi/compressors/subcompressors/liquidation/treehouseLiquidationSubcompressor.d.ts +148 -0
  100. package/dist/types/abi/compressors/subcompressors/withdrawal/treehouseWithdrawalSubcompressor.d.ts +440 -0
  101. package/dist/types/abi/router/treehouseWorker.d.ts +728 -0
  102. package/dist/types/onchain/market/adapters/types.d.ts +4 -1
  103. package/dist/types/permissionless/api/index.d.ts +10 -2
  104. package/dist/types/permissionless/api/oracles/PermissionlessOracles.d.ts +232 -35
  105. package/dist/types/permissionless/api/oracles/enrich.d.ts +59 -0
  106. package/dist/types/permissionless/api/oracles/index.d.ts +12 -2
  107. package/dist/types/permissionless/api/oracles/schemas.d.ts +209 -22
  108. package/dist/types/permissionless/api/oracles/score/formula.d.ts +46 -0
  109. package/dist/types/permissionless/api/oracles/score/index.d.ts +4 -0
  110. package/dist/types/permissionless/api/oracles/score/run.d.ts +21 -0
  111. package/dist/types/permissionless/api/oracles/score/types.d.ts +85 -0
  112. package/dist/types/permissionless/api/oracles/stress/classify.d.ts +57 -0
  113. package/dist/types/permissionless/api/oracles/stress/index.d.ts +6 -0
  114. package/dist/types/permissionless/api/oracles/stress/override.d.ts +59 -0
  115. package/dist/types/permissionless/api/oracles/stress/run.d.ts +73 -0
  116. package/dist/types/permissionless/api/oracles/stress/score.d.ts +57 -0
  117. package/dist/types/permissionless/api/oracles/stress/types.d.ts +272 -0
  118. package/dist/types/permissionless/api/oracles/types.d.ts +408 -63
  119. package/dist/types/permissionless/api/schemas.d.ts +0 -2
  120. package/dist/types/permissionless/index.d.ts +11 -3
  121. package/dist/types/permissionless/utils/index.d.ts +2 -2
  122. package/dist/types/permissionless/utils/price-update/get-prices.d.ts +33 -0
  123. package/dist/types/permissionless/utils/price-update/index.d.ts +2 -2
  124. package/dist/types/testnets/TestnetsAPI.d.ts +108 -0
  125. package/dist/types/testnets/errors/TestnetNotFoundError.d.ts +12 -0
  126. package/dist/types/testnets/errors/TestnetRequestFailedError.d.ts +11 -0
  127. package/dist/types/testnets/errors/TestnetStatusError.d.ts +15 -0
  128. package/dist/types/testnets/errors/TestnetValidationError.d.ts +16 -0
  129. package/dist/types/testnets/errors/TestnetWaitTimeoutError.d.ts +21 -0
  130. package/dist/types/testnets/errors/TestnetsError.d.ts +47 -0
  131. package/dist/types/testnets/errors/index.d.ts +7 -0
  132. package/dist/types/testnets/index.d.ts +11 -0
  133. package/dist/types/testnets/schemas.d.ts +554 -0
  134. package/dist/types/testnets/types.d.ts +717 -0
  135. package/package.json +9 -3
@@ -1,62 +1,53 @@
1
+ import { AssetType } from "../../../model/primitives.js";
2
+ import { PermissionlessChain } from "../chains/types.js";
1
3
  import { PriceFeed } from "../../core/pricefeed.js";
2
4
  import "../../core/index.js";
3
5
  import { Address } from "viem";
4
6
  //#region src/permissionless/api/oracles/types.d.ts
5
7
  /**
6
- * One asset of a chain, with the feeds allowed for it. The backend indexes
7
- * the chain, so every feed listed here is one the PriceFeedStore carries and
8
- * allows for the asset.
8
+ * What identifies an asset, which is all a feed's own listing of one says.
9
+ *
10
+ * Used on its own where the asset hangs off something else — a feed's assets,
11
+ * say, where listing the feeds allowed for each would only name the feed back.
9
12
  **/
10
- export interface PermissionlessAsset {
13
+ export interface PermissionlessPriceFeedAsset {
11
14
  address: Address;
12
15
  symbol: string;
13
16
  name: string;
14
17
  decimals: number;
18
+ }
19
+ /**
20
+ * One asset of a chain, with the feeds allowed for it. The backend indexes
21
+ * the chain, so every feed listed here is one the PriceFeedStore carries and
22
+ * allows for the asset.
23
+ **/
24
+ export interface PermissionlessAsset extends PermissionlessPriceFeedAsset {
15
25
  owner: Address;
16
26
  priceFeeds: PriceFeed[];
17
27
  }
18
28
  /**
19
29
  * The PriceFeedStore of one chain as the backend has indexed it: the assets
20
30
  * it prices, the feeds it carries, and which feed is allowed on which asset.
31
+ *
32
+ * A store is a chain's, so it is described by the same fields the chain list
33
+ * answers with, plus what it holds.
21
34
  **/
22
- export interface PermissionlessPriceFeedStore {
23
- chainId: number;
24
- name: string;
25
- isPublic: boolean;
26
- isActivated: boolean;
27
- explorerUrl: string;
35
+ export interface PermissionlessPriceFeedStore extends PermissionlessChain {
28
36
  assets: PermissionlessAsset[];
29
37
  priceFeeds: PriceFeed[];
30
38
  }
31
39
  /**
32
- * A price per feed, and a market cap per feed and the asset it prices.
33
- * `null` is a price the backend could not read, not a zero.
34
- **/
35
- export interface PermissionlessPrices {
36
- prices: Record<Address, string | null>;
37
- marketCaps: Record<Address, Record<Address, string | null>>;
38
- time: number;
39
- }
40
- /**
41
- * An asset the PriceFeedStore currently allows one feed to price.
40
+ * What names a market, whichever side it is being listed from.
42
41
  *
43
- * Narrower than {@link PermissionlessAsset} on purpose: this hangs off the
44
- * feed, so listing the feeds allowed for it would just name the feed back.
45
- **/
46
- export interface PermissionlessPriceFeedAsset {
47
- address: Address;
48
- symbol: string;
49
- name: string;
50
- decimals: number;
51
- }
52
- /**
53
- * One token a market prices with the feed.
42
+ * A feed's markets and an asset's markets are different reads, but what they
43
+ * say about the market is the same: who curates it, what it is denominated in
44
+ * and how much of its quota is taken. Only the thing the row is about differs,
45
+ * which is what each of the two below adds.
54
46
  *
55
- * A row per `(market, token, role)` rather than per market: the same feed can
56
- * be the main feed of one token and the reserve feed of another in the very
57
- * same market, and both are reported.
47
+ * "This token" throughout means whatever the extending row is about — the
48
+ * token the feed prices, or the asset the market holds as collateral.
58
49
  **/
59
- export interface PermissionlessPriceFeedMarket {
50
+ export interface PermissionlessMarket {
60
51
  market: Address;
61
52
  marketConfigurator: Address;
62
53
  /** The configurator's own name, as the backend's sync recorded it. */
@@ -66,17 +57,12 @@ export interface PermissionlessPriceFeedMarket {
66
57
  * of the backend calls a market by as well.
67
58
  */
68
59
  marketName: string | null;
69
- token: Address;
70
- /** `null` for a token the backend has no metadata row for. */
71
- tokenSymbol: string | null;
72
60
  /**
73
61
  * Symbol of the market's underlying, which is both what the market is
74
- * pictured by and what its quota limit is denominated in.
62
+ * pictured by and what its quota figures are denominated in.
75
63
  */
76
64
  underlyingSymbol: string | null;
77
- /** The feed is the market's reserve feed for this token, not its main one. */
78
- reserve: boolean;
79
- /** The token is the market's underlying. */
65
+ /** This token is the market's own underlying, so it is not quota-managed. */
80
66
  isUnderlying: boolean;
81
67
  /**
82
68
  * What the pool will take of this token, in units of the market's
@@ -88,6 +74,98 @@ export interface PermissionlessPriceFeedMarket {
88
74
  * answers.
89
75
  */
90
76
  quotaLimit: number | null;
77
+ /**
78
+ * How much of {@link quotaLimit} the market's borrowers have actually taken,
79
+ * in the same units.
80
+ *
81
+ * The sum of every open credit account's current quota for this token across
82
+ * the credit managers borrowing from the market, so it is what the token is
83
+ * backing right now rather than what it is allowed to back.
84
+ *
85
+ * `null` only where {@link quotaLimit} is: a token nobody quotes reads as a
86
+ * zero against a limit, which is a different answer from a token the keeper
87
+ * holds no entry for at all.
88
+ */
89
+ quotaUsed: number | null;
90
+ }
91
+ /**
92
+ * One token a market prices with the feed.
93
+ *
94
+ * A row per `(market, token, role)` rather than per market: the same feed can
95
+ * be the main feed of one token and the reserve feed of another in the very
96
+ * same market, and both are reported.
97
+ **/
98
+ export interface PermissionlessIndexedPriceFeedMarket extends PermissionlessMarket {
99
+ token: Address;
100
+ /** `null` for a token the backend has no metadata row for. */
101
+ tokenSymbol: string | null;
102
+ /** The feed is the market's reserve feed for this token, not its main one. */
103
+ reserve: boolean;
104
+ /**
105
+ * The price oracle holding the slot, which is what the period is read from.
106
+ *
107
+ * The oracle and not the market: a market that has switched oracles has
108
+ * rows under each, and the period lives on whichever one holds the slot now.
109
+ */
110
+ priceOracle: Address;
111
+ }
112
+ /**
113
+ * The same slot with the period its oracle holds for it.
114
+ *
115
+ * Read off the chain rather than served, because it is not indexed: a
116
+ * curator sets one per slot in their price oracle, and nothing obliges it to
117
+ * agree with the period the PriceFeedStore carries for the feed. A reader
118
+ * comparing the two is comparing two contracts, which is why both are
119
+ * reported.
120
+ **/
121
+ export interface PermissionlessPriceFeedMarket extends PermissionlessIndexedPriceFeedMarket {
122
+ /**
123
+ * Staleness period this market's own price oracle holds for the slot, in
124
+ * seconds.
125
+ *
126
+ * `null` means the oracle would not answer, or that it names another feed
127
+ * for the slot — in which case the slot has moved on since it was indexed
128
+ * and the period it holds is not this feed's to report.
129
+ */
130
+ marketStalenessPeriod: number | null;
131
+ }
132
+ /**
133
+ * One `(market, token, role)` slot of a chain, with the feed holding it.
134
+ *
135
+ * The same row {@link PermissionlessIndexedPriceFeedMarket} is, read from the
136
+ * chain's end rather than from one feed's: the feed is a column here because
137
+ * it is no longer what was asked for, and the chain is named because the read
138
+ * spans several.
139
+ *
140
+ * Unpivoted — a token's main and reserve feeds are two rows. What reads them
141
+ * this way is analysis over every slot at once, where the two roles of a
142
+ * token are the pair being compared and folding them together would hide it.
143
+ **/
144
+ export interface PermissionlessMarketSlot extends PermissionlessIndexedPriceFeedMarket {
145
+ chainId: number;
146
+ /** The market's underlying, which its quota figures are denominated in. */
147
+ underlyingToken: Address;
148
+ /**
149
+ * The market has been shut down: no new borrowing, but its open accounts
150
+ * are quoting all the same.
151
+ */
152
+ isShutdown: boolean;
153
+ /** The feed in force for the slot. */
154
+ priceFeed: Address;
155
+ /** Display name the store recorded, or `null` for a feed it never had. */
156
+ priceFeedName: string | null;
157
+ /**
158
+ * Whether the PriceFeedStore still carries that feed.
159
+ *
160
+ * `false` is the case worth looking at: the market goes on pricing with
161
+ * something the store has removed, or never had.
162
+ */
163
+ priceFeedInStore: boolean;
164
+ /**
165
+ * The feed the market prices its own underlying with, which is what
166
+ * converts this row's quota figures. `null` for a market that has none.
167
+ */
168
+ underlyingPriceFeed: Address | null;
91
169
  }
92
170
  /**
93
171
  * One feed of the store, with everywhere the store lets it be used.
@@ -96,7 +174,7 @@ export interface PermissionlessPriceFeedMarket {
96
174
  * no status history, hence no name or staleness — so the read throws for them
97
175
  * rather than answering a half-filled row.
98
176
  **/
99
- export interface PermissionlessPriceFeedDetails {
177
+ export interface PermissionlessIndexedPriceFeedDetails {
100
178
  chainId: number;
101
179
  priceFeed: PriceFeed;
102
180
  assets: PermissionlessPriceFeedAsset[];
@@ -105,38 +183,305 @@ export interface PermissionlessPriceFeedDetails {
105
183
  * ahead of the reserve ones — the grouping a reader wants, so a caller
106
184
  * rendering a table does not have to sort it again.
107
185
  */
186
+ markets: PermissionlessIndexedPriceFeedMarket[];
187
+ }
188
+ /**
189
+ * The same feed with each slot's staleness period read off its oracle.
190
+ **/
191
+ export interface PermissionlessPriceFeedDetails extends PermissionlessIndexedPriceFeedDetails {
108
192
  markets: PermissionlessPriceFeedMarket[];
109
193
  }
110
194
  /**
111
- * Market caps of one feed's assets, keyed by the lowercased asset address.
195
+ * One feed as a market slot holds it.
112
196
  *
113
- * Scoped to the feed rather than to the chain, which is what
114
- * {@link PermissionlessOracles.prices} answers. A cap is
115
- * `price × totalSupply`, so the chain-wide read pays for one `totalSupply` per
116
- * asset of every market on it; a screen showing one feed's handful of rows
117
- * should not.
197
+ * The store's view of the feed and not the feed itself: a market keeps
198
+ * pricing with whatever it was last pointed at, and nothing removes it from a
199
+ * market when the store drops it. {@link inStore} is what tells those apart,
200
+ * and the name survives either way because the store recorded it before.
201
+ **/
202
+ export interface PermissionlessAssetMarketFeed {
203
+ address: Address;
204
+ /**
205
+ * Display name the store recorded, or `null` for a feed it never carried —
206
+ * an aggregator a curator pointed a market straight at, say.
207
+ */
208
+ name: string | null;
209
+ /**
210
+ * Whether the PriceFeedStore still carries the feed.
211
+ *
212
+ * `false` is the case worth showing: the market goes on pricing the asset
213
+ * with a feed the store has removed, or never had. Nothing on chain forbids
214
+ * that, which is exactly why it has to be visible.
215
+ */
216
+ inStore: boolean;
217
+ }
218
+ /**
219
+ * One market that prices an asset, with both of the slots it may fill.
118
220
  *
119
- * `null` for an asset whose price or supply could not be read — not a zero,
221
+ * A row per market rather than per `(market, role)`: the two roles are two
222
+ * columns of the same market's row, and the quota is the market's whatever
223
+ * feed holds which slot.
224
+ **/
225
+ export interface PermissionlessAssetMarket extends PermissionlessMarket {
226
+ /** The market's underlying, which its quota figures are denominated in. */
227
+ underlyingToken: Address;
228
+ /**
229
+ * The feed the market prices its own underlying with, which is what converts
230
+ * this row's quota figures. `null` for a market that has no main feed for
231
+ * its underlying, whose figures therefore cannot be converted at all.
232
+ */
233
+ underlyingPriceFeed: Address | null;
234
+ /**
235
+ * The market has been shut down.
236
+ *
237
+ * Still reported, and still counted in {@link
238
+ * PermissionlessQuotaTotals.quotaUsedUsd}: a shut down market carries no
239
+ * new borrowing but its open accounts are quoting all the same.
240
+ */
241
+ isShutdown: boolean;
242
+ /** The feed the market prices the asset with, or `null` if it has none. */
243
+ mainFeed: PermissionlessAssetMarketFeed | null;
244
+ /** The feed the market falls back to, or `null` if it has none. */
245
+ reserveFeed: PermissionlessAssetMarketFeed | null;
246
+ }
247
+ /**
248
+ * One asset of the store: what prices it, and what it is used as collateral
249
+ * for.
250
+ *
251
+ * The counterpart of {@link PermissionlessPriceFeedDetails} — the same corner
252
+ * of the chain read from the asset's end instead of the feed's.
253
+ **/
254
+ export interface PermissionlessIndexedAssetDetails {
255
+ chainId: number;
256
+ asset: PermissionlessPriceFeedAsset;
257
+ /**
258
+ * Feeds the store currently allows for the asset.
259
+ *
260
+ * Only the store's. A feed a market still prices the asset with but the
261
+ * store has dropped is not here — it is on its market's row, flagged.
262
+ */
263
+ priceFeeds: PriceFeed[];
264
+ /** Ordered by curator, then by market. */
265
+ markets: PermissionlessAssetMarket[];
266
+ }
267
+ /**
268
+ * The same asset with its quotas totalled, which is what a reader gets.
269
+ *
270
+ * The totals are over the very rows {@link markets} reports, converted at the
271
+ * price each market's own oracle holds for its underlying, so the header and
272
+ * the table under it cannot disagree.
273
+ **/
274
+ export interface PermissionlessAssetDetails extends PermissionlessIndexedAssetDetails, PermissionlessQuotaTotals {}
275
+ /**
276
+ * One asset of the PriceFeedStore, with what its markets make of it.
277
+ *
278
+ * Everything a list of assets renders and nothing else: the store's own read
279
+ * carries each asset's feeds too, which is several times this payload and not
280
+ * what a reader scanning for the big positions is looking at.
281
+ *
282
+ * The quota rows are the ones {@link PermissionlessAssetDetails} heads an
283
+ * asset's own page with, off the same query, so the list and the page a row of
284
+ * it opens are totalling the very same figures.
285
+ *
286
+ * What a reader gets is {@link PermissionlessAssetSummary}, this plus what the
287
+ * SDK makes of the asset.
288
+ **/
289
+ export interface PermissionlessIndexedAssetSummary {
290
+ chainId: number;
291
+ /** Lowercased, as everything addressed in these payloads is. */
292
+ address: Address;
293
+ symbol: string;
294
+ /**
295
+ * How many markets still running are underlain by this asset.
296
+ *
297
+ * What makes an asset central rather than merely listed: a token several
298
+ * markets borrow against is the one a reader opens the list for. Shut down
299
+ * markets are left out for the reason their limits are — they are no longer
300
+ * a place anything happens.
301
+ */
302
+ underlyingMarketCount: number;
303
+ /**
304
+ * What each market holding the asset has committed to it, unconverted.
305
+ *
306
+ * One entry per market, in that market's own underlying — see
307
+ * {@link PermissionlessAssetQuota}. Totalling them is
308
+ * {@link PermissionlessAssetSummary}'s two USD figures, which is why they
309
+ * are carried rather than summed: the sum needs a price, and a price needs
310
+ * the chain.
311
+ */
312
+ marketQuotas: PermissionlessAssetQuota[];
313
+ }
314
+ /**
315
+ * One market's commitment to an asset, in that market's own underlying.
316
+ *
317
+ * Unconverted on purpose: a limit is denominated in its market's underlying,
318
+ * and an asset is routinely collateral in markets underlain by different
319
+ * tokens — WETH is collateral in USDC, WETH and wstETH markets at once on
320
+ * mainnet — so the figures are not comparable until each is priced. The feed
321
+ * that prices the underlying is named here so that whoever totals them knows
322
+ * what to ask the chain.
323
+ **/
324
+ export interface PermissionlessAssetQuota {
325
+ /**
326
+ * What the pool will take of the asset, in units of the market's underlying.
327
+ *
328
+ * `null` for a token the quota keeper was never told a limit for, which the
329
+ * market's own underlying always is — it is not quota-managed. A zero is a
330
+ * limit the curator has actually set to zero, and the two are different
331
+ * answers.
332
+ */
333
+ quotaLimit: number | null;
334
+ /** How much of that limit is taken, in the same units. */
335
+ quotaUsed: number | null;
336
+ /** The market has been shut down, so its limit is no longer borrowable. */
337
+ isShutdown: boolean;
338
+ /**
339
+ * The feed the market prices its own underlying with.
340
+ *
341
+ * `null` for a market with no main feed for its underlying, whose figures
342
+ * therefore cannot be converted at all.
343
+ */
344
+ underlyingPriceFeed: Address | null;
345
+ }
346
+ /**
347
+ * Totals of {@link PermissionlessAssetQuota}, converted to USD.
348
+ *
349
+ * Limits count only the markets still running, because a shut down market's
350
+ * limit is not borrowable; what is already quoted counts everywhere, because
351
+ * debt outstanding is exposure either way. A market whose underlying could not
352
+ * be priced is skipped, which makes both figures floors, and `null` is nothing
353
+ * to total rather than a zero.
354
+ **/
355
+ export interface PermissionlessQuotaTotals {
356
+ /** Total quota limit across the markets still running, in USD. */
357
+ quotaLimitUsd: number | null;
358
+ /** Total quota actually taken across every market, in USD. */
359
+ quotaUsedUsd: number | null;
360
+ }
361
+ /**
362
+ * The same asset with what this SDK makes of it.
363
+ *
364
+ * Two things the backend does not answer for. What the asset is comes off this
365
+ * package's curated tables, because a backend consulting them could only
366
+ * answer from whichever version it was built against — a reader on a newer SDK
367
+ * than the deployment it talks to still classifies by the newer tables. The
368
+ * quota totals come off the chain, because converting a market's own
369
+ * denomination needs a price and the chain is where prices are.
370
+ **/
371
+ export interface PermissionlessAssetSummary extends PermissionlessIndexedAssetSummary, PermissionlessQuotaTotals {
372
+ /**
373
+ * What the asset is, where the tables say so.
374
+ *
375
+ * `null` for anything they do not name, which is most of a store: they
376
+ * classify the tokens markets are built on, and a store carries everything
377
+ * those markets will take as collateral. A filter over this sorts the
378
+ * assets worth sorting and leaves the rest in one heap, which is the honest
379
+ * answer rather than a guess from the symbol.
380
+ */
381
+ assetType: AssetType | null;
382
+ /**
383
+ * Whether the asset stands for something outside the chain.
384
+ *
385
+ * A flag rather than a value of {@link assetType}, because the two answer
386
+ * different questions and an asset can be both: a tokenised treasury is a
387
+ * real-world asset and may still be the stable a market is built on. Unlike
388
+ * {@link assetType} there is no third state — the curated list naming it is
389
+ * the whole of what makes an asset one, so not being on it is a real `false`
390
+ * rather than something unknown.
391
+ */
392
+ isRwa: boolean;
393
+ }
394
+ /**
395
+ * One feed of a chain, named so it can be read alongside another chain's.
396
+ *
397
+ * An address alone does not identify a feed: the same aggregator is deployed
398
+ * to several chains, and reading it on the wrong one answers the wrong price.
399
+ **/
400
+ export interface PriceFeedRef {
401
+ chainId: number;
402
+ address: Address;
403
+ }
404
+ /**
405
+ * The price one feed reports, as {@link PermissionlessOracles.getPrices}
406
+ * answers.
407
+ *
408
+ * `price` is `null` for a feed whose read reverted, which is not a zero, and
409
+ * is in the 8 decimals every Gearbox feed reports.
410
+ **/
411
+ export interface PriceFeedPrice extends PriceFeedRef {
412
+ price: bigint | null;
413
+ }
414
+ /**
415
+ * How many decimals a feed's answer carries, as
416
+ * {@link PermissionlessOracles.getDecimals} answers.
417
+ *
418
+ * Its own call rather than a field of {@link PriceFeedPrice}, because the two
419
+ * are not read on the same schedule: a price is the figure that moves and is
420
+ * re-read for it, while a deployed feed's decimals never change, so a caller
421
+ * reads these once and keeps them.
422
+ *
423
+ * Needed wherever the feeds are not only the ones a market reads. Every
424
+ * Gearbox feed an oracle holds reports 8, which is why most of this namespace
425
+ * can assume it — but a composite's own dependencies are whatever the
426
+ * aggregator underneath happens to be, and a rate leg of one is routinely 18.
427
+ *
428
+ * `null` is a feed that would not answer `decimals()` at all, which a caller
429
+ * showing the figure should treat as unknown rather than as 8.
430
+ **/
431
+ export interface PriceFeedDecimals extends PriceFeedRef {
432
+ decimals: number | null;
433
+ }
434
+ /**
435
+ * One asset with the feeds to value it through.
436
+ *
437
+ * The asset's side of {@link PermissionlessOracles.getMarketCap} — the shape a
438
+ * screen showing one asset's feeds asks with.
439
+ **/
440
+ export interface AssetCap {
441
+ chainId: number;
442
+ asset: Address;
443
+ priceFeeds: Address[];
444
+ }
445
+ /**
446
+ * One feed with the assets to value through it.
447
+ *
448
+ * The feed's side of the same call. Both exist because a screen shows one row
449
+ * per feed or one row per asset, never the full cross product.
450
+ **/
451
+ export interface FeedCap {
452
+ chainId: number;
453
+ priceFeed: Address;
454
+ assets: Address[];
455
+ }
456
+ /**
457
+ * What one feed values one asset's supply at, in USD.
458
+ *
459
+ * `price × totalSupply`, as a decimal string: the product of an 8-decimal
460
+ * price and a supply in the asset's own decimals does not fit a JS number
461
+ * without losing the small end of it.
462
+ *
463
+ * `null` for a pair whose price or supply could not be read — not a zero,
120
464
  * since an asset nobody could price is not an asset worth nothing.
121
- */
122
- export interface PermissionlessPriceFeedMarketCaps {
123
- marketCaps: Record<Address, string | null>;
124
- /** When the backend computed the figures; they are read live, not indexed. */
125
- time: number;
465
+ **/
466
+ export interface MarketCap {
467
+ chainId: number;
468
+ priceFeed: Address;
469
+ asset: Address;
470
+ cap: string | null;
126
471
  }
127
472
  /** Args of a read scoped to one feed. */
128
473
  export interface PriceFeedArgs {
129
474
  chainId: number;
130
475
  address: Address;
131
476
  }
132
- /** Args of {@link PermissionlessOracles.getPrices}. */
133
- export interface GetPricesArgs {
477
+ /** Args of a read scoped to one asset. */
478
+ export interface AssetArgs {
134
479
  chainId: number;
135
- /**
136
- * The feeds to price. Any address answering `latestRoundData` works — the
137
- * store does not have to carry it, which is the point of reading the chain
138
- * rather than asking the backend.
139
- **/
140
- priceFeeds: Address[];
480
+ address: Address;
481
+ }
482
+ /** Args of {@link PermissionlessOracles.assets}. */
483
+ export interface AssetsArgs {
484
+ /** Omit for every chain the backend serves. */
485
+ chainId?: number;
141
486
  }
142
487
  //#endregion
@@ -11,8 +11,6 @@ import { z } from "zod/v4";
11
11
  **/
12
12
  /** An address, in whatever case the backend serves it. */
13
13
  export declare const addressSchema: z.ZodCustom<`0x${string}`, `0x${string}`>;
14
- /** A `0x`-prefixed hex string, as viem's `Hex`. */
15
- export declare const hexSchema: z.ZodCustom<`0x${string}`, `0x${string}`>;
16
14
  /**
17
15
  * A record keyed by address. Spelled out here because zod types a record key
18
16
  * by the schema's output, which the branded `Address` is not inferred as.
@@ -13,7 +13,9 @@ import "./core/index.js";
13
13
  import { FunctionParams, ValueParams, encodeFunctionParams } from "./utils/abi-encoder.js";
14
14
  import { DeployArgs, DeployContractArgs, DeployPriceFeedArgs, PreparedDeployment, PreparedPriceFeedDeployment } from "./api/deploy/types.js";
15
15
  import { DEFAULT_DEPLOY_SALT, PermissionlessDeploy, priceFeedSalt } from "./api/deploy/PermissionlessDeploy.js";
16
- import { GetPricesArgs, PermissionlessAsset, PermissionlessPriceFeedAsset, PermissionlessPriceFeedDetails, PermissionlessPriceFeedMarket, PermissionlessPriceFeedMarketCaps, PermissionlessPriceFeedStore, PermissionlessPrices, PriceFeedArgs } from "./api/oracles/types.js";
16
+ import { AssetScore, AssetScoresArgs, MarketScore, ScoredFeed } from "./api/oracles/score/types.js";
17
+ import { BreakingPoint, FeedOutcome, GroupReport, GroupScenarioOutcome, SlotOutcome, StressReport, StressScenario, StressSource, StressSourceKind, StressTestArgs } from "./api/oracles/stress/types.js";
18
+ import { AssetArgs, AssetCap, AssetsArgs, FeedCap, MarketCap, PermissionlessAsset, PermissionlessAssetDetails, PermissionlessAssetMarket, PermissionlessAssetMarketFeed, PermissionlessAssetQuota, PermissionlessAssetSummary, PermissionlessIndexedAssetDetails, PermissionlessIndexedAssetSummary, PermissionlessIndexedPriceFeedDetails, PermissionlessIndexedPriceFeedMarket, PermissionlessMarket, PermissionlessMarketSlot, PermissionlessPriceFeedAsset, PermissionlessPriceFeedDetails, PermissionlessPriceFeedMarket, PermissionlessPriceFeedStore, PermissionlessQuotaTotals, PriceFeedArgs, PriceFeedDecimals, PriceFeedPrice, PriceFeedRef } from "./api/oracles/types.js";
17
19
  import { GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, PermissionlessOracles } from "./api/oracles/PermissionlessOracles.js";
18
20
  import { AddressProviderContract } from "./bindings/address-provider.js";
19
21
  import { BytecodeRepositoryContract } from "./bindings/bytecode-repository.js";
@@ -38,6 +40,12 @@ import { InstanceOwnerTransactions } from "./api/transactions/InstanceOwnerTrans
38
40
  import { GearboxPermissionless } from "./api/GearboxPermissionless.js";
39
41
  import { deriveEffectiveStalenessPeriod } from "./api/deploy/effective-staleness.js";
40
42
  import { PermissionlessChainUnreachableError, PermissionlessNotAttachedError, PriceFeedNotInStoreError, PriceFeedSaltMissingError, PriceFeedStalenessUnknownError } from "./api/errors.js";
43
+ import { BOUND_WEIGHT, INDEPENDENCE_WEIGHT, ScoreSource, scoreMarket } from "./api/oracles/score/formula.js";
44
+ import { runAssetScores } from "./api/oracles/score/run.js";
45
+ import { TreeNode, classifySources, sourcesByFeed } from "./api/oracles/stress/classify.js";
46
+ import { UNBOUNDED_DOWN, UNBOUNDED_UP, groupOverride, perturb, rateStub, roundDataStub } from "./api/oracles/stress/override.js";
47
+ import { DEFAULT_SCENARIOS, RATE_FEED_TYPE, readForest, readRateTargets, runStressTest } from "./api/oracles/stress/run.js";
48
+ import { scoreGroup, slotHarm, verdictOf } from "./api/oracles/stress/score.js";
41
49
  import "./api/index.js";
42
50
  import { ArchiveTransport, ArchiveTransportConfig } from "./chains/archive-transport.js";
43
51
  import { chunkedLogsTransport } from "./chains/chunked-log-transport.js";
@@ -50,8 +58,8 @@ import { calculateChecksum, convertRawTxToSafeMultisigTx, getSafeBatch, getSafeB
50
58
  import { convertQueueBatchToExecuteTx } from "./utils/governance/timelock-txs.js";
51
59
  import { BYTECODE_REPOSITORY, CROSS_CHAIN_GOVERNANCE, CROSS_CHAIN_MULTISIG, INSTANCE_MANAGER, MARKET_CONFIGURATOR_FACTORY, PRICE_FEED_STORE, TOKEN_COMPRESSOR } from "./utils/literals.js";
52
60
  import { getPriceUpdateTx } from "./utils/price-update/get-price-update-tx.js";
53
- import { getPrices } from "./utils/price-update/get-prices.js";
61
+ import { getFeedDecimals, getLatestPrices, getPrices } from "./utils/price-update/get-prices.js";
54
62
  import { GetUpdatablePriceFeedsArgs, getUpdatablePriceFeeds } from "./utils/price-update/get-updatable-feeds.js";
55
63
  import { normalizeSignature } from "./utils/signature.js";
56
64
  import "./utils/index.js";
57
- export { AccessMode, AddAssetParams, AddFeedsArgs, AddressProviderContract, Addresses, AllowTokenParams, ArchiveTransport, ArchiveTransportConfig, AttachChainsArgs, AuditEvent, Auditor, BYTECODE_REPOSITORY, Batch, Bytecode, BytecodeRepositoryContract, CCMConstructorParams, CROSS_CHAIN_GOVERNANCE, CROSS_CHAIN_MULTISIG, ChainScope, ChainSummaryArgs, ChainsNamespace, ChangeNamesArgs, ChangeStalenessPeriodsArgs, ConstructorParams, CreditManagerFees, CrossChainCall, CrossChainMultisigContract, DEFAULT_DEPLOY_SALT, DeployArgs, DeployContractArgs, DeployParams, DeployPriceFeedArgs, Deployment, DeploymentExtended, ForbidAdapterParams, ForbidFeedsArgs, ForbidTokenParams, FunctionParams, GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, GearboxPermissionless, GearboxPermissionlessOptions, GetPricesArgs, GetUpdatablePriceFeedsArgs, GovernorContract, INSTANCE_MANAGER, InputValueParams, InstanceManagerContract, InstanceOwnerTransactions, InstanceTxs, InstanceTxsArgs, MAINNET_CCM_CONSTRUCTOR_PARAMS, MAINNET_DEPLOYMENT_BLOCK, MAINNET_DEPLOYMENT_CCM_SALT, MAINNET_DEPLOYMENT_IM_SALT, MARKET_CONFIGURATOR_FACTORY, Market, MarketConfiguratorContract, MarketConfiguratorFactoryContract, PRICE_FEED_STORE, PUBLIC_CREATE2_FACTORY, PauseCreditManagerParams, PeripheryDomain, PermissionlessAnalytics, PermissionlessAsset, PermissionlessChain, PermissionlessChainSummary, PermissionlessChainUnreachableError, PermissionlessDeploy, PermissionlessNotAttachedError, PermissionlessOracles, PermissionlessPriceFeedAsset, PermissionlessPriceFeedDetails, PermissionlessPriceFeedMarket, PermissionlessPriceFeedMarketCaps, PermissionlessPriceFeedStore, PermissionlessPrices, PreparedDeployment, PreparedPriceFeedDeployment, PriceChartArgs, PriceFeed, PriceFeedArgs, PriceFeedChartPoint, PriceFeedConstructorParam, PriceFeedNotInStoreError, PriceFeedPair, PriceFeedParamType, PriceFeedParams, PriceFeedPriceChart, PriceFeedSaltMissingError, PriceFeedSetupParams, PriceFeedStalenessUnknownError, PriceFeedStoreContract, Proposal, QueuedAndExecutedTransaction, RecoveryMessage, RoutingManagerContract, SafeBatch, SafeMeta, SafeTx, SetExpirationDateParams, SetFeesParams, SetPriceFeedParams, SetReservePriceFeedParams, SetTokenQuotaIncreaseFeeParams, Signature, TOKEN_COMPRESSOR, TimeLockContract, TimelockTransaction, TimelockTxParams, TimelockTxs, TokenCompressorContract, TreasurySplitterContract, UnpauseCreditManagerParams, ValueParams, WithdrawalCompressorContract, calculateChecksum, checkCreate2Deployment, checkCreate2DeploymentAddress, chunkedLogsTransport, convertPercent, convertQueueBatchToExecuteTx, convertRawTxToSafeMultisigTx, createCallData, createCreate2DeployRawTx, deepJsonParse, deployUsingPublicCreate2, deriveEffectiveStalenessPeriod, encodeFunctionParams, formatBytecodeSize, formatBytecodeVersion, getBlockNumberByTimestamp, getCreate2AddressPublicFactory, getCreate2DeploymentAddress, getPriceUpdateTx, getPrices, getSafeBatch, getSafeBatches, getUpdatablePriceFeeds, handleSalt, normalizeSignature, priceFeedSalt, priceFeedSetupParams, shortenHash, significantTrunc };
65
+ export { AccessMode, AddAssetParams, AddFeedsArgs, AddressProviderContract, Addresses, AllowTokenParams, ArchiveTransport, ArchiveTransportConfig, AssetArgs, AssetCap, AssetScore, AssetScoresArgs, AssetsArgs, AttachChainsArgs, AuditEvent, Auditor, BOUND_WEIGHT, BYTECODE_REPOSITORY, Batch, BreakingPoint, Bytecode, BytecodeRepositoryContract, CCMConstructorParams, CROSS_CHAIN_GOVERNANCE, CROSS_CHAIN_MULTISIG, ChainScope, ChainSummaryArgs, ChainsNamespace, ChangeNamesArgs, ChangeStalenessPeriodsArgs, ConstructorParams, CreditManagerFees, CrossChainCall, CrossChainMultisigContract, DEFAULT_DEPLOY_SALT, DEFAULT_SCENARIOS, DeployArgs, DeployContractArgs, DeployParams, DeployPriceFeedArgs, Deployment, DeploymentExtended, FeedCap, FeedOutcome, ForbidAdapterParams, ForbidFeedsArgs, ForbidTokenParams, FunctionParams, GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, GearboxPermissionless, GearboxPermissionlessOptions, GetUpdatablePriceFeedsArgs, GovernorContract, GroupReport, GroupScenarioOutcome, INDEPENDENCE_WEIGHT, INSTANCE_MANAGER, InputValueParams, InstanceManagerContract, InstanceOwnerTransactions, InstanceTxs, InstanceTxsArgs, MAINNET_CCM_CONSTRUCTOR_PARAMS, MAINNET_DEPLOYMENT_BLOCK, MAINNET_DEPLOYMENT_CCM_SALT, MAINNET_DEPLOYMENT_IM_SALT, MARKET_CONFIGURATOR_FACTORY, Market, MarketCap, MarketConfiguratorContract, MarketConfiguratorFactoryContract, MarketScore, PRICE_FEED_STORE, PUBLIC_CREATE2_FACTORY, PauseCreditManagerParams, PeripheryDomain, PermissionlessAnalytics, PermissionlessAsset, PermissionlessAssetDetails, PermissionlessAssetMarket, PermissionlessAssetMarketFeed, PermissionlessAssetQuota, PermissionlessAssetSummary, PermissionlessChain, PermissionlessChainSummary, PermissionlessChainUnreachableError, PermissionlessDeploy, PermissionlessIndexedAssetDetails, PermissionlessIndexedAssetSummary, PermissionlessIndexedPriceFeedDetails, PermissionlessIndexedPriceFeedMarket, PermissionlessMarket, PermissionlessMarketSlot, PermissionlessNotAttachedError, PermissionlessOracles, PermissionlessPriceFeedAsset, PermissionlessPriceFeedDetails, PermissionlessPriceFeedMarket, PermissionlessPriceFeedStore, PermissionlessQuotaTotals, PreparedDeployment, PreparedPriceFeedDeployment, PriceChartArgs, PriceFeed, PriceFeedArgs, PriceFeedChartPoint, PriceFeedConstructorParam, PriceFeedDecimals, PriceFeedNotInStoreError, PriceFeedPair, PriceFeedParamType, PriceFeedParams, PriceFeedPrice, PriceFeedPriceChart, PriceFeedRef, PriceFeedSaltMissingError, PriceFeedSetupParams, PriceFeedStalenessUnknownError, PriceFeedStoreContract, Proposal, QueuedAndExecutedTransaction, RATE_FEED_TYPE, RecoveryMessage, RoutingManagerContract, SafeBatch, SafeMeta, SafeTx, ScoreSource, ScoredFeed, SetExpirationDateParams, SetFeesParams, SetPriceFeedParams, SetReservePriceFeedParams, SetTokenQuotaIncreaseFeeParams, Signature, SlotOutcome, StressReport, StressScenario, StressSource, StressSourceKind, StressTestArgs, TOKEN_COMPRESSOR, TimeLockContract, TimelockTransaction, TimelockTxParams, TimelockTxs, TokenCompressorContract, TreasurySplitterContract, TreeNode, UNBOUNDED_DOWN, UNBOUNDED_UP, UnpauseCreditManagerParams, ValueParams, WithdrawalCompressorContract, calculateChecksum, checkCreate2Deployment, checkCreate2DeploymentAddress, chunkedLogsTransport, classifySources, convertPercent, convertQueueBatchToExecuteTx, convertRawTxToSafeMultisigTx, createCallData, createCreate2DeployRawTx, deepJsonParse, deployUsingPublicCreate2, deriveEffectiveStalenessPeriod, encodeFunctionParams, formatBytecodeSize, formatBytecodeVersion, getBlockNumberByTimestamp, getCreate2AddressPublicFactory, getCreate2DeploymentAddress, getFeedDecimals, getLatestPrices, getPriceUpdateTx, getPrices, getSafeBatch, getSafeBatches, getUpdatablePriceFeeds, groupOverride, handleSalt, normalizeSignature, perturb, priceFeedSalt, priceFeedSetupParams, rateStub, readForest, readRateTargets, roundDataStub, runAssetScores, runStressTest, scoreGroup, scoreMarket, shortenHash, significantTrunc, slotHarm, sourcesByFeed, verdictOf };
@@ -8,8 +8,8 @@ import { convertQueueBatchToExecuteTx } from "./governance/timelock-txs.js";
8
8
  import "./governance/index.js";
9
9
  import { BYTECODE_REPOSITORY, CROSS_CHAIN_GOVERNANCE, CROSS_CHAIN_MULTISIG, INSTANCE_MANAGER, MARKET_CONFIGURATOR_FACTORY, PRICE_FEED_STORE, TOKEN_COMPRESSOR } from "./literals.js";
10
10
  import { getPriceUpdateTx } from "./price-update/get-price-update-tx.js";
11
- import { getPrices } from "./price-update/get-prices.js";
11
+ import { getFeedDecimals, getLatestPrices, getPrices } from "./price-update/get-prices.js";
12
12
  import { GetUpdatablePriceFeedsArgs, getUpdatablePriceFeeds } from "./price-update/get-updatable-feeds.js";
13
13
  import "./price-update/index.js";
14
14
  import { normalizeSignature } from "./signature.js";
15
- export { BYTECODE_REPOSITORY, CROSS_CHAIN_GOVERNANCE, CROSS_CHAIN_MULTISIG, FunctionParams, GetUpdatablePriceFeedsArgs, INSTANCE_MANAGER, InstanceTxs, MARKET_CONFIGURATOR_FACTORY, PRICE_FEED_STORE, PUBLIC_CREATE2_FACTORY, TOKEN_COMPRESSOR, TimelockTxs, ValueParams, calculateChecksum, checkCreate2Deployment, checkCreate2DeploymentAddress, convertPercent, convertQueueBatchToExecuteTx, convertRawTxToSafeMultisigTx, createCreate2DeployRawTx, deepJsonParse, deployUsingPublicCreate2, encodeFunctionParams, formatBytecodeSize, formatBytecodeVersion, getBlockNumberByTimestamp, getCreate2AddressPublicFactory, getCreate2DeploymentAddress, getPriceUpdateTx, getPrices, getSafeBatch, getSafeBatches, getUpdatablePriceFeeds, handleSalt, normalizeSignature, shortenHash, significantTrunc };
15
+ export { BYTECODE_REPOSITORY, CROSS_CHAIN_GOVERNANCE, CROSS_CHAIN_MULTISIG, FunctionParams, GetUpdatablePriceFeedsArgs, INSTANCE_MANAGER, InstanceTxs, MARKET_CONFIGURATOR_FACTORY, PRICE_FEED_STORE, PUBLIC_CREATE2_FACTORY, TOKEN_COMPRESSOR, TimelockTxs, ValueParams, calculateChecksum, checkCreate2Deployment, checkCreate2DeploymentAddress, convertPercent, convertQueueBatchToExecuteTx, convertRawTxToSafeMultisigTx, createCreate2DeployRawTx, deepJsonParse, deployUsingPublicCreate2, encodeFunctionParams, formatBytecodeSize, formatBytecodeVersion, getBlockNumberByTimestamp, getCreate2AddressPublicFactory, getCreate2DeploymentAddress, getFeedDecimals, getLatestPrices, getPriceUpdateTx, getPrices, getSafeBatch, getSafeBatches, getUpdatablePriceFeeds, handleSalt, normalizeSignature, shortenHash, significantTrunc };
@@ -1,5 +1,38 @@
1
1
  import { Address, PublicClient } from "viem";
2
2
  //#region src/permissionless/utils/price-update/get-prices.d.ts
3
+ /**
4
+ * The scale each feed's answer is in, in one multicall.
5
+ *
6
+ * Part of the Chainlink interface every feed in a Gearbox tree implements,
7
+ * and the only way to read an answer that is not an oracle's own: a feed an
8
+ * oracle holds reports 8 decimals by construction, while the feeds beneath a
9
+ * composite are whatever was deployed — an ETH/USD aggregator at 8 and a
10
+ * rate leg at 18 sit under the same parent.
11
+ *
12
+ * `null` is a feed that would not answer, which a caller should treat as
13
+ * unknown rather than defaulting it to 8.
14
+ */
15
+ export declare function getFeedDecimals({ client, priceFeeds }: {
16
+ client: PublicClient;
17
+ priceFeeds: Address[];
18
+ }): Promise<Record<Address, number | null>>;
19
+ /**
20
+ * What the feeds report as they stand, in one multicall.
21
+ *
22
+ * What {@link getPrices} does without the part that makes it expensive: no
23
+ * `OnchainSDK` to attach and no update transactions to assemble, which is the
24
+ * whole cost of that call and is wasted on a feed that answers already. A feed
25
+ * that needs a fresh answer before it will be read comes back `null` here, so
26
+ * a caller that must price those falls back to {@link getPrices} for them and
27
+ * pays once for the few rather than once for all.
28
+ *
29
+ * `null` is also a feed whose read reverted for any other reason, which is not
30
+ * a zero.
31
+ */
32
+ export declare function getLatestPrices({ client, priceFeeds }: {
33
+ client: PublicClient;
34
+ priceFeeds: Address[];
35
+ }): Promise<Record<Address, bigint | null>>;
3
36
  export declare function getPrices({ client, priceFeeds, chunkSize, gasLimit }: {
4
37
  client: PublicClient;
5
38
  priceFeeds: Address[];
@@ -1,4 +1,4 @@
1
1
  import { getPriceUpdateTx } from "./get-price-update-tx.js";
2
- import { getPrices } from "./get-prices.js";
2
+ import { getFeedDecimals, getLatestPrices, getPrices } from "./get-prices.js";
3
3
  import { GetUpdatablePriceFeedsArgs, getUpdatablePriceFeeds } from "./get-updatable-feeds.js";
4
- export { GetUpdatablePriceFeedsArgs, getPriceUpdateTx, getPrices, getUpdatablePriceFeeds };
4
+ export { GetUpdatablePriceFeedsArgs, getFeedDecimals, getLatestPrices, getPriceUpdateTx, getPrices, getUpdatablePriceFeeds };