@gearbox-protocol/sdk 13.7.0-kyc.3 → 14.0.0-next.10

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 (214) hide show
  1. package/dist/cjs/dev/AccountOpener.js +5 -45
  2. package/dist/cjs/dev/RevolverTransport.js +10 -4
  3. package/dist/cjs/dev/index.js +0 -2
  4. package/dist/cjs/dev/logSplitterTransport.js +10 -1
  5. package/dist/cjs/permissionless/utils/create2.js +2 -2
  6. package/dist/cjs/permissionless/utils/price-update/get-price-feeds.js +11 -5
  7. package/dist/cjs/permissionless/utils/price-update/get-price-update-tx.js +11 -5
  8. package/dist/cjs/permissionless/utils/price-update/get-prices.js +12 -6
  9. package/dist/cjs/sdk/MultichainSDK.js +232 -0
  10. package/dist/cjs/sdk/OnchainSDK.js +478 -0
  11. package/dist/cjs/sdk/accounts/AbstractCreditAccountsService.js +16 -324
  12. package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +1 -7
  13. package/dist/cjs/sdk/base/TokensMeta.js +42 -22
  14. package/dist/cjs/sdk/base/token-types.js +0 -9
  15. package/dist/cjs/sdk/chain/chains.js +1 -2
  16. package/dist/cjs/sdk/constants/address-provider.js +0 -3
  17. package/dist/cjs/sdk/core/errors.js +77 -0
  18. package/dist/cjs/sdk/core/index.js +2 -0
  19. package/dist/cjs/sdk/index.js +4 -2
  20. package/dist/cjs/sdk/market/MarketRegister.js +116 -70
  21. package/dist/cjs/sdk/market/MarketSuite.js +0 -3
  22. package/dist/cjs/sdk/market/index.js +0 -2
  23. package/dist/cjs/sdk/market/pool/PoolSuite.js +0 -3
  24. package/dist/cjs/sdk/market/pool/PoolV310Contract.js +2 -11
  25. package/dist/cjs/sdk/market/pool/index.js +0 -2
  26. package/dist/cjs/sdk/market/pricefeeds/PriceFeedsRegister.js +10 -3
  27. package/dist/cjs/sdk/market/pricefeeds/updates/PythAccumulatorUpdateData.js +20 -23
  28. package/dist/cjs/sdk/market/pricefeeds/updates/PythUpdater.js +7 -4
  29. package/dist/cjs/sdk/market/pricefeeds/updates/RedstoneUpdater.js +4 -4
  30. package/dist/cjs/sdk/market/pricefeeds/updates/fetchPythPayloads.js +1 -1
  31. package/dist/cjs/sdk/market/pricefeeds/updates/index.js +3 -0
  32. package/dist/cjs/sdk/options.js +24 -52
  33. package/dist/cjs/sdk/plugins/BasePlugin.js +11 -4
  34. package/dist/cjs/sdk/pools/PoolService.js +12 -104
  35. package/dist/cjs/sdk/utils/formatter.js +99 -20
  36. package/dist/cjs/sdk/utils/viem/index.js +3 -3
  37. package/dist/cjs/sdk/utils/viem/watchBlocksAsync.js +76 -0
  38. package/dist/esm/dev/AccountOpener.js +6 -47
  39. package/dist/esm/dev/RevolverTransport.js +10 -4
  40. package/dist/esm/dev/index.js +0 -1
  41. package/dist/esm/dev/logSplitterTransport.js +10 -1
  42. package/dist/esm/permissionless/utils/create2.js +1 -1
  43. package/dist/esm/permissionless/utils/price-update/get-price-feeds.js +12 -6
  44. package/dist/esm/permissionless/utils/price-update/get-price-update-tx.js +13 -7
  45. package/dist/esm/permissionless/utils/price-update/get-prices.js +13 -7
  46. package/dist/esm/sdk/MultichainSDK.js +217 -0
  47. package/dist/esm/sdk/OnchainSDK.js +472 -0
  48. package/dist/esm/sdk/accounts/AbstractCreditAccountsService.js +17 -328
  49. package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +1 -7
  50. package/dist/esm/sdk/base/TokensMeta.js +44 -22
  51. package/dist/esm/sdk/base/token-types.js +0 -6
  52. package/dist/esm/sdk/chain/chains.js +1 -2
  53. package/dist/esm/sdk/constants/address-provider.js +0 -2
  54. package/dist/esm/sdk/core/errors.js +48 -0
  55. package/dist/esm/sdk/core/index.js +1 -0
  56. package/dist/esm/sdk/index.js +2 -1
  57. package/dist/esm/sdk/market/MarketRegister.js +118 -74
  58. package/dist/esm/sdk/market/MarketSuite.js +0 -3
  59. package/dist/esm/sdk/market/index.js +0 -1
  60. package/dist/esm/sdk/market/pool/PoolSuite.js +0 -3
  61. package/dist/esm/sdk/market/pool/PoolV310Contract.js +2 -11
  62. package/dist/esm/sdk/market/pool/index.js +0 -1
  63. package/dist/esm/sdk/market/pricefeeds/PriceFeedsRegister.js +10 -3
  64. package/dist/esm/sdk/market/pricefeeds/updates/PythAccumulatorUpdateData.js +20 -13
  65. package/dist/esm/sdk/market/pricefeeds/updates/PythUpdater.js +7 -4
  66. package/dist/esm/sdk/market/pricefeeds/updates/RedstoneUpdater.js +4 -4
  67. package/dist/esm/sdk/market/pricefeeds/updates/fetchPythPayloads.js +1 -1
  68. package/dist/esm/sdk/market/pricefeeds/updates/index.js +2 -0
  69. package/dist/esm/sdk/options.js +22 -51
  70. package/dist/esm/sdk/plugins/BasePlugin.js +11 -4
  71. package/dist/esm/sdk/pools/PoolService.js +13 -109
  72. package/dist/esm/sdk/utils/formatter.js +99 -10
  73. package/dist/esm/sdk/utils/viem/index.js +1 -1
  74. package/dist/esm/sdk/utils/viem/watchBlocksAsync.js +52 -0
  75. package/dist/types/dev/RevolverTransport.d.ts +2 -1
  76. package/dist/types/dev/calcLiquidatableLTs.d.ts +2 -2
  77. package/dist/types/dev/claimFromFaucet.d.ts +2 -2
  78. package/dist/types/dev/create2.d.ts +3 -4
  79. package/dist/types/dev/index.d.ts +0 -1
  80. package/dist/types/dev/logSplitterTransport.d.ts +3 -1
  81. package/dist/types/dev/migrateFaucet.d.ts +2 -2
  82. package/dist/types/dev/mint/AbstractMinter.d.ts +2 -2
  83. package/dist/types/dev/mint/FallbackMinter.d.ts +2 -2
  84. package/dist/types/dev/mint/factory.d.ts +2 -2
  85. package/dist/types/dev/replaceStorage.d.ts +1 -1
  86. package/dist/types/permissionless/utils/price-update/get-updatable-feeds.d.ts +2 -2
  87. package/dist/types/plugins/accounts/AccountsPlugin.d.ts +2 -2
  88. package/dist/types/plugins/accounts-counter/AccountsCounterPlugin.d.ts +2 -2
  89. package/dist/types/plugins/adapters/AdaptersPlugin.d.ts +2 -2
  90. package/dist/types/plugins/apy/ApyPlugin.d.ts +2 -2
  91. package/dist/types/plugins/bots/BotsPlugin.d.ts +2 -2
  92. package/dist/types/plugins/bots/PartialLiquidationBotV310Contract.d.ts +2 -2
  93. package/dist/types/plugins/degen-distributors/DegenDistributorsPlugin.d.ts +2 -2
  94. package/dist/types/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.d.ts +2 -2
  95. package/dist/types/sdk/MultichainSDK.d.ts +144 -0
  96. package/dist/types/sdk/OnchainSDK.d.ts +257 -0
  97. package/dist/types/sdk/accounts/AbstractCreditAccountsService.d.ts +4 -54
  98. package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +1 -1
  99. package/dist/types/sdk/accounts/createCreditAccountService.d.ts +2 -2
  100. package/dist/types/sdk/accounts/types.d.ts +15 -95
  101. package/dist/types/sdk/base/SDKConstruct.d.ts +4 -4
  102. package/dist/types/sdk/base/TokensMeta.d.ts +3 -14
  103. package/dist/types/sdk/base/token-types.d.ts +4 -44
  104. package/dist/types/sdk/base/types.d.ts +2 -116
  105. package/dist/types/sdk/chain/chains.d.ts +1 -5
  106. package/dist/types/sdk/constants/address-provider.d.ts +0 -1
  107. package/dist/types/sdk/core/createAddressProvider.d.ts +3 -3
  108. package/dist/types/sdk/core/errors.d.ts +51 -0
  109. package/dist/types/sdk/core/index.d.ts +1 -0
  110. package/dist/types/sdk/index.d.ts +2 -1
  111. package/dist/types/sdk/market/MarketRegister.d.ts +11 -8
  112. package/dist/types/sdk/market/MarketSuite.d.ts +2 -4
  113. package/dist/types/sdk/market/adapters/createAdapter.d.ts +2 -2
  114. package/dist/types/sdk/market/credit/CreditConfiguratorV310Contract.d.ts +3 -3
  115. package/dist/types/sdk/market/credit/CreditManagerV310Contract.d.ts +2 -2
  116. package/dist/types/sdk/market/credit/CreditSuite.d.ts +2 -2
  117. package/dist/types/sdk/market/credit/createCreditConfigurator.d.ts +2 -2
  118. package/dist/types/sdk/market/credit/createCreditFacade.d.ts +2 -2
  119. package/dist/types/sdk/market/credit/createCreditManager.d.ts +2 -2
  120. package/dist/types/sdk/market/credit/types.d.ts +1 -1
  121. package/dist/types/sdk/market/index.d.ts +0 -1
  122. package/dist/types/sdk/market/loss-policy/AliasLossPolicyV310Contract.d.ts +3 -3
  123. package/dist/types/sdk/market/loss-policy/createLossPolicy.d.ts +2 -2
  124. package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +5 -6
  125. package/dist/types/sdk/market/oracle/PriceOracleV310Contract.d.ts +2 -2
  126. package/dist/types/sdk/market/oracle/createPriceOracle.d.ts +2 -2
  127. package/dist/types/sdk/market/oracle/types.d.ts +10 -3
  128. package/dist/types/sdk/market/pool/PoolSuite.d.ts +2 -4
  129. package/dist/types/sdk/market/pool/PoolV310Contract.d.ts +2 -6
  130. package/dist/types/sdk/market/pool/createInterestRateModel.d.ts +2 -2
  131. package/dist/types/sdk/market/pool/createPool.d.ts +2 -2
  132. package/dist/types/sdk/market/pool/createPoolQuotaKeeper.d.ts +2 -2
  133. package/dist/types/sdk/market/pool/createRateKeeper.d.ts +2 -2
  134. package/dist/types/sdk/market/pool/index.d.ts +0 -1
  135. package/dist/types/sdk/market/pricefeeds/PriceFeedsRegister.d.ts +8 -3
  136. package/dist/types/sdk/market/pricefeeds/updates/PythAccumulatorUpdateData.d.ts +12 -13
  137. package/dist/types/sdk/market/pricefeeds/updates/PythUpdater.d.ts +8 -3
  138. package/dist/types/sdk/market/pricefeeds/updates/RedstoneUpdater.d.ts +8 -3
  139. package/dist/types/sdk/market/pricefeeds/updates/index.d.ts +1 -0
  140. package/dist/types/sdk/market/pricefeeds/updates/types.d.ts +4 -0
  141. package/dist/types/sdk/market/types.d.ts +1 -1
  142. package/dist/types/sdk/options.d.ts +15 -16
  143. package/dist/types/sdk/plugins/BasePlugin.d.ts +12 -6
  144. package/dist/types/sdk/plugins/errors.d.ts +2 -2
  145. package/dist/types/sdk/plugins/types.d.ts +16 -6
  146. package/dist/types/sdk/pools/PoolService.d.ts +8 -8
  147. package/dist/types/sdk/pools/types.d.ts +2 -3
  148. package/dist/types/sdk/router/AbstractRouterContract.d.ts +3 -3
  149. package/dist/types/sdk/router/RouterV310Contract.d.ts +2 -2
  150. package/dist/types/sdk/router/createRouter.d.ts +2 -2
  151. package/dist/types/sdk/router/helpers.d.ts +1 -1
  152. package/dist/types/sdk/types/state-human.d.ts +10 -2
  153. package/dist/types/sdk/types/state.d.ts +14 -8
  154. package/dist/types/sdk/utils/filterDust.d.ts +2 -2
  155. package/dist/types/sdk/utils/formatter.d.ts +1 -1
  156. package/dist/types/sdk/utils/isDust.d.ts +2 -2
  157. package/dist/types/sdk/utils/toAddress.d.ts +1 -1
  158. package/dist/types/sdk/utils/viem/getLogsPaginated.d.ts +1 -2
  159. package/dist/types/sdk/utils/viem/getLogsSafe.d.ts +1 -1
  160. package/dist/types/sdk/utils/viem/index.d.ts +1 -1
  161. package/dist/types/sdk/utils/viem/simulateWithPriceUpdates.d.ts +1 -2
  162. package/dist/types/sdk/utils/viem/watchBlocksAsync.d.ts +74 -0
  163. package/package.json +3 -6
  164. package/dist/cjs/abi/kyc/iDSRegistryService.js +0 -70
  165. package/dist/cjs/abi/kyc/iDSToken.js +0 -71
  166. package/dist/cjs/abi/kyc/iKYCCompressor.js +0 -196
  167. package/dist/cjs/abi/kyc/iKYCFactory.js +0 -122
  168. package/dist/cjs/abi/kyc/iKYCUnderlying.js +0 -401
  169. package/dist/cjs/abi/kyc/iSecuritizeDegenNFT.js +0 -326
  170. package/dist/cjs/abi/kyc/iSecuritizeKYCFactory.js +0 -319
  171. package/dist/cjs/dev/CachedStateSubscriber.js +0 -78
  172. package/dist/cjs/sdk/GearboxSDK.js +0 -696
  173. package/dist/cjs/sdk/market/kyc/KYCRegistry.js +0 -269
  174. package/dist/cjs/sdk/market/kyc/index.js +0 -26
  175. package/dist/cjs/sdk/market/kyc/securitize/SecuritizeKYCFactory.js +0 -244
  176. package/dist/cjs/sdk/market/kyc/securitize/constants.js +0 -28
  177. package/dist/cjs/sdk/market/kyc/securitize/index.js +0 -26
  178. package/dist/cjs/sdk/market/kyc/securitize/types.js +0 -16
  179. package/dist/cjs/sdk/market/kyc/types.js +0 -34
  180. package/dist/cjs/sdk/utils/viem/executeDelegatedMulticalls.js +0 -38
  181. package/dist/esm/abi/kyc/iDSRegistryService.js +0 -46
  182. package/dist/esm/abi/kyc/iDSToken.js +0 -47
  183. package/dist/esm/abi/kyc/iKYCCompressor.js +0 -172
  184. package/dist/esm/abi/kyc/iKYCFactory.js +0 -98
  185. package/dist/esm/abi/kyc/iKYCUnderlying.js +0 -377
  186. package/dist/esm/abi/kyc/iSecuritizeDegenNFT.js +0 -302
  187. package/dist/esm/abi/kyc/iSecuritizeKYCFactory.js +0 -295
  188. package/dist/esm/dev/CachedStateSubscriber.js +0 -54
  189. package/dist/esm/sdk/GearboxSDK.js +0 -689
  190. package/dist/esm/sdk/market/kyc/KYCRegistry.js +0 -253
  191. package/dist/esm/sdk/market/kyc/index.js +0 -3
  192. package/dist/esm/sdk/market/kyc/securitize/SecuritizeKYCFactory.js +0 -220
  193. package/dist/esm/sdk/market/kyc/securitize/constants.js +0 -4
  194. package/dist/esm/sdk/market/kyc/securitize/index.js +0 -3
  195. package/dist/esm/sdk/market/kyc/securitize/types.js +0 -0
  196. package/dist/esm/sdk/market/kyc/types.js +0 -9
  197. package/dist/esm/sdk/utils/viem/executeDelegatedMulticalls.js +0 -14
  198. package/dist/types/abi/kyc/iDSRegistryService.d.ts +0 -71
  199. package/dist/types/abi/kyc/iDSToken.d.ts +0 -67
  200. package/dist/types/abi/kyc/iKYCCompressor.d.ts +0 -228
  201. package/dist/types/abi/kyc/iKYCFactory.d.ts +0 -139
  202. package/dist/types/abi/kyc/iKYCUnderlying.d.ts +0 -548
  203. package/dist/types/abi/kyc/iSecuritizeDegenNFT.d.ts +0 -404
  204. package/dist/types/abi/kyc/iSecuritizeKYCFactory.d.ts +0 -376
  205. package/dist/types/dev/CachedStateSubscriber.d.ts +0 -21
  206. package/dist/types/sdk/GearboxSDK.d.ts +0 -324
  207. package/dist/types/sdk/market/kyc/KYCRegistry.d.ts +0 -52
  208. package/dist/types/sdk/market/kyc/index.d.ts +0 -3
  209. package/dist/types/sdk/market/kyc/securitize/SecuritizeKYCFactory.d.ts +0 -428
  210. package/dist/types/sdk/market/kyc/securitize/constants.d.ts +0 -1
  211. package/dist/types/sdk/market/kyc/securitize/index.d.ts +0 -3
  212. package/dist/types/sdk/market/kyc/securitize/types.d.ts +0 -127
  213. package/dist/types/sdk/market/kyc/types.d.ts +0 -170
  214. package/dist/types/sdk/utils/viem/executeDelegatedMulticalls.d.ts +0 -28
