@gearbox-protocol/sdk 16.6.0 → 16.6.2

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 (118) hide show
  1. package/dist/cjs/dev/midasUtils.js +8 -5
  2. package/dist/cjs/onchain/OnchainSDK.js +3 -3
  3. package/dist/cjs/onchain/index.js +49 -38
  4. package/dist/cjs/onchain/market/index.js +49 -38
  5. package/dist/cjs/onchain/market/oracle/PriceOracleBaseContract.js +3 -3
  6. package/dist/cjs/onchain/market/pricefeeds/AbstractPriceFeed.js +0 -5
  7. package/dist/cjs/onchain/market/pricefeeds/PriceFeedRegistry.js +127 -0
  8. package/dist/cjs/onchain/market/pricefeeds/{BalancerStablePriceFeed.js → feeds/BalancerStablePriceFeed.js} +4 -4
  9. package/dist/cjs/onchain/market/pricefeeds/{BalancerWeightedPriceFeed.js → feeds/BalancerWeightedPriceFeed.js} +4 -4
  10. package/dist/cjs/onchain/market/pricefeeds/{BoundedPriceFeed.js → feeds/BoundedPriceFeed.js} +4 -4
  11. package/dist/cjs/onchain/market/pricefeeds/{CompositePriceFeed.js → feeds/CompositePriceFeed.js} +4 -4
  12. package/dist/cjs/onchain/market/pricefeeds/{ConstantPriceFeed.js → feeds/ConstantPriceFeed.js} +3 -3
  13. package/dist/cjs/onchain/market/pricefeeds/{CurveCryptoPriceFeed.js → feeds/CurveCryptoPriceFeed.js} +4 -4
  14. package/dist/cjs/onchain/market/pricefeeds/{CurveStablePriceFeed.js → feeds/CurveStablePriceFeed.js} +4 -4
  15. package/dist/cjs/onchain/market/pricefeeds/{CurveUSDPriceFeed.js → feeds/CurveUSDPriceFeed.js} +4 -4
  16. package/dist/cjs/onchain/market/pricefeeds/{Erc4626PriceFeed.js → feeds/Erc4626PriceFeed.js} +4 -4
  17. package/dist/cjs/onchain/market/pricefeeds/{ExternalPriceFeed.js → feeds/ExternalPriceFeed.js} +4 -4
  18. package/dist/cjs/onchain/market/pricefeeds/{MellowLRTPriceFeed.js → feeds/MellowLRTPriceFeed.js} +4 -4
  19. package/dist/cjs/onchain/market/pricefeeds/{PendleTWAPPTPriceFeed.js → feeds/PendleTWAPPTPriceFeed.js} +4 -4
  20. package/dist/cjs/onchain/market/pricefeeds/{PythPriceFeed.js → feeds/PythPriceFeed.js} +3 -3
  21. package/dist/cjs/onchain/market/pricefeeds/{RedstonePriceFeed.js → feeds/RedstonePriceFeed.js} +6 -6
  22. package/dist/cjs/onchain/market/pricefeeds/{WstETHPriceFeed.js → feeds/WstETHPriceFeed.js} +4 -4
  23. package/dist/cjs/onchain/market/pricefeeds/{YearnPriceFeed.js → feeds/YearnPriceFeed.js} +4 -4
  24. package/dist/cjs/onchain/market/pricefeeds/{ZeroPriceFeed.js → feeds/ZeroPriceFeed.js} +4 -4
  25. package/dist/cjs/onchain/market/pricefeeds/feeds/index.js +35 -0
  26. package/dist/cjs/onchain/market/pricefeeds/index.js +51 -39
  27. package/dist/cjs/onchain/market/pricefeeds/updates/UpdatablePriceFeedRegistry.js +189 -0
  28. package/dist/cjs/onchain/market/pricefeeds/{getRawPriceUpdates.js → updates/getRawPriceUpdates.js} +2 -2
  29. package/dist/cjs/onchain/market/pricefeeds/updates/index.js +8 -0
  30. package/dist/cjs/onchain/market/pricefeeds/{isUpdatablePriceFeed.js → updates/isUpdatablePriceFeed.js} +1 -1
  31. package/dist/cjs/onchain/market/pricefeeds/updates/updatableDependencies.js +14 -0
  32. package/dist/cjs/permissionless/utils/price-update/get-price-update-tx.js +2 -2
  33. package/dist/cjs/permissionless/utils/price-update/get-updatable-feeds.js +2 -2
  34. package/dist/esm/dev/midasUtils.js +8 -5
  35. package/dist/esm/onchain/OnchainSDK.js +3 -3
  36. package/dist/esm/onchain/index.js +25 -20
  37. package/dist/esm/onchain/market/index.js +25 -20
  38. package/dist/esm/onchain/market/oracle/PriceOracleBaseContract.js +1 -1
  39. package/dist/esm/onchain/market/pricefeeds/AbstractPriceFeed.js +0 -5
  40. package/dist/esm/onchain/market/pricefeeds/PriceFeedRegistry.js +126 -0
  41. package/dist/esm/onchain/market/pricefeeds/{BalancerStablePriceFeed.js → feeds/BalancerStablePriceFeed.js} +4 -4
  42. package/dist/esm/onchain/market/pricefeeds/{BalancerWeightedPriceFeed.js → feeds/BalancerWeightedPriceFeed.js} +4 -4
  43. package/dist/esm/onchain/market/pricefeeds/{BoundedPriceFeed.js → feeds/BoundedPriceFeed.js} +4 -4
  44. package/dist/esm/onchain/market/pricefeeds/{CompositePriceFeed.js → feeds/CompositePriceFeed.js} +4 -4
  45. package/dist/esm/onchain/market/pricefeeds/{ConstantPriceFeed.js → feeds/ConstantPriceFeed.js} +3 -3
  46. package/dist/esm/onchain/market/pricefeeds/{CurveCryptoPriceFeed.js → feeds/CurveCryptoPriceFeed.js} +4 -4
  47. package/dist/esm/onchain/market/pricefeeds/{CurveStablePriceFeed.js → feeds/CurveStablePriceFeed.js} +4 -4
  48. package/dist/esm/onchain/market/pricefeeds/{CurveUSDPriceFeed.js → feeds/CurveUSDPriceFeed.js} +4 -4
  49. package/dist/esm/onchain/market/pricefeeds/{Erc4626PriceFeed.js → feeds/Erc4626PriceFeed.js} +4 -4
  50. package/dist/esm/onchain/market/pricefeeds/{ExternalPriceFeed.js → feeds/ExternalPriceFeed.js} +4 -4
  51. package/dist/esm/onchain/market/pricefeeds/{MellowLRTPriceFeed.js → feeds/MellowLRTPriceFeed.js} +4 -4
  52. package/dist/esm/onchain/market/pricefeeds/{PendleTWAPPTPriceFeed.js → feeds/PendleTWAPPTPriceFeed.js} +4 -4
  53. package/dist/esm/onchain/market/pricefeeds/{PythPriceFeed.js → feeds/PythPriceFeed.js} +3 -3
  54. package/dist/esm/onchain/market/pricefeeds/{RedstonePriceFeed.js → feeds/RedstonePriceFeed.js} +6 -6
  55. package/dist/esm/onchain/market/pricefeeds/{WstETHPriceFeed.js → feeds/WstETHPriceFeed.js} +4 -4
  56. package/dist/esm/onchain/market/pricefeeds/{YearnPriceFeed.js → feeds/YearnPriceFeed.js} +4 -4
  57. package/dist/esm/onchain/market/pricefeeds/{ZeroPriceFeed.js → feeds/ZeroPriceFeed.js} +4 -4
  58. package/dist/esm/onchain/market/pricefeeds/feeds/index.js +18 -0
  59. package/dist/esm/onchain/market/pricefeeds/index.js +27 -21
  60. package/dist/esm/onchain/market/pricefeeds/updates/UpdatablePriceFeedRegistry.js +188 -0
  61. package/dist/esm/onchain/market/pricefeeds/{getRawPriceUpdates.js → updates/getRawPriceUpdates.js} +2 -2
  62. package/dist/esm/onchain/market/pricefeeds/updates/index.js +5 -1
  63. package/dist/esm/onchain/market/pricefeeds/{isUpdatablePriceFeed.js → updates/isUpdatablePriceFeed.js} +1 -1
  64. package/dist/esm/onchain/market/pricefeeds/updates/updatableDependencies.js +13 -0
  65. package/dist/esm/permissionless/utils/price-update/get-price-update-tx.js +1 -1
  66. package/dist/esm/permissionless/utils/price-update/get-updatable-feeds.js +1 -1
  67. package/dist/types/dev/midasUtils.d.ts +6 -2
  68. package/dist/types/onchain/OnchainSDK.d.ts +2 -2
  69. package/dist/types/onchain/index.d.ts +27 -22
  70. package/dist/types/onchain/market/index.d.ts +27 -22
  71. package/dist/types/onchain/market/oracle/PriceOracleBaseContract.d.ts +2 -1
  72. package/dist/types/onchain/market/oracle/types.d.ts +2 -1
  73. package/dist/types/onchain/market/pricefeeds/AbstractPriceFeed.d.ts +1 -2
  74. package/dist/types/onchain/market/pricefeeds/PriceFeedRegistry.d.ts +60 -0
  75. package/dist/types/onchain/market/pricefeeds/feeds/BalancerStablePriceFeed.d.ts +12 -0
  76. package/dist/types/onchain/market/pricefeeds/{BalancerWeightedPriceFeed.d.ts → feeds/BalancerWeightedPriceFeed.d.ts} +7 -7
  77. package/dist/types/onchain/market/pricefeeds/feeds/BoundedPriceFeed.d.ts +15 -0
  78. package/dist/types/onchain/market/pricefeeds/{CompositePriceFeed.d.ts → feeds/CompositePriceFeed.d.ts} +6 -6
  79. package/dist/types/onchain/market/pricefeeds/{ConstantPriceFeed.d.ts → feeds/ConstantPriceFeed.d.ts} +6 -6
  80. package/dist/types/onchain/market/pricefeeds/feeds/CurveCryptoPriceFeed.d.ts +12 -0
  81. package/dist/types/onchain/market/pricefeeds/feeds/CurveStablePriceFeed.d.ts +12 -0
  82. package/dist/types/onchain/market/pricefeeds/feeds/CurveUSDPriceFeed.d.ts +12 -0
  83. package/dist/types/onchain/market/pricefeeds/feeds/Erc4626PriceFeed.d.ts +12 -0
  84. package/dist/types/onchain/market/pricefeeds/feeds/ExternalPriceFeed.d.ts +11 -0
  85. package/dist/types/onchain/market/pricefeeds/feeds/MellowLRTPriceFeed.d.ts +12 -0
  86. package/dist/types/onchain/market/pricefeeds/{PendleTWAPPTPriceFeed.d.ts → feeds/PendleTWAPPTPriceFeed.d.ts} +3 -3
  87. package/dist/types/onchain/market/pricefeeds/{PythPriceFeed.d.ts → feeds/PythPriceFeed.d.ts} +3 -3
  88. package/dist/types/onchain/market/pricefeeds/{RedstonePriceFeed.d.ts → feeds/RedstonePriceFeed.d.ts} +9 -9
  89. package/dist/types/onchain/market/pricefeeds/feeds/WstETHPriceFeed.d.ts +12 -0
  90. package/dist/types/onchain/market/pricefeeds/feeds/YearnPriceFeed.d.ts +12 -0
  91. package/dist/types/onchain/market/pricefeeds/feeds/ZeroPriceFeed.d.ts +11 -0
  92. package/dist/types/onchain/market/pricefeeds/feeds/index.d.ts +18 -0
  93. package/dist/types/onchain/market/pricefeeds/index.d.ts +28 -22
  94. package/dist/types/onchain/market/pricefeeds/types.d.ts +1 -31
  95. package/dist/types/onchain/market/pricefeeds/updates/RedstoneUpdater.d.ts +1 -1
  96. package/dist/types/onchain/market/pricefeeds/updates/UpdatablePriceFeedRegistry.d.ts +106 -0
  97. package/dist/types/onchain/market/pricefeeds/updates/getRawPriceUpdates.d.ts +6 -0
  98. package/dist/types/onchain/market/pricefeeds/updates/index.d.ts +7 -3
  99. package/dist/types/onchain/market/pricefeeds/updates/isUpdatablePriceFeed.d.ts +6 -0
  100. package/dist/types/onchain/market/pricefeeds/updates/types.d.ts +56 -2
  101. package/dist/types/onchain/market/pricefeeds/updates/updatableDependencies.d.ts +10 -0
  102. package/package.json +1 -1
  103. package/dist/cjs/onchain/market/pricefeeds/PriceFeedsRegister.js +0 -301
  104. package/dist/esm/onchain/market/pricefeeds/PriceFeedsRegister.js +0 -300
  105. package/dist/types/onchain/market/pricefeeds/BalancerStablePriceFeed.d.ts +0 -12
  106. package/dist/types/onchain/market/pricefeeds/BoundedPriceFeed.d.ts +0 -15
  107. package/dist/types/onchain/market/pricefeeds/CurveCryptoPriceFeed.d.ts +0 -12
  108. package/dist/types/onchain/market/pricefeeds/CurveStablePriceFeed.d.ts +0 -12
  109. package/dist/types/onchain/market/pricefeeds/CurveUSDPriceFeed.d.ts +0 -12
  110. package/dist/types/onchain/market/pricefeeds/Erc4626PriceFeed.d.ts +0 -12
  111. package/dist/types/onchain/market/pricefeeds/ExternalPriceFeed.d.ts +0 -11
  112. package/dist/types/onchain/market/pricefeeds/MellowLRTPriceFeed.d.ts +0 -12
  113. package/dist/types/onchain/market/pricefeeds/PriceFeedsRegister.d.ts +0 -180
  114. package/dist/types/onchain/market/pricefeeds/WstETHPriceFeed.d.ts +0 -12
  115. package/dist/types/onchain/market/pricefeeds/YearnPriceFeed.d.ts +0 -12
  116. package/dist/types/onchain/market/pricefeeds/ZeroPriceFeed.d.ts +0 -11
  117. package/dist/types/onchain/market/pricefeeds/getRawPriceUpdates.d.ts +0 -5
  118. package/dist/types/onchain/market/pricefeeds/isUpdatablePriceFeed.d.ts +0 -5
