@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
|
@@ -4,35 +4,35 @@ import type { AddLiquidityProps, DepositMetadata, IPoolsService, PoolServiceCall
|
|
|
4
4
|
export declare class PoolService extends SDKConstruct implements IPoolsService {
|
|
5
5
|
#private;
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* @inheritdoc IPoolsService.getDepositTokensIn
|
|
8
8
|
*/
|
|
9
9
|
getDepositTokensIn(pool: Address): Address[];
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* @inheritdoc IPoolsService.getDepositTokensOut
|
|
12
12
|
*/
|
|
13
13
|
getDepositTokensOut(pool: Address, tokenIn: Address): Address[];
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* @inheritdoc IPoolsService.getDepositMetadata
|
|
16
16
|
*/
|
|
17
17
|
getDepositMetadata(pool: Address, tokenIn: Address, tokenOut?: Address): DepositMetadata;
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* @inheritdoc IPoolsService.addLiquidity
|
|
20
20
|
*/
|
|
21
21
|
addLiquidity(props: AddLiquidityProps): PoolServiceCall | undefined;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* @inheritdoc IPoolsService.getWithdrawalTokensIn
|
|
24
24
|
*/
|
|
25
25
|
getWithdrawalTokensIn(pool: Address): Address[];
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* @inheritdoc IPoolsService.getWithdrawalTokensOut
|
|
28
28
|
*/
|
|
29
29
|
getWithdrawalTokensOut(pool: Address, tokenIn: Address): Address[];
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
31
|
+
* @inheritdoc IPoolsService.removeLiquidity
|
|
32
32
|
*/
|
|
33
33
|
removeLiquidity(props: RemoveLiquidityProps): PoolServiceCall;
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* @inheritdoc IPoolsService.getWithdrawalMetadata
|
|
36
36
|
*/
|
|
37
37
|
getWithdrawalMetadata(pool: Address, tokenIn: Address, tokenOut?: Address): WithdrawalMetadata;
|
|
38
38
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { Abi } from "
|
|
2
|
-
import type { Address, ContractFunctionArgs, ContractFunctionName } from "viem";
|
|
1
|
+
import type { Abi, Address, ContractFunctionArgs, ContractFunctionName } from "viem";
|
|
3
2
|
import type { ZapperData } from "../market/index.js";
|
|
4
3
|
import type { Asset } from "../router/index.js";
|
|
5
4
|
interface PermitResult {
|
|
@@ -53,7 +52,7 @@ export interface RemoveLiquidityProps {
|
|
|
53
52
|
permit: PermitResult | undefined;
|
|
54
53
|
meta: WithdrawalMetadata;
|
|
55
54
|
}
|
|
56
|
-
export type MarketType = "
|
|
55
|
+
export type MarketType = "classic";
|
|
57
56
|
export interface DepositMetadata {
|
|
58
57
|
/**
|
|
59
58
|
* Zapper that will perform the deposit, undefined in case of direct pool underlying deposit
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Abi, Address } from "viem";
|
|
2
2
|
import { BaseContract, type BaseContractArgs } from "../base/index.js";
|
|
3
|
-
import type { GearboxSDK } from "../GearboxSDK.js";
|
|
4
3
|
import type { IPriceOracleContract } from "../market/index.js";
|
|
4
|
+
import type { OnchainSDK } from "../OnchainSDK.js";
|
|
5
5
|
import { AddressMap, AddressSet } from "../utils/index.js";
|
|
6
6
|
import type { Asset, RouterCASlice, RouterCMSlice } from "./types.js";
|
|
7
7
|
export interface ExpectedAndLeftoverOptions {
|
|
@@ -29,8 +29,8 @@ export declare abstract class AbstractRouterContract<abi extends Abi | readonly
|
|
|
29
29
|
/**
|
|
30
30
|
* Reference to the parent SDK instance.
|
|
31
31
|
**/
|
|
32
|
-
readonly sdk:
|
|
33
|
-
constructor(sdk:
|
|
32
|
+
readonly sdk: OnchainSDK;
|
|
33
|
+
constructor(sdk: OnchainSDK, args: BaseContractArgs<abi>);
|
|
34
34
|
protected getExpectedAndLeftover(ca: RouterCASlice, cm: RouterCMSlice, options?: ExpectedAndLeftoverOptions): Leftovers;
|
|
35
35
|
protected getDefaultExpectedAndLeftover(ca: RouterCASlice, keepAssets?: Address[], debtOnly?: boolean): Leftovers;
|
|
36
36
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Address } from "viem";
|
|
2
|
-
import type {
|
|
2
|
+
import type { OnchainSDK } from "../OnchainSDK.js";
|
|
3
3
|
import { AbstractRouterContract } from "./AbstractRouterContract.js";
|
|
4
4
|
import type { FindBestClosePathProps, FindClaimAllRewardsProps, FindOneTokenPathProps, FindOpenStrategyPathProps, IRouterContract, OpenStrategyResult, RouterCloseResult, RouterResult, RouterRewardsResult } from "./types.js";
|
|
5
5
|
declare const abi: readonly [{
|
|
@@ -893,7 +893,7 @@ type abi = typeof abi;
|
|
|
893
893
|
**/
|
|
894
894
|
export declare class RouterV310Contract extends AbstractRouterContract<abi> implements IRouterContract {
|
|
895
895
|
#private;
|
|
896
|
-
constructor(sdk:
|
|
896
|
+
constructor(sdk: OnchainSDK, address: Address, version: number);
|
|
897
897
|
/**
|
|
898
898
|
* {@inheritDoc IRouterContract.findOneTokenPath}
|
|
899
899
|
**/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
|
-
import type {
|
|
2
|
+
import type { OnchainSDK } from "../OnchainSDK.js";
|
|
3
3
|
import type { IRouterContract } from "./types.js";
|
|
4
|
-
export declare function createRouter(sdk:
|
|
4
|
+
export declare function createRouter(sdk: OnchainSDK, address: Address, version: number): IRouterContract;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
2
|
import type { TokenMetaData } from "../base/index.js";
|
|
3
3
|
import type { PriceFeedContractType } from "../market/index.js";
|
|
4
|
-
import type { KYCStateHuman } from "../market/kyc/index.js";
|
|
5
4
|
export interface BaseContractStateHuman {
|
|
6
5
|
address: string;
|
|
7
6
|
version: number;
|
|
@@ -194,11 +193,20 @@ export interface MarketStateHuman {
|
|
|
194
193
|
emergencyLiquidators: string[];
|
|
195
194
|
}
|
|
196
195
|
export interface GearboxStateHuman {
|
|
196
|
+
network: string;
|
|
197
197
|
block: number;
|
|
198
198
|
timestamp: string;
|
|
199
199
|
core: CoreStateHuman;
|
|
200
200
|
markets: MarketStateHuman[];
|
|
201
201
|
plugins: Record<string, unknown>;
|
|
202
202
|
tokens: TokenMetaData[];
|
|
203
|
-
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Human-readable state for all chains managed by {@link MultichainSDK}.
|
|
206
|
+
**/
|
|
207
|
+
export interface MultichainStateHuman {
|
|
208
|
+
/** State format version. */
|
|
209
|
+
version: number;
|
|
210
|
+
/** Per-chain human-readable state. */
|
|
211
|
+
chains: GearboxStateHuman[];
|
|
204
212
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import type { MarketData } from "../base/index.js";
|
|
2
2
|
import type { NetworkType } from "../chain/chains.js";
|
|
3
3
|
import type { AddressProviderState } from "../core/index.js";
|
|
4
|
-
import type { KYCState } from "../market/kyc/index.js";
|
|
5
4
|
import type { PluginStatesMap, PluginsMap } from "../plugins/index.js";
|
|
6
5
|
/**
|
|
7
|
-
* Complete serialisable snapshot of the
|
|
6
|
+
* Complete serialisable snapshot of the SDK state for a single chain.
|
|
8
7
|
*
|
|
9
|
-
* Produced by {@link
|
|
10
|
-
* {@link
|
|
8
|
+
* Produced by {@link OnchainSDK.state} and consumed by
|
|
9
|
+
* {@link OnchainSDK.hydrate} for instant offline restoration.
|
|
11
10
|
*
|
|
12
11
|
* @typeParam Plugins - Map of plugin names to plugin instances.
|
|
13
12
|
**/
|
|
@@ -41,12 +40,19 @@ export interface GearboxState<Plugins extends PluginsMap = {}> {
|
|
|
41
40
|
* All loaded market data.
|
|
42
41
|
**/
|
|
43
42
|
markets: MarketData[];
|
|
44
|
-
/**
|
|
45
|
-
* KYC compressor state snapshot, if KYC factories were loaded.
|
|
46
|
-
**/
|
|
47
|
-
kyc?: KYCState;
|
|
48
43
|
/**
|
|
49
44
|
* Per-plugin serialised state.
|
|
50
45
|
**/
|
|
51
46
|
plugins: PluginStatesMap<Plugins>;
|
|
52
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Serialised state for all chains managed by {@link MultichainSDK}.
|
|
50
|
+
*
|
|
51
|
+
* @typeParam Plugins - Map of plugin names to plugin instances.
|
|
52
|
+
**/
|
|
53
|
+
export interface MultichainState<Plugins extends PluginsMap = {}> {
|
|
54
|
+
/** State format version. */
|
|
55
|
+
version: number;
|
|
56
|
+
/** Per-chain serialised state. */
|
|
57
|
+
chains: GearboxState<Plugins>[];
|
|
58
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
2
|
import type { CreditAccountData } from "../base/index.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { OnchainSDK } from "../OnchainSDK.js";
|
|
4
4
|
/**
|
|
5
5
|
* Helper function to filter out low-balance assets
|
|
6
6
|
* @param account
|
|
@@ -8,7 +8,7 @@ import type { GearboxSDK } from "../GearboxSDK.js";
|
|
|
8
8
|
*/
|
|
9
9
|
export declare function filterDust(account: CreditAccountData): Record<Address, bigint>;
|
|
10
10
|
export interface FilterDustUSDOptions {
|
|
11
|
-
sdk:
|
|
11
|
+
sdk: OnchainSDK;
|
|
12
12
|
account: CreditAccountData;
|
|
13
13
|
/**
|
|
14
14
|
* Dust threshold in USD, without decimals
|
|
@@ -12,10 +12,10 @@ export declare function formatNumberToString_(value: bigint | number): string;
|
|
|
12
12
|
export declare function formatTimestamp(timestamp: number, raw?: boolean): string;
|
|
13
13
|
type BigNumberish = bigint | number | string;
|
|
14
14
|
export declare function rayToNumber(num: BigNumberish): number;
|
|
15
|
-
export declare function toSignificant(num: bigint, decimals: number, precision?: number): string;
|
|
16
15
|
export declare function toBN(num: string, decimals: number): bigint;
|
|
17
16
|
export declare function shortAddress(address?: string): string;
|
|
18
17
|
export declare function shortHash(address?: string): string;
|
|
19
18
|
export declare function formatPercentage(healthFactor: number, decimals?: number): string;
|
|
20
19
|
export declare function formatLeverage(leverage: number, decimals?: number): string;
|
|
20
|
+
export declare function toSignificant(num: bigint, decimals: number, precision?: number): string;
|
|
21
21
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
|
-
import type {
|
|
2
|
+
import type { OnchainSDK } from "../OnchainSDK.js";
|
|
3
3
|
export interface IsDustOptions {
|
|
4
|
-
sdk:
|
|
4
|
+
sdk: OnchainSDK;
|
|
5
5
|
token: Address;
|
|
6
6
|
balance: bigint;
|
|
7
7
|
creditManager: Address;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { AbiEvent } from "
|
|
2
|
-
import type { BlockNumber, Chain, Client, GetLogsParameters, GetLogsReturnType, MaybeAbiEventName, Transport } from "viem";
|
|
1
|
+
import type { AbiEvent, BlockNumber, Chain, Client, GetLogsParameters, GetLogsReturnType, MaybeAbiEventName, Transport } from "viem";
|
|
3
2
|
export type GetLogsPaginatedParameters<abiEvent extends AbiEvent | undefined = undefined, abiEvents extends readonly AbiEvent[] | readonly unknown[] | undefined = abiEvent extends AbiEvent ? [abiEvent] : undefined, strict extends boolean | undefined = undefined, _eventName extends string | undefined = MaybeAbiEventName<abiEvent>> = GetLogsParameters<abiEvent, abiEvents, strict, BlockNumber, BlockNumber, _eventName> & {
|
|
4
3
|
pageSize: bigint;
|
|
5
4
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { AbiEvent } from "
|
|
1
|
+
import type { AbiEvent } from "viem";
|
|
2
2
|
import { type BlockNumber, type Chain, type Client, type GetLogsParameters, type GetLogsReturnType, type Transport } from "viem";
|
|
3
3
|
export declare function getLogsSafe<chain extends Chain | undefined, const abiEvent extends AbiEvent | undefined = undefined, const abiEvents extends readonly AbiEvent[] | readonly unknown[] | undefined = abiEvent extends AbiEvent ? [abiEvent] : undefined, strict extends boolean | undefined = undefined>(client: Client<Transport, chain>, params?: GetLogsParameters<abiEvent, abiEvents, strict, BlockNumber, BlockNumber>): Promise<GetLogsReturnType<abiEvent, abiEvents, strict, BlockNumber, BlockNumber>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from "./cast.js";
|
|
2
|
-
export * from "./executeDelegatedMulticalls.js";
|
|
3
2
|
export * from "./getLogsPaginated.js";
|
|
4
3
|
export * from "./getLogsSafe.js";
|
|
5
4
|
export * from "./sendRawTx.js";
|
|
6
5
|
export * from "./simulateMulticall.js";
|
|
7
6
|
export * from "./simulateWithPriceUpdates.js";
|
|
7
|
+
export * from "./watchBlocksAsync.js";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { Narrow } from "
|
|
2
|
-
import type { CallParameters, Chain, Client, ContractFunctionParameters, MulticallContracts, MulticallReturnType, Transport } from "viem";
|
|
1
|
+
import type { CallParameters, Chain, Client, ContractFunctionParameters, MulticallContracts, MulticallReturnType, Narrow, Transport } from "viem";
|
|
3
2
|
import { BaseError } from "viem";
|
|
4
3
|
import type { IPriceUpdateTx } from "../../types/index.js";
|
|
5
4
|
import type { SimulateMulticallParameters } from "./simulateMulticall.js";
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { Chain, Client, Transport } from "viem";
|
|
2
|
+
import { type GetBlockReturnType } from "viem/actions";
|
|
3
|
+
type Block<chain extends Chain | undefined = Chain> = GetBlockReturnType<chain>;
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for {@link watchBlocksAsync}.
|
|
6
|
+
*
|
|
7
|
+
* @typeParam chain - The chain type, derived from the client.
|
|
8
|
+
*/
|
|
9
|
+
export interface WatchBlocksAsyncParameters<chain extends Chain | undefined = Chain> {
|
|
10
|
+
/**
|
|
11
|
+
* Async callback invoked when a new block is received.
|
|
12
|
+
* If the handler is still running when the next block arrives, the new block
|
|
13
|
+
* is silently dropped and {@link WatchBlocksAsyncParameters.onDrop | onDrop}
|
|
14
|
+
* is called instead.
|
|
15
|
+
*/
|
|
16
|
+
onBlock: (block: Block<chain>, prevBlock: Block<chain> | undefined) => Promise<void>;
|
|
17
|
+
/** Callback invoked when `getBlock` or `onBlock` throws. */
|
|
18
|
+
onError?: ((error: Error) => void) | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Synchronous callback invoked when a new block is dropped because the
|
|
21
|
+
* previous {@link WatchBlocksAsyncParameters.onBlock | onBlock} handler has
|
|
22
|
+
* not yet resolved.
|
|
23
|
+
*/
|
|
24
|
+
onDrop?: ((block: Block<chain>) => void) | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Polling frequency in milliseconds.
|
|
27
|
+
* @defaultValue `client.pollingInterval`
|
|
28
|
+
*/
|
|
29
|
+
pollingInterval?: number | undefined;
|
|
30
|
+
}
|
|
31
|
+
/** Unwatch function returned by {@link watchBlocksAsync}. */
|
|
32
|
+
export type WatchBlocksAsyncReturnType = () => void;
|
|
33
|
+
/**
|
|
34
|
+
* Polls for new blocks over HTTP and invokes an **async** `onBlock` handler.
|
|
35
|
+
*
|
|
36
|
+
* Unlike viem's built-in `watchBlocks`, the handler is awaited. If a new block
|
|
37
|
+
* arrives while the previous handler is still running, the block is silently
|
|
38
|
+
* dropped and the optional `onDrop` callback is invoked synchronously.
|
|
39
|
+
*
|
|
40
|
+
* Only HTTP transports are supported (no WebSocket / IPC).
|
|
41
|
+
*
|
|
42
|
+
* @param client - A viem {@link Client} configured with an HTTP transport.
|
|
43
|
+
* @param parameters - {@link WatchBlocksAsyncParameters}
|
|
44
|
+
* @returns A function that stops polling when called. {@link WatchBlocksAsyncReturnType}
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* import { createPublicClient, http } from "viem";
|
|
49
|
+
* import { mainnet } from "viem/chains";
|
|
50
|
+
* import { watchBlocksAsync } from "./watchBlocksAsync.js";
|
|
51
|
+
*
|
|
52
|
+
* const client = createPublicClient({
|
|
53
|
+
* chain: mainnet,
|
|
54
|
+
* transport: http(),
|
|
55
|
+
* });
|
|
56
|
+
*
|
|
57
|
+
* const unwatch = watchBlocksAsync(client, {
|
|
58
|
+
* onBlock: async (block, prevBlock) => {
|
|
59
|
+
* console.log("new block", block.number);
|
|
60
|
+
* },
|
|
61
|
+
* onDrop: (block) => {
|
|
62
|
+
* console.log("dropped block", block.number);
|
|
63
|
+
* },
|
|
64
|
+
* onError: (err) => {
|
|
65
|
+
* console.error(err);
|
|
66
|
+
* },
|
|
67
|
+
* });
|
|
68
|
+
*
|
|
69
|
+
* // later
|
|
70
|
+
* unwatch();
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export declare function watchBlocksAsync<chain extends Chain | undefined>(client: Client<Transport, chain>, parameters: WatchBlocksAsyncParameters<chain>): WatchBlocksAsyncReturnType;
|
|
74
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gearbox-protocol/sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.0.0-next.10",
|
|
4
4
|
"description": "Gearbox SDK",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/cjs/sdk/index.js",
|
|
@@ -79,20 +79,17 @@
|
|
|
79
79
|
"@redstone-finance/protocol": "^0.9.0",
|
|
80
80
|
"@redstone-finance/sdk": "^0.9.0",
|
|
81
81
|
"@redstone-finance/utils": "^0.9.0",
|
|
82
|
-
"@types/bn.js": "^5.2.0",
|
|
83
82
|
"abitype": "^1.2.3",
|
|
84
|
-
"bn.js": "^5.2.3",
|
|
85
83
|
"buffer": "^6.0.3",
|
|
86
84
|
"date-fns": "^4.1.0",
|
|
87
|
-
"decimal.js-light": "^2.5.1",
|
|
88
85
|
"viem": ">=2.23.15 <3.0.0",
|
|
89
86
|
"zod": "^4.3.6"
|
|
90
87
|
},
|
|
91
88
|
"devDependencies": {
|
|
92
|
-
"@biomejs/biome": "^2.4.
|
|
89
|
+
"@biomejs/biome": "^2.4.12",
|
|
93
90
|
"@commitlint/cli": "^20.5.0",
|
|
94
91
|
"@commitlint/config-conventional": "^20.5.0",
|
|
95
|
-
"@gearbox-protocol/biome-config": "^1.0.
|
|
92
|
+
"@gearbox-protocol/biome-config": "^1.0.27",
|
|
96
93
|
"@types/cross-spawn": "^6.0.6",
|
|
97
94
|
"axios": "^1.15.0",
|
|
98
95
|
"cross-spawn": "^7.0.6",
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var iDSRegistryService_exports = {};
|
|
20
|
-
__export(iDSRegistryService_exports, {
|
|
21
|
-
iDSRegistryServiceAbi: () => iDSRegistryServiceAbi
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(iDSRegistryService_exports);
|
|
24
|
-
const iDSRegistryServiceAbi = [
|
|
25
|
-
{
|
|
26
|
-
type: "function",
|
|
27
|
-
name: "addWallet",
|
|
28
|
-
inputs: [
|
|
29
|
-
{ name: "wallet", type: "address", internalType: "address" },
|
|
30
|
-
{ name: "investorId", type: "string", internalType: "string" }
|
|
31
|
-
],
|
|
32
|
-
outputs: [],
|
|
33
|
-
stateMutability: "nonpayable"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
type: "function",
|
|
37
|
-
name: "getInvestor",
|
|
38
|
-
inputs: [{ name: "wallet", type: "address", internalType: "address" }],
|
|
39
|
-
outputs: [{ name: "", type: "string", internalType: "string" }],
|
|
40
|
-
stateMutability: "view"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
type: "function",
|
|
44
|
-
name: "isInvestor",
|
|
45
|
-
inputs: [{ name: "investorId", type: "string", internalType: "string" }],
|
|
46
|
-
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
47
|
-
stateMutability: "view"
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
type: "function",
|
|
51
|
-
name: "isWallet",
|
|
52
|
-
inputs: [{ name: "wallet", type: "address", internalType: "address" }],
|
|
53
|
-
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
54
|
-
stateMutability: "view"
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
type: "function",
|
|
58
|
-
name: "registerInvestor",
|
|
59
|
-
inputs: [
|
|
60
|
-
{ name: "investorId", type: "string", internalType: "string" },
|
|
61
|
-
{ name: "collisionHash", type: "string", internalType: "string" }
|
|
62
|
-
],
|
|
63
|
-
outputs: [],
|
|
64
|
-
stateMutability: "nonpayable"
|
|
65
|
-
}
|
|
66
|
-
];
|
|
67
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
68
|
-
0 && (module.exports = {
|
|
69
|
-
iDSRegistryServiceAbi
|
|
70
|
-
});
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var iDSToken_exports = {};
|
|
20
|
-
__export(iDSToken_exports, {
|
|
21
|
-
iDSTokenAbi: () => iDSTokenAbi
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(iDSToken_exports);
|
|
24
|
-
const iDSTokenAbi = [
|
|
25
|
-
{
|
|
26
|
-
type: "function",
|
|
27
|
-
name: "REGISTRY_SERVICE",
|
|
28
|
-
inputs: [],
|
|
29
|
-
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
30
|
-
stateMutability: "view"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
type: "function",
|
|
34
|
-
name: "TRUST_SERVICE",
|
|
35
|
-
inputs: [],
|
|
36
|
-
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
37
|
-
stateMutability: "view"
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
type: "function",
|
|
41
|
-
name: "burn",
|
|
42
|
-
inputs: [
|
|
43
|
-
{ name: "from", type: "address", internalType: "address" },
|
|
44
|
-
{ name: "amount", type: "uint256", internalType: "uint256" },
|
|
45
|
-
{ name: "reason", type: "string", internalType: "string" }
|
|
46
|
-
],
|
|
47
|
-
outputs: [],
|
|
48
|
-
stateMutability: "nonpayable"
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
type: "function",
|
|
52
|
-
name: "getDSService",
|
|
53
|
-
inputs: [{ name: "serviceId", type: "uint256", internalType: "uint256" }],
|
|
54
|
-
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
55
|
-
stateMutability: "view"
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
type: "function",
|
|
59
|
-
name: "issueTokens",
|
|
60
|
-
inputs: [
|
|
61
|
-
{ name: "to", type: "address", internalType: "address" },
|
|
62
|
-
{ name: "amount", type: "uint256", internalType: "uint256" }
|
|
63
|
-
],
|
|
64
|
-
outputs: [],
|
|
65
|
-
stateMutability: "nonpayable"
|
|
66
|
-
}
|
|
67
|
-
];
|
|
68
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
69
|
-
0 && (module.exports = {
|
|
70
|
-
iDSTokenAbi
|
|
71
|
-
});
|