@gearbox-protocol/sdk 13.6.0-kyc.6 → 13.6.0
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/plugins/adapters/abi/actionAbi.js +1 -1
- package/dist/cjs/plugins/adapters/abi/conctructorAbi.js +1 -1
- package/dist/cjs/plugins/adapters/createAdapter.js +1 -1
- package/dist/cjs/plugins/adapters/types.js +1 -1
- package/dist/cjs/plugins/apy/ApyPlugin.js +266 -0
- package/dist/cjs/plugins/apy/apy-cache.js +120 -0
- package/dist/cjs/plugins/apy/apy-parser.js +169 -0
- package/dist/cjs/{sdk/market/kyc/securitize → plugins/apy}/constants.js +6 -3
- package/dist/cjs/{sdk/market/kyc/securitize → plugins/apy}/index.js +14 -6
- package/dist/cjs/{sdk/market/kyc/securitize/types.js → plugins/apy/pool-apy-types.js} +2 -2
- package/dist/cjs/plugins/apy/pool-apy-utils.js +141 -0
- package/dist/cjs/rewards/rewards/extra-apy.js +10 -8
- package/dist/cjs/sdk/GearboxSDK.js +5 -52
- package/dist/cjs/sdk/accounts/AbstractCreditAccountsService.js +16 -331
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +1 -7
- package/dist/cjs/sdk/base/TokensMeta.js +43 -32
- package/dist/cjs/sdk/base/token-types.js +0 -9
- package/dist/cjs/sdk/chain/chains.js +32 -17
- package/dist/cjs/sdk/constants/address-provider.js +0 -3
- 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 +3 -3
- package/dist/cjs/sdk/options.js +1 -7
- package/dist/cjs/sdk/pools/PoolService.js +12 -104
- package/dist/cjs/sdk/utils/viem/index.js +0 -2
- package/dist/cjs/sdk/utils/viem/simulateWithPriceUpdates.js +39 -2
- package/dist/esm/dev/AccountOpener.js +6 -47
- package/dist/esm/plugins/adapters/abi/actionAbi.js +1 -1
- package/dist/esm/plugins/adapters/abi/conctructorAbi.js +1 -1
- package/dist/esm/plugins/adapters/createAdapter.js +1 -1
- package/dist/esm/plugins/adapters/types.js +1 -1
- package/dist/esm/plugins/apy/ApyPlugin.js +255 -0
- package/dist/esm/plugins/apy/apy-cache.js +86 -0
- package/dist/esm/plugins/apy/apy-parser.js +143 -0
- package/dist/esm/plugins/apy/constants.js +6 -0
- package/dist/esm/plugins/apy/index.js +7 -0
- package/dist/esm/plugins/apy/pool-apy-utils.js +113 -0
- package/dist/esm/rewards/rewards/extra-apy.js +10 -8
- package/dist/esm/sdk/GearboxSDK.js +6 -56
- package/dist/esm/sdk/accounts/AbstractCreditAccountsService.js +17 -332
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +1 -7
- package/dist/esm/sdk/base/TokensMeta.js +45 -32
- package/dist/esm/sdk/base/token-types.js +0 -6
- package/dist/esm/sdk/chain/chains.js +32 -17
- package/dist/esm/sdk/constants/address-provider.js +0 -2
- 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 +3 -3
- package/dist/esm/sdk/options.js +1 -7
- package/dist/esm/sdk/pools/PoolService.js +13 -109
- package/dist/esm/sdk/utils/viem/index.js +0 -1
- package/dist/esm/sdk/utils/viem/simulateWithPriceUpdates.js +41 -2
- package/dist/types/plugins/adapters/types.d.ts +2 -2
- package/dist/types/plugins/apy/ApyPlugin.d.ts +46 -0
- package/dist/types/plugins/apy/apy-cache.d.ts +28 -0
- package/dist/types/plugins/apy/apy-parser.d.ts +5 -0
- package/dist/types/plugins/apy/constants.d.ts +2 -0
- package/dist/types/plugins/apy/index.d.ts +7 -0
- package/dist/types/plugins/apy/pool-apy-types.d.ts +41 -0
- package/dist/types/plugins/apy/pool-apy-utils.d.ts +73 -0
- package/dist/types/plugins/apy/types.d.ts +37 -0
- package/dist/types/rewards/rewards/api.d.ts +10 -1
- package/dist/types/rewards/rewards/common.d.ts +0 -10
- package/dist/types/rewards/rewards/extra-apy.d.ts +4 -6
- package/dist/types/sdk/GearboxSDK.d.ts +0 -7
- package/dist/types/sdk/accounts/AbstractCreditAccountsService.d.ts +2 -55
- package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +1 -1
- package/dist/types/sdk/accounts/types.d.ts +13 -93
- 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 +11 -116
- package/dist/types/sdk/chain/chains.d.ts +5 -5
- package/dist/types/sdk/constants/address-provider.d.ts +0 -1
- package/dist/types/sdk/market/MarketRegister.d.ts +9 -6
- package/dist/types/sdk/market/MarketSuite.d.ts +0 -2
- package/dist/types/sdk/market/index.d.ts +0 -1
- package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +2 -3
- package/dist/types/sdk/market/oracle/types.d.ts +10 -3
- package/dist/types/sdk/market/pool/PoolSuite.d.ts +0 -2
- package/dist/types/sdk/market/pool/PoolV310Contract.d.ts +2 -6
- package/dist/types/sdk/market/pool/index.d.ts +0 -1
- package/dist/types/sdk/market/pricefeeds/PriceFeedsRegister.d.ts +1 -1
- package/dist/types/sdk/market/types.d.ts +1 -1
- package/dist/types/sdk/options.d.ts +0 -1
- package/dist/types/sdk/pools/PoolService.d.ts +8 -8
- package/dist/types/sdk/pools/types.d.ts +1 -1
- package/dist/types/sdk/types/state-human.d.ts +0 -2
- package/dist/types/sdk/types/state.d.ts +0 -5
- package/dist/types/sdk/utils/viem/index.d.ts +0 -1
- package/package.json +2 -3
- 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/plugins/pools-history/Pools7DAgoPlugin.js +0 -108
- package/dist/cjs/plugins/pools-history/index.js +0 -24
- 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 -229
- package/dist/cjs/sdk/market/kyc/types.js +0 -29
- 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/plugins/pools-history/Pools7DAgoPlugin.js +0 -90
- package/dist/esm/plugins/pools-history/index.js +0 -2
- 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 -205
- 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/types.js +0 -5
- 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/plugins/pools-history/Pools7DAgoPlugin.d.ts +0 -20
- package/dist/types/plugins/pools-history/index.d.ts +0 -2
- package/dist/types/plugins/pools-history/types.d.ts +0 -9
- 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 -420
- 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 -107
- package/dist/types/sdk/market/kyc/types.d.ts +0 -136
- package/dist/types/sdk/utils/viem/executeDelegatedMulticalls.d.ts +0 -28
- /package/dist/cjs/plugins/{pools-history → apy}/package.json +0 -0
- /package/dist/cjs/plugins/{pools-history → apy}/types.js +0 -0
- /package/dist/esm/plugins/{pools-history → apy}/package.json +0 -0
- /package/dist/esm/plugins/{pools-history/types.js → apy/pool-apy-types.js} +0 -0
- /package/dist/esm/{sdk/market/kyc/securitize → plugins/apy}/types.js +0 -0
|
@@ -4,10 +4,9 @@ import { SDKConstruct } from "../base/index.js";
|
|
|
4
4
|
import type { GearboxSDK } from "../GearboxSDK.js";
|
|
5
5
|
import type { CreditSuite } from "../market/index.js";
|
|
6
6
|
import { type PriceUpdate, type UpdatePriceFeedsResult } from "../market/index.js";
|
|
7
|
-
import type { OpenAccountRequirements } from "../market/kyc/index.js";
|
|
8
7
|
import { type Asset, type RouterCASlice } from "../router/index.js";
|
|
9
8
|
import type { MultiCall, RawTx } from "../types/index.js";
|
|
10
|
-
import type { AccountToCheck, AddCollateralProps, ChangeDeptProps, ClaimDelayedProps, CloseCreditAccountProps, CloseCreditAccountResult, CloseOptions, CreditAccountOperationResult, CreditAccountTokensSlice, ExecuteSwapProps, FullyLiquidateProps, FullyLiquidateResult,
|
|
9
|
+
import type { AccountToCheck, AddCollateralProps, ChangeDeptProps, ClaimDelayedProps, CloseCreditAccountProps, CloseCreditAccountResult, CloseOptions, CreditAccountOperationResult, CreditAccountTokensSlice, ExecuteSwapProps, FullyLiquidateProps, FullyLiquidateResult, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsOptions, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, OpenCAProps, PermitResult, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, PreviewDelayedWithdrawalResult, Rewards, StartDelayedWithdrawalProps, UpdateQuotasProps } from "./types.js";
|
|
11
10
|
/**
|
|
12
11
|
* Options for configuring the credit account service.
|
|
13
12
|
**/
|
|
@@ -33,15 +32,11 @@ export declare abstract class AbstractCreditAccountService extends SDKConstruct
|
|
|
33
32
|
/**
|
|
34
33
|
* {@inheritDoc ICreditAccountsService.getCreditAccountData}
|
|
35
34
|
**/
|
|
36
|
-
getCreditAccountData(account: Address, blockNumber?: bigint): Promise<CreditAccountData
|
|
35
|
+
getCreditAccountData(account: Address, blockNumber?: bigint): Promise<CreditAccountData | undefined>;
|
|
37
36
|
/**
|
|
38
37
|
* {@inheritDoc ICreditAccountsService.getCreditAccounts}
|
|
39
38
|
**/
|
|
40
39
|
getCreditAccounts(options?: GetCreditAccountsOptions, blockNumber?: bigint): Promise<Array<CreditAccountData>>;
|
|
41
|
-
/**
|
|
42
|
-
* {@inheritDoc ICreditAccountsService.getBorrowerCreditAccounts}
|
|
43
|
-
**/
|
|
44
|
-
getBorrowerCreditAccounts(borrower: Address, options?: GetCreditAccountsOptions, blockNumber?: bigint): Promise<Array<CreditAccountData<true>>>;
|
|
45
40
|
/**
|
|
46
41
|
* {@inheritDoc ICreditAccountsService.getRewards}
|
|
47
42
|
**/
|
|
@@ -94,17 +89,6 @@ export declare abstract class AbstractCreditAccountService extends SDKConstruct
|
|
|
94
89
|
* {@inheritDoc ICreditAccountsService.claimDelayed}
|
|
95
90
|
**/
|
|
96
91
|
claimDelayed({ creditAccount, minQuota, averageQuota, claimableNow, }: ClaimDelayedProps): Promise<CreditAccountOperationResult>;
|
|
97
|
-
/**
|
|
98
|
-
* Returns address to which approval should be given on collateral token
|
|
99
|
-
* It's credit manager for classical markets and special wallet for KYC markets
|
|
100
|
-
* @param options - {@link GetApprovalAddressProps}
|
|
101
|
-
* @returns
|
|
102
|
-
**/
|
|
103
|
-
getApprovalAddress(options: GetApprovalAddressProps): Promise<Address>;
|
|
104
|
-
/**
|
|
105
|
-
* {@inheritDoc ICreditAccountsService.getOpenAccountRequirements}
|
|
106
|
-
*/
|
|
107
|
-
getOpenAccountRequirements(borrower: Address, props: Pick<OpenCAProps, "creditManager">): Promise<OpenAccountRequirements | undefined>;
|
|
108
92
|
/**
|
|
109
93
|
* {@inheritDoc ICreditAccountsService.openCA}
|
|
110
94
|
**/
|
|
@@ -118,43 +102,6 @@ export declare abstract class AbstractCreditAccountService extends SDKConstruct
|
|
|
118
102
|
**/
|
|
119
103
|
getOptimalHFForPartialLiquidation(ca: CreditAccountData): bigint;
|
|
120
104
|
/**
|
|
121
|
-
* Returns multicall entries to redeem (unwrap) KYC ERC-4626 vault shares into underlying for the given credit manager.
|
|
122
|
-
* Used when withdrawing debt from a KYC market: redeems adapter vault shares so the underlying can be withdrawn.
|
|
123
|
-
* Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
|
|
124
|
-
* @param amount - Number of vault shares (adapter tokens) to redeem
|
|
125
|
-
* @param creditManager - Credit manager address
|
|
126
|
-
* @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
|
|
127
|
-
*/
|
|
128
|
-
getKYCUnwrapCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
|
|
129
|
-
/**
|
|
130
|
-
* Returns multicall entries to deposit (wrap) underlying into KYC ERC-4626 vault shares for the given credit manager.
|
|
131
|
-
* Used when adding debt on a KYC market: deposits underlying into the adapter vault so shares are minted on the account.
|
|
132
|
-
* Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
|
|
133
|
-
* @param amount - Amount of underlying assets to deposit into the vault (in underlying decimals)
|
|
134
|
-
* @param creditManager - Credit manager address
|
|
135
|
-
* @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
|
|
136
|
-
*/
|
|
137
|
-
getKYCWrapCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
|
|
138
|
-
/**
|
|
139
|
-
* Returns multicall entries to call redeemDiff on the KYC ERC-4626 adapter for the given credit manager.
|
|
140
|
-
* Redeems the leftover vault shares (e.g. after repaying debt) so the account does not hold excess KYC vault tokens.
|
|
141
|
-
* Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
|
|
142
|
-
* @param amount - Leftover vault share amount to redeem (in adapter/vault decimals)
|
|
143
|
-
* @param creditManager - Credit manager address
|
|
144
|
-
* @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
|
|
145
|
-
*/
|
|
146
|
-
getRedeemDiffCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
|
|
147
|
-
/**
|
|
148
|
-
* Returns multicall entries to call depositDiff on the KYC ERC-4626 adapter for the given credit manager.
|
|
149
|
-
* Deposits the leftover underlying (e.g. after decreasing debt) into the vault so the account does not hold excess underlying.
|
|
150
|
-
* Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
|
|
151
|
-
* @param amount - Leftover underlying amount to deposit into the vault (in underlying decimals)
|
|
152
|
-
* @param creditManager - Credit manager address
|
|
153
|
-
* @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
|
|
154
|
-
*/
|
|
155
|
-
getDepositDiffCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
|
|
156
|
-
/**
|
|
157
|
-
* Returns raw txs that are needed to update all price feeds so that all credit accounts (possibly from different markets) compute
|
|
158
105
|
* {@inheritDoc ICreditAccountsService.getOnDemandPriceUpdates}
|
|
159
106
|
**/
|
|
160
107
|
getOnDemandPriceUpdates(account: CreditAccountTokensSlice, ignoreReservePrices?: boolean): Promise<PriceUpdate[]>;
|
|
@@ -21,7 +21,7 @@ export declare class CreditAccountServiceV310 extends AbstractCreditAccountServi
|
|
|
21
21
|
/**
|
|
22
22
|
* {@inheritDoc ICreditAccountsService.repayCreditAccount}
|
|
23
23
|
*/
|
|
24
|
-
repayCreditAccount({ operation, collateralAssets, assetsToWithdraw, creditAccount: ca, permits, to, tokensToClaim,
|
|
24
|
+
repayCreditAccount({ operation, collateralAssets, assetsToWithdraw, creditAccount: ca, permits, to, tokensToClaim, }: RepayCreditAccountProps): Promise<CreditAccountOperationResult>;
|
|
25
25
|
/**
|
|
26
26
|
* {@inheritDoc ICreditAccountsService.repayAndLiquidateCreditAccount}
|
|
27
27
|
*/
|
|
@@ -4,7 +4,6 @@ import type { iWithdrawalCompressorV310Abi } from "../../abi/IWithdrawalCompress
|
|
|
4
4
|
import type { ConnectedBotData, Construct, CreditAccountData } from "../base/index.js";
|
|
5
5
|
import type { GearboxSDK } from "../GearboxSDK.js";
|
|
6
6
|
import type { CreditSuite, PriceUpdate } from "../market/index.js";
|
|
7
|
-
import type { OpenAccountRequirements } from "../market/kyc/index.js";
|
|
8
7
|
import type { Asset, RouterCASlice, RouterCloseResult } from "../router/index.js";
|
|
9
8
|
import type { MultiCall, RawTx } from "../types/index.js";
|
|
10
9
|
/**
|
|
@@ -183,10 +182,6 @@ export interface CloseCreditAccountProps {
|
|
|
183
182
|
closePath?: RouterCloseResult;
|
|
184
183
|
}
|
|
185
184
|
export interface RepayCreditAccountProps extends RepayAndLiquidateCreditAccountProps {
|
|
186
|
-
/**
|
|
187
|
-
* Swap calls for repay
|
|
188
|
-
*/
|
|
189
|
-
calls?: Array<MultiCall>;
|
|
190
185
|
/**
|
|
191
186
|
* close or zeroDebt
|
|
192
187
|
*/
|
|
@@ -444,10 +439,6 @@ export interface ChangeDeptProps {
|
|
|
444
439
|
* Assets to add as collateral
|
|
445
440
|
*/
|
|
446
441
|
collateral?: [Asset];
|
|
447
|
-
/**
|
|
448
|
-
* Assets to wrap
|
|
449
|
-
*/
|
|
450
|
-
wrapAsset?: [Asset];
|
|
451
442
|
}
|
|
452
443
|
export interface FullyLiquidateProps {
|
|
453
444
|
/**
|
|
@@ -591,46 +582,25 @@ export type GetConnectedMigrationBotsResult = {
|
|
|
591
582
|
})[];
|
|
592
583
|
botAddress: Address;
|
|
593
584
|
} | undefined;
|
|
594
|
-
/**
|
|
595
|
-
* Options to get approval address for collateral token
|
|
596
|
-
*/
|
|
597
|
-
export type GetApprovalAddressProps = {
|
|
598
|
-
creditManager: Address;
|
|
599
|
-
borrower: Address;
|
|
600
|
-
} | {
|
|
601
|
-
creditManager: Address;
|
|
602
|
-
creditAccount: Address;
|
|
603
|
-
};
|
|
604
585
|
export interface ICreditAccountsService extends Construct {
|
|
605
586
|
sdk: GearboxSDK;
|
|
606
587
|
/**
|
|
607
|
-
* Returns single credit account data
|
|
608
|
-
*
|
|
609
|
-
*
|
|
610
|
-
* @param
|
|
611
|
-
* @
|
|
612
|
-
* @returns Credit account data with investor, or undefined
|
|
588
|
+
* Returns single credit account data, or undefined if it's not found
|
|
589
|
+
* Performs all necessary price feed updates under the hood
|
|
590
|
+
* @param account
|
|
591
|
+
* @param blockNumber
|
|
592
|
+
* @returns
|
|
613
593
|
*/
|
|
614
|
-
getCreditAccountData(account: Address, blockNumber?: bigint): Promise<CreditAccountData
|
|
594
|
+
getCreditAccountData(account: Address, blockNumber?: bigint): Promise<CreditAccountData | undefined>;
|
|
615
595
|
/**
|
|
616
|
-
*
|
|
617
|
-
* Performs all necessary price feed updates under the hood
|
|
596
|
+
* Methods to get all credit accounts with some optional filtering
|
|
597
|
+
* Performs all necessary price feed updates under the hood
|
|
618
598
|
*
|
|
619
|
-
* @param options
|
|
620
|
-
* @param blockNumber
|
|
621
|
-
* @returns
|
|
599
|
+
* @param options
|
|
600
|
+
* @param blockNumber
|
|
601
|
+
* @returns returned credit accounts are sorted by health factor in ascending order
|
|
622
602
|
*/
|
|
623
603
|
getCreditAccounts(options?: GetCreditAccountsOptions, blockNumber?: bigint): Promise<Array<CreditAccountData>>;
|
|
624
|
-
/**
|
|
625
|
-
* Returns all credit accounts for a borrower,
|
|
626
|
-
* both normal and KYC accounts with investor resolved on each.
|
|
627
|
-
*
|
|
628
|
-
* @param borrower - Actual owner of credit account
|
|
629
|
-
* @param options - Filter options (creditManager, health factor, etc.)
|
|
630
|
-
* @param blockNumber - Optional block number for the read
|
|
631
|
-
* @returns Credit accounts (with investor) sorted by health factor ascending
|
|
632
|
-
*/
|
|
633
|
-
getBorrowerCreditAccounts(borrower: Address, options?: GetCreditAccountsOptions, blockNumber?: bigint): Promise<Array<CreditAccountData<true>>>;
|
|
634
604
|
/**
|
|
635
605
|
* Method to get all claimable rewards for credit account (ex. stkUSDS SKY rewards).
|
|
636
606
|
* Associates rewards by adapter + stakedPhantomToken.
|
|
@@ -659,9 +629,9 @@ export interface ICreditAccountsService extends Construct {
|
|
|
659
629
|
/**
|
|
660
630
|
* Generates transaction to liquidate credit account
|
|
661
631
|
* @param props - {@link FullyLiquidateProps}
|
|
662
|
-
* @returns
|
|
632
|
+
* @returns
|
|
663
633
|
*/
|
|
664
|
-
fullyLiquidate(props: FullyLiquidateProps): Promise<
|
|
634
|
+
fullyLiquidate(props: FullyLiquidateProps): Promise<CloseCreditAccountResult>;
|
|
665
635
|
/**
|
|
666
636
|
* Closes credit account or closes credit account and keeps it open with zero debt.
|
|
667
637
|
* - Ca is closed in the following order: price update -> close path to swap all tokens into underlying ->
|
|
@@ -724,20 +694,6 @@ export interface ICreditAccountsService extends Construct {
|
|
|
724
694
|
* @returns
|
|
725
695
|
*/
|
|
726
696
|
claimDelayed(props: ClaimDelayedProps): Promise<CreditAccountOperationResult>;
|
|
727
|
-
/**
|
|
728
|
-
* Returns address to which approval should be given on collateral token
|
|
729
|
-
* It's credit manager for classical markets and special wallet for KYC markets
|
|
730
|
-
* @param props - {@link GetApprovalAddressProps}
|
|
731
|
-
* @returns
|
|
732
|
-
*/
|
|
733
|
-
getApprovalAddress(props: GetApprovalAddressProps): Promise<Address>;
|
|
734
|
-
/**
|
|
735
|
-
* Returns open account requirements for a borrower
|
|
736
|
-
* @param borrower - Borrower address
|
|
737
|
-
* @param props - {@link OpenCAProps}
|
|
738
|
-
* @returns Open account requirements or undefined if the user can open a credit account without any further actions
|
|
739
|
-
*/
|
|
740
|
-
getOpenAccountRequirements(borrower: Address, props: Pick<OpenCAProps, "creditManager">): Promise<OpenAccountRequirements | undefined>;
|
|
741
697
|
/**
|
|
742
698
|
* Executes swap specified by given calls, update quotas of affected tokens
|
|
743
699
|
* - Open credit account is executed in the following order: price update -> increase debt -> add collateral ->
|
|
@@ -793,42 +749,6 @@ export interface ICreditAccountsService extends Construct {
|
|
|
793
749
|
botMulticall(creditAccount: RouterCASlice, calls: Array<MultiCall>, options?: {
|
|
794
750
|
ignoreReservePrices?: boolean;
|
|
795
751
|
}): Promise<RawTx>;
|
|
796
|
-
/**
|
|
797
|
-
* Returns multicall entries to redeem (unwrap) KYC ERC-4626 vault shares into underlying for the given credit manager.
|
|
798
|
-
* Used when withdrawing debt from a KYC market: redeems adapter vault shares so the underlying can be withdrawn.
|
|
799
|
-
* Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
|
|
800
|
-
* @param amount - Number of vault shares (adapter tokens) to redeem
|
|
801
|
-
* @param creditManager - Credit manager address
|
|
802
|
-
* @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
|
|
803
|
-
*/
|
|
804
|
-
getKYCUnwrapCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
|
|
805
|
-
/**
|
|
806
|
-
* Returns multicall entries to deposit (wrap) underlying into KYC ERC-4626 vault shares for the given credit manager.
|
|
807
|
-
* Used when adding debt on a KYC market: deposits underlying into the adapter vault so shares are minted on the account.
|
|
808
|
-
* Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
|
|
809
|
-
* @param amount - Amount of underlying assets to deposit into the vault (in underlying decimals)
|
|
810
|
-
* @param creditManager - Credit manager address
|
|
811
|
-
* @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
|
|
812
|
-
*/
|
|
813
|
-
getKYCWrapCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
|
|
814
|
-
/**
|
|
815
|
-
* Returns multicall entries to call redeemDiff on the KYC ERC-4626 adapter for the given credit manager.
|
|
816
|
-
* Redeems the leftover vault shares (e.g. after repaying debt) so the account does not hold excess KYC vault tokens.
|
|
817
|
-
* Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
|
|
818
|
-
* @param amount - Leftover vault share amount to redeem (in adapter/vault decimals)
|
|
819
|
-
* @param creditManager - Credit manager address
|
|
820
|
-
* @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
|
|
821
|
-
*/
|
|
822
|
-
getRedeemDiffCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
|
|
823
|
-
/**
|
|
824
|
-
* Returns multicall entries to call depositDiff on the KYC ERC-4626 adapter for the given credit manager.
|
|
825
|
-
* Deposits the leftover underlying (e.g. after decreasing debt) into the vault so the account does not hold excess underlying.
|
|
826
|
-
* Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
|
|
827
|
-
* @param amount - Leftover underlying amount to deposit into the vault (in underlying decimals)
|
|
828
|
-
* @param creditManager - Credit manager address
|
|
829
|
-
* @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
|
|
830
|
-
*/
|
|
831
|
-
getDepositDiffCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
|
|
832
752
|
/**
|
|
833
753
|
* Withdraws a single collateral from credit account to wallet to and updates quotas;
|
|
834
754
|
* technically can withdraw several tokens at once
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Address, type Chain, type PublicClient, type Transport } from "viem";
|
|
2
2
|
import type { Asset } from "../router/index.js";
|
|
3
3
|
import type { ILogger } from "../types/logger.js";
|
|
4
4
|
import { AddressMap } from "../utils/index.js";
|
|
5
|
-
import type {
|
|
5
|
+
import type { PhantomTokenMeta, TokenMetaData } from "./token-types.js";
|
|
6
6
|
/**
|
|
7
7
|
* Options for {@link TokensMeta.formatBN}.
|
|
8
8
|
**/
|
|
@@ -50,22 +50,11 @@ export declare class TokensMeta extends AddressMap<TokenMetaData> {
|
|
|
50
50
|
* @returns
|
|
51
51
|
*/
|
|
52
52
|
isPhantomToken(t: TokenMetaData): t is PhantomTokenMeta;
|
|
53
|
-
/**
|
|
54
|
-
* Returns true if the token is a KYC underlying token, throws if the token data is not loaded
|
|
55
|
-
* @param t
|
|
56
|
-
* @returns
|
|
57
|
-
*/
|
|
58
|
-
isKYCUnderlying(t: TokenMetaData): t is KYCTokenMeta;
|
|
59
53
|
/**
|
|
60
54
|
* Returns a map of all phantom tokens
|
|
61
55
|
* Throws if token data is not loaded
|
|
62
56
|
*/
|
|
63
57
|
get phantomTokens(): AddressMap<PhantomTokenMeta>;
|
|
64
|
-
/**
|
|
65
|
-
* Returns a map of all KYC underlying tokens
|
|
66
|
-
* Throws if token data is not loaded
|
|
67
|
-
*/
|
|
68
|
-
get kycUnderlyings(): AddressMap<KYCTokenMeta>;
|
|
69
58
|
/**
|
|
70
59
|
* Formats a raw token amount into a human-readable decimal string,
|
|
71
60
|
* dividing by `10^decimals` for the token.
|
|
@@ -96,7 +85,7 @@ export declare class TokensMeta extends AddressMap<TokenMetaData> {
|
|
|
96
85
|
mustFindBySymbol(symbol: string): TokenMetaData;
|
|
97
86
|
/**
|
|
98
87
|
* Loads token information about phantom tokens
|
|
99
|
-
*
|
|
88
|
+
* Other special tokens may be loaded here in the future
|
|
100
89
|
*
|
|
101
90
|
* @param tokens - tokens to load data for, defaults to all tokens
|
|
102
91
|
*/
|
|
@@ -1,53 +1,13 @@
|
|
|
1
|
-
import type { Address } from "viem";
|
|
2
1
|
import type { MarketData, Unarray } from "./types.js";
|
|
3
2
|
type TokenData = Unarray<MarketData["tokens"]>;
|
|
4
3
|
export declare const PHANTOM_TOKEN_CONTRACT_TYPES: readonly ["PHANTOM_TOKEN::CONVEX", "PHANTOM_TOKEN::INFINIFI_UNWIND", "PHANTOM_TOKEN::INFRARED", "PHANTOM_TOKEN::MELLOW_WITHDRAWAL", "PHANTOM_TOKEN::MIDAS_REDEMPTION", "PHANTOM_TOKEN::STAKING_REWARDS", "PHANTOM_TOKEN::UPSHIFT_WITHDRAW"];
|
|
5
|
-
export declare const KYC_UNDERLYING_DEFAULT = "KYC_UNDERLYING::DEFAULT";
|
|
6
|
-
export declare const KYC_UNDERLYING_ON_DEMAND = "KYC_UNDERLYING::ON_DEMAND";
|
|
7
|
-
export type KYCUnderlyingContractType = typeof KYC_UNDERLYING_DEFAULT | typeof KYC_UNDERLYING_ON_DEMAND;
|
|
8
|
-
export declare const KYC_ON_DEMAND_LP_MONOPOLIZED = "ON_DEMAND_LP::MONOPOLIZED";
|
|
9
|
-
export type KYCOnDemandLpContractType = typeof KYC_ON_DEMAND_LP_MONOPOLIZED;
|
|
10
4
|
export type PhantomTokenContractType = (typeof PHANTOM_TOKEN_CONTRACT_TYPES)[number];
|
|
11
|
-
export
|
|
5
|
+
export type SimpleTokenMeta = TokenData & {
|
|
6
|
+
isDSToken?: boolean;
|
|
12
7
|
contractType?: string;
|
|
13
|
-
}
|
|
8
|
+
};
|
|
14
9
|
export type PhantomTokenMeta = SimpleTokenMeta & {
|
|
15
10
|
contractType: PhantomTokenContractType;
|
|
16
11
|
};
|
|
17
|
-
export
|
|
18
|
-
contractType: typeof KYC_UNDERLYING_DEFAULT;
|
|
19
|
-
kycFactory: Address;
|
|
20
|
-
asset: Address;
|
|
21
|
-
}
|
|
22
|
-
export interface LPMonopolizedPoolMeta {
|
|
23
|
-
pool: Address;
|
|
24
|
-
wrappedUnderlying: Address;
|
|
25
|
-
unwrappedUnderlying: Address;
|
|
26
|
-
depositAllowance: bigint;
|
|
27
|
-
claimableAmount: bigint;
|
|
28
|
-
}
|
|
29
|
-
export interface KYCOnDemandLPMonopolizedMeta {
|
|
30
|
-
addr: Address;
|
|
31
|
-
version: bigint;
|
|
32
|
-
contractType: typeof KYC_ON_DEMAND_LP_MONOPOLIZED;
|
|
33
|
-
marketConfigurator: Address;
|
|
34
|
-
/**
|
|
35
|
-
* Only this user can deposit into the pool and withdraw
|
|
36
|
-
* Other users should not see it at all
|
|
37
|
-
*/
|
|
38
|
-
depositor: Address;
|
|
39
|
-
pools: LPMonopolizedPoolMeta[];
|
|
40
|
-
}
|
|
41
|
-
export type KYCOnDemandLPMeta = KYCOnDemandLPMonopolizedMeta;
|
|
42
|
-
export interface KYCOnDemandTokenMeta extends SimpleTokenMeta {
|
|
43
|
-
contractType: typeof KYC_UNDERLYING_ON_DEMAND;
|
|
44
|
-
kycFactory: Address;
|
|
45
|
-
asset: Address;
|
|
46
|
-
pool: Address;
|
|
47
|
-
marketConfigurator: Address;
|
|
48
|
-
allowedDepositors: Address[];
|
|
49
|
-
liquidityProvider: KYCOnDemandLPMeta;
|
|
50
|
-
}
|
|
51
|
-
export type KYCTokenMeta = KYCDefaultTokenMeta | KYCOnDemandTokenMeta;
|
|
52
|
-
export type TokenMetaData = SimpleTokenMeta | PhantomTokenMeta | KYCTokenMeta;
|
|
12
|
+
export type TokenMetaData = SimpleTokenMeta | PhantomTokenMeta;
|
|
53
13
|
export {};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { AbiParametersToPrimitiveTypes, ExtractAbiFunction } from "abitype";
|
|
2
2
|
import type { Address, Hex } from "viem";
|
|
3
|
+
import type { creditAccountCompressorAbi } from "../../abi/compressors/creditAccountCompressor.js";
|
|
3
4
|
import type { gaugeCompressorAbi } from "../../abi/compressors/gaugeCompressor.js";
|
|
4
5
|
import type { marketCompressorAbi } from "../../abi/compressors/marketCompressor.js";
|
|
5
6
|
import type { peripheryCompressorAbi } from "../../abi/compressors/peripheryCompressor.js";
|
|
6
7
|
import type { rewardsCompressorAbi } from "../../abi/compressors/rewardsCompressor.js";
|
|
8
|
+
import type { NetworkType } from "../chain/index.js";
|
|
7
9
|
/**
|
|
8
10
|
* Recursively unwraps array types to their element type.
|
|
9
11
|
**/
|
|
@@ -61,125 +63,10 @@ export interface BaseState {
|
|
|
61
63
|
* Filter criteria for querying markets.
|
|
62
64
|
**/
|
|
63
65
|
export type MarketFilter = AbiParametersToPrimitiveTypes<ExtractAbiFunction<typeof marketCompressorAbi, "getMarkets">["inputs"]>[0];
|
|
64
|
-
/**
|
|
65
|
-
* Info on credit account's assets
|
|
66
|
-
**/
|
|
67
|
-
export interface TokenInfo {
|
|
68
|
-
/**
|
|
69
|
-
* Token address.
|
|
70
|
-
**/
|
|
71
|
-
token: Address;
|
|
72
|
-
/**
|
|
73
|
-
* Token mask in the credit manager.
|
|
74
|
-
**/
|
|
75
|
-
mask: bigint;
|
|
76
|
-
/**
|
|
77
|
-
* Account's balance of token.
|
|
78
|
-
**/
|
|
79
|
-
balance: bigint;
|
|
80
|
-
/**
|
|
81
|
-
* Account's quota of token.
|
|
82
|
-
**/
|
|
83
|
-
quota: bigint;
|
|
84
|
-
/**
|
|
85
|
-
* Whether balance call was successful.
|
|
86
|
-
**/
|
|
87
|
-
success: boolean;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* On-chain state of a credit account.
|
|
91
|
-
*
|
|
92
|
-
* @remarks
|
|
93
|
-
* Fields from `totalDebtUSD` through `healthFactor` are not filled when
|
|
94
|
-
* `success` is `false`.
|
|
95
|
-
*
|
|
96
|
-
**/
|
|
97
|
-
export interface CreditAccountDataPayload {
|
|
98
|
-
/**
|
|
99
|
-
* Credit account address.
|
|
100
|
-
**/
|
|
101
|
-
creditAccount: Address;
|
|
102
|
-
/**
|
|
103
|
-
* Credit manager account is opened in.
|
|
104
|
-
**/
|
|
105
|
-
creditManager: Address;
|
|
106
|
-
/**
|
|
107
|
-
* Facade connected to account's credit manager.
|
|
108
|
-
**/
|
|
109
|
-
creditFacade: Address;
|
|
110
|
-
/**
|
|
111
|
-
* Credit manager's underlying token.
|
|
112
|
-
**/
|
|
113
|
-
underlying: Address;
|
|
114
|
-
/**
|
|
115
|
-
* Credit account's owner (contract address for KYC accounts, EOA for
|
|
116
|
-
* normal accounts).
|
|
117
|
-
**/
|
|
118
|
-
owner: Address;
|
|
119
|
-
/**
|
|
120
|
-
* Expiration timestamp, in case facade is expirable.
|
|
121
|
-
**/
|
|
122
|
-
expirationDate: number;
|
|
123
|
-
/**
|
|
124
|
-
* Bitmask of tokens enabled on credit account as collateral.
|
|
125
|
-
**/
|
|
126
|
-
enabledTokensMask: bigint;
|
|
127
|
-
/**
|
|
128
|
-
* Credit account's debt principal in underlying.
|
|
129
|
-
**/
|
|
130
|
-
debt: bigint;
|
|
131
|
-
/**
|
|
132
|
-
* Base and quota interest accrued on the credit account.
|
|
133
|
-
**/
|
|
134
|
-
accruedInterest: bigint;
|
|
135
|
-
/**
|
|
136
|
-
* Fees accrued on the credit account.
|
|
137
|
-
**/
|
|
138
|
-
accruedFees: bigint;
|
|
139
|
-
/**
|
|
140
|
-
* Account's total debt in USD.
|
|
141
|
-
**/
|
|
142
|
-
totalDebtUSD: bigint;
|
|
143
|
-
/**
|
|
144
|
-
* Account's total value in USD.
|
|
145
|
-
**/
|
|
146
|
-
totalValueUSD: bigint;
|
|
147
|
-
/**
|
|
148
|
-
* Account's threshold-weighted value in USD.
|
|
149
|
-
**/
|
|
150
|
-
twvUSD: bigint;
|
|
151
|
-
/**
|
|
152
|
-
* Account's total value in underlying.
|
|
153
|
-
**/
|
|
154
|
-
totalValue: bigint;
|
|
155
|
-
/**
|
|
156
|
-
* Account's health factor, i.e. ratio of `twvUSD` to `totalDebtUSD`,
|
|
157
|
-
* with 18 decimals precision.
|
|
158
|
-
**/
|
|
159
|
-
healthFactor: bigint;
|
|
160
|
-
/**
|
|
161
|
-
* Whether collateral calculation was successful.
|
|
162
|
-
**/
|
|
163
|
-
success: boolean;
|
|
164
|
-
/**
|
|
165
|
-
* Info on credit account's enabled tokens and tokens with non-zero balance.
|
|
166
|
-
**/
|
|
167
|
-
tokens: readonly TokenInfo[];
|
|
168
|
-
}
|
|
169
66
|
/**
|
|
170
67
|
* Full on-chain snapshot of a single credit account.
|
|
171
|
-
*
|
|
172
|
-
* @typeParam WithInvestor - When `true`, the result includes an `investor`
|
|
173
|
-
* field (`Address | undefined`). Defaults to `false` (no investor field).
|
|
174
68
|
**/
|
|
175
|
-
export type CreditAccountData
|
|
176
|
-
/**
|
|
177
|
-
* Investor EOA address (the real person behind the account).
|
|
178
|
-
* - KYC accounts: resolved from KYC factory, always defined.
|
|
179
|
-
* - Normal accounts: `undefined` (owner IS the investor).
|
|
180
|
-
**/
|
|
181
|
-
investor: Address | undefined;
|
|
182
|
-
} : CreditAccountDataPayload;
|
|
69
|
+
export type CreditAccountData = Unarray<AbiParametersToPrimitiveTypes<ExtractAbiFunction<typeof creditAccountCompressorAbi, "getCreditAccountData">["outputs"]>>;
|
|
183
70
|
/**
|
|
184
71
|
* Reward distribution details for a single reward token.
|
|
185
72
|
**/
|
|
@@ -358,6 +245,14 @@ export interface IBaseContract {
|
|
|
358
245
|
* labeling methods for user-facing output.
|
|
359
246
|
*/
|
|
360
247
|
readonly name: string;
|
|
248
|
+
/**
|
|
249
|
+
* Chain ID of the contract.
|
|
250
|
+
**/
|
|
251
|
+
readonly chainId: number;
|
|
252
|
+
/**
|
|
253
|
+
* Network type of the contract.
|
|
254
|
+
**/
|
|
255
|
+
readonly networkType: NetworkType;
|
|
361
256
|
/**
|
|
362
257
|
* @internal
|
|
363
258
|
* `true` when the local state has diverged from on-chain and needs a sync.
|
|
@@ -4,7 +4,7 @@ import { z } from "zod/v4";
|
|
|
4
4
|
* Known curator names that manage Gearbox markets.
|
|
5
5
|
*
|
|
6
6
|
**/
|
|
7
|
-
export type Curator = "Chaos Labs" | "K3" | "cp0x" | "Re7" | "Invariant Group" | "Tulipa" | "M11 Credit" | "kpk" | "Hyperithm" | "UltraYield" | "TelosC" | "Gami Labs"
|
|
7
|
+
export type Curator = "Chaos Labs" | "K3" | "cp0x" | "Re7" | "Invariant Group" | "Tulipa" | "M11 Credit" | "kpk" | "Hyperithm" | "UltraYield" | "TelosC" | "Gami Labs";
|
|
8
8
|
/**
|
|
9
9
|
* Extended viem {@link Chain} with Gearbox-specific metadata.
|
|
10
10
|
*
|
|
@@ -20,10 +20,6 @@ export interface GearboxChain extends Chain {
|
|
|
20
20
|
* Market configurator addresses operated by known curators on this chain.
|
|
21
21
|
**/
|
|
22
22
|
defaultMarketConfigurators: Record<Address, Curator>;
|
|
23
|
-
/**
|
|
24
|
-
* Known KYC factory addresses on this chain
|
|
25
|
-
*/
|
|
26
|
-
kycFactories?: Address[];
|
|
27
23
|
/**
|
|
28
24
|
* Market configurators used in test/staging environments.
|
|
29
25
|
**/
|
|
@@ -46,6 +42,10 @@ export interface GearboxChain extends Chain {
|
|
|
46
42
|
* Block number when the Gearbox address provider was deployed.
|
|
47
43
|
**/
|
|
48
44
|
firstBlock?: bigint;
|
|
45
|
+
/**
|
|
46
|
+
* Default read-only calls gas limit for this chain.
|
|
47
|
+
*/
|
|
48
|
+
gasLimit: bigint;
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
51
|
* Tuple of all network labels the SDK can work with.
|
|
@@ -31,7 +31,6 @@ export declare const AP_WETH_GATEWAY = "WETH_GATEWAY";
|
|
|
31
31
|
export declare const AP_WETH_TOKEN = "WETH_TOKEN";
|
|
32
32
|
export declare const AP_ZAPPER_REGISTER = "ZAPPER_REGISTER";
|
|
33
33
|
export declare const AP_ZERO_PRICE_FEED = "ZERO_PRICE_FEED";
|
|
34
|
-
export declare const AP_KYC_COMPRESSOR = "GLOBAL::KYC_COMPRESSOR";
|
|
35
34
|
/**
|
|
36
35
|
* Default address provider address for v3.1.0
|
|
37
36
|
* Is determenistic and does not depend on the network type
|
|
@@ -3,7 +3,6 @@ import type { MarketData, MarketFilter } from "../base/index.js";
|
|
|
3
3
|
import type { GearboxSDK } from "../GearboxSDK.js";
|
|
4
4
|
import type { MarketStateHuman } from "../types/index.js";
|
|
5
5
|
import { AddressMap } from "../utils/index.js";
|
|
6
|
-
import { type DelegatedMulticall } from "../utils/viem/index.js";
|
|
7
6
|
import type { CreditSuite } from "./credit/index.js";
|
|
8
7
|
import { MarketConfiguratorContract } from "./MarketConfiguratorContract.js";
|
|
9
8
|
import { MarketSuite } from "./MarketSuite.js";
|
|
@@ -31,13 +30,13 @@ export declare class MarketRegister extends ZapperRegister {
|
|
|
31
30
|
**/
|
|
32
31
|
hydrate(state: MarketData[]): void;
|
|
33
32
|
/**
|
|
34
|
-
*
|
|
35
|
-
* Returns delegated multicalls for loading all markets from the on-chain
|
|
36
|
-
* market compressor. Used by the SDK to compose batched RPC calls.
|
|
33
|
+
* Fetches all markets from the on-chain for the given market configurators.
|
|
37
34
|
*
|
|
38
|
-
* @param
|
|
35
|
+
* @param marketConfigurators - Addresses of market configurator contracts to query.
|
|
36
|
+
* @param ignoreUpdateablePrices - When `true`, skips generating off-chain
|
|
37
|
+
* price updates before loading
|
|
39
38
|
**/
|
|
40
|
-
|
|
39
|
+
loadMarkets(marketConfigurators: Address[], ignoreUpdateablePrices?: boolean): Promise<void>;
|
|
41
40
|
/**
|
|
42
41
|
* The active filter used to scope market compressor queries.
|
|
43
42
|
* @throws If the register has not been hydrated or attached yet.
|
|
@@ -53,6 +52,10 @@ export declare class MarketRegister extends ZapperRegister {
|
|
|
53
52
|
* @param ignoreUpdateablePrices - When `true`, skips off-chain price updates.
|
|
54
53
|
**/
|
|
55
54
|
syncState(ignoreUpdateablePrices?: boolean): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Loads new prices and price feeds for given oracles from PriceFeedCompressor, defaults to all oracles
|
|
57
|
+
*/
|
|
58
|
+
updatePrices(oracles?: Address[]): Promise<void>;
|
|
56
59
|
get watchAddresses(): Set<Address>;
|
|
57
60
|
/**
|
|
58
61
|
* Serializable snapshot of all loaded markets, suitable for hydration.
|
|
@@ -4,7 +4,6 @@ import { SDKConstruct } from "../base/index.js";
|
|
|
4
4
|
import type { GearboxSDK } from "../GearboxSDK.js";
|
|
5
5
|
import type { MarketStateHuman } from "../types/index.js";
|
|
6
6
|
import { CreditSuite } from "./credit/index.js";
|
|
7
|
-
import type { IKYCFactory, OpenAccountRequirements } from "./kyc/types.js";
|
|
8
7
|
import { type ILossPolicyContract } from "./loss-policy/index.js";
|
|
9
8
|
import { MarketConfiguratorContract } from "./MarketConfiguratorContract.js";
|
|
10
9
|
import type { IPriceOracleContract } from "./oracle/index.js";
|
|
@@ -23,7 +22,6 @@ export declare class MarketSuite extends SDKConstruct {
|
|
|
23
22
|
readonly state: MarketData;
|
|
24
23
|
constructor(sdk: GearboxSDK, marketData: MarketData);
|
|
25
24
|
get underlying(): Address;
|
|
26
|
-
get kycFactory(): IKYCFactory<unknown, OpenAccountRequirements> | undefined;
|
|
27
25
|
get dirty(): boolean;
|
|
28
26
|
get watchAddresses(): Set<Address>;
|
|
29
27
|
stateHuman(raw?: boolean): MarketStateHuman;
|
|
@@ -5,11 +5,10 @@ import { BaseContract } from "../../base/index.js";
|
|
|
5
5
|
import type { GearboxSDK } from "../../GearboxSDK.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
|
*
|
|
@@ -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
|
**/
|