@@ -0,0 +1,12 @@
1
+ import { PartialPriceFeedTreeNode } from "../AbstractPriceFeed.js";
2
+ import { AbstractLPPriceFeedContract } from "../AbstractLPPriceFeed.js";
3
+ import { erc4626PriceFeedAbi } from "../../../abi/oracles.js";
4
+ import "../../../abi/index.js";
5
+ import { ConstructOptions } from "../../../base/Construct.js";
6
+ //#region src/onchain/market/pricefeeds/feeds/Erc4626PriceFeed.d.ts
7
+ type abi = typeof erc4626PriceFeedAbi;
8
+ declare class Erc4626PriceFeedContract extends AbstractLPPriceFeedContract<abi> {
9
+ constructor(options: ConstructOptions, args: PartialPriceFeedTreeNode);
10
+ }
11
+ //#endregion
12
+ export { Erc4626PriceFeedContract };
@@ -0,0 +1,11 @@
1
+ import { AbstractPriceFeedContract, PartialPriceFeedTreeNode } from "../AbstractPriceFeed.js";
2
+ import { chainlinkReadableAggregatorAbi } from "../../../abi/oracles.js";
3
+ import "../../../abi/index.js";
4
+ import { ConstructOptions } from "../../../base/Construct.js";
5
+ //#region src/onchain/market/pricefeeds/feeds/ExternalPriceFeed.d.ts
6
+ type abi = typeof chainlinkReadableAggregatorAbi;
7
+ declare class ExternalPriceFeedContract extends AbstractPriceFeedContract<abi> {
8
+ constructor(options: ConstructOptions, args: PartialPriceFeedTreeNode);
9
+ }
10
+ //#endregion
11
+ export { ExternalPriceFeedContract };
@@ -0,0 +1,12 @@
1
+ import { PartialPriceFeedTreeNode } from "../AbstractPriceFeed.js";
2
+ import { AbstractLPPriceFeedContract } from "../AbstractLPPriceFeed.js";
3
+ import { mellowLrtPriceFeedAbi } from "../../../abi/oracles.js";
4
+ import "../../../abi/index.js";
5
+ import { ConstructOptions } from "../../../base/Construct.js";
6
+ //#region src/onchain/market/pricefeeds/feeds/MellowLRTPriceFeed.d.ts
7
+ type abi = typeof mellowLrtPriceFeedAbi;
8
+ declare class MellowLRTPriceFeedContract extends AbstractLPPriceFeedContract<abi> {
9
+ constructor(options: ConstructOptions, args: PartialPriceFeedTreeNode);
10
+ }
11
+ //#endregion
12
+ export { MellowLRTPriceFeedContract };
@@ -1,7 +1,7 @@
1
- import { AbstractPriceFeedContract, PartialPriceFeedTreeNode } from "./AbstractPriceFeed.js";
2
- import { ConstructOptions } from "../../base/Construct.js";
1
+ import { AbstractPriceFeedContract, PartialPriceFeedTreeNode } from "../AbstractPriceFeed.js";
2
+ import { ConstructOptions } from "../../../base/Construct.js";
3
3
  import { Address } from "viem";
