@gearbox-protocol/sdk 14.12.0-next.74 → 14.12.0-next.75
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/plugins/accounts-counter/AccountsCounterPlugin.js +1 -1
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +73 -445
- package/dist/cjs/sdk/accounts/credit-account-compressor/CreditAccountCompressor.js +280 -0
- package/dist/cjs/sdk/accounts/credit-account-compressor/CreditAccountCompressorV310Contract.js +141 -0
- package/dist/cjs/sdk/accounts/credit-account-compressor/index.js +6 -0
- package/dist/cjs/sdk/accounts/credit-account-compressor/types.js +1 -0
- package/dist/cjs/sdk/accounts/index.js +5 -0
- package/dist/cjs/sdk/index.js +4 -0
- package/dist/cjs/sdk/market/oracle/PriceOracleBaseContract.js +41 -1
- package/dist/cjs/sdk/market/oracle/PriceOracleV310Contract.js +0 -23
- package/dist/cjs/sdk/market/pricefeeds/PriceFeedsRegister.js +1 -1
- package/dist/esm/plugins/accounts-counter/AccountsCounterPlugin.js +1 -1
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +74 -446
- package/dist/esm/sdk/accounts/credit-account-compressor/CreditAccountCompressor.js +279 -0
- package/dist/esm/sdk/accounts/credit-account-compressor/CreditAccountCompressorV310Contract.js +141 -0
- package/dist/esm/sdk/accounts/credit-account-compressor/index.js +4 -0
- package/dist/esm/sdk/accounts/credit-account-compressor/types.js +1 -0
- package/dist/esm/sdk/accounts/index.js +4 -1
- package/dist/esm/sdk/index.js +3 -1
- package/dist/esm/sdk/market/oracle/PriceOracleBaseContract.js +41 -1
- package/dist/esm/sdk/market/oracle/PriceOracleV310Contract.js +0 -23
- package/dist/esm/sdk/market/pricefeeds/PriceFeedsRegister.js +1 -1
- package/dist/types/plugins/accounts/AccountsPlugin.d.ts +1 -1
- package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +10 -44
- package/dist/types/sdk/accounts/credit-account-compressor/CreditAccountCompressor.d.ts +60 -0
- package/dist/types/sdk/accounts/credit-account-compressor/CreditAccountCompressorV310Contract.d.ts +879 -0
- package/dist/types/sdk/accounts/credit-account-compressor/index.d.ts +4 -0
- package/dist/types/sdk/accounts/credit-account-compressor/types.d.ts +164 -0
- package/dist/types/sdk/accounts/index.d.ts +7 -3
- package/dist/types/sdk/accounts/types.d.ts +5 -112
- package/dist/types/sdk/base/index.d.ts +2 -2
- package/dist/types/sdk/base/types.d.ts +6 -1
- package/dist/types/sdk/index.d.ts +8 -5
- package/dist/types/sdk/market/index.d.ts +2 -2
- package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +15 -4
- package/dist/types/sdk/market/oracle/PriceOracleV310Contract.d.ts +0 -11
- package/dist/types/sdk/market/oracle/index.d.ts +2 -2
- package/dist/types/sdk/market/oracle/types.d.ts +30 -14
- package/package.json +1 -1
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { StrategyPosition } from "../../model/positions.js";
|
|
2
2
|
import "../../model/index.js";
|
|
3
3
|
import { RequestableWithdrawal } from "./withdrawal-compressor/types.js";
|
|
4
|
-
import { Asset, CreditAccountData } from "../base/types.js";
|
|
4
|
+
import { Asset, CreditAccountData, CreditAccountTokensSlice } from "../base/types.js";
|
|
5
5
|
import { RWAOpenAccountRequirements } from "../market/rwa/types.js";
|
|
6
6
|
import "../market/rwa/index.js";
|
|
7
7
|
import { RouterCASlice } from "../router/types.js";
|
|
8
8
|
import "../router/index.js";
|
|
9
|
+
import { GetCreditAccountsOptions, ListStrategyPositionsProps } from "./credit-account-compressor/types.js";
|
|
10
|
+
import "./credit-account-compressor/index.js";
|
|
9
11
|
import "./withdrawal-compressor/index.js";
|
|
10
|
-
import { AccountToCheck, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, ClaimFarmRewardsProps, CreditAccountOperationResult,
|
|
12
|
+
import { AccountToCheck, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, ClaimFarmRewardsProps, CreditAccountOperationResult, CreditManagerOperationResult, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, ICreditAccountsService, OpenCAProps, PartiallyLiquidateProps, PermitResult, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, Rewards, SetBotProps } from "./types.js";
|
|
11
13
|
import { PriceUpdate } from "../market/pricefeeds/types.js";
|
|
12
14
|
import "../market/index.js";
|
|
13
15
|
import { MultiCall, RawTx } from "../types/transactions.js";
|
|
@@ -17,16 +19,6 @@ import { SDKConstruct } from "../base/SDKConstruct.js";
|
|
|
17
19
|
import "../base/index.js";
|
|
18
20
|
import { Address } from "viem";
|
|
19
21
|
//#region src/sdk/accounts/CreditAccountsServiceV310.d.ts
|
|
20
|
-
/**
|
|
21
|
-
* Options for configuring the credit account service.
|
|
22
|
-
**/
|
|
23
|
-
interface CreditAccountServiceOptions {
|
|
24
|
-
/**
|
|
25
|
-
* Maximum number of credit accounts to fetch per compressor call.
|
|
26
|
-
* When set, accounts are loaded in batches of this size until all are fetched.
|
|
27
|
-
**/
|
|
28
|
-
batchSize?: number;
|
|
29
|
-
}
|
|
30
22
|
/**
|
|
31
23
|
* Service for querying and operating on Gearbox credit accounts.
|
|
32
24
|
*
|
|
@@ -38,8 +30,7 @@ interface CreditAccountServiceOptions {
|
|
|
38
30
|
**/
|
|
39
31
|
declare class CreditAccountsServiceV310 extends SDKConstruct implements ICreditAccountsService {
|
|
40
32
|
#private;
|
|
41
|
-
constructor(sdk: OnchainSDK
|
|
42
|
-
setBatchSize(batchSize: number): void;
|
|
33
|
+
constructor(sdk: OnchainSDK);
|
|
43
34
|
/**
|
|
44
35
|
* {@inheritDoc ICreditAccountsService.getCreditAccountData}
|
|
45
36
|
**/
|
|
@@ -109,39 +100,19 @@ declare class CreditAccountsServiceV310 extends SDKConstruct implements ICreditA
|
|
|
109
100
|
**/
|
|
110
101
|
openCA(props: OpenCAProps): Promise<RawTx>;
|
|
111
102
|
/**
|
|
112
|
-
*
|
|
113
|
-
* Used when withdrawing debt from a RWA market: redeems adapter vault shares so the underlying can be withdrawn.
|
|
114
|
-
* Only applies when the credit manager's underlying is RWA-gated and has an ERC-4626 adapter configured.
|
|
115
|
-
* @param amount - Number of vault shares (adapter tokens) to redeem
|
|
116
|
-
* @param creditManager - Credit manager address
|
|
117
|
-
* @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not RWA or no adapter is configured
|
|
103
|
+
* {@inheritDoc ICreditAccountsService.assembleRWAUnwrapCalls}
|
|
118
104
|
*/
|
|
119
105
|
assembleRWAUnwrapCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
|
|
120
106
|
/**
|
|
121
|
-
*
|
|
122
|
-
* Used when adding debt on a RWA market: deposits underlying into the adapter vault so shares are minted on the account.
|
|
123
|
-
* Only applies when the credit manager's underlying is RWA-gated and has an ERC-4626 adapter configured.
|
|
124
|
-
* @param amount - Amount of underlying assets to deposit into the vault (in underlying decimals)
|
|
125
|
-
* @param creditManager - Credit manager address
|
|
126
|
-
* @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not RWA or no adapter is configured
|
|
107
|
+
* {@inheritDoc ICreditAccountsService.assembleRWAWrapCalls}
|
|
127
108
|
*/
|
|
128
109
|
assembleRWAWrapCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
|
|
129
110
|
/**
|
|
130
|
-
*
|
|
131
|
-
* Redeems the leftover vault shares (e.g. after repaying debt) so the account does not hold excess RWA vault tokens.
|
|
132
|
-
* Only applies when the credit manager's underlying is RWA-gated and has an ERC-4626 adapter configured.
|
|
133
|
-
* @param amount - Leftover vault share amount to redeem (in adapter/vault decimals)
|
|
134
|
-
* @param creditManager - Credit manager address
|
|
135
|
-
* @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not RWA or no adapter is configured
|
|
111
|
+
* {@inheritDoc ICreditAccountsService.assembleRedeemDiffCalls}
|
|
136
112
|
*/
|
|
137
113
|
assembleRedeemDiffCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
|
|
138
114
|
/**
|
|
139
|
-
*
|
|
140
|
-
* Deposits the leftover underlying (e.g. after decreasing debt) into the vault so the account does not hold excess underlying.
|
|
141
|
-
* Only applies when the credit manager's underlying is RWA-gated and has an ERC-4626 adapter configured.
|
|
142
|
-
* @param amount - Leftover underlying amount to deposit into the vault (in underlying decimals)
|
|
143
|
-
* @param creditManager - Credit manager address
|
|
144
|
-
* @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not RWA or no adapter is configured
|
|
115
|
+
* {@inheritDoc ICreditAccountsService.assembleDepositDiffCalls}
|
|
145
116
|
*/
|
|
146
117
|
assembleDepositDiffCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
|
|
147
118
|
/**
|
|
@@ -198,13 +169,8 @@ declare class CreditAccountsServiceV310 extends SDKConstruct implements ICreditA
|
|
|
198
169
|
* {@inheritDoc ICreditAccountsService.prepareAddCollateral}
|
|
199
170
|
*/
|
|
200
171
|
prepareAddCollateral(creditFacade: Address, assets: Array<Asset>, permits: Record<string, PermitResult>): Array<MultiCall>;
|
|
201
|
-
/**
|
|
202
|
-
* Returns addresses of market configurators
|
|
203
|
-
*/
|
|
204
|
-
private get marketConfigurators();
|
|
205
172
|
private get rewardCompressor();
|
|
206
173
|
private get peripheryCompressor();
|
|
207
|
-
private get compressor();
|
|
208
174
|
}
|
|
209
175
|
//#endregion
|
|
210
|
-
export {
|
|
176
|
+
export { CreditAccountsServiceV310 };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { StrategyPosition } from "../../../model/positions.js";
|
|
2
|
+
import "../../../model/index.js";
|
|
3
|
+
import { CreditAccountData } from "../../base/types.js";
|
|
4
|
+
import { GetCreditAccountsOptions, ListStrategyPositionsProps } from "./types.js";
|
|
5
|
+
import { SDKConstruct } from "../../base/SDKConstruct.js";
|
|
6
|
+
import "../../base/index.js";
|
|
7
|
+
import { Address } from "viem";
|
|
8
|
+
//#region src/sdk/accounts/credit-account-compressor/CreditAccountCompressor.d.ts
|
|
9
|
+
/**
|
|
10
|
+
* Reads credit accounts of the current chain.
|
|
11
|
+
*
|
|
12
|
+
* Stitches the credit account compressor together with the RWA factories (for
|
|
13
|
+
* accounts owned via an investor EOA) and with the withdrawal compressor (for
|
|
14
|
+
* assets that are on their way out of an account), and describes the result
|
|
15
|
+
* either as raw account data or as {@link StrategyPosition}s.
|
|
16
|
+
*
|
|
17
|
+
* TODO: create and deploy new compressor contract onchain to avoid all this stitching
|
|
18
|
+
**/
|
|
19
|
+
declare class CreditAccountCompressor extends SDKConstruct {
|
|
20
|
+
#private;
|
|
21
|
+
/**
|
|
22
|
+
* Reads data of a single credit account.
|
|
23
|
+
*
|
|
24
|
+
* When the compressor cannot value the account with current prices, the read
|
|
25
|
+
* is retried with price feed updates applied.
|
|
26
|
+
*
|
|
27
|
+
* @param account - Credit account address.
|
|
28
|
+
* @param blockNumber - Block to read at, defaults to the latest block.
|
|
29
|
+
* @returns Account data, or `undefined` if the account does not exist.
|
|
30
|
+
**/
|
|
31
|
+
getCreditAccountData(account: Address, blockNumber?: bigint): Promise<CreditAccountData<true> | undefined>;
|
|
32
|
+
/**
|
|
33
|
+
* Reads all credit accounts matching the options, sorted by health factor
|
|
34
|
+
* ascending.
|
|
35
|
+
*
|
|
36
|
+
* @param options - {@link GetCreditAccountsOptions}
|
|
37
|
+
* @param blockNumber - Block to read at, defaults to the latest block.
|
|
38
|
+
**/
|
|
39
|
+
getCreditAccounts(options?: GetCreditAccountsOptions, blockNumber?: bigint): Promise<CreditAccountData[]>;
|
|
40
|
+
/**
|
|
41
|
+
* Reads all credit accounts of a borrower, sorted by health factor
|
|
42
|
+
* ascending.
|
|
43
|
+
*
|
|
44
|
+
* Covers accounts the borrower owns directly and RWA accounts they own as an
|
|
45
|
+
* investor, which are owned on-chain by an RWA factory.
|
|
46
|
+
*
|
|
47
|
+
* @param borrower - Wallet address.
|
|
48
|
+
* @param options - {@link GetCreditAccountsOptions}
|
|
49
|
+
* @param blockNumber - Block to read at, defaults to the latest block.
|
|
50
|
+
**/
|
|
51
|
+
getBorrowerCreditAccounts(borrower: Address, options?: GetCreditAccountsOptions, blockNumber?: bigint): Promise<CreditAccountData<true>[]>;
|
|
52
|
+
/**
|
|
53
|
+
* Describes all credit accounts of a wallet as strategy positions.
|
|
54
|
+
*
|
|
55
|
+
* @param props - {@link ListStrategyPositionsProps}
|
|
56
|
+
**/
|
|
57
|
+
listPositions(props: ListStrategyPositionsProps): Promise<StrategyPosition[]>;
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
export { CreditAccountCompressor };
|