@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.
- package/dist/cjs/dev/AccountOpener.js +5 -45
- package/dist/cjs/dev/RevolverTransport.js +10 -4
- package/dist/cjs/dev/index.js +0 -2
- package/dist/cjs/dev/logSplitterTransport.js +10 -1
- package/dist/cjs/permissionless/utils/create2.js +2 -2
- package/dist/cjs/permissionless/utils/price-update/get-price-feeds.js +11 -5
- package/dist/cjs/permissionless/utils/price-update/get-price-update-tx.js +11 -5
- package/dist/cjs/permissionless/utils/price-update/get-prices.js +12 -6
- package/dist/cjs/sdk/MultichainSDK.js +232 -0
- package/dist/cjs/sdk/OnchainSDK.js +478 -0
- package/dist/cjs/sdk/accounts/AbstractCreditAccountsService.js +16 -324
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +1 -7
- package/dist/cjs/sdk/base/TokensMeta.js +42 -22
- package/dist/cjs/sdk/base/token-types.js +0 -9
- package/dist/cjs/sdk/chain/chains.js +1 -2
- package/dist/cjs/sdk/constants/address-provider.js +0 -3
- package/dist/cjs/sdk/core/errors.js +77 -0
- package/dist/cjs/sdk/core/index.js +2 -0
- package/dist/cjs/sdk/index.js +4 -2
- package/dist/cjs/sdk/market/MarketRegister.js +116 -70
- package/dist/cjs/sdk/market/MarketSuite.js +0 -3
- package/dist/cjs/sdk/market/index.js +0 -2
- package/dist/cjs/sdk/market/pool/PoolSuite.js +0 -3
- package/dist/cjs/sdk/market/pool/PoolV310Contract.js +2 -11
- package/dist/cjs/sdk/market/pool/index.js +0 -2
- package/dist/cjs/sdk/market/pricefeeds/PriceFeedsRegister.js +10 -3
- package/dist/cjs/sdk/market/pricefeeds/updates/PythAccumulatorUpdateData.js +20 -23
- package/dist/cjs/sdk/market/pricefeeds/updates/PythUpdater.js +7 -4
- package/dist/cjs/sdk/market/pricefeeds/updates/RedstoneUpdater.js +4 -4
- package/dist/cjs/sdk/market/pricefeeds/updates/fetchPythPayloads.js +1 -1
- package/dist/cjs/sdk/market/pricefeeds/updates/index.js +3 -0
- package/dist/cjs/sdk/options.js +24 -52
- package/dist/cjs/sdk/plugins/BasePlugin.js +11 -4
- package/dist/cjs/sdk/pools/PoolService.js +12 -104
- package/dist/cjs/sdk/utils/formatter.js +99 -20
- package/dist/cjs/sdk/utils/viem/index.js +3 -3
- package/dist/cjs/sdk/utils/viem/watchBlocksAsync.js +76 -0
- package/dist/esm/dev/AccountOpener.js +6 -47
- package/dist/esm/dev/RevolverTransport.js +10 -4
- package/dist/esm/dev/index.js +0 -1
- package/dist/esm/dev/logSplitterTransport.js +10 -1
- package/dist/esm/permissionless/utils/create2.js +1 -1
- package/dist/esm/permissionless/utils/price-update/get-price-feeds.js +12 -6
- package/dist/esm/permissionless/utils/price-update/get-price-update-tx.js +13 -7
- package/dist/esm/permissionless/utils/price-update/get-prices.js +13 -7
- package/dist/esm/sdk/MultichainSDK.js +217 -0
- package/dist/esm/sdk/OnchainSDK.js +472 -0
- package/dist/esm/sdk/accounts/AbstractCreditAccountsService.js +17 -328
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +1 -7
- package/dist/esm/sdk/base/TokensMeta.js +44 -22
- package/dist/esm/sdk/base/token-types.js +0 -6
- package/dist/esm/sdk/chain/chains.js +1 -2
- package/dist/esm/sdk/constants/address-provider.js +0 -2
- package/dist/esm/sdk/core/errors.js +48 -0
- package/dist/esm/sdk/core/index.js +1 -0
- package/dist/esm/sdk/index.js +2 -1
- package/dist/esm/sdk/market/MarketRegister.js +118 -74
- package/dist/esm/sdk/market/MarketSuite.js +0 -3
- package/dist/esm/sdk/market/index.js +0 -1
- package/dist/esm/sdk/market/pool/PoolSuite.js +0 -3
- package/dist/esm/sdk/market/pool/PoolV310Contract.js +2 -11
- package/dist/esm/sdk/market/pool/index.js +0 -1
- package/dist/esm/sdk/market/pricefeeds/PriceFeedsRegister.js +10 -3
- package/dist/esm/sdk/market/pricefeeds/updates/PythAccumulatorUpdateData.js +20 -13
- package/dist/esm/sdk/market/pricefeeds/updates/PythUpdater.js +7 -4
- package/dist/esm/sdk/market/pricefeeds/updates/RedstoneUpdater.js +4 -4
- package/dist/esm/sdk/market/pricefeeds/updates/fetchPythPayloads.js +1 -1
- package/dist/esm/sdk/market/pricefeeds/updates/index.js +2 -0
- package/dist/esm/sdk/options.js +22 -51
- package/dist/esm/sdk/plugins/BasePlugin.js +11 -4
- package/dist/esm/sdk/pools/PoolService.js +13 -109
- package/dist/esm/sdk/utils/formatter.js +99 -10
- package/dist/esm/sdk/utils/viem/index.js +1 -1
- package/dist/esm/sdk/utils/viem/watchBlocksAsync.js +52 -0
- package/dist/types/dev/RevolverTransport.d.ts +2 -1
- package/dist/types/dev/calcLiquidatableLTs.d.ts +2 -2
- package/dist/types/dev/claimFromFaucet.d.ts +2 -2
- package/dist/types/dev/create2.d.ts +3 -4
- package/dist/types/dev/index.d.ts +0 -1
- package/dist/types/dev/logSplitterTransport.d.ts +3 -1
- package/dist/types/dev/migrateFaucet.d.ts +2 -2
- package/dist/types/dev/mint/AbstractMinter.d.ts +2 -2
- package/dist/types/dev/mint/FallbackMinter.d.ts +2 -2
- package/dist/types/dev/mint/factory.d.ts +2 -2
- package/dist/types/dev/replaceStorage.d.ts +1 -1
- package/dist/types/permissionless/utils/price-update/get-updatable-feeds.d.ts +2 -2
- package/dist/types/plugins/accounts/AccountsPlugin.d.ts +2 -2
- package/dist/types/plugins/accounts-counter/AccountsCounterPlugin.d.ts +2 -2
- package/dist/types/plugins/adapters/AdaptersPlugin.d.ts +2 -2
- package/dist/types/plugins/apy/ApyPlugin.d.ts +2 -2
- package/dist/types/plugins/bots/BotsPlugin.d.ts +2 -2
- package/dist/types/plugins/bots/PartialLiquidationBotV310Contract.d.ts +2 -2
- package/dist/types/plugins/degen-distributors/DegenDistributorsPlugin.d.ts +2 -2
- package/dist/types/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.d.ts +2 -2
- package/dist/types/sdk/MultichainSDK.d.ts +144 -0
- package/dist/types/sdk/OnchainSDK.d.ts +257 -0
- package/dist/types/sdk/accounts/AbstractCreditAccountsService.d.ts +4 -54
- package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +1 -1
- package/dist/types/sdk/accounts/createCreditAccountService.d.ts +2 -2
- package/dist/types/sdk/accounts/types.d.ts +15 -95
- package/dist/types/sdk/base/SDKConstruct.d.ts +4 -4
- package/dist/types/sdk/base/TokensMeta.d.ts +3 -14
- package/dist/types/sdk/base/token-types.d.ts +4 -44
- package/dist/types/sdk/base/types.d.ts +2 -116
- package/dist/types/sdk/chain/chains.d.ts +1 -5
- package/dist/types/sdk/constants/address-provider.d.ts +0 -1
- package/dist/types/sdk/core/createAddressProvider.d.ts +3 -3
- package/dist/types/sdk/core/errors.d.ts +51 -0
- package/dist/types/sdk/core/index.d.ts +1 -0
- package/dist/types/sdk/index.d.ts +2 -1
- package/dist/types/sdk/market/MarketRegister.d.ts +11 -8
- package/dist/types/sdk/market/MarketSuite.d.ts +2 -4
- package/dist/types/sdk/market/adapters/createAdapter.d.ts +2 -2
- package/dist/types/sdk/market/credit/CreditConfiguratorV310Contract.d.ts +3 -3
- package/dist/types/sdk/market/credit/CreditManagerV310Contract.d.ts +2 -2
- package/dist/types/sdk/market/credit/CreditSuite.d.ts +2 -2
- package/dist/types/sdk/market/credit/createCreditConfigurator.d.ts +2 -2
- package/dist/types/sdk/market/credit/createCreditFacade.d.ts +2 -2
- package/dist/types/sdk/market/credit/createCreditManager.d.ts +2 -2
- package/dist/types/sdk/market/credit/types.d.ts +1 -1
- package/dist/types/sdk/market/index.d.ts +0 -1
- package/dist/types/sdk/market/loss-policy/AliasLossPolicyV310Contract.d.ts +3 -3
- package/dist/types/sdk/market/loss-policy/createLossPolicy.d.ts +2 -2
- package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +5 -6
- package/dist/types/sdk/market/oracle/PriceOracleV310Contract.d.ts +2 -2
- package/dist/types/sdk/market/oracle/createPriceOracle.d.ts +2 -2
- package/dist/types/sdk/market/oracle/types.d.ts +10 -3
- package/dist/types/sdk/market/pool/PoolSuite.d.ts +2 -4
- package/dist/types/sdk/market/pool/PoolV310Contract.d.ts +2 -6
- package/dist/types/sdk/market/pool/createInterestRateModel.d.ts +2 -2
- package/dist/types/sdk/market/pool/createPool.d.ts +2 -2
- package/dist/types/sdk/market/pool/createPoolQuotaKeeper.d.ts +2 -2
- package/dist/types/sdk/market/pool/createRateKeeper.d.ts +2 -2
- package/dist/types/sdk/market/pool/index.d.ts +0 -1
- package/dist/types/sdk/market/pricefeeds/PriceFeedsRegister.d.ts +8 -3
- package/dist/types/sdk/market/pricefeeds/updates/PythAccumulatorUpdateData.d.ts +12 -13
- package/dist/types/sdk/market/pricefeeds/updates/PythUpdater.d.ts +8 -3
- package/dist/types/sdk/market/pricefeeds/updates/RedstoneUpdater.d.ts +8 -3
- package/dist/types/sdk/market/pricefeeds/updates/index.d.ts +1 -0
- package/dist/types/sdk/market/pricefeeds/updates/types.d.ts +4 -0
- package/dist/types/sdk/market/types.d.ts +1 -1
- package/dist/types/sdk/options.d.ts +15 -16
- package/dist/types/sdk/plugins/BasePlugin.d.ts +12 -6
- package/dist/types/sdk/plugins/errors.d.ts +2 -2
- package/dist/types/sdk/plugins/types.d.ts +16 -6
- package/dist/types/sdk/pools/PoolService.d.ts +8 -8
- package/dist/types/sdk/pools/types.d.ts +2 -3
- package/dist/types/sdk/router/AbstractRouterContract.d.ts +3 -3
- package/dist/types/sdk/router/RouterV310Contract.d.ts +2 -2
- package/dist/types/sdk/router/createRouter.d.ts +2 -2
- package/dist/types/sdk/router/helpers.d.ts +1 -1
- package/dist/types/sdk/types/state-human.d.ts +10 -2
- package/dist/types/sdk/types/state.d.ts +14 -8
- package/dist/types/sdk/utils/filterDust.d.ts +2 -2
- package/dist/types/sdk/utils/formatter.d.ts +1 -1
- package/dist/types/sdk/utils/isDust.d.ts +2 -2
- package/dist/types/sdk/utils/toAddress.d.ts +1 -1
- package/dist/types/sdk/utils/viem/getLogsPaginated.d.ts +1 -2
- package/dist/types/sdk/utils/viem/getLogsSafe.d.ts +1 -1
- package/dist/types/sdk/utils/viem/index.d.ts +1 -1
- package/dist/types/sdk/utils/viem/simulateWithPriceUpdates.d.ts +1 -2
- package/dist/types/sdk/utils/viem/watchBlocksAsync.d.ts +74 -0
- package/package.json +3 -6
- package/dist/cjs/abi/kyc/iDSRegistryService.js +0 -70
- package/dist/cjs/abi/kyc/iDSToken.js +0 -71
- package/dist/cjs/abi/kyc/iKYCCompressor.js +0 -196
- package/dist/cjs/abi/kyc/iKYCFactory.js +0 -122
- package/dist/cjs/abi/kyc/iKYCUnderlying.js +0 -401
- package/dist/cjs/abi/kyc/iSecuritizeDegenNFT.js +0 -326
- package/dist/cjs/abi/kyc/iSecuritizeKYCFactory.js +0 -319
- package/dist/cjs/dev/CachedStateSubscriber.js +0 -78
- package/dist/cjs/sdk/GearboxSDK.js +0 -696
- package/dist/cjs/sdk/market/kyc/KYCRegistry.js +0 -269
- package/dist/cjs/sdk/market/kyc/index.js +0 -26
- package/dist/cjs/sdk/market/kyc/securitize/SecuritizeKYCFactory.js +0 -244
- package/dist/cjs/sdk/market/kyc/securitize/constants.js +0 -28
- package/dist/cjs/sdk/market/kyc/securitize/index.js +0 -26
- package/dist/cjs/sdk/market/kyc/securitize/types.js +0 -16
- package/dist/cjs/sdk/market/kyc/types.js +0 -34
- package/dist/cjs/sdk/utils/viem/executeDelegatedMulticalls.js +0 -38
- package/dist/esm/abi/kyc/iDSRegistryService.js +0 -46
- package/dist/esm/abi/kyc/iDSToken.js +0 -47
- package/dist/esm/abi/kyc/iKYCCompressor.js +0 -172
- package/dist/esm/abi/kyc/iKYCFactory.js +0 -98
- package/dist/esm/abi/kyc/iKYCUnderlying.js +0 -377
- package/dist/esm/abi/kyc/iSecuritizeDegenNFT.js +0 -302
- package/dist/esm/abi/kyc/iSecuritizeKYCFactory.js +0 -295
- package/dist/esm/dev/CachedStateSubscriber.js +0 -54
- package/dist/esm/sdk/GearboxSDK.js +0 -689
- package/dist/esm/sdk/market/kyc/KYCRegistry.js +0 -253
- package/dist/esm/sdk/market/kyc/index.js +0 -3
- package/dist/esm/sdk/market/kyc/securitize/SecuritizeKYCFactory.js +0 -220
- package/dist/esm/sdk/market/kyc/securitize/constants.js +0 -4
- package/dist/esm/sdk/market/kyc/securitize/index.js +0 -3
- package/dist/esm/sdk/market/kyc/securitize/types.js +0 -0
- package/dist/esm/sdk/market/kyc/types.js +0 -9
- package/dist/esm/sdk/utils/viem/executeDelegatedMulticalls.js +0 -14
- package/dist/types/abi/kyc/iDSRegistryService.d.ts +0 -71
- package/dist/types/abi/kyc/iDSToken.d.ts +0 -67
- package/dist/types/abi/kyc/iKYCCompressor.d.ts +0 -228
- package/dist/types/abi/kyc/iKYCFactory.d.ts +0 -139
- package/dist/types/abi/kyc/iKYCUnderlying.d.ts +0 -548
- package/dist/types/abi/kyc/iSecuritizeDegenNFT.d.ts +0 -404
- package/dist/types/abi/kyc/iSecuritizeKYCFactory.d.ts +0 -376
- package/dist/types/dev/CachedStateSubscriber.d.ts +0 -21
- package/dist/types/sdk/GearboxSDK.d.ts +0 -324
- package/dist/types/sdk/market/kyc/KYCRegistry.d.ts +0 -52
- package/dist/types/sdk/market/kyc/index.d.ts +0 -3
- package/dist/types/sdk/market/kyc/securitize/SecuritizeKYCFactory.d.ts +0 -428
- package/dist/types/sdk/market/kyc/securitize/constants.d.ts +0 -1
- package/dist/types/sdk/market/kyc/securitize/index.d.ts +0 -3
- package/dist/types/sdk/market/kyc/securitize/types.d.ts +0 -127
- package/dist/types/sdk/market/kyc/types.d.ts +0 -170
- 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 {
|
|
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:
|
|
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 {
|
|
2
|
+
import type { OnchainSDK } from "../../OnchainSDK.js";
|
|
3
3
|
import type { ICreditConfiguratorContract } from "./types.js";
|
|
4
|
-
export default function createCreditConfigurator(sdk:
|
|
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 {
|
|
2
|
+
import type { OnchainSDK } from "../../OnchainSDK.js";
|
|
3
3
|
import type { CreditFacadeContract } from "./types.js";
|
|
4
|
-
export default function createCreditFacade(sdk:
|
|
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 {
|
|
2
|
+
import type { OnchainSDK } from "../../OnchainSDK.js";
|
|
3
3
|
import type { ICreditManagerContract } from "./types.js";
|
|
4
|
-
export default function createCreditManager(sdk:
|
|
4
|
+
export default function createCreditManager(sdk: OnchainSDK, data: CreditSuiteState): ICreditManagerContract;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Address } from "
|
|
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,6 @@
|
|
|
1
1
|
import { type Address, type Hex } from "viem";
|
|
2
2
|
import { BaseContract, type BaseParams } from "../../base/index.js";
|
|
3
|
-
import type {
|
|
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:
|
|
289
|
-
constructor(sdk:
|
|
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 {
|
|
2
|
+
import type { OnchainSDK } from "../../OnchainSDK.js";
|
|
3
3
|
import type { ILossPolicyContract } from "./types.js";
|
|
4
|
-
export declare function createLossPolicy(sdk:
|
|
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 {
|
|
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:
|
|
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:
|
|
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():
|
|
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 {
|
|
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:
|
|
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 {
|
|
2
|
+
import type { OnchainSDK } from "../../OnchainSDK.js";
|
|
3
3
|
import type { IPriceOracleContract } from "./types.js";
|
|
4
|
-
export declare function createPriceOracle(sdk:
|
|
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: () =>
|
|
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 {
|
|
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:
|
|
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(
|
|
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 {
|
|
2
|
+
import type { OnchainSDK } from "../../OnchainSDK.js";
|
|
3
3
|
import type { IInterestRateModelContract } from "./types.js";
|
|
4
|
-
export default function createInterestRateModel(sdk:
|
|
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 {
|
|
2
|
+
import type { OnchainSDK } from "../../OnchainSDK.js";
|
|
3
3
|
import type { PoolContract } from "./types.js";
|
|
4
|
-
export default function createPool(sdk:
|
|
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 {
|
|
2
|
+
import type { OnchainSDK } from "../../OnchainSDK.js";
|
|
3
3
|
import type { PoolQuotaKeeperContract } from "./types.js";
|
|
4
|
-
export default function createPoolQuotaKeeper(sdk:
|
|
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 {
|
|
2
|
+
import type { OnchainSDK } from "../../OnchainSDK.js";
|
|
3
3
|
import type { IRateKeeperContract } from "./types.js";
|
|
4
|
-
export default function createRateKeeper(sdk:
|
|
4
|
+
export default function createRateKeeper(sdk: OnchainSDK, pool: PoolState, data: RateKeeperState): IRateKeeperContract;
|
|
@@ -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 {
|
|
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:
|
|
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:
|
|
17
|
-
confidence:
|
|
15
|
+
price: bigint;
|
|
16
|
+
confidence: bigint;
|
|
18
17
|
exponent: number;
|
|
19
|
-
publishTime:
|
|
20
|
-
prevPublishTime:
|
|
21
|
-
emaPrice:
|
|
22
|
-
emaConf:
|
|
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:
|
|
27
|
-
cumulativeConf:
|
|
28
|
-
numDownSlots:
|
|
25
|
+
cumulativePrice: bigint;
|
|
26
|
+
cumulativeConf: bigint;
|
|
27
|
+
numDownSlots: bigint;
|
|
29
28
|
exponent: number;
|
|
30
|
-
publishTime:
|
|
31
|
-
prevPublishTime:
|
|
32
|
-
publishSlot:
|
|
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 {
|
|
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:
|
|
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 {
|
|
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:
|
|
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" | "
|
|
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
|
|
5
|
+
* Zod schema for validating {@link OnchainSDKOptions} at runtime.
|
|
6
6
|
**/
|
|
7
|
-
export declare const
|
|
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
|
-
*
|
|
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
|
|
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
|
|
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():
|
|
33
|
-
set sdk(sdk: GearboxSDK<any>);
|
|
32
|
+
get sdk(): OnchainSDK<any>;
|
|
34
33
|
/**
|
|
35
|
-
*
|
|
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
|
|
45
|
+
* {@inheritDoc IOnchainSDKPlugin.syncState}
|
|
40
46
|
**/
|
|
41
47
|
syncState(): Promise<void>;
|
|
42
48
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IOnchainSDKPlugin, IPluginState } from "./types.js";
|
|
2
2
|
export declare class PluginStateVersionError<TState extends IPluginState> extends Error {
|
|
3
|
-
constructor(plugin:
|
|
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 {
|
|
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
|
|
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
|
|
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:
|
|
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
|
|
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,
|
|
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
|
+
};
|