@gearbox-protocol/sdk 13.4.0-beta.1 → 13.4.0-beta.2
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/permissionless/utils/price-update/get-price-update-tx.js +3 -15
- package/dist/cjs/sdk/GearboxSDK.js +135 -20
- package/dist/cjs/sdk/accounts/AbstractCreditAccountsService.js +66 -187
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +5 -5
- package/dist/cjs/sdk/base/BaseContract.js +26 -6
- package/dist/cjs/sdk/base/ChainContractsRegister.js +39 -2
- package/dist/cjs/sdk/base/Construct.js +15 -3
- package/dist/cjs/sdk/base/TokensMeta.js +23 -0
- package/dist/cjs/sdk/constants/address-provider.js +0 -22
- package/dist/cjs/sdk/core/AbstractAddressProviderContract.js +15 -0
- package/dist/cjs/sdk/market/MarketRegister.js +74 -3
- package/dist/cjs/sdk/market/oracle/PriceOracleBaseContract.js +31 -50
- package/dist/cjs/sdk/market/pricefeeds/PriceFeedRef.js +16 -0
- package/dist/cjs/sdk/market/pricefeeds/PriceFeedsRegister.js +55 -12
- package/dist/cjs/sdk/options.js +30 -24
- package/dist/cjs/sdk/plugins/BasePlugin.js +24 -0
- package/dist/cjs/sdk/pools/AbstractPoolService.js +6 -0
- package/dist/cjs/sdk/router/AbstractRouterContract.js +4 -1
- package/dist/cjs/sdk/router/RouterV310Contract.js +20 -15
- package/dist/cjs/sdk/utils/AddressMap.js +53 -17
- package/dist/cjs/sdk/utils/AddressSet.js +9 -0
- package/dist/esm/permissionless/utils/price-update/get-price-update-tx.js +6 -20
- package/dist/esm/sdk/GearboxSDK.js +135 -20
- package/dist/esm/sdk/accounts/AbstractCreditAccountsService.js +69 -188
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +5 -5
- package/dist/esm/sdk/base/BaseContract.js +26 -6
- package/dist/esm/sdk/base/ChainContractsRegister.js +39 -2
- package/dist/esm/sdk/base/Construct.js +15 -3
- package/dist/esm/sdk/base/TokensMeta.js +23 -0
- package/dist/esm/sdk/constants/address-provider.js +0 -21
- package/dist/esm/sdk/core/AbstractAddressProviderContract.js +15 -0
- package/dist/esm/sdk/market/MarketRegister.js +74 -3
- package/dist/esm/sdk/market/oracle/PriceOracleBaseContract.js +31 -50
- package/dist/esm/sdk/market/pricefeeds/PriceFeedRef.js +16 -0
- package/dist/esm/sdk/market/pricefeeds/PriceFeedsRegister.js +55 -12
- package/dist/esm/sdk/options.js +30 -24
- package/dist/esm/sdk/plugins/BasePlugin.js +24 -0
- package/dist/esm/sdk/pools/AbstractPoolService.js +6 -0
- package/dist/esm/sdk/router/AbstractRouterContract.js +4 -1
- package/dist/esm/sdk/router/RouterV310Contract.js +20 -15
- package/dist/esm/sdk/utils/AddressMap.js +53 -17
- package/dist/esm/sdk/utils/AddressSet.js +9 -0
- package/dist/types/permissionless/bindings/price-feed-store.d.ts +1 -2
- package/dist/types/permissionless/bindings/types.d.ts +0 -4
- package/dist/types/permissionless/utils/price-update/get-price-update-tx.d.ts +1 -3
- package/dist/types/sdk/GearboxSDK.d.ts +236 -34
- package/dist/types/sdk/accounts/AbstractCreditAccountsService.d.ts +55 -132
- package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +14 -5
- package/dist/types/sdk/accounts/multicall-utils.d.ts +3 -3
- package/dist/types/sdk/accounts/types.d.ts +215 -28
- package/dist/types/sdk/base/BaseContract.d.ts +67 -6
- package/dist/types/sdk/base/ChainContractsRegister.d.ts +51 -2
- package/dist/types/sdk/base/Construct.d.ts +31 -0
- package/dist/types/sdk/base/PlaceholderContract.d.ts +3 -0
- package/dist/types/sdk/base/SDKConstruct.d.ts +10 -0
- package/dist/types/sdk/base/TokensMeta.d.ts +59 -2
- package/dist/types/sdk/base/types.d.ts +185 -25
- package/dist/types/sdk/chain/chains.d.ts +78 -18
- package/dist/types/sdk/chain/detectNetwork.d.ts +7 -0
- package/dist/types/sdk/constants/address-provider.d.ts +4 -3
- package/dist/types/sdk/core/AbstractAddressProviderContract.d.ts +23 -0
- package/dist/types/sdk/core/types.d.ts +46 -0
- package/dist/types/sdk/market/MarketRegister.d.ts +81 -0
- package/dist/types/sdk/market/adapters/PlaceholderAdapterContracts.d.ts +3 -0
- package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +40 -50
- package/dist/types/sdk/market/oracle/types.d.ts +78 -59
- package/dist/types/sdk/market/pricefeeds/AbstractLPPriceFeed.d.ts +3 -0
- package/dist/types/sdk/market/pricefeeds/AbstractPriceFeed.d.ts +3 -0
- package/dist/types/sdk/market/pricefeeds/PriceFeedRef.d.ts +22 -2
- package/dist/types/sdk/market/pricefeeds/PriceFeedsRegister.d.ts +80 -16
- package/dist/types/sdk/market/pricefeeds/getRawPriceUpdates.d.ts +2 -2
- package/dist/types/sdk/market/pricefeeds/types.d.ts +75 -11
- package/dist/types/sdk/options.d.ts +13 -4
- package/dist/types/sdk/plugins/BasePlugin.d.ts +39 -0
- package/dist/types/sdk/plugins/types.d.ts +73 -43
- package/dist/types/sdk/pools/AbstractPoolService.d.ts +12 -0
- package/dist/types/sdk/pools/types.d.ts +75 -6
- package/dist/types/sdk/router/AbstractRouterContract.d.ts +21 -2
- package/dist/types/sdk/router/RouterV310Contract.d.ts +27 -15
- package/dist/types/sdk/router/types.d.ts +47 -70
- package/dist/types/sdk/types/state.d.ts +32 -3
- package/dist/types/sdk/utils/AddressMap.d.ts +61 -17
- package/dist/types/sdk/utils/AddressSet.d.ts +15 -0
- package/package.json +3 -2
|
@@ -2,47 +2,47 @@ import type { Address } from "viem";
|
|
|
2
2
|
import type { CreditAccountData } from "../base/index.js";
|
|
3
3
|
import { SDKConstruct } from "../base/index.js";
|
|
4
4
|
import type { GearboxSDK } from "../GearboxSDK.js";
|
|
5
|
-
import type
|
|
5
|
+
import { type PriceUpdate, type UpdatePriceFeedsResult } from "../market/index.js";
|
|
6
6
|
import { type Asset, type RouterCASlice } from "../router/index.js";
|
|
7
7
|
import type { MultiCall, RawTx } from "../types/index.js";
|
|
8
|
-
import type { AccountToCheck, AddCollateralProps, ChangeDeptProps, ClaimDelayedProps, CloseCreditAccountProps, CloseCreditAccountResult, CreditAccountOperationResult, ExecuteSwapProps, FullyLiquidateProps, FullyLiquidateResult, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsOptions, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, OpenCAProps, PermitResult, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, PreviewDelayedWithdrawalResult,
|
|
8
|
+
import type { AccountToCheck, AddCollateralProps, ChangeDeptProps, ClaimDelayedProps, CloseCreditAccountProps, CloseCreditAccountResult, CreditAccountOperationResult, CreditAccountTokensSlice, ExecuteSwapProps, FullyLiquidateProps, FullyLiquidateResult, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsOptions, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, OpenCAProps, PermitResult, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, PreviewDelayedWithdrawalResult, Rewards, StartDelayedWithdrawalProps, UpdateQuotasProps } from "./types.js";
|
|
9
|
+
/**
|
|
10
|
+
* Options for configuring the credit account service.
|
|
11
|
+
**/
|
|
9
12
|
export interface CreditAccountServiceOptions {
|
|
13
|
+
/**
|
|
14
|
+
* Maximum number of credit accounts to fetch per compressor call.
|
|
15
|
+
* When set, accounts are loaded in batches of this size until all are fetched.
|
|
16
|
+
**/
|
|
10
17
|
batchSize?: number;
|
|
11
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Returns the withdrawal compressor contract address for the given chain, or `undefined` if none is configured.
|
|
21
|
+
* @param chainId - Numeric chain ID.
|
|
22
|
+
* @returns Withdrawal compressor address, or `undefined`.
|
|
23
|
+
**/
|
|
12
24
|
export declare function getWithdrawalCompressorAddress(chainId: number): `0x${string}`;
|
|
25
|
+
/**
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
13
28
|
export declare abstract class AbstractCreditAccountService extends SDKConstruct {
|
|
14
29
|
#private;
|
|
15
30
|
constructor(sdk: GearboxSDK, options?: CreditAccountServiceOptions);
|
|
16
31
|
/**
|
|
17
|
-
*
|
|
18
|
-
|
|
19
|
-
* @param account
|
|
20
|
-
* @param blockNumber
|
|
21
|
-
* @returns
|
|
22
|
-
*/
|
|
32
|
+
* {@inheritDoc ICreditAccountsService.getCreditAccountData}
|
|
33
|
+
**/
|
|
23
34
|
getCreditAccountData(account: Address, blockNumber?: bigint): Promise<CreditAccountData | undefined>;
|
|
24
35
|
/**
|
|
25
|
-
*
|
|
26
|
-
|
|
27
|
-
*
|
|
28
|
-
* @param options
|
|
29
|
-
* @param blockNumber
|
|
30
|
-
* @returns returned credit accounts are sorted by health factor in ascending order
|
|
31
|
-
*/
|
|
36
|
+
* {@inheritDoc ICreditAccountsService.getCreditAccounts}
|
|
37
|
+
**/
|
|
32
38
|
getCreditAccounts(options?: GetCreditAccountsOptions, blockNumber?: bigint): Promise<Array<CreditAccountData>>;
|
|
33
39
|
/**
|
|
34
|
-
*
|
|
35
|
-
|
|
36
|
-
* @param {Address} creditAccount - address of credit account to get rewards for
|
|
37
|
-
* @returns {Array<Rewards>} list of {@link Rewards} that can be claimed
|
|
38
|
-
*/
|
|
40
|
+
* {@inheritDoc ICreditAccountsService.getRewards}
|
|
41
|
+
**/
|
|
39
42
|
getRewards(creditAccount: Address): Promise<Array<Rewards>>;
|
|
40
43
|
/**
|
|
41
|
-
*
|
|
42
|
-
|
|
43
|
-
and their credit managers to check connected bots on
|
|
44
|
-
* @returns call result of getConnectedBots for each credit account
|
|
45
|
-
*/
|
|
44
|
+
* {@inheritDoc ICreditAccountsService.getConnectedBots}
|
|
45
|
+
**/
|
|
46
46
|
getConnectedBots(accountsToCheck: Array<AccountToCheck>, legacyMigrationBot: Address | undefined, additionalBots: Array<Address>): Promise<{
|
|
47
47
|
legacy: GetConnectedBotsResult;
|
|
48
48
|
legacyMigration: GetConnectedMigrationBotsResult;
|
|
@@ -51,139 +51,61 @@ export declare abstract class AbstractCreditAccountService extends SDKConstruct
|
|
|
51
51
|
private getActiveBots;
|
|
52
52
|
private getActiveMigrationBots;
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
55
|
-
|
|
56
|
-
* @returns
|
|
57
|
-
*/
|
|
54
|
+
* {@inheritDoc ICreditAccountsService.fullyLiquidate}
|
|
55
|
+
**/
|
|
58
56
|
fullyLiquidate(props: FullyLiquidateProps): Promise<FullyLiquidateResult>;
|
|
59
57
|
/**
|
|
60
|
-
*
|
|
61
|
-
|
|
62
|
-
-> disable quotas of exiting tokens -> decrease debt -> disable exiting tokens tokens -> withdraw underlying tokenz
|
|
63
|
-
* @param {CloseOptions} operation - {@link CloseOptions}: close or zeroDebt
|
|
64
|
-
* @param {RouterCASlice} creditAccount - minimal credit account data {@link RouterCASlice} on which operation is performed
|
|
65
|
-
* @param {Array<Address>} assetsToWithdraw - tokens to withdraw from credit account.
|
|
66
|
-
For credit account closing this is the underlying token, because during the closure,
|
|
67
|
-
all tokens on account are swapped into the underlying,
|
|
68
|
-
and only the underlying token will remain on the credit account
|
|
69
|
-
* @param {Address} to - Wallet address to withdraw underlying to
|
|
70
|
-
* @param {number} slippage - Slippage in PERCENTAGE_FORMAT (100% = 10_000) per operation
|
|
71
|
-
* @default 50n
|
|
72
|
-
* @param {RouterCloseResult | undefined} closePath - result of findBestClosePath method from router; if omited, calls marketRegister.findCreditManager {@link RouterCloseResult}
|
|
73
|
-
* @returns All necessary data to execute the transaction (call, credit facade)
|
|
74
|
-
*/
|
|
58
|
+
* {@inheritDoc ICreditAccountsService.closeCreditAccount}
|
|
59
|
+
**/
|
|
75
60
|
closeCreditAccount({ operation, assetsToWithdraw, creditAccount: ca, to, slippage, closePath, }: CloseCreditAccountProps): Promise<CloseCreditAccountResult>;
|
|
76
61
|
/**
|
|
77
|
-
*
|
|
78
|
-
|
|
79
|
-
* @param {RouterCASlice} creditAccount - minimal credit account data {@link RouterCASlice} on which operation is performed
|
|
80
|
-
* @param {Array<Asset>} averageQuota - average quota for desired tokens {@link Asset}
|
|
81
|
-
* @param {Array<Asset>} minQuota - minimum quota for desired tokens {@link Asset}
|
|
82
|
-
* @returns All necessary data to execute the transaction (call, credit facade)
|
|
83
|
-
*/
|
|
62
|
+
* {@inheritDoc ICreditAccountsService.updateQuotas}
|
|
63
|
+
**/
|
|
84
64
|
updateQuotas({ minQuota, averageQuota, creditAccount, }: UpdateQuotasProps): Promise<CreditAccountOperationResult>;
|
|
85
65
|
/**
|
|
86
|
-
*
|
|
87
|
-
|
|
88
|
-
* @param {RouterCASlice} creditAccount - minimal credit account data {@link RouterCASlice} on which operation is performed
|
|
89
|
-
* @param {Array<Asset>} averageQuota - average quota for desired token {@link Asset}
|
|
90
|
-
* @param {Array<Asset>} minQuota - minimum quota for desired token {@link Asset}
|
|
91
|
-
* @param {Asset} asset - asset to add as collateral {@link Asset}
|
|
92
|
-
* @param {PermitResult | undefined} permits - permits of collateral asset if it is permittable {@link PermitResult}
|
|
93
|
-
* @param {bigint} ethAmount - native token amount to attach to tx
|
|
94
|
-
* @returns All necessary data to execute the transaction (call, credit facade)
|
|
95
|
-
*/
|
|
66
|
+
* {@inheritDoc ICreditAccountsService.addCollateral}
|
|
67
|
+
**/
|
|
96
68
|
addCollateral({ creditAccount, asset, permit, ethAmount, minQuota, averageQuota, }: AddCollateralProps): Promise<CreditAccountOperationResult>;
|
|
97
69
|
/**
|
|
98
|
-
*
|
|
99
|
-
|
|
100
|
-
* @param {RouterCASlice} creditAccount - minimal credit account data {@link RouterCASlice} on which operation is performed
|
|
101
|
-
* @param {bigint} amount - amount to change debt by;
|
|
102
|
-
0 - prohibited value;
|
|
103
|
-
negative value for debt decrease;
|
|
104
|
-
positive value for debt increase.
|
|
105
|
-
* @returns All necessary data to execute the transaction (call, credit facade)
|
|
106
|
-
*/
|
|
70
|
+
* {@inheritDoc ICreditAccountsService.changeDebt}
|
|
71
|
+
**/
|
|
107
72
|
changeDebt({ creditAccount, amount, addCollateral, }: ChangeDeptProps): Promise<CreditAccountOperationResult>;
|
|
108
73
|
/**
|
|
109
|
-
*
|
|
110
|
-
|
|
111
|
-
* @param {RouterCASlice} creditAccount - minimal credit account data {@link RouterCASlice} on which operation is performed
|
|
112
|
-
* @param {Array<Asset>} averageQuota - average quota for desired token {@link Asset}
|
|
113
|
-
* @param {Array<Asset>} minQuota - minimum quota for desired token {@link Asset}
|
|
114
|
-
* @param {Array<MultiCall>} calls - array of MultiCall from router methods getSingleSwap or getAllSwaps {@link MultiCall}
|
|
115
|
-
* @returns All necessary data to execute the transaction (call, credit facade)
|
|
116
|
-
*/
|
|
74
|
+
* {@inheritDoc ICreditAccountsService.executeSwap}
|
|
75
|
+
**/
|
|
117
76
|
executeSwap({ creditAccount, calls: swapCalls, minQuota, averageQuota, }: ExecuteSwapProps): Promise<CreditAccountOperationResult>;
|
|
118
77
|
/**
|
|
119
|
-
*
|
|
120
|
-
|
|
121
|
-
* @returns
|
|
122
|
-
*/
|
|
78
|
+
* {@inheritDoc ICreditAccountsService.previewDelayedWithdrawal}
|
|
79
|
+
**/
|
|
123
80
|
previewDelayedWithdrawal({ creditAccount, amount, token, }: PreviewDelayedWithdrawalProps): Promise<PreviewDelayedWithdrawalResult>;
|
|
124
81
|
/**
|
|
125
|
-
*
|
|
126
|
-
|
|
127
|
-
* @returns
|
|
128
|
-
*/
|
|
82
|
+
* {@inheritDoc ICreditAccountsService.getPendingWithdrawals}
|
|
83
|
+
**/
|
|
129
84
|
getPendingWithdrawals({ creditAccount, }: GetPendingWithdrawalsProps): Promise<GetPendingWithdrawalsResult>;
|
|
130
85
|
/**
|
|
131
|
-
*
|
|
132
|
-
|
|
133
|
-
* @param props - {@link StartDelayedWithdrawalProps}
|
|
134
|
-
* @returns
|
|
135
|
-
*/
|
|
86
|
+
* {@inheritDoc ICreditAccountsService.startDelayedWithdrawal}
|
|
87
|
+
**/
|
|
136
88
|
startDelayedWithdrawal({ creditAccount, minQuota, averageQuota, preview, }: StartDelayedWithdrawalProps): Promise<CreditAccountOperationResult>;
|
|
137
89
|
/**
|
|
138
|
-
*
|
|
139
|
-
|
|
140
|
-
* @param props - {@link ClaimDelayedProps}
|
|
141
|
-
* @returns
|
|
142
|
-
*/
|
|
90
|
+
* {@inheritDoc ICreditAccountsService.claimDelayed}
|
|
91
|
+
**/
|
|
143
92
|
claimDelayed({ creditAccount, minQuota, averageQuota, claimableNow, }: ClaimDelayedProps): Promise<CreditAccountOperationResult>;
|
|
144
93
|
/**
|
|
145
|
-
*
|
|
146
|
-
|
|
147
|
-
-> update quotas -> (optionally: execute swap path for trading/strategy) ->
|
|
148
|
-
-> (optionally: withdraw debt for lending)
|
|
149
|
-
- Basic open credit account: price update -> increase debt -> add collateral -> update quotas
|
|
150
|
-
- Lending: price update -> increase debt -> add collateral -> update quotas -> withdraw debt
|
|
151
|
-
- Strategy/trading: price update -> increase debt -> add collateral -> update quotas -> execute swap path
|
|
152
|
-
- In strategy is possible situation when collateral is added, but not swapped; the only swapped value in this case will be debt
|
|
153
|
-
* @param {bigint} ethAmount - native token amount to attach to tx
|
|
154
|
-
* @param {Address} creditManager - address of credit manager to open credit account on
|
|
155
|
-
* @param {Array<Asset>} collateral - array of collateral which can be just directly added or swapped using the path {@link Asset}
|
|
156
|
-
* @param {Record<Address, PermitResult>} permits - permits of collateral tokens (in any permittable token is present) {@link PermitResult}
|
|
157
|
-
* @param {bigint} debt - debt to open credit account with
|
|
158
|
-
* @param {boolean} withdrawDebt - flag to withdraw debt to wallet after opening credit account;
|
|
159
|
-
used for borrowing functionality
|
|
160
|
-
* @param {bigint} referralCode - referral code to open credit account with
|
|
161
|
-
* @param {Address} to - wallet address to transfer credit account to\
|
|
162
|
-
* @param {Array<MultiCall>} calls - array of MultiCall from router methods findOpenStrategyPath {@link MultiCall}.
|
|
163
|
-
Used for trading and strategy functionality
|
|
164
|
-
* @param {Array<Asset>} averageQuota - average quota for tokens after open {@link Asset}
|
|
165
|
-
* @param {Array<Asset>} minQuota - minimum quota for tokens after open {@link Asset}
|
|
166
|
-
* @returns All necessary data to execute the transaction (call, credit facade)
|
|
167
|
-
*/
|
|
94
|
+
* {@inheritDoc ICreditAccountsService.openCA}
|
|
95
|
+
**/
|
|
168
96
|
openCA({ ethAmount, creditManager, collateral, permits, debt, withdrawDebt, referralCode, to, calls: openPathCalls, minQuota, averageQuota, }: OpenCAProps): Promise<CreditAccountOperationResult>;
|
|
169
97
|
/**
|
|
170
|
-
*
|
|
171
|
-
|
|
172
|
-
* @returns
|
|
173
|
-
*/
|
|
98
|
+
* {@inheritDoc ICreditAccountsService.getBorrowRate}
|
|
99
|
+
**/
|
|
174
100
|
getBorrowRate(ca: CreditAccountData): bigint;
|
|
175
101
|
/**
|
|
176
|
-
*
|
|
177
|
-
|
|
178
|
-
*/
|
|
102
|
+
* {@inheritDoc ICreditAccountsService.getOptimalHFForPartialLiquidation}
|
|
103
|
+
**/
|
|
179
104
|
getOptimalHFForPartialLiquidation(ca: CreditAccountData): bigint;
|
|
180
|
-
protected getUpdateForAccount(options: PriceUpdatesOptions): Promise<UpdatePriceFeedsResult>;
|
|
181
105
|
/**
|
|
182
|
-
*
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
*/
|
|
186
|
-
getOnDemandPriceUpdates(options: PriceUpdatesOptions): Promise<PriceUpdateV310[]>;
|
|
106
|
+
* {@inheritDoc ICreditAccountsService.getOnDemandPriceUpdates}
|
|
107
|
+
**/
|
|
108
|
+
getOnDemandPriceUpdates(account: CreditAccountTokensSlice, ignoreReservePrices?: boolean): Promise<PriceUpdate[]>;
|
|
187
109
|
/**
|
|
188
110
|
* Analyzes a multicall array and prepends necessary on-demand price feed updates.
|
|
189
111
|
*
|
|
@@ -199,6 +121,7 @@ export declare abstract class AbstractCreditAccountService extends SDKConstruct
|
|
|
199
121
|
protected prependPriceUpdates(creditManager: Address, calls: MultiCall[], ca?: RouterCASlice, options?: {
|
|
200
122
|
ignoreReservePrices?: boolean;
|
|
201
123
|
}): Promise<MultiCall[]>;
|
|
124
|
+
protected getUpdateForAccount(account: CreditAccountTokensSlice, ignoreReservePrices?: boolean): Promise<UpdatePriceFeedsResult>;
|
|
202
125
|
/**
|
|
203
126
|
* Executes a multicall on a credit account, automatically prepending
|
|
204
127
|
* necessary on-demand price feed updates.
|
|
@@ -1,24 +1,33 @@
|
|
|
1
1
|
import { AbstractCreditAccountService } from "./AbstractCreditAccountsService.js";
|
|
2
2
|
import type { ClaimFarmRewardsProps, CreditAccountOperationResult, CreditManagerOperationResult, ICreditAccountsService, LlamathenaProportionalWithdrawProps, PreviewWithdrawLlamathenaProportionallyProps, PreviewWithdrawLlamathenaProportionallyResult, RepayAndLiquidateCreditAccountProps, RepayCreditAccountProps, SetBotProps, WithdrawCollateralProps } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Service for querying and operating on Gearbox credit accounts.
|
|
5
|
+
*
|
|
6
|
+
* Provides methods to fetch account data, build transactions for common operations
|
|
7
|
+
* (open, close, liquidate, swap, manage collateral/debt/quotas), and generate
|
|
8
|
+
* the price feed updates required by the credit facade.
|
|
9
|
+
*
|
|
10
|
+
* @see {@link ICreditAccountsService}
|
|
11
|
+
**/
|
|
3
12
|
export declare class CreditAccountServiceV310 extends AbstractCreditAccountService implements ICreditAccountsService {
|
|
4
13
|
/**
|
|
5
|
-
*
|
|
14
|
+
* {@inheritDoc ICreditAccountsService.setBot}
|
|
6
15
|
*/
|
|
7
16
|
setBot({ botAddress, permissions: defaultPermissions, targetContract, }: SetBotProps): Promise<CreditAccountOperationResult | CreditManagerOperationResult>;
|
|
8
17
|
/**
|
|
9
|
-
*
|
|
18
|
+
* {@inheritDoc ICreditAccountsService.withdrawCollateral}
|
|
10
19
|
*/
|
|
11
20
|
withdrawCollateral({ creditAccount, assetsToWithdraw, to, minQuota, averageQuota, }: WithdrawCollateralProps): Promise<CreditAccountOperationResult>;
|
|
12
21
|
/**
|
|
13
|
-
*
|
|
22
|
+
* {@inheritDoc ICreditAccountsService.repayCreditAccount}
|
|
14
23
|
*/
|
|
15
24
|
repayCreditAccount({ operation, collateralAssets, assetsToWithdraw, creditAccount: ca, permits, to, tokensToClaim, }: RepayCreditAccountProps): Promise<CreditAccountOperationResult>;
|
|
16
25
|
/**
|
|
17
|
-
*
|
|
26
|
+
* {@inheritDoc ICreditAccountsService.repayAndLiquidateCreditAccount}
|
|
18
27
|
*/
|
|
19
28
|
repayAndLiquidateCreditAccount({ collateralAssets, assetsToWithdraw, creditAccount: ca, permits, to, tokensToClaim, }: RepayAndLiquidateCreditAccountProps): Promise<CreditAccountOperationResult>;
|
|
20
29
|
/**
|
|
21
|
-
*
|
|
30
|
+
* {@inheritDoc ICreditAccountsService.claimFarmRewards}
|
|
22
31
|
*/
|
|
23
32
|
claimFarmRewards({ calls: externalCalls, creditAccount: ca, minQuota, averageQuota, tokensToClaim, }: ClaimFarmRewardsProps): Promise<CreditAccountOperationResult>;
|
|
24
33
|
previewWithdrawLlamathenaProportionally(_: PreviewWithdrawLlamathenaProportionallyProps): Promise<PreviewWithdrawLlamathenaProportionallyResult>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PriceUpdate } from "../market/pricefeeds/types.js";
|
|
2
2
|
import type { MultiCall } from "../types/index.js";
|
|
3
3
|
import { AddressSet } from "../utils/AddressSet.js";
|
|
4
4
|
/**
|
|
@@ -13,7 +13,7 @@ import { AddressSet } from "../utils/AddressSet.js";
|
|
|
13
13
|
* `remainingCalls` (everything else, preserving order)
|
|
14
14
|
*/
|
|
15
15
|
export declare function extractPriceUpdates(calls: MultiCall[]): {
|
|
16
|
-
priceUpdates:
|
|
16
|
+
priceUpdates: PriceUpdate[];
|
|
17
17
|
remainingCalls: MultiCall[];
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
@@ -36,4 +36,4 @@ export declare function extractQuotaTokens(calls: MultiCall[]): AddressSet;
|
|
|
36
36
|
* @param generated - Newly generated price updates to merge in
|
|
37
37
|
* @returns Merged array with no duplicate `priceFeed` addresses
|
|
38
38
|
*/
|
|
39
|
-
export declare function mergePriceUpdates(existing:
|
|
39
|
+
export declare function mergePriceUpdates(existing: PriceUpdate[], generated: PriceUpdate[]): PriceUpdate[];
|