@@ -1,7 +1,7 @@
1
1
  import type { Address } from "viem";
2
2
  import type { CreditSuiteState, MarketData } from "../../base/index.js";
3
3
  import { SDKConstruct } from "../../base/index.js";
4
- import type { GearboxSDK } from "../../GearboxSDK.js";
4
+ import type { OnchainSDK } from "../../OnchainSDK.js";
5
5
  import type { IRouterContract } from "../../router/index.js";
6
6
  import type { CreditSuiteStateHuman } from "../../types/index.js";
7
7
  import type { CreditFacadeContract, ICreditConfiguratorContract, ICreditManagerContract } from "./types.js";
@@ -14,7 +14,7 @@ export declare class CreditSuite extends SDKConstruct {
14
14
  readonly marketConfigurator: Address;
15
15
  readonly state: CreditSuiteState;
16
16
  readonly name: string;
17
- constructor(sdk: GearboxSDK, marketData: MarketData, index: number);
17
+ constructor(sdk: OnchainSDK, marketData: MarketData, index: number);
18
18
  get router(): IRouterContract;
19
19
  get isExpired(): boolean;
20
20
  get dirty(): boolean;
@@ -1,4 +1,4 @@
1
1
  import type { CreditSuiteState } from "../../base/index.js";
2
- import type { GearboxSDK } from "../../GearboxSDK.js";
2
+ import type { OnchainSDK } from "../../OnchainSDK.js";
3
3
  import type { ICreditConfiguratorContract } from "./types.js";
4
- export default function createCreditConfigurator(sdk: GearboxSDK, data: CreditSuiteState): ICreditConfiguratorContract;
4
+ export default function createCreditConfigurator(sdk: OnchainSDK, data: CreditSuiteState): ICreditConfiguratorContract;
@@ -1,4 +1,4 @@
1
1
  import type { CreditSuiteState } from "../../base/index.js";
2
- import type { GearboxSDK } from "../../GearboxSDK.js";
2
+ import type { OnchainSDK } from "../../OnchainSDK.js";
3
3
  import type { CreditFacadeContract } from "./types.js";
4
- export default function createCreditFacade(sdk: GearboxSDK, data: CreditSuiteState): CreditFacadeContract;
4
+ export default function createCreditFacade(sdk: OnchainSDK, data: CreditSuiteState): CreditFacadeContract;
@@ -1,4 +1,4 @@
1
1
  import type { CreditSuiteState } from "../../base/index.js";
2
- import type { GearboxSDK } from "../../GearboxSDK.js";
2
+ import type { OnchainSDK } from "../../OnchainSDK.js";
3
3
  import type { ICreditManagerContract } from "./types.js";
4
- export default function createCreditManager(sdk: GearboxSDK, data: CreditSuiteState): ICreditManagerContract;
4
+ export default function createCreditManager(sdk: OnchainSDK, data: CreditSuiteState): ICreditManagerContract;
@@ -1,4 +1,4 @@
1
- import type { Address } from "abitype";
1
+ import type { Address } from "viem";
2
2
  import type { CreditManagerState, IBaseContract } from "../../base/index.js";
3
3
  import type { CreditConfiguratorStateHuman, CreditManagerStateHuman } from "../../types/index.js";
4
4
  import type { AddressMap } from "../../utils/index.js";
@@ -1,6 +1,5 @@
1
1
  export * from "./adapters/index.js";
2
2
  export * from "./credit/index.js";
3
- export * from "./kyc/index.js";
4
3
  export * from "./MarketRegister.js";
5
4
  export * from "./MarketSuite.js";
6
5
  export * from "./oracle/index.js";
@@ -1,6 +1,6 @@
1
1
  import { type Address, type Hex } from "viem";
2
2
  import { BaseContract, type BaseParams } from "../../base/index.js";
3
- import type { GearboxSDK } from "../../GearboxSDK.js";
3
+ import type { OnchainSDK } from "../../OnchainSDK.js";
4
4
  import type { AliasLossPolicyStateHuman } from "../../types/state-human.js";
5
5
  import type { ILossPolicyContract } from "./types.js";
6
6
  declare const abi: readonly [{
@@ -285,8 +285,8 @@ export declare class AliasLossPolicyV310Contract extends BaseContract<abi> imple
285
285
  readonly checksEnabled: boolean;
286
286
  readonly tokens: readonly Address[];
287
287
  readonly priceFeedParams: readonly AliasedPriceFeedParams[];
288
- readonly sdk: GearboxSDK;
289
- constructor(sdk: GearboxSDK, params: BaseParams);
288
+ readonly sdk: OnchainSDK;
289
+ constructor(sdk: OnchainSDK, params: BaseParams);
290
290
  getLiquidationData(creditAccount: Address, blockNumber?: bigint): Promise<Hex | undefined>;
291
291
  stateHuman(raw?: boolean): AliasLossPolicyStateHuman;
292
292
  }
@@ -1,4 +1,4 @@
1
1
  import type { BaseState } from "../../base/index.js";
2
- import type { GearboxSDK } from "../../GearboxSDK.js";
2
+ import type { OnchainSDK } from "../../OnchainSDK.js";
3
3
  import type { ILossPolicyContract } from "./types.js";
4
- export declare function createLossPolicy(sdk: GearboxSDK, { baseParams }: BaseState): ILossPolicyContract;
4
+ export declare function createLossPolicy(sdk: OnchainSDK, { baseParams }: BaseState): ILossPolicyContract;
@@ -2,14 +2,13 @@ import type { Abi, Address } from "viem";
2
2
  import type { BaseContractArgs } from "../../base/BaseContract.js";
3
3
  import type { PriceOracleData } from "../../base/index.js";
4
4
  import { BaseContract } from "../../base/index.js";
5
- import type { GearboxSDK } from "../../GearboxSDK.js";
5
+ import type { OnchainSDK } from "../../OnchainSDK.js";
6
6
  import type { PriceOracleStateHuman } from "../../types/index.js";
7
7
  import { AddressMap } from "../../utils/index.js";
8
- import type { DelegatedMulticall } from "../../utils/viem/index.js";
9
8
  import type { IPriceFeedContract, UpdatePriceFeedsResult } from "../pricefeeds/index.js";
10
9
  import { PriceFeedRef } from "../pricefeeds/index.js";
11
10
  import PriceFeedAnswerMap from "./PriceFeedAnswerMap.js";
12
- import type { IPriceOracleContract, OnDemandPriceUpdates, PriceFeedsForTokensOptions } from "./types.js";
11
+ import type { DelegatedOracleMulticall, IPriceOracleContract, OnDemandPriceUpdates, PriceFeedsForTokensOptions } from "./types.js";
13
12
  /**
14
13
  * Base implementation of the Gearbox price oracle.
15
14
  *
@@ -21,7 +20,7 @@ import type { IPriceOracleContract, OnDemandPriceUpdates, PriceFeedsForTokensOpt
21
20
  **/
22
21
  export declare abstract class PriceOracleBaseContract<abi extends Abi | readonly unknown[]> extends BaseContract<abi> implements IPriceOracleContract {
23
22
  #private;
24
- readonly sdk: GearboxSDK;
23
+ readonly sdk: OnchainSDK;
25
24
  /**
26
25
  * {@inheritDoc IPriceOracleContract.mainPriceFeeds}
27
26
  **/
@@ -38,7 +37,7 @@ export declare abstract class PriceOracleBaseContract<abi extends Abi | readonly
38
37
  * {@inheritDoc IPriceOracleContract.reservePrices}
39
38
  **/
40
39
  readonly reservePrices: PriceFeedAnswerMap;
41
- constructor(sdk: GearboxSDK, args: BaseContractArgs<abi>, data: PriceOracleData);
40
+ constructor(sdk: OnchainSDK, args: BaseContractArgs<abi>, data: PriceOracleData);
42
41
  /**
43
42
  * {@inheritDoc IPriceOracleContract.priceFeedsForTokens}
44
43
  **/
@@ -75,7 +74,7 @@ export declare abstract class PriceOracleBaseContract<abi extends Abi | readonly
75
74
  /**
76
75
  * {@inheritDoc IPriceOracleContract.syncStateMulticall}
77
76
  **/
78
- syncStateMulticall(): DelegatedMulticall;
77
+ syncStateMulticall(): DelegatedOracleMulticall;
79
78
  /**
80
79
  * {@inheritDoc IPriceOracleContract.watchAddresses}
81
80
  **/
@@ -1,6 +1,6 @@
1
1
  import { type Address, type ContractEventName, type Log } from "viem";
2
2
  import type { PriceOracleData } from "../../base/index.js";
3
- import type { GearboxSDK } from "../../GearboxSDK.js";
3
+ import type { OnchainSDK } from "../../OnchainSDK.js";
4
4
  import { type UpdatePriceFeedsResult } from "../pricefeeds/index.js";
5
5
  import { PriceOracleBaseContract } from "./PriceOracleBaseContract.js";
6
6
  import type { OnDemandPriceUpdates } from "./types.js";
@@ -341,7 +341,7 @@ declare const abi: readonly [{
341
341
  }];
342
342
  type abi = typeof abi;
343
343
  export declare class PriceOracleV310Contract extends PriceOracleBaseContract<abi> {
344
- constructor(sdk: GearboxSDK, data: PriceOracleData);
344
+ constructor(sdk: OnchainSDK, data: PriceOracleData);
345
345
  /**
346
346
  * Converts previously obtained price updates into CreditFacade multicall entry
347
347
  * @param creditFacade
@@ -1,4 +1,4 @@
1
1
  import type { PriceOracleData } from "../../base/index.js";
2
- import type { GearboxSDK } from "../../GearboxSDK.js";
2
+ import type { OnchainSDK } from "../../OnchainSDK.js";
3
3
  import type { IPriceOracleContract } from "./types.js";
4
- export declare function createPriceOracle(sdk: GearboxSDK, data: PriceOracleData): IPriceOracleContract;
4
+ export declare function createPriceOracle(sdk: OnchainSDK, data: PriceOracleData): IPriceOracleContract;
@@ -1,8 +1,8 @@
1
- import type { Address } from "viem";
1
+ import type { Address, ContractFunctionParameters, ContractFunctionReturnType } from "viem";
2
+ import type { priceFeedCompressorAbi } from "../../../abi/compressors/priceFeedCompressor.js";
2
3
  import type { IBaseContract } from "../../base/index.js";
3
4
  import type { MultiCall, PriceOracleStateHuman } from "../../types/index.js";
4
5
  import type { AddressMap } from "../../utils/index.js";
5
- import type { DelegatedMulticall } from "../../utils/viem/index.js";
6
6
  import type { IPriceFeedContract, PriceFeedRef, PriceUpdate, UpdatePriceFeedsResult } from "../pricefeeds/index.js";
7
7
  import type PriceFeedAnswerMap from "./PriceFeedAnswerMap.js";
8
8
  /**
@@ -71,7 +71,7 @@ export interface IPriceOracleContract extends IBaseContract {
71
71
  /**
72
72
  * @internal
73
73
  **/
74
- syncStateMulticall: () => DelegatedMulticall;
74
+ syncStateMulticall: () => DelegatedOracleMulticall;
75
75
  /**
76
76
  * Checks whether the given price feed address appears anywhere in this
77
77
  * oracle's feed tree (including as a dependency of a composite feed,
@@ -124,3 +124,10 @@ export interface IPriceOracleContract extends IBaseContract {
124
124
  **/
125
125
  stateHuman: (raw?: boolean) => PriceOracleStateHuman;
126
126
  }
127
+ /**
128
+ * @internal
129
+ **/
130
+ export interface DelegatedOracleMulticall {
131
+ call: ContractFunctionParameters<typeof priceFeedCompressorAbi, "view", "getPriceOracleState">;
132
+ onResult: (resp: ContractFunctionReturnType<typeof priceFeedCompressorAbi, "view", "getPriceOracleState">) => void;
133
+ }
@@ -1,9 +1,8 @@
1
1
  import type { Address } from "viem";
2
2
  import type { MarketData } from "../../base/index.js";
3
3
  import { SDKConstruct } from "../../base/index.js";
4
- import type { GearboxSDK } from "../../GearboxSDK.js";
4
+ import type { OnchainSDK } from "../../OnchainSDK.js";
5
5
  import type { PoolSuiteStateHuman } from "../../types/index.js";
6
- import type { IKYCFactory } from "../kyc/types.js";
7
6
  import type { MarketConfiguratorContract } from "../MarketConfiguratorContract.js";
8
7
  import { GaugeContract } from "./GaugeContract.js";
9
8
  import { LinearInterestRateModelContract } from "./LinearInterestRateModelContract.js";
@@ -15,13 +14,12 @@ export declare class PoolSuite extends SDKConstruct {
15
14
  readonly pqk: PoolQuotaKeeperContract;
16
15
  readonly rateKeeper: IRateKeeperContract;
17
16
  readonly interestRateModel: IInterestRateModelContract;
18
- constructor(sdk: GearboxSDK, data: MarketData);
17
+ constructor(sdk: OnchainSDK, data: MarketData);
19
18
  get gauge(): GaugeContract;
20
19
  get tumbler(): TumblerContract;
21
20
  get linearModel(): LinearInterestRateModelContract;
22
21
  get marketConfigurator(): MarketConfiguratorContract;
23
22
  get underlying(): Address;
24
- get kycFactory(): IKYCFactory | undefined;
25
23
  get dirty(): boolean;
26
24
  get watchAddresses(): Set<Address>;
27
25
  stateHuman(raw?: boolean): PoolSuiteStateHuman;
@@ -1,10 +1,8 @@
1
1
  import type { ContractEventName, DecodeFunctionDataReturnType, Log } from "viem";
2
- import type { CreditManagerDebtParams, PoolState } from "../../base/index.js";
2
+ import type { ConstructOptions, CreditManagerDebtParams, PoolState } from "../../base/index.js";
3
3
  import { BaseContract } from "../../base/index.js";
4
- import type { GearboxSDK } from "../../GearboxSDK.js";
5
4
  import type { PoolStateHuman } from "../../types/index.js";
6
5
  import { AddressMap } from "../../utils/index.js";
7
- import type { IKYCFactory } from "../kyc/types.js";
8
6
  declare const abi: readonly [{
9
7
  readonly type: "function";
10
8
  readonly inputs: readonly [];
@@ -1132,10 +1130,8 @@ type abi = typeof abi;
1132
1130
  export interface PoolV310Contract extends Omit<PoolState, "baseParams" | "creditManagerDebtParams" | "name">, BaseContract<abi> {
1133
1131
  }
1134
1132
  export declare class PoolV310Contract extends BaseContract<abi> {
1135
- #private;
1136
1133
  readonly creditManagerDebtParams: AddressMap<CreditManagerDebtParams>;
1137
- constructor(sdk: GearboxSDK, data: PoolState);
1138
- get kycFactory(): IKYCFactory | undefined;
1134
+ constructor(options: ConstructOptions, data: PoolState);
1139
1135
  stateHuman(raw?: boolean): PoolStateHuman;
1140
1136
  processLog(log: Log<bigint, number, false, undefined, undefined, abi, ContractEventName<abi>>): void;
1141
1137
  protected stringifyFunctionParams(params: DecodeFunctionDataReturnType<abi>): string[];
@@ -1,4 +1,4 @@
1
1
  import type { BaseState } from "../../base/index.js";
2
- import type { GearboxSDK } from "../../GearboxSDK.js";
2
+ import type { OnchainSDK } from "../../OnchainSDK.js";
3
3
  import type { IInterestRateModelContract } from "./types.js";
4
- export default function createInterestRateModel(sdk: GearboxSDK, data: BaseState): IInterestRateModelContract;
4
+ export default function createInterestRateModel(sdk: OnchainSDK, data: BaseState): IInterestRateModelContract;
@@ -1,4 +1,4 @@
1
1
  import type { PoolState } from "../../base/index.js";
2
- import type { GearboxSDK } from "../../GearboxSDK.js";
2
+ import type { OnchainSDK } from "../../OnchainSDK.js";
3
3
  import type { PoolContract } from "./types.js";
4
- export default function createPool(sdk: GearboxSDK, data: PoolState): PoolContract;
4
+ export default function createPool(sdk: OnchainSDK, data: PoolState): PoolContract;
@@ -1,4 +1,4 @@
1
1
  import type { PoolState, QuotaKeeperState } from "../../base/index.js";
2
- import type { GearboxSDK } from "../../GearboxSDK.js";
2
+ import type { OnchainSDK } from "../../OnchainSDK.js";
3
3
  import type { PoolQuotaKeeperContract } from "./types.js";
4
- export default function createPoolQuotaKeeper(sdk: GearboxSDK, pool: PoolState, pqk: QuotaKeeperState): PoolQuotaKeeperContract;
4
+ export default function createPoolQuotaKeeper(sdk: OnchainSDK, pool: PoolState, pqk: QuotaKeeperState): PoolQuotaKeeperContract;
@@ -1,4 +1,4 @@
1
1
  import type { PoolState, RateKeeperState } from "../../base/index.js";
2
- import type { GearboxSDK } from "../../GearboxSDK.js";
2
+ import type { OnchainSDK } from "../../OnchainSDK.js";
3
3
  import type { IRateKeeperContract } from "./types.js";
4
- export default function createRateKeeper(sdk: GearboxSDK, pool: PoolState, data: RateKeeperState): IRateKeeperContract;
4
+ export default function createRateKeeper(sdk: OnchainSDK, pool: PoolState, data: RateKeeperState): IRateKeeperContract;
@@ -1,5 +1,4 @@
1
1
  export * from "./GaugeContract.js";
2
2
  export * from "./LinearInterestRateModelContract.js";
3
3
  export * from "./PoolSuite.js";
4
- export * from "./PoolV310Contract.js";
5
4
  export * from "./types.js";
@@ -1,7 +1,7 @@
1
1
  import { type Address, type BlockTag } from "viem";
2
2
  import type { PriceFeedTreeNode } from "../../base/index.js";
3
3
  import { SDKConstruct } from "../../base/index.js";
4
- import type { GearboxSDK } from "../../GearboxSDK.js";
4
+ import type { OnchainSDK } from "../../OnchainSDK.js";
5
5
  import type { RawTx } from "../../types/index.js";
6
6
  import type { IHooks } from "../../utils/internal/index.js";
7
7
  import { type PartialPriceFeedTreeNode } from "./AbstractPriceFeed.js";
@@ -50,7 +50,7 @@ export interface LatestUpdate {
50
50
  **/
51
51
  export declare class PriceFeedRegister extends SDKConstruct implements IHooks<PriceFeedRegisterHooks> {
52
52
  #private;
53
- constructor(sdk: GearboxSDK, opts?: PriceFeedRegisterOptions);
53
+ constructor(sdk: OnchainSDK, opts?: PriceFeedRegisterOptions);
54
54
  /**
55
55
  * @internal
56
56
  * Registers a callback for price-feed register lifecycle events.
@@ -152,7 +152,7 @@ export declare class PriceFeedRegister extends SDKConstruct implements IHooks<Pr
152
152
  * Loads PARTIAL information about all updatable price feeds from MarketCompressor
153
153
  * Discovered price feeds are not saved anywhere in PriceFeedRegister, and can later be used to load price feed updates
154
154
  */
155
- getPartialUpdatablePriceFeeds(configurators: Address[]): Promise<IPriceFeedContract[]>;
155
+ getPartialUpdatablePriceFeeds(configurators: Address[], pools?: Address[]): Promise<IPriceFeedContract[]>;
156
156
  /**
157
157
  * Instantiates the appropriate price feed contract wrapper based on
158
158
  * the `contractType` discriminator in the node's base params.
@@ -168,4 +168,9 @@ export declare class PriceFeedRegister extends SDKConstruct implements IHooks<Pr
168
168
  * `undefined` if no updates have been generated yet.
169
169
  **/
170
170
  get latestUpdate(): LatestUpdate | undefined;
171
+ /**
172
+ * @internal
173
+ * Returns true if any of the updaters are in historical mode
174
+ */
175
+ get historical(): boolean;
171
176
  }
@@ -2,7 +2,6 @@
2
2
  * This is https://github.com/pyth-network/pyth-crosschain/blob/main/price_service/sdk/js/src/AccumulatorUpdateData.ts
3
3
  * modified to use buffer from npm package
4
4
  */
5
- import BN from "bn.js";
6
5
  import { Buffer } from "buffer";
7
6
  export type AccumulatorUpdateData = {
8
7
  vaa: Buffer;
@@ -13,23 +12,23 @@ export type AccumulatorUpdateData = {
13
12
  };
14
13
  export type PriceFeedMessage = {
15
14
  feedId: Buffer;
16
- price: BN;
17
- confidence: BN;
15
+ price: bigint;
16
+ confidence: bigint;
18
17
  exponent: number;
19
- publishTime: BN;
20
- prevPublishTime: BN;
21
- emaPrice: BN;
22
- emaConf: BN;
18
+ publishTime: bigint;
19
+ prevPublishTime: bigint;
20
+ emaPrice: bigint;
21
+ emaConf: bigint;
23
22
  };
24
23
  export type TwapMessage = {
25
24
  feedId: Buffer;
26
- cumulativePrice: BN;
27
- cumulativeConf: BN;
28
- numDownSlots: BN;
25
+ cumulativePrice: bigint;
26
+ cumulativeConf: bigint;
27
+ numDownSlots: bigint;
29
28
  exponent: number;
30
- publishTime: BN;
31
- prevPublishTime: BN;
32
- publishSlot: BN;
29
+ publishTime: bigint;
30
+ prevPublishTime: bigint;
31
+ publishSlot: bigint;
33
32
  };
34
33
  export declare function isAccumulatorUpdateData(updateBytes: Buffer): boolean;
35
34
  export declare function parsePriceFeedMessage(message: Buffer): PriceFeedMessage;
@@ -1,7 +1,8 @@
1
1
  import { z } from "zod/v4";
2
2
  import { SDKConstruct } from "../../../base/index.js";
3
- import type { GearboxSDK } from "../../../GearboxSDK.js";
3
+ import type { OnchainSDK } from "../../../OnchainSDK.js";
4
4
  import type { IPriceFeedContract } from "../types.js";
5
+ import { PriceUpdatesCache } from "./PriceUpdatesCache.js";
5
6
  import { PriceUpdateTx } from "./PriceUpdateTx.js";
6
7
  import type { IPriceUpdater, IPriceUpdateTask } from "./types.js";
7
8
  export type PythUpdateTask = IPriceUpdateTask;
@@ -14,13 +15,17 @@ export declare const PythOptions: z.ZodObject<{
14
15
  cacheTTL: z.ZodOptional<z.ZodNumber>;
15
16
  failOnMissingFeeds: z.ZodOptional<z.ZodBoolean>;
16
17
  }, z.core.$strip>;
17
- export type PythOptions = z.infer<typeof PythOptions>;
18
+ export type PythOptions = z.infer<typeof PythOptions> & {
19
+ /** Shared cache injected by {@link MultichainSDK} to avoid redundant fetches. */
20
+ cache?: PriceUpdatesCache;
21
+ };
18
22
  /**
19
23
  * Class to update multiple pyth price feeds at once
20
24
  */
21
25
  export declare class PythUpdater extends SDKConstruct implements IPriceUpdater<PythUpdateTask> {
22
26
  #private;
23
- constructor(sdk: GearboxSDK, opts?: PythOptions);
27
+ constructor(sdk: OnchainSDK, opts?: PythOptions);
24
28
  getUpdateTxs(feeds: IPriceFeedContract[]): Promise<PythUpdateTx[]>;
29
+ get historical(): boolean;
25
30
  }
26
31
  export {};
@@ -1,7 +1,8 @@
1
1
  import { z } from "zod/v4";
2
2
  import { SDKConstruct } from "../../../base/index.js";
3
- import type { GearboxSDK } from "../../../GearboxSDK.js";
3
+ import type { OnchainSDK } from "../../../OnchainSDK.js";
4
4
  import type { IPriceFeedContract } from "../types.js";
5
+ import { PriceUpdatesCache } from "./PriceUpdatesCache.js";
5
6
  import { PriceUpdateTx } from "./PriceUpdateTx.js";
6
7
  import type { IPriceUpdater, IPriceUpdateTask } from "./types.js";
7
8
  interface RedstoneUpdateTask extends IPriceUpdateTask {
@@ -17,13 +18,17 @@ export declare const RedstoneOptions: z.ZodObject<{
17
18
  failOnMissingFeeds: z.ZodOptional<z.ZodBoolean>;
18
19
  enableLogging: z.ZodOptional<z.ZodBoolean>;
19
20
  }, z.core.$strip>;
20
- export type RedstoneOptions = z.infer<typeof RedstoneOptions>;
21
+ export type RedstoneOptions = z.infer<typeof RedstoneOptions> & {
22
+ /** Shared cache injected by {@link MultichainSDK} to avoid redundant fetches. */
23
+ cache?: PriceUpdatesCache;
24
+ };
21
25
  /**
22
26
  * Class to update multiple redstone price feeds at once
23
27
  */
24
28
  export declare class RedstoneUpdater extends SDKConstruct implements IPriceUpdater<RedstoneUpdateTask> {
25
29
  #private;
26
- constructor(sdk: GearboxSDK, opts?: RedstoneOptions);
30
+ constructor(sdk: OnchainSDK, opts?: RedstoneOptions);
27
31
  getUpdateTxs(feeds: IPriceFeedContract[]): Promise<RedstoneUpdateTx[]>;
32
+ get historical(): boolean;
28
33
  }
29
34
  export {};
@@ -1,5 +1,6 @@
1
1
  export * from "./fetchPythPayloads.js";
2
2
  export * from "./fetchRedstonePayloads.js";
3
+ export { PriceUpdatesCache } from "./PriceUpdatesCache.js";
3
4
  export { PythOptions, PythUpdater } from "./PythUpdater.js";
4
5
  export { RedstoneOptions, RedstoneUpdater } from "./RedstoneUpdater.js";
5
6
  export type * from "./types.js";
@@ -9,6 +9,10 @@ export interface IPriceUpdateTask {
9
9
  }
10
10
  export interface IPriceUpdater<T extends IPriceUpdateTask = IPriceUpdateTask> {
11
11
  getUpdateTxs: (feeds: IPriceFeedContract[]) => Promise<IPriceUpdateTx<T>[]>;
12
+ /**
13
+ * Returns true if the updater is in historical mode
14
+ */
15
+ historical: boolean;
12
16
  }
13
17
  export interface TimestampedCalldata {
14
18
  dataFeedId: string;
@@ -5,6 +5,6 @@ import type { Unarray } from "../base/index.js";
5
5
  type CompressorZapperData = Unarray<AbiParametersToPrimitiveTypes<ExtractAbiFunction<typeof peripheryCompressorAbi, "getZappers">["outputs"]>>;
6
6
  export interface ZapperData extends CompressorZapperData {
7
7
  pool: Address;
8
- type: "migration" | "kyc" | "base";
8
+ type: "migration" | "base";
9
9
  }
10
10
  export {};
@@ -2,18 +2,23 @@ import { z } from "zod/v4";
2
2
  import type { PluginsMap } from "./plugins/index.js";
3
3
  import type { ILogger } from "./types/index.js";
4
4
  /**
5
- * Zod schema for validating {@link SDKOptions} at runtime.
5
+ * Zod schema for validating {@link OnchainSDKOptions} at runtime.
6
6
  **/
7
- export declare const SDKOptions: z.ZodObject<{
7
+ export declare const OnchainSDKOptionsSchema: z.ZodObject<{
8
+ strictContractTypes: z.ZodOptional<z.ZodBoolean>;
9
+ plugins: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
10
+ logger: z.ZodAny;
11
+ gasLimit: z.ZodOptional<z.ZodNullable<z.ZodBigInt>>;
12
+ }, z.core.$strip>;
13
+ /**
14
+ * Zod schema for validating {@link AttachOptions} at runtime.
15
+ **/
16
+ export declare const AttachOptionsSchema: z.ZodObject<{
8
17
  addressProvider: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
9
18
  marketConfigurators: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
10
- kycFactories: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
11
19
  blockNumber: z.ZodOptional<z.ZodUnion<readonly [z.ZodBigInt, z.ZodNumber]>>;
12
20
  ignoreUpdateablePrices: z.ZodOptional<z.ZodBoolean>;
13
21
  ignoreMarkets: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
14
- strictContractTypes: z.ZodOptional<z.ZodBoolean>;
15
- plugins: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
16
- logger: z.ZodAny;
17
22
  redstone: z.ZodOptional<z.ZodObject<{
18
23
  historicTimestamp: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<true>]>>;
19
24
  gateways: z.ZodOptional<z.ZodArray<z.ZodURL>>;
@@ -27,21 +32,15 @@ export declare const SDKOptions: z.ZodObject<{
27
32
  cacheTTL: z.ZodOptional<z.ZodNumber>;
28
33
  failOnMissingFeeds: z.ZodOptional<z.ZodBoolean>;
29
34
  }, z.core.$strip>>;
30
- gasLimit: z.ZodOptional<z.ZodNullable<z.ZodBigInt>>;
31
35
  }, z.core.$strip>;
32
36
  /**
33
- * Configuration options accepted by {@link GearboxSDK.attach} and related
34
- * factory methods.
37
+ * SDK constructor options type.
35
38
  *
36
39
  * @typeParam Plugins - Map of plugin names to plugin instances.
37
40
  **/
38
- export type SDKOptions<Plugins extends PluginsMap> = Omit<z.infer<typeof SDKOptions>, "logger" | "plugins"> & {
39
- /**
40
- * Plugins that extend SDK functionality.
41
- **/
41
+ export type SDKOptions<Plugins extends PluginsMap> = Omit<z.infer<typeof OnchainSDKOptionsSchema>, "logger" | "plugins"> & {
42
+ /** Plugins that extend SDK functionality. */
42
43
  plugins?: Plugins;
43
- /**
44
- * Custom logger implementation.
45
- **/
44
+ /** Custom logger implementation. */
46
45
  logger?: ILogger;
47
46
  };
@@ -1,9 +1,9 @@
1
1
  import type { Address, PublicClient } from "viem";
2
2
  import type { NetworkType } from "../chain/index.js";
3
- import type { GearboxSDK } from "../GearboxSDK.js";
4
3
  import type { ILogger } from "../index.js";
4
+ import type { OnchainSDK } from "../OnchainSDK.js";
5
5
  /**
6
- * Convenience base class for {@link IGearboxSDKPlugin} implementations.
6
+ * Convenience base class for {@link IOnchainSDKPlugin} implementations.
7
7
  *
8
8
  * Handles the SDK attachment lifecycle, logger setup, and provides
9
9
  * common accessors (`network`, `client`). Subclasses only need to
@@ -29,14 +29,20 @@ export declare abstract class BasePlugin<TState extends Record<keyof TState, unk
29
29
  * Reference to the parent SDK instance.
30
30
  * @throws Error if the SDK has not been attached yet.
31
31
  **/
32
- get sdk(): GearboxSDK<any>;
33
- set sdk(sdk: GearboxSDK<any>);
32
+ get sdk(): OnchainSDK<any>;
34
33
  /**
35
- * {@inheritDoc IGearboxSDKPlugin.attach}
34
+ * @internal
35
+ * Set the SDK instance. Called by the SDK constructor.
36
+ * @param sdk - The SDK instance.
37
+ * @throws Error if the SDK is already attached.
38
+ */
39
+ set sdk(sdk: OnchainSDK<any>);
40
+ /**
41
+ * {@inheritDoc IOnchainSDKPlugin.attach}
36
42
  **/
37
43
  attach(): Promise<void>;
38
44
  /**
39
- * {@inheritDoc IGearboxSDKPlugin.syncState}
45
+ * {@inheritDoc IOnchainSDKPlugin.syncState}
40
46
  **/
41
47
  syncState(): Promise<void>;
42
48
  /**
@@ -1,4 +1,4 @@
1
- import type { IGearboxSDKPlugin, IPluginState } from "./types.js";
1
+ import type { IOnchainSDKPlugin, IPluginState } from "./types.js";
2
2
  export declare class PluginStateVersionError<TState extends IPluginState> extends Error {
3
- constructor(plugin: IGearboxSDKPlugin<TState>, state: TState);
3
+ constructor(plugin: IOnchainSDKPlugin<TState>, state: TState);
4
4
  }
@@ -1,5 +1,5 @@
1
1
  import type { BaseState, IBaseContract } from "../base/index.js";
2
- import type { GearboxSDK } from "../GearboxSDK.js";
2
+ import type { OnchainSDK } from "../OnchainSDK.js";
3
3
  /**
4
4
  * Serialisable snapshot of a plugin's state, used for hydration.
5
5
  *
@@ -22,7 +22,7 @@ export type IPluginState<State extends Record<keyof State, unknown> = {}> = {
22
22
  * @typeParam TState - Plugin-specific state shape.
23
23
  * @typeParam TPlugin - Concrete plugin type produced by the constructor.
24
24
  **/
25
- export type IGearboxSDKPluginConstructor<TState extends Record<keyof TState, unknown>, TPlugin extends IGearboxSDKPlugin<TState>> = new (sdk: GearboxSDK<any>) => TPlugin;
25
+ export type IOnchainSDKPluginConstructor<TState extends Record<keyof TState, unknown>, TPlugin extends IOnchainSDKPlugin<TState>> = new (sdk: OnchainSDK<any>) => TPlugin;
26
26
  /**
27
27
  * Public contract every SDK plugin must satisfy.
28
28
  *
@@ -32,12 +32,12 @@ export type IGearboxSDKPluginConstructor<TState extends Record<keyof TState, unk
32
32
  *
33
33
  * @typeParam TState - Plugin-specific state shape.
34
34
  **/
35
- export interface IGearboxSDKPlugin<TState extends Record<keyof TState, unknown> = {}> {
35
+ export interface IOnchainSDKPlugin<TState extends Record<keyof TState, unknown> = {}> {
36
36
  /**
37
37
  * Reference to the parent SDK instance.
38
38
  * Set automatically by the SDK constructor.
39
39
  **/
40
- sdk: GearboxSDK<any>;
40
+ sdk: OnchainSDK<any>;
41
41
  /**
42
42
  * Plugin version, used to verify state compatibility during hydration.
43
43
  **/
@@ -98,12 +98,12 @@ export interface IGearboxSDKPlugin<TState extends Record<keyof TState, unknown>
98
98
  /**
99
99
  * Helper type that extracts the state type from a plugin instance.
100
100
  **/
101
- export type PluginState<T> = T extends IGearboxSDKPlugin<infer TState> ? IPluginState<TState> : never;
101
+ export type PluginState<T> = T extends IOnchainSDKPlugin<infer TState> ? IPluginState<TState> : never;
102
102
  /**
103
103
  * @internal
104
104
  * Mapping between plugin name and plugin instance.
105
105
  **/
106
- export type PluginsMap = Record<string, IGearboxSDKPlugin<any>>;
106
+ export type PluginsMap = Record<string, IOnchainSDKPlugin<any>>;
107
107
  /**
108
108
  * @internal
109
109
  * Mapping that infers plugin states from plugin instances.
@@ -111,3 +111,13 @@ export type PluginsMap = Record<string, IGearboxSDKPlugin<any>>;
111
111
  export type PluginStatesMap<T extends PluginsMap> = {
112
112
  [K in keyof T]: PluginState<T[K]>;
113
113
  };
114
+ /**
115
+ * Factory function that produces a plugin instance.
116
+ **/
117
+ export type PluginFactory<P extends IOnchainSDKPlugin> = () => P;
118
+ /**
119
+ * Map of plugin factories keyed by plugin name.
120
+ **/
121
+ export type PluginFactoriesMap<Plugins extends PluginsMap> = {
122
+ [K in keyof Plugins]: PluginFactory<Plugins[K]>;
123
+ };