4
- //#region src/onchain/market/pricefeeds/PendleTWAPPTPriceFeed.d.ts
4
+ //#region src/onchain/market/pricefeeds/feeds/PendleTWAPPTPriceFeed.d.ts
5
5
  declare const abi: readonly [{
6
6
  readonly type: "constructor";
7
7
  readonly inputs: readonly [{
@@ -1,7 +1,7 @@
1
- import { AbstractPriceFeedContract, PartialPriceFeedTreeNode } from "./AbstractPriceFeed.js";
2
- import { ConstructOptions } from "../../base/Construct.js";
1
+ import { AbstractPriceFeedContract, PartialPriceFeedTreeNode } from "../AbstractPriceFeed.js";
2
+ import { ConstructOptions } from "../../../base/Construct.js";
3
3
  import { Address, Hex } from "viem";
4
- //#region src/onchain/market/pricefeeds/PythPriceFeed.d.ts
4
+ //#region src/onchain/market/pricefeeds/feeds/PythPriceFeed.d.ts
5
5
  declare const abi: readonly [{
6
6
  readonly type: "constructor";
7
7
  readonly inputs: readonly [{
@@ -1,13 +1,13 @@
1
- import { RedstonePriceFeedStateHuman } from "../../types/state-human.js";
2
- import { IUpdatablePriceFeedContract } from "./types.js";
3
- import { AbstractPriceFeedContract, PartialPriceFeedTreeNode } from "./AbstractPriceFeed.js";
4
- import { redstonePriceFeedAbi } from "../../abi/oracles.js";
5
- import "../../abi/index.js";
6
- import { RawTx } from "../../types/transactions.js";
7
- import { ConstructOptions } from "../../base/Construct.js";
8
- import "../../types/index.js";
1
+ import { RedstonePriceFeedStateHuman } from "../../../types/state-human.js";
2
+ import { AbstractPriceFeedContract, PartialPriceFeedTreeNode } from "../AbstractPriceFeed.js";
3
+ import { redstonePriceFeedAbi } from "../../../abi/oracles.js";
4
+ import "../../../abi/index.js";
5
+ import { IUpdatablePriceFeedContract } from "../updates/types.js";
6
+ import { RawTx } from "../../../types/transactions.js";
7
+ import { ConstructOptions } from "../../../base/Construct.js";
8
+ import "../../../types/index.js";
9
9
  import { Address, Hex } from "viem";
10
- //#region src/onchain/market/pricefeeds/RedstonePriceFeed.d.ts
10
+ //#region src/onchain/market/pricefeeds/feeds/RedstonePriceFeed.d.ts
11
11
  type abi = typeof redstonePriceFeedAbi;
12
12
  declare class RedstonePriceFeedContract extends AbstractPriceFeedContract<abi> implements IUpdatablePriceFeedContract {
13
13
  readonly token: Address;
@@ -0,0 +1,12 @@
1
+ import { PartialPriceFeedTreeNode } from "../AbstractPriceFeed.js";
2
+ import { AbstractLPPriceFeedContract } from "../AbstractLPPriceFeed.js";
3
+ import { wstEthPriceFeedAbi } from "../../../abi/oracles.js";
4
+ import "../../../abi/index.js";
5
+ import { ConstructOptions } from "../../../base/Construct.js";
6
+ //#region src/onchain/market/pricefeeds/feeds/WstETHPriceFeed.d.ts
7
+ type abi = typeof wstEthPriceFeedAbi;
8
+ declare class WstETHPriceFeedContract extends AbstractLPPriceFeedContract<abi> {
9
+ constructor(options: ConstructOptions, args: PartialPriceFeedTreeNode);
10
+ }
11
+ //#endregion
12
+ export { WstETHPriceFeedContract };
@@ -0,0 +1,12 @@
1
+ import { PartialPriceFeedTreeNode } from "../AbstractPriceFeed.js";
2
+ import { AbstractLPPriceFeedContract } from "../AbstractLPPriceFeed.js";
3
+ import { yearnPriceFeedAbi } from "../../../abi/oracles.js";
4
+ import "../../../abi/index.js";
5
+ import { ConstructOptions } from "../../../base/Construct.js";
6
+ //#region src/onchain/market/pricefeeds/feeds/YearnPriceFeed.d.ts
7
+ type abi = typeof yearnPriceFeedAbi;
8
+ declare class YearnPriceFeedContract extends AbstractLPPriceFeedContract<abi> {
9
+ constructor(options: ConstructOptions, args: PartialPriceFeedTreeNode);
10
+ }
11
+ //#endregion
12
+ export { YearnPriceFeedContract };
@@ -0,0 +1,11 @@
1
+ import { AbstractPriceFeedContract, PartialPriceFeedTreeNode } from "../AbstractPriceFeed.js";
2
+ import { zeroPriceFeedAbi } from "../../../abi/oracles.js";
3
+ import "../../../abi/index.js";
4
+ import { ConstructOptions } from "../../../base/Construct.js";
5
+ //#region src/onchain/market/pricefeeds/feeds/ZeroPriceFeed.d.ts
6
+ type abi = typeof zeroPriceFeedAbi;
7
+ declare class ZeroPriceFeedContract extends AbstractPriceFeedContract<abi> {
8
+ constructor(options: ConstructOptions, args: PartialPriceFeedTreeNode);
9
+ }
10
+ //#endregion
11
+ export { ZeroPriceFeedContract };
@@ -0,0 +1,18 @@
1
+ import { BalancerStablePriceFeedContract } from "./BalancerStablePriceFeed.js";
2
+ import { BalancerWeightedPriceFeedContract } from "./BalancerWeightedPriceFeed.js";
3
+ import { BoundedPriceFeedContract } from "./BoundedPriceFeed.js";
4
+ import { CompositePriceFeedContract } from "./CompositePriceFeed.js";
5
+ import { ConstantPriceFeedContract } from "./ConstantPriceFeed.js";
6
+ import { CurveCryptoPriceFeedContract } from "./CurveCryptoPriceFeed.js";
7
+ import { CurveStablePriceFeedContract } from "./CurveStablePriceFeed.js";
8
+ import { CurveUSDPriceFeedContract } from "./CurveUSDPriceFeed.js";
9
+ import { Erc4626PriceFeedContract } from "./Erc4626PriceFeed.js";
10
+ import { ExternalPriceFeedContract } from "./ExternalPriceFeed.js";
11
+ import { MellowLRTPriceFeedContract } from "./MellowLRTPriceFeed.js";
12
+ import { PendleTWAPPTPriceFeed } from "./PendleTWAPPTPriceFeed.js";
13
+ import { PythPriceFeed } from "./PythPriceFeed.js";
14
+ import { RedstonePriceFeedContract } from "./RedstonePriceFeed.js";
15
+ import { WstETHPriceFeedContract } from "./WstETHPriceFeed.js";
16
+ import { YearnPriceFeedContract } from "./YearnPriceFeed.js";
17
+ import { ZeroPriceFeedContract } from "./ZeroPriceFeed.js";
18
+ export { BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, BoundedPriceFeedContract, CompositePriceFeedContract, ConstantPriceFeedContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, Erc4626PriceFeedContract, ExternalPriceFeedContract, MellowLRTPriceFeedContract, PendleTWAPPTPriceFeed, PythPriceFeed, RedstonePriceFeedContract, WstETHPriceFeedContract, YearnPriceFeedContract, ZeroPriceFeedContract };
@@ -1,27 +1,33 @@
1
- import { IPriceFeedContract, IUpdatablePriceFeedContract, PriceFeedContractType, PriceFeedUsageType, PriceUpdate, UpdatePriceFeedsResult } from "./types.js";
1
+ import { IPriceFeedContract, PriceFeedContractType, PriceFeedUsageType, PriceUpdate } from "./types.js";
2
2
  import { PriceFeedRef } from "./PriceFeedRef.js";
3
3
  import { AbstractPriceFeedContract, PartialPriceFeedInitError, PartialPriceFeedTreeNode, PriceFeedConstructorArgs } from "./AbstractPriceFeed.js";
4
4
  import { AbstractLPPriceFeedContract, isLPPriceFeed } from "./AbstractLPPriceFeed.js";
5
- import { BalancerStablePriceFeedContract } from "./BalancerStablePriceFeed.js";
6
- import { BalancerWeightedPriceFeedContract } from "./BalancerWeightedPriceFeed.js";
7
- import { BoundedPriceFeedContract } from "./BoundedPriceFeed.js";
8
- import { CompositePriceFeedContract } from "./CompositePriceFeed.js";
9
- import { CurveCryptoPriceFeedContract } from "./CurveCryptoPriceFeed.js";
10
- import { CurveStablePriceFeedContract } from "./CurveStablePriceFeed.js";
11
- import { CurveUSDPriceFeedContract } from "./CurveUSDPriceFeed.js";
12
- import { Erc4626PriceFeedContract } from "./Erc4626PriceFeed.js";
13
- import { ExternalPriceFeedContract } from "./ExternalPriceFeed.js";
14
- import { getRawPriceUpdates } from "./getRawPriceUpdates.js";
15
- import { isUpdatablePriceFeed } from "./isUpdatablePriceFeed.js";
16
- import { MellowLRTPriceFeedContract } from "./MellowLRTPriceFeed.js";
17
- import { PendleTWAPPTPriceFeed } from "./PendleTWAPPTPriceFeed.js";
18
- import { TimestampedCalldata } from "./updates/types.js";
5
+ import { BalancerStablePriceFeedContract } from "./feeds/BalancerStablePriceFeed.js";
6
+ import { BalancerWeightedPriceFeedContract } from "./feeds/BalancerWeightedPriceFeed.js";
7
+ import { BoundedPriceFeedContract } from "./feeds/BoundedPriceFeed.js";
8
+ import { CompositePriceFeedContract } from "./feeds/CompositePriceFeed.js";
9
+ import { ConstantPriceFeedContract } from "./feeds/ConstantPriceFeed.js";
10
+ import { CurveCryptoPriceFeedContract } from "./feeds/CurveCryptoPriceFeed.js";
11
+ import { CurveStablePriceFeedContract } from "./feeds/CurveStablePriceFeed.js";
12
+ import { CurveUSDPriceFeedContract } from "./feeds/CurveUSDPriceFeed.js";
13
+ import { Erc4626PriceFeedContract } from "./feeds/Erc4626PriceFeed.js";
14
+ import { ExternalPriceFeedContract } from "./feeds/ExternalPriceFeed.js";
15
+ import { MellowLRTPriceFeedContract } from "./feeds/MellowLRTPriceFeed.js";
16
+ import { PendleTWAPPTPriceFeed } from "./feeds/PendleTWAPPTPriceFeed.js";
17
+ import { PythPriceFeed } from "./feeds/PythPriceFeed.js";
18
+ import { PriceUpdatesCache } from "./updates/PriceUpdatesCache.js";
19
+ import { RedstoneOptions, RedstoneUpdater } from "./updates/RedstoneUpdater.js";
20
+ import { IPriceUpdateTask, IPriceUpdater, IUpdatablePriceFeedContract, LatestUpdate, TimestampedCalldata, TimestampedCalldataWithPrice, UpdatablePriceFeedRegistryHooks, UpdatablePriceFeedRegistryOptions, UpdatePriceFeedsResult } from "./updates/types.js";
21
+ import { RedstonePriceFeedContract } from "./feeds/RedstonePriceFeed.js";
22
+ import { WstETHPriceFeedContract } from "./feeds/WstETHPriceFeed.js";
23
+ import { YearnPriceFeedContract } from "./feeds/YearnPriceFeed.js";
24
+ import { ZeroPriceFeedContract } from "./feeds/ZeroPriceFeed.js";
25
+ import "./feeds/index.js";
26
+ import { PriceFeedRegistry } from "./PriceFeedRegistry.js";
19
27
  import { FetchRedstonePayloadsOptions, fetchRedstonePayloads } from "./updates/fetchRedstonePayloads.js";
28
+ import { getRawPriceUpdates } from "./updates/getRawPriceUpdates.js";
29
+ import { isUpdatablePriceFeed } from "./updates/isUpdatablePriceFeed.js";
30
+ import { UpdatablePriceFeedRegistry } from "./updates/UpdatablePriceFeedRegistry.js";
31
+ import { updatableDependencies } from "./updates/updatableDependencies.js";
20
32
  import "./updates/index.js";
21
- import { LatestUpdate, PriceFeedRegister, PriceFeedRegisterHooks, PriceFeedRegisterOptions } from "./PriceFeedsRegister.js";
22
- import { PythPriceFeed } from "./PythPriceFeed.js";
23
- import { RedstonePriceFeedContract } from "./RedstonePriceFeed.js";
24
- import { WstETHPriceFeedContract } from "./WstETHPriceFeed.js";
25
- import { YearnPriceFeedContract } from "./YearnPriceFeed.js";
26
- import { ZeroPriceFeedContract } from "./ZeroPriceFeed.js";
27
- export { AbstractLPPriceFeedContract, AbstractPriceFeedContract, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, BoundedPriceFeedContract, CompositePriceFeedContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, Erc4626PriceFeedContract, ExternalPriceFeedContract, type FetchRedstonePayloadsOptions, IPriceFeedContract, IUpdatablePriceFeedContract, LatestUpdate, MellowLRTPriceFeedContract, PartialPriceFeedInitError, PartialPriceFeedTreeNode, PendleTWAPPTPriceFeed, PriceFeedConstructorArgs, PriceFeedContractType, PriceFeedRef, PriceFeedRegister, PriceFeedRegisterHooks, PriceFeedRegisterOptions, PriceFeedUsageType, PriceUpdate, PythPriceFeed, RedstonePriceFeedContract, type TimestampedCalldata, UpdatePriceFeedsResult, WstETHPriceFeedContract, YearnPriceFeedContract, ZeroPriceFeedContract, fetchRedstonePayloads, getRawPriceUpdates, isLPPriceFeed, isUpdatablePriceFeed };
33
+ export { AbstractLPPriceFeedContract, AbstractPriceFeedContract, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, BoundedPriceFeedContract, CompositePriceFeedContract, ConstantPriceFeedContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, Erc4626PriceFeedContract, ExternalPriceFeedContract, FetchRedstonePayloadsOptions, IPriceFeedContract, type IPriceUpdateTask, type IPriceUpdater, type IUpdatablePriceFeedContract, type LatestUpdate, MellowLRTPriceFeedContract, PartialPriceFeedInitError, PartialPriceFeedTreeNode, PendleTWAPPTPriceFeed, PriceFeedConstructorArgs, PriceFeedContractType, PriceFeedRef, PriceFeedRegistry, PriceFeedUsageType, PriceUpdate, PriceUpdatesCache, PythPriceFeed, RedstoneOptions, RedstonePriceFeedContract, RedstoneUpdater, type TimestampedCalldata, type TimestampedCalldataWithPrice, UpdatablePriceFeedRegistry, type UpdatablePriceFeedRegistryHooks, type UpdatablePriceFeedRegistryOptions, type UpdatePriceFeedsResult, WstETHPriceFeedContract, YearnPriceFeedContract, ZeroPriceFeedContract, fetchRedstonePayloads, getRawPriceUpdates, isLPPriceFeed, isUpdatablePriceFeed, updatableDependencies };
@@ -3,7 +3,6 @@ import "../../../model/index.js";
3
3
  import { IBaseContract, PriceFeedAnswer } from "../../base/types.js";
4
4
  import { PriceFeedStateHuman } from "../../types/state-human.js";
5
5
  import { PriceFeedRef } from "./PriceFeedRef.js";
6
- import { IPriceUpdateTx, RawTx } from "../../types/transactions.js";
7
6
  import "../../types/index.js";
8
7
  import "../../base/index.js";
9
8
  import { Address, Hex, UnionOmit } from "viem";
@@ -74,11 +73,6 @@ interface IPriceFeedContract extends IBaseContract {
74
73
  * @param raw - When `true`, includes raw/unformatted values.
75
74
  **/
76
75
  stateHuman: (raw?: boolean) => UnionOmit<PriceFeedStateHuman, "stalenessPeriod">;
77
- /**
78
- * Collects all updatable feeds in this feed's dependency tree,
79
- * including this feed itself when it is updatable.
80
- **/
81
- updatableDependencies: () => IUpdatablePriceFeedContract[];
82
76
  /**
83
77
  * Describes this feed and the feeds it reads from the way the shared read
84
78
  * model does.
@@ -88,30 +82,6 @@ interface IPriceFeedContract extends IBaseContract {
88
82
  **/
89
83
  describe: () => PriceFeedData;
90
84
  }
91
- /**
92
- * Extended price feed interface for feeds whose price can be refreshed
93
- * via an off-chain data push (e.g. Pyth or Redstone feeds).
94
- **/
95
- interface IUpdatablePriceFeedContract extends IPriceFeedContract {
96
- /**
97
- * Builds a raw transaction that pushes new price data to the on-chain feed.
98
- * @param data - ABI-encoded update payload.
99
- **/
100
- createPriceUpdateTx: (data: `0x${string}`) => RawTx;
101
- }
102
- /**
103
- * Result of generating price-feed update transactions.
104
- **/
105
- interface UpdatePriceFeedsResult {
106
- /**
107
- * Transactions that push fresh prices to updatable feeds.
108
- **/
109
- txs: IPriceUpdateTx[];
110
- /**
111
- * Latest timestamp among all fetched price updates (unix seconds).
112
- **/
113
- timestamp: number;
114
- }
115
85
  /**
116
86
  * Pair: updatable price feed address and
117
87
  * data can be passed to IUpdatablePriceFeed.updatePrice
@@ -127,4 +97,4 @@ interface PriceUpdate {
127
97
  data: Hex;
128
98
  }
129
99
  //#endregion
130
- export { IPriceFeedContract, IUpdatablePriceFeedContract, PriceFeedContractType, PriceFeedUsageType, PriceUpdate, UpdatePriceFeedsResult };
100
+ export { IPriceFeedContract, PriceFeedContractType, PriceFeedUsageType, PriceUpdate };
@@ -1,7 +1,7 @@
1
1
  import { IPriceFeedContract } from "../types.js";
2
- import { IPriceUpdateTask, IPriceUpdater } from "./types.js";
3
2
  import { PriceUpdatesCache } from "./PriceUpdatesCache.js";
4
3
  import { PriceUpdateTx } from "./PriceUpdateTx.js";
4
+ import { IPriceUpdateTask, IPriceUpdater } from "./types.js";
5
5
  import { OnchainSDK } from "../../../OnchainSDK.js";
6
6
  import { SDKConstruct } from "../../../base/SDKConstruct.js";
7
7
  import "../../../base/index.js";
@@ -0,0 +1,106 @@
1
+ import { IPriceFeedContract, PriceUpdate } from "../types.js";
2
+ import { LatestUpdate, UpdatablePriceFeedRegistryHooks, UpdatablePriceFeedRegistryOptions, UpdatePriceFeedsResult } from "./types.js";
3
+ import { PriceFeedRegistry } from "../PriceFeedRegistry.js";
4
+ import { IHooks } from "../../../utils/internal/Hooks.js";
5
+ import "../../../utils/internal/index.js";
6
+ import { RawTx } from "../../../types/transactions.js";
7
+ import { OnchainSDK } from "../../../OnchainSDK.js";
8
+ import "../../../types/index.js";
9
+ import { Address, BlockTag } from "viem";
10
+ //#region src/onchain/market/pricefeeds/updates/UpdatablePriceFeedRegistry.d.ts
11
+ /**
12
+ * {@link PriceFeedRegistry} that also orchestrates off-chain price updates
13
+ * (Redstone, etc.).
14
+ **/
15
+ declare class UpdatablePriceFeedRegistry extends PriceFeedRegistry implements IHooks<UpdatablePriceFeedRegistryHooks> {
16
+ #private;
17
+ constructor(sdk: OnchainSDK, opts?: UpdatablePriceFeedRegistryOptions);
18
+ /**
19
+ * @internal
20
+ * Registers a callback for price-feed registry lifecycle events.
21
+ * @param event - Event name.
22
+ * @param handler - Callback to invoke.
23
+ **/
24
+ addHook: <K extends "updatesGenerated">(hookName: K, fn: (...args: UpdatablePriceFeedRegistryHooks[K]) => void | Promise<void>) => void;
25
+ /**
26
+ * @internal
27
+ * Removes a previously registered hook.
28
+ * @param event - Event name.
29
+ * @param handler - Callback to remove.
30
+ **/
31
+ removeHook: <K extends "updatesGenerated">(hookName: K, fn: (...args: UpdatablePriceFeedRegistryHooks[K]) => void | Promise<void>) => void;
32
+ /**
33
+ * Generates transactions to push fresh off-chain prices to updatable feeds.
34
+ *
35
+ * @param priceFeeds - Top-level price feeds whose updatable dependencies
36
+ * will be resolved, or a filter (`{ main: true }` / `{ reserve: true }`)
37
+ * to gather feeds from all oracles. When omitted, all registered feeds
38
+ * are used.
39
+ **/
40
+ generatePriceFeedsUpdateTxs(priceFeeds?: IPriceFeedContract[] | {
41
+ main: true;
42
+ } | {
43
+ reserve: true;
44
+ }): Promise<UpdatePriceFeedsResult>;
45
+ /**
46
+ * Similar to {@link generatePriceFeedsUpdateTxs}, but returns raw structures instead of transactions
47
+ * @param priceFeeds
48
+ * @returns
49
+ */
50
+ generatePriceFeedsUpdates(priceFeeds?: IPriceFeedContract[] | {
51
+ main: true;
52
+ } | {
53
+ reserve: true;
54
+ }): Promise<PriceUpdate[]>;
55
+ /**
56
+ * Similar to {@link generatePriceFeedsUpdates}, but returns raw transaction to PriceFeedStore.updatePrices
57
+ * @param priceFeeds
58
+ * @returns
59
+ */
60
+ getPriceFeedStoreUpdateTx(priceFeeds?: IPriceFeedContract[] | {
61
+ main: true;
62
+ } | {
63
+ reserve: true;
64
+ }): Promise<RawTx>;
65
+ /**
66
+ * Similar to {@link generatePriceFeedsUpdateTxs}, but will generate necessary price update transactions for external price feeds (not known to sdk)
67
+ * This does not add feeds to this registry, so they won't be implicitly included in future generatePriceFeedsUpdateTxs calls
68
+ * @param feeds
69
+ * @param block
70
+ * @returns
71
+ */
72
+ generateExternalPriceFeedsUpdateTxs(feeds: Address[], block?: {
73
+ blockNumber: bigint;
74
+ } | {
75
+ blockTag: BlockTag;
76
+ }): Promise<UpdatePriceFeedsResult>;
77
+ /**
78
+ * Similar to {@link generateExternalPriceFeedsUpdateTxs}, but returns raw structures instead of transactions
79
+ * @param feeds
80
+ * @param block
81
+ * @returns
82
+ */
83
+ generateExternalPriceFeedsUpdates(feeds: Address[], block?: {
84
+ blockNumber: bigint;
85
+ } | {
86
+ blockTag: BlockTag;
87
+ }): Promise<PriceUpdate[]>;
88
+ /**
89
+ * Loads PARTIAL information about all updatable price feeds from MarketCompressor
90
+ * Discovered price feeds are not saved anywhere in PriceFeedRegistry, and can later be used to load price feed updates
91
+ */
92
+ getPartialUpdatablePriceFeeds(configurators: Address[]): Promise<IPriceFeedContract[]>;
93
+ /**
94
+ * @internal
95
+ * Diagnostic snapshot of the most recent price-update round, or
96
+ * `undefined` if no updates have been generated yet.
97
+ **/
98
+ get latestUpdate(): LatestUpdate | undefined;
99
+ /**
100
+ * @internal
101
+ * Returns true if any of the updaters are in historical mode
102
+ */
103
+ get historical(): boolean;
104
+ }
105
+ //#endregion
106
+ export { UpdatablePriceFeedRegistry };
@@ -0,0 +1,6 @@
1
+ import { PriceUpdate } from "../types.js";
2
+ import { UpdatePriceFeedsResult } from "./types.js";
3
+ //#region src/onchain/market/pricefeeds/updates/getRawPriceUpdates.d.ts
4
+ declare function getRawPriceUpdates(updates: UpdatePriceFeedsResult): PriceUpdate[];
5
+ //#endregion
6
+ export { getRawPriceUpdates };
@@ -1,5 +1,9 @@
1
- import { IPriceUpdateTask, IPriceUpdater, TimestampedCalldata, TimestampedCalldataWithPrice } from "./types.js";
2
- import { FetchRedstonePayloadsOptions, fetchRedstonePayloads } from "./fetchRedstonePayloads.js";
3
1
  import { PriceUpdatesCache } from "./PriceUpdatesCache.js";
4
2
  import { RedstoneOptions, RedstoneUpdater } from "./RedstoneUpdater.js";
5
- export { FetchRedstonePayloadsOptions, type IPriceUpdateTask, type IPriceUpdater, PriceUpdatesCache, RedstoneOptions, RedstoneUpdater, type TimestampedCalldata, type TimestampedCalldataWithPrice, fetchRedstonePayloads };
3
+ import { IPriceUpdateTask, IPriceUpdater, IUpdatablePriceFeedContract, LatestUpdate, TimestampedCalldata, TimestampedCalldataWithPrice, UpdatablePriceFeedRegistryHooks, UpdatablePriceFeedRegistryOptions, UpdatePriceFeedsResult } from "./types.js";
4
+ import { FetchRedstonePayloadsOptions, fetchRedstonePayloads } from "./fetchRedstonePayloads.js";
5
+ import { getRawPriceUpdates } from "./getRawPriceUpdates.js";
6
+ import { isUpdatablePriceFeed } from "./isUpdatablePriceFeed.js";
7
+ import { UpdatablePriceFeedRegistry } from "./UpdatablePriceFeedRegistry.js";
8
+ import { updatableDependencies } from "./updatableDependencies.js";
9
+ export { FetchRedstonePayloadsOptions, type IPriceUpdateTask, type IPriceUpdater, type IUpdatablePriceFeedContract, type LatestUpdate, PriceUpdatesCache, RedstoneOptions, RedstoneUpdater, type TimestampedCalldata, type TimestampedCalldataWithPrice, UpdatablePriceFeedRegistry, type UpdatablePriceFeedRegistryHooks, type UpdatablePriceFeedRegistryOptions, type UpdatePriceFeedsResult, fetchRedstonePayloads, getRawPriceUpdates, isUpdatablePriceFeed, updatableDependencies };
@@ -0,0 +1,6 @@
1
+ import { IPriceFeedContract } from "../types.js";
2
+ import { IUpdatablePriceFeedContract } from "./types.js";
3
+ //#region src/onchain/market/pricefeeds/updates/isUpdatablePriceFeed.d.ts
4
+ declare function isUpdatablePriceFeed(pf: IPriceFeedContract): pf is IUpdatablePriceFeedContract;
5
+ //#endregion
6
+ export { isUpdatablePriceFeed };
@@ -1,5 +1,6 @@
1
1
  import { IPriceFeedContract } from "../types.js";
2
- import { IPriceUpdateTx } from "../../../types/transactions.js";
2
+ import { RedstoneOptions } from "./RedstoneUpdater.js";
3
+ import { IPriceUpdateTx, RawTx } from "../../../types/transactions.js";
3
4
  import "../../../types/index.js";
4
5
  import { Address } from "viem";
5
6
  //#region src/onchain/market/pricefeeds/updates/types.d.ts
@@ -29,5 +30,58 @@ interface TimestampedCalldataWithPrice extends TimestampedCalldata {
29
30
  price: bigint;
30
31
  decimals: number;
31
32
  }
33
+ /**
34
+ * Extended price feed interface for feeds whose price can be refreshed
35
+ * via an off-chain data push (e.g. Pyth or Redstone feeds).
36
+ **/
37
+ interface IUpdatablePriceFeedContract extends IPriceFeedContract {
38
+ /**
39
+ * Builds a raw transaction that pushes new price data to the on-chain feed.
40
+ * @param data - ABI-encoded update payload.
41
+ **/
42
+ createPriceUpdateTx: (data: `0x${string}`) => RawTx;
43
+ }
44
+ /**
45
+ * Result of generating price-feed update transactions.
46
+ **/
47
+ interface UpdatePriceFeedsResult {
48
+ /**
49
+ * Transactions that push fresh prices to updatable feeds.
50
+ **/
51
+ txs: IPriceUpdateTx[];
52
+ /**
53
+ * Latest timestamp among all fetched price updates (unix seconds).
54
+ **/
55
+ timestamp: number;
56
+ }
57
+ type UpdatablePriceFeedRegistryHooks = {
58
+ /**
59
+ * Emitted when transactions to update price feeds have been generated, but before they're used anywhere
60
+ */
61
+ updatesGenerated: [UpdatePriceFeedsResult];
62
+ };
63
+ /**
64
+ * Configuration for external price-update providers supported by the registry.
65
+ **/
66
+ interface UpdatablePriceFeedRegistryOptions {
67
+ /**
68
+ * Redstone price-update provider options.
69
+ **/
70
+ redstone?: RedstoneOptions;
71
+ }
72
+ /**
73
+ * @internal
74
+ * Diagnostic snapshot of the most recent price-update round.
75
+ **/
76
+ interface LatestUpdate {
77
+ /**
78
+ * Unix timestamp (seconds) of the most recent update.
79
+ **/
80
+ timestamp: number;
81
+ /**
82
+ * Individual update tasks that were executed.
83
+ **/
84
+ updates: IPriceUpdateTask[];
85
+ }
32
86
  //#endregion
33
- export { IPriceUpdateTask, IPriceUpdater, TimestampedCalldata, TimestampedCalldataWithPrice };
87
+ export { IPriceUpdateTask, IPriceUpdater, IUpdatablePriceFeedContract, LatestUpdate, TimestampedCalldata, TimestampedCalldataWithPrice, UpdatablePriceFeedRegistryHooks, UpdatablePriceFeedRegistryOptions, UpdatePriceFeedsResult };
@@ -0,0 +1,10 @@
1
+ import { IPriceFeedContract } from "../types.js";
2
+ import { IUpdatablePriceFeedContract } from "./types.js";
3
+ //#region src/onchain/market/pricefeeds/updates/updatableDependencies.d.ts
4
+ /**
5
+ * Collects updatable feeds in this feed's dependency tree, including this
6
+ * feed itself when it is updatable.
7
+ **/
8
+ declare function updatableDependencies(feed: IPriceFeedContract): IUpdatablePriceFeedContract[];
9
+ //#endregion
10
+ export { updatableDependencies };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "16.6.0",
3
+ "version": "16.6.2",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "repository": {