@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,84 +1,34 @@
|
|
|
1
1
|
import { iPoolV310Abi } from "../../abi/310/generated.js";
|
|
2
|
-
import { ierc20Abi } from "../../abi/iERC20.js";
|
|
3
2
|
import { ierc20ZapperDepositsAbi } from "../../abi/iERC20ZapperDeposits.js";
|
|
4
3
|
import { iethZapperDepositsAbi } from "../../abi/iETHZapperDeposits.js";
|
|
5
4
|
import { iZapperAbi } from "../../abi/iZapper.js";
|
|
6
|
-
import {
|
|
7
|
-
KYC_UNDERLYING_DEFAULT,
|
|
8
|
-
KYC_UNDERLYING_ON_DEMAND,
|
|
9
|
-
SDKConstruct
|
|
10
|
-
} from "../base/index.js";
|
|
5
|
+
import { SDKConstruct } from "../base/index.js";
|
|
11
6
|
import { NATIVE_ADDRESS } from "../constants/index.js";
|
|
12
7
|
import { AddressSet, hexEq } from "../utils/index.js";
|
|
13
8
|
class PoolService extends SDKConstruct {
|
|
14
9
|
/**
|
|
15
|
-
*
|
|
10
|
+
* @inheritdoc IPoolsService.getDepositTokensIn
|
|
16
11
|
*/
|
|
17
12
|
getDepositTokensIn(pool) {
|
|
18
|
-
const underlying = this.#describeUnderlying(pool);
|
|
19
|
-
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
20
|
-
switch (underlying.contractType) {
|
|
21
|
-
case KYC_UNDERLYING_DEFAULT:
|
|
22
|
-
return this.#depositTokensIn(pool, false);
|
|
23
|
-
case KYC_UNDERLYING_ON_DEMAND:
|
|
24
|
-
return [underlying.asset];
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
13
|
return this.#depositTokensIn(pool, true);
|
|
28
14
|
}
|
|
29
15
|
/**
|
|
30
|
-
*
|
|
16
|
+
* @inheritdoc IPoolsService.getDepositTokensOut
|
|
31
17
|
*/
|
|
32
18
|
getDepositTokensOut(pool, tokenIn) {
|
|
33
|
-
const underlying = this.#describeUnderlying(pool);
|
|
34
|
-
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
35
|
-
switch (underlying.contractType) {
|
|
36
|
-
case KYC_UNDERLYING_DEFAULT:
|
|
37
|
-
return this.#depositTokensOut(pool, tokenIn, false);
|
|
38
|
-
case KYC_UNDERLYING_ON_DEMAND:
|
|
39
|
-
return [];
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
19
|
return this.#depositTokensOut(pool, tokenIn, true);
|
|
43
20
|
}
|
|
44
21
|
/**
|
|
45
|
-
*
|
|
22
|
+
* @inheritdoc IPoolsService.getDepositMetadata
|
|
46
23
|
*/
|
|
47
24
|
getDepositMetadata(pool, tokenIn, tokenOut) {
|
|
48
|
-
const underlying = this.#describeUnderlying(pool);
|
|
49
|
-
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
50
|
-
switch (underlying.contractType) {
|
|
51
|
-
case KYC_UNDERLYING_DEFAULT: {
|
|
52
|
-
return this.#depositMetadata(
|
|
53
|
-
"kyc-default",
|
|
54
|
-
pool,
|
|
55
|
-
tokenIn,
|
|
56
|
-
tokenOut,
|
|
57
|
-
false
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
case KYC_UNDERLYING_ON_DEMAND:
|
|
61
|
-
return {
|
|
62
|
-
zapper: void 0,
|
|
63
|
-
approveTarget: underlying.liquidityProvider.addr,
|
|
64
|
-
permissible: false,
|
|
65
|
-
type: "kyc-on-demand"
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
25
|
return this.#depositMetadata("classic", pool, tokenIn, tokenOut, true);
|
|
70
26
|
}
|
|
71
27
|
/**
|
|
72
|
-
*
|
|
28
|
+
* @inheritdoc IPoolsService.addLiquidity
|
|
73
29
|
*/
|
|
74
30
|
addLiquidity(props) {
|
|
75
31
|
const { collateral, meta, permit, referralCode, pool, wallet } = props;
|
|
76
|
-
const underlying = this.#describeUnderlying(pool);
|
|
77
|
-
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
78
|
-
if (underlying.contractType === KYC_UNDERLYING_ON_DEMAND) {
|
|
79
|
-
return void 0;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
32
|
const { zapper } = meta;
|
|
83
33
|
if (zapper && hexEq(zapper.tokenIn.addr, NATIVE_ADDRESS)) {
|
|
84
34
|
return {
|
|
@@ -118,51 +68,22 @@ class PoolService extends SDKConstruct {
|
|
|
118
68
|
}
|
|
119
69
|
}
|
|
120
70
|
/**
|
|
121
|
-
*
|
|
71
|
+
* @inheritdoc IPoolsService.getWithdrawalTokensIn
|
|
122
72
|
*/
|
|
123
73
|
getWithdrawalTokensIn(pool) {
|
|
124
|
-
const underlying = this.#describeUnderlying(pool);
|
|
125
|
-
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
126
|
-
switch (underlying.contractType) {
|
|
127
|
-
case KYC_UNDERLYING_DEFAULT:
|
|
128
|
-
return this.#withdrawalTokensIn(pool, false);
|
|
129
|
-
case KYC_UNDERLYING_ON_DEMAND:
|
|
130
|
-
return [];
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
74
|
return this.#withdrawalTokensIn(pool, true);
|
|
134
75
|
}
|
|
135
76
|
/**
|
|
136
|
-
*
|
|
77
|
+
* @inheritdoc IPoolsService.getWithdrawalTokensOut
|
|
137
78
|
*/
|
|
138
79
|
getWithdrawalTokensOut(pool, tokenIn) {
|
|
139
|
-
const underlying = this.#describeUnderlying(pool);
|
|
140
|
-
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
141
|
-
switch (underlying.contractType) {
|
|
142
|
-
case KYC_UNDERLYING_DEFAULT:
|
|
143
|
-
return this.#withdrawalTokensOut(pool, tokenIn, false);
|
|
144
|
-
case KYC_UNDERLYING_ON_DEMAND:
|
|
145
|
-
return [underlying.asset];
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
80
|
return this.#withdrawalTokensOut(pool, tokenIn, true);
|
|
149
81
|
}
|
|
150
82
|
/**
|
|
151
|
-
*
|
|
83
|
+
* @inheritdoc IPoolsService.removeLiquidity
|
|
152
84
|
*/
|
|
153
85
|
removeLiquidity(props) {
|
|
154
86
|
const { pool, amount, meta, wallet, permit } = props;
|
|
155
|
-
const underlying = this.#describeUnderlying(pool);
|
|
156
|
-
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
157
|
-
if (underlying.contractType === KYC_UNDERLYING_ON_DEMAND) {
|
|
158
|
-
return {
|
|
159
|
-
abi: ierc20Abi,
|
|
160
|
-
functionName: "approve",
|
|
161
|
-
args: [underlying.liquidityProvider, 0n],
|
|
162
|
-
target: underlying.asset
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
87
|
if (meta.zapper) {
|
|
167
88
|
return permit ? {
|
|
168
89
|
target: meta.zapper.baseParams.addr,
|
|
@@ -191,30 +112,9 @@ class PoolService extends SDKConstruct {
|
|
|
191
112
|
};
|
|
192
113
|
}
|
|
193
114
|
/**
|
|
194
|
-
*
|
|
115
|
+
* @inheritdoc IPoolsService.getWithdrawalMetadata
|
|
195
116
|
*/
|
|
196
117
|
getWithdrawalMetadata(pool, tokenIn, tokenOut) {
|
|
197
|
-
const underlying = this.#describeUnderlying(pool);
|
|
198
|
-
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
199
|
-
switch (underlying.contractType) {
|
|
200
|
-
case KYC_UNDERLYING_DEFAULT: {
|
|
201
|
-
return this.#withdrawalMetadata(
|
|
202
|
-
"kyc-default",
|
|
203
|
-
pool,
|
|
204
|
-
tokenIn,
|
|
205
|
-
tokenOut,
|
|
206
|
-
false
|
|
207
|
-
);
|
|
208
|
-
}
|
|
209
|
-
case KYC_UNDERLYING_ON_DEMAND:
|
|
210
|
-
return {
|
|
211
|
-
zapper: void 0,
|
|
212
|
-
approveTarget: void 0,
|
|
213
|
-
permissible: false,
|
|
214
|
-
type: "kyc-on-demand"
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
118
|
return this.#withdrawalMetadata("classic", pool, tokenIn, tokenOut, true);
|
|
219
119
|
}
|
|
220
120
|
/**
|
|
@@ -374,6 +274,8 @@ class PoolService extends SDKConstruct {
|
|
|
374
274
|
zapper,
|
|
375
275
|
// Approval target is zapper when routed, otherwise the pool contract.
|
|
376
276
|
approveTarget: zapper?.baseParams.addr ?? pool.pool.address,
|
|
277
|
+
// TODO: instead of permissible, return permitType depending on tokenIn
|
|
278
|
+
// "none" | "eip2612" | "dai_like";
|
|
377
279
|
permissible: !!zapper && !hexEq(tokenIn, NATIVE_ADDRESS),
|
|
378
280
|
type
|
|
379
281
|
};
|
|
@@ -401,6 +303,8 @@ class PoolService extends SDKConstruct {
|
|
|
401
303
|
zapper,
|
|
402
304
|
// Approval target exists only for zapper-based withdrawals.
|
|
403
305
|
approveTarget: zapper?.baseParams.addr,
|
|
306
|
+
// TODO: instead of permissible, return permitType depending on tokenIn
|
|
307
|
+
// "none" | "eip2612" | "dai_like";
|
|
404
308
|
permissible: !!zapper,
|
|
405
309
|
type
|
|
406
310
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { formatDuration as fmtDuration, intervalToDuration } from "date-fns";
|
|
2
|
-
import Decimal from "decimal.js-light";
|
|
3
2
|
import { LEVERAGE_DECIMALS, PERCENTAGE_FACTOR } from "../constants/index.js";
|
|
4
3
|
const toBigInt = (v) => {
|
|
5
4
|
const value = typeof v === "object" && v.type === "BigNumber" ? v.hex : v.toString();
|
|
@@ -103,17 +102,22 @@ function formatTimestamp(timestamp, raw = true) {
|
|
|
103
102
|
function rayToNumber(num) {
|
|
104
103
|
return Number(toBigInt(num) / 10n ** 21n) / 1e6;
|
|
105
104
|
}
|
|
106
|
-
function toSignificant(num, decimals, precision = 6) {
|
|
107
|
-
if (num === 1n) return "0";
|
|
108
|
-
const divider = new Decimal(10).toPower(decimals);
|
|
109
|
-
const number = new Decimal(num.toString()).div(divider);
|
|
110
|
-
return number.toSignificantDigits(precision, 4).toString();
|
|
111
|
-
}
|
|
112
105
|
function toBN(num, decimals) {
|
|
113
106
|
if (num === "") return 0n;
|
|
114
|
-
const
|
|
115
|
-
const
|
|
116
|
-
|
|
107
|
+
const negative = num.startsWith("-");
|
|
108
|
+
const abs = negative ? num.slice(1) : num;
|
|
109
|
+
const [intPart = "0", fracPart = ""] = abs.split(".");
|
|
110
|
+
let frac = fracPart;
|
|
111
|
+
let roundUp = false;
|
|
112
|
+
if (frac.length > decimals) {
|
|
113
|
+
roundUp = frac.charCodeAt(decimals) >= 53;
|
|
114
|
+
frac = frac.slice(0, decimals);
|
|
115
|
+
} else {
|
|
116
|
+
frac = frac.padEnd(decimals, "0");
|
|
117
|
+
}
|
|
118
|
+
let result = BigInt(intPart + frac);
|
|
119
|
+
if (roundUp) result += 1n;
|
|
120
|
+
return negative ? -result : result;
|
|
117
121
|
}
|
|
118
122
|
function shortAddress(address) {
|
|
119
123
|
return address === void 0 ? "" : `${address.slice(0, 6)}...${address.slice(address.length - 4)}`;
|
|
@@ -127,6 +131,91 @@ function formatPercentage(healthFactor, decimals = 2) {
|
|
|
127
131
|
function formatLeverage(leverage, decimals = 2) {
|
|
128
132
|
return (leverage / Number(LEVERAGE_DECIMALS)).toFixed(decimals);
|
|
129
133
|
}
|
|
134
|
+
function formatDecimalJsLikeToString(digits, base10exp) {
|
|
135
|
+
const len = digits.length;
|
|
136
|
+
const isExp = base10exp <= -7 || base10exp >= 21;
|
|
137
|
+
if (isExp) {
|
|
138
|
+
let coeff = digits;
|
|
139
|
+
if (len > 1) {
|
|
140
|
+
coeff = `${digits[0]}.${digits.slice(1)}`;
|
|
141
|
+
}
|
|
142
|
+
const exp = base10exp;
|
|
143
|
+
const expStr = exp < 0 ? `e${exp}` : `e+${exp}`;
|
|
144
|
+
return `${coeff}${expStr}`;
|
|
145
|
+
}
|
|
146
|
+
if (base10exp < 0) {
|
|
147
|
+
return `0.${"0".repeat(-base10exp - 1)}${digits}`;
|
|
148
|
+
}
|
|
149
|
+
if (base10exp >= len) {
|
|
150
|
+
return `${digits}${"0".repeat(base10exp + 1 - len)}`;
|
|
151
|
+
}
|
|
152
|
+
const k = base10exp + 1;
|
|
153
|
+
if (k === len) return digits;
|
|
154
|
+
return `${digits.slice(0, k)}.${digits.slice(k)}`;
|
|
155
|
+
}
|
|
156
|
+
function roundToSignificantDigitsHalfUp(digits, base10exp, precision) {
|
|
157
|
+
if (precision < 1) {
|
|
158
|
+
throw new Error(`Invalid precision: ${precision}`);
|
|
159
|
+
}
|
|
160
|
+
if (digits === "0") return { digits: "0", base10exp: 0 };
|
|
161
|
+
let norm = digits;
|
|
162
|
+
while (norm.length > 1 && norm.endsWith("0")) {
|
|
163
|
+
norm = norm.slice(0, -1);
|
|
164
|
+
}
|
|
165
|
+
digits = norm;
|
|
166
|
+
if (digits.length <= precision) {
|
|
167
|
+
return { digits, base10exp };
|
|
168
|
+
}
|
|
169
|
+
const cut = digits.slice(0, precision).split("");
|
|
170
|
+
const next = digits.charCodeAt(precision) - 48;
|
|
171
|
+
if (next >= 5) {
|
|
172
|
+
let i = cut.length - 1;
|
|
173
|
+
while (i >= 0) {
|
|
174
|
+
const cur = cut[i];
|
|
175
|
+
if (cur === void 0) {
|
|
176
|
+
throw new Error("roundToSignificantDigitsHalfUp: invalid state");
|
|
177
|
+
}
|
|
178
|
+
const d = cur.charCodeAt(0) - 48;
|
|
179
|
+
if (d !== 9) {
|
|
180
|
+
cut[i] = String.fromCharCode(48 + d + 1);
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
cut[i] = "0";
|
|
184
|
+
i -= 1;
|
|
185
|
+
}
|
|
186
|
+
if (i < 0) {
|
|
187
|
+
cut.unshift("1");
|
|
188
|
+
base10exp += 1;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
let rounded = cut.join("");
|
|
192
|
+
let tz = 0;
|
|
193
|
+
for (let i = rounded.length - 1; i >= 0 && rounded[i] === "0"; i -= 1) {
|
|
194
|
+
tz += 1;
|
|
195
|
+
}
|
|
196
|
+
if (tz > 0) {
|
|
197
|
+
rounded = rounded.slice(0, -tz);
|
|
198
|
+
}
|
|
199
|
+
if (rounded === "") {
|
|
200
|
+
return { digits: "0", base10exp: 0 };
|
|
201
|
+
}
|
|
202
|
+
return { digits: rounded, base10exp };
|
|
203
|
+
}
|
|
204
|
+
function toSignificant(num, decimals, precision = 6) {
|
|
205
|
+
if (num === 1n) return "0";
|
|
206
|
+
if (num === 0n) return "0";
|
|
207
|
+
const negative = num < 0n;
|
|
208
|
+
const abs = negative ? -num : num;
|
|
209
|
+
const rawDigits = abs.toString();
|
|
210
|
+
const base10exp = rawDigits.length - decimals - 1;
|
|
211
|
+
const rounded = roundToSignificantDigitsHalfUp(
|
|
212
|
+
rawDigits,
|
|
213
|
+
base10exp,
|
|
214
|
+
precision
|
|
215
|
+
);
|
|
216
|
+
const body = formatDecimalJsLikeToString(rounded.digits, rounded.base10exp);
|
|
217
|
+
return negative ? `-${body}` : body;
|
|
218
|
+
}
|
|
130
219
|
export {
|
|
131
220
|
fmtBinaryMask,
|
|
132
221
|
formatBN,
|
|
@@ -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";
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { getBlock } from "viem/actions";
|
|
2
|
+
import { getAction } from "viem/utils";
|
|
3
|
+
function watchBlocksAsync(client, parameters) {
|
|
4
|
+
const {
|
|
5
|
+
onBlock,
|
|
6
|
+
onError,
|
|
7
|
+
onDrop,
|
|
8
|
+
pollingInterval = client.pollingInterval
|
|
9
|
+
} = parameters;
|
|
10
|
+
let active = true;
|
|
11
|
+
let busy = false;
|
|
12
|
+
let prevBlock;
|
|
13
|
+
const poll = async () => {
|
|
14
|
+
if (!active) return;
|
|
15
|
+
let block;
|
|
16
|
+
try {
|
|
17
|
+
block = await getAction(
|
|
18
|
+
client,
|
|
19
|
+
getBlock,
|
|
20
|
+
"getBlock"
|
|
21
|
+
)({});
|
|
22
|
+
} catch (err) {
|
|
23
|
+
onError?.(err);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (!active) return;
|
|
27
|
+
if (block.number !== null && prevBlock?.number != null && block.number <= prevBlock.number) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (busy) {
|
|
31
|
+
onDrop?.(block);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
busy = true;
|
|
35
|
+
try {
|
|
36
|
+
await onBlock(block, prevBlock);
|
|
37
|
+
prevBlock = block;
|
|
38
|
+
} catch (err) {
|
|
39
|
+
onError?.(err);
|
|
40
|
+
} finally {
|
|
41
|
+
busy = false;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const timer = setInterval(poll, pollingInterval);
|
|
45
|
+
return () => {
|
|
46
|
+
active = false;
|
|
47
|
+
clearInterval(timer);
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
watchBlocksAsync
|
|
52
|
+
};
|
|
@@ -167,7 +167,8 @@ export type RevolverTransportConfig = {
|
|
|
167
167
|
onRotateFailed?: (oldTransportName: string, reason?: BaseError) => void | Promise<void>;
|
|
168
168
|
} & z.infer<typeof revolverTransportConfigSchema>;
|
|
169
169
|
export declare class NoAvailableTransportsError extends BaseError {
|
|
170
|
-
|
|
170
|
+
statuses: ProviderStatus[];
|
|
171
|
+
constructor(statuses: ProviderStatus[], cause?: Error);
|
|
171
172
|
}
|
|
172
173
|
export interface RevolverTransportValue {
|
|
173
174
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
|
-
import type { CreditAccountData,
|
|
2
|
+
import type { CreditAccountData, ILogger, OnchainSDK } from "../sdk/index.js";
|
|
3
3
|
/**
|
|
4
4
|
* Given credit accounts, calculates new liquidation thresholds that needs to be set to drop account health factor a bit to make it eligible for partial liquidation
|
|
5
5
|
* @param ca
|
|
6
6
|
*/
|
|
7
|
-
export declare function calcLiquidatableLTs(sdk:
|
|
7
|
+
export declare function calcLiquidatableLTs(sdk: OnchainSDK, ca: CreditAccountData, factor?: bigint, logger?: ILogger): Promise<Record<Address, number>>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type Account, type Address, type PublicClient, type WalletClient } from "viem";
|
|
2
|
-
import { type
|
|
2
|
+
import { type ILogger, type OnchainSDK } from "../sdk/index.js";
|
|
3
3
|
interface TokenClaim {
|
|
4
4
|
token: Address;
|
|
5
5
|
amount: bigint;
|
|
6
6
|
}
|
|
7
7
|
interface ClaimFromFaucetOptions {
|
|
8
|
-
sdk?:
|
|
8
|
+
sdk?: OnchainSDK;
|
|
9
9
|
publicClient: PublicClient;
|
|
10
10
|
wallet: WalletClient;
|
|
11
11
|
faucet: Address;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { Abi } from "
|
|
2
|
-
import type {
|
|
3
|
-
import type { GearboxSDK } from "../sdk/index.js";
|
|
1
|
+
import type { Abi, Account, Address, Chain, Client, ContractConstructorArgs, GetChainParameter, Hash, Hex, SendTransactionParameters, SendTransactionReturnType, Transport, UnionEvaluate, UnionOmit, WalletClient } from "viem";
|
|
2
|
+
import type { OnchainSDK } from "../sdk/index.js";
|
|
4
3
|
import { Construct } from "../sdk/index.js";
|
|
5
4
|
export declare const PUBLIC_CREATE2_FACTORY: Address;
|
|
6
5
|
export declare const DEFAULT_CREATE2_SALT = "GEARBOX";
|
|
@@ -26,7 +25,7 @@ export interface EnsureExistsUsingPublicCreate2ReturnType {
|
|
|
26
25
|
}
|
|
27
26
|
export declare class Create2Deployer<transport extends Transport = Transport, chain extends Chain = Chain, account extends Account = Account> extends Construct {
|
|
28
27
|
#private;
|
|
29
|
-
constructor(sdk:
|
|
28
|
+
constructor(sdk: OnchainSDK, walletClient: WalletClient<transport, chain, account>);
|
|
30
29
|
ensureExists<abi extends Abi | readonly unknown[], chainOverride extends Chain | undefined = Chain | undefined>(parameters: Create2Parameters<abi, chain, account, chainOverride>): Promise<EnsureExistsUsingPublicCreate2ReturnType>;
|
|
31
30
|
}
|
|
32
31
|
/**
|
|
@@ -56,7 +56,9 @@ export declare function isRangeError(error: unknown): boolean;
|
|
|
56
56
|
* 1. **Alchemy JSON details** — parses the `details` field of a
|
|
57
57
|
* {@link HttpRequestError} for a suggested `[fromHex, toHex]` range and
|
|
58
58
|
* computes the span as `toHex - fromHex + 1`.
|
|
59
|
-
* 2. **
|
|
59
|
+
* 2. **DRPC decimal range** — matches `retry with the range <from>-<to>` and
|
|
60
|
+
* computes the span as `to - from + 1`.
|
|
61
|
+
* 3. **Generic N-blocks pattern** — matches `/<number> block(s)/i` in the
|
|
60
62
|
* error message.
|
|
61
63
|
*
|
|
62
64
|
* @param error - Any thrown value.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
|
-
import type {
|
|
2
|
+
import type { OnchainSDK } from "../sdk/index.js";
|
|
3
3
|
/**
|
|
4
4
|
* Sets faucet address on address provider
|
|
5
5
|
* @param sdk
|
|
6
6
|
* @param faucet - faucet address.
|
|
7
7
|
* @returns faucet address as read from address provider
|
|
8
8
|
*/
|
|
9
|
-
export declare function migrateFaucet(sdk:
|
|
9
|
+
export declare function migrateFaucet(sdk: OnchainSDK, faucet: Address): Promise<Address>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type Address } from "viem";
|
|
2
|
-
import { type
|
|
2
|
+
import { type OnchainSDK, SDKConstruct } from "../../sdk/index.js";
|
|
3
3
|
import type { AnvilClient } from "../createAnvilClient.js";
|
|
4
4
|
import type { IMinter } from "./types.js";
|
|
5
5
|
export default abstract class AbstractMinter extends SDKConstruct implements IMinter {
|
|
6
6
|
protected readonly anvil: AnvilClient;
|
|
7
7
|
name: string;
|
|
8
|
-
constructor(sdk:
|
|
8
|
+
constructor(sdk: OnchainSDK, anvil: AnvilClient);
|
|
9
9
|
tryMint(token: Address, dest: Address, amount: bigint): Promise<bigint>;
|
|
10
10
|
abstract mint(token: Address, dest: Address, amount: bigint): Promise<void>;
|
|
11
11
|
protected getOwner(address: Address): Promise<Address>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
|
-
import type {
|
|
2
|
+
import type { OnchainSDK } from "../../sdk/index.js";
|
|
3
3
|
import type { AnvilClient } from "../createAnvilClient.js";
|
|
4
4
|
import AbstractMinter from "./AbstractMinter.js";
|
|
5
5
|
import type { IMinter } from "./types.js";
|
|
6
6
|
export declare class FallbackMinter extends AbstractMinter implements IMinter {
|
|
7
7
|
#private;
|
|
8
|
-
constructor(sdk:
|
|
8
|
+
constructor(sdk: OnchainSDK, anvil: AnvilClient, minters: IMinter[]);
|
|
9
9
|
mint(token: Address, dest: Address, amount: bigint): Promise<void>;
|
|
10
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
|
-
import type {
|
|
2
|
+
import type { OnchainSDK } from "../../sdk/index.js";
|
|
3
3
|
import type { AnvilClient } from "../createAnvilClient.js";
|
|
4
4
|
import type { IMinter } from "./types.js";
|
|
5
|
-
export declare function createMinter(sdk:
|
|
5
|
+
export declare function createMinter(sdk: OnchainSDK, anvil: AnvilClient, _token: Address): IMinter;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Abi } from "
|
|
1
|
+
import type { Abi } from "viem";
|
|
2
2
|
import { type ContractFunctionArgs, type ContractFunctionName, type ContractFunctionParameters, type ReadContractReturnType } from "viem";
|
|
3
3
|
import type { AnvilClient } from "./createAnvilClient.js";
|
|
4
4
|
export type ReplaceStorageParams<abi extends Abi | readonly unknown[] = Abi, functionName extends ContractFunctionName<abi, "pure" | "view"> = ContractFunctionName<abi, "pure" | "view">, args extends ContractFunctionArgs<abi, "pure" | "view", functionName> = ContractFunctionArgs<abi, "pure" | "view", functionName>> = ContractFunctionParameters<abi, "pure" | "view", functionName, args, false> & {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Address, type PublicClient } from "viem";
|
|
2
|
-
import { type
|
|
2
|
+
import { type IPriceFeedContract, type OnchainSDK } from "../../../sdk/index.js";
|
|
3
3
|
export declare function getUpdatablePriceFeeds(args: {
|
|
4
|
-
sdk:
|
|
4
|
+
sdk: OnchainSDK;
|
|
5
5
|
client: PublicClient;
|
|
6
6
|
pfCompressor: Address;
|
|
7
7
|
priceFeeds: Address[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
|
-
import type { CreditAccountData, GetCreditAccountsOptions,
|
|
2
|
+
import type { CreditAccountData, GetCreditAccountsOptions, IOnchainSDKPlugin } from "../../sdk/index.js";
|
|
3
3
|
import { BasePlugin } from "../../sdk/index.js";
|
|
4
4
|
export interface AccountsPluginState {
|
|
5
5
|
/**
|
|
@@ -7,7 +7,7 @@ export interface AccountsPluginState {
|
|
|
7
7
|
*/
|
|
8
8
|
accounts: CreditAccountData[];
|
|
9
9
|
}
|
|
10
|
-
export declare class AccountsPlugin extends BasePlugin<AccountsPluginState> implements
|
|
10
|
+
export declare class AccountsPlugin extends BasePlugin<AccountsPluginState> implements IOnchainSDKPlugin<AccountsPluginState> {
|
|
11
11
|
#private;
|
|
12
12
|
constructor(options?: GetCreditAccountsOptions, loadOnAttach?: boolean);
|
|
13
13
|
get accounts(): CreditAccountData[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
|
-
import type {
|
|
2
|
+
import type { IOnchainSDKPlugin } from "../../sdk/index.js";
|
|
3
3
|
import { AddressMap, BasePlugin } from "../../sdk/index.js";
|
|
4
4
|
export interface AccountsCounterPluginState {
|
|
5
5
|
/**
|
|
@@ -7,7 +7,7 @@ export interface AccountsCounterPluginState {
|
|
|
7
7
|
*/
|
|
8
8
|
accounts: Record<Address, bigint>;
|
|
9
9
|
}
|
|
10
|
-
export declare class AccountsCounterPlugin extends BasePlugin<AccountsCounterPluginState> implements
|
|
10
|
+
export declare class AccountsCounterPlugin extends BasePlugin<AccountsCounterPluginState> implements IOnchainSDKPlugin<AccountsCounterPluginState> {
|
|
11
11
|
#private;
|
|
12
12
|
constructor(loadOnAttach?: boolean);
|
|
13
13
|
get accounts(): AddressMap<bigint>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { BaseState, IBaseContract,
|
|
1
|
+
import type { BaseState, IBaseContract, IOnchainSDKPlugin } from "../../sdk/index.js";
|
|
2
2
|
import { BasePlugin } from "../../sdk/index.js";
|
|
3
|
-
export declare class AdaptersPlugin extends BasePlugin<{}> implements
|
|
3
|
+
export declare class AdaptersPlugin extends BasePlugin<{}> implements IOnchainSDKPlugin<{}> {
|
|
4
4
|
readonly name = "Adapters";
|
|
5
5
|
readonly version = 1;
|
|
6
6
|
readonly loaded = true;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
|
-
import type {
|
|
2
|
+
import type { IOnchainSDKPlugin } from "../../sdk/index.js";
|
|
3
3
|
import { AddressMap, BasePlugin } from "../../sdk/index.js";
|
|
4
4
|
import type { GetPoolsAPYResult } from "./pool-apy-types.js";
|
|
5
5
|
import type { ApySnapshotState, Pool7DAgoState, Pools7DAgoStateHuman } from "./types.js";
|
|
@@ -20,7 +20,7 @@ export interface ApyPluginLoadOptions {
|
|
|
20
20
|
*/
|
|
21
21
|
loadPools7DAgo?: boolean;
|
|
22
22
|
}
|
|
23
|
-
export declare class ApyPlugin extends BasePlugin<ApyPluginState> implements
|
|
23
|
+
export declare class ApyPlugin extends BasePlugin<ApyPluginState> implements IOnchainSDKPlugin<ApyPluginState> {
|
|
24
24
|
#private;
|
|
25
25
|
constructor(loadOnAttach?: boolean, options?: ApyPluginConstructorOptions);
|
|
26
26
|
load(force?: boolean, loadOptions?: ApyPluginLoadOptions): Promise<ApyPluginState>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IOnchainSDKPlugin } from "../../sdk/index.js";
|
|
2
2
|
import { BasePlugin } from "../../sdk/index.js";
|
|
3
3
|
import { PartialLiquidationBotV310Contract } from "./PartialLiquidationBotV310Contract.js";
|
|
4
4
|
import { type BotsPluginState, type BotsPluginStateHuman, type MigrationBotState } from "./types.js";
|
|
5
|
-
export declare class BotsPlugin extends BasePlugin<BotsPluginState> implements
|
|
5
|
+
export declare class BotsPlugin extends BasePlugin<BotsPluginState> implements IOnchainSDKPlugin<BotsPluginState> {
|
|
6
6
|
#private;
|
|
7
7
|
get loaded(): boolean;
|
|
8
8
|
get bots(): PartialLiquidationBotV310Contract[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Address, type Hex } from "viem";
|
|
2
|
-
import { BaseContract, type
|
|
2
|
+
import { BaseContract, type OnchainSDK } from "../../sdk/index.js";
|
|
3
3
|
import { type BotStateV310Human } from "./types.js";
|
|
4
4
|
declare const abi: readonly [{
|
|
5
5
|
readonly type: "function";
|
|
@@ -205,7 +205,7 @@ export declare class PartialLiquidationBotV310Contract extends BaseContract<abi>
|
|
|
205
205
|
readonly maxHealthFactor: number;
|
|
206
206
|
readonly premiumScaleFactor: number;
|
|
207
207
|
readonly feeScaleFactor: number;
|
|
208
|
-
constructor(sdk:
|
|
208
|
+
constructor(sdk: OnchainSDK, args: PartialLiquidationBotV310Params);
|
|
209
209
|
stateHuman(raw?: boolean): BotStateV310Human;
|
|
210
210
|
get state(): PartialLiquidationBotV310Params;
|
|
211
211
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
|
-
import type {
|
|
2
|
+
import type { IOnchainSDKPlugin } from "../../sdk/index.js";
|
|
3
3
|
import { AddressMap, BasePlugin } from "../../sdk/index.js";
|
|
4
4
|
import type { DegenDistributorsStateHuman } from "./types.js";
|
|
5
5
|
export interface DegenDistributorsPluginState {
|
|
6
6
|
distributors: Record<Address, Address>;
|
|
7
7
|
}
|
|
8
|
-
export declare class DegenDistributorsPlugin extends BasePlugin<DegenDistributorsPluginState> implements
|
|
8
|
+
export declare class DegenDistributorsPlugin extends BasePlugin<DegenDistributorsPluginState> implements IOnchainSDKPlugin<DegenDistributorsPluginState> {
|
|
9
9
|
#private;
|
|
10
10
|
load(force?: boolean): Promise<DegenDistributorsPluginState>;
|
|
11
11
|
get loaded(): boolean;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
|
-
import type {
|
|
2
|
+
import type { IOnchainSDKPlugin } from "../../sdk/index.js";
|
|
3
3
|
import { AddressMap, BasePlugin } from "../../sdk/index.js";
|
|
4
4
|
import type { WithdrawableAsset, WithdrawableAssetStateHuman } from "./types.js";
|
|
5
5
|
export interface DelayedWithdrawalPluginState {
|
|
6
6
|
withdrawableAssets: Record<Address, Array<WithdrawableAsset>>;
|
|
7
7
|
}
|
|
8
|
-
export declare class DelayedWithdrawalPlugin extends BasePlugin<DelayedWithdrawalPluginState> implements
|
|
8
|
+
export declare class DelayedWithdrawalPlugin extends BasePlugin<DelayedWithdrawalPluginState> implements IOnchainSDKPlugin<DelayedWithdrawalPluginState> {
|
|
9
9
|
#private;
|
|
10
10
|
load(force?: boolean): Promise<DelayedWithdrawalPluginState>;
|
|
11
11
|
get loaded(): boolean;
|