@gearbox-protocol/sdk 3.0.0-vfour.81 → 3.0.0-vfour.83
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/sdk/index.cjs +11 -8
- package/dist/cjs/sdk/index.d.ts +13 -13
- package/dist/esm/sdk/index.d.mts +13 -13
- package/dist/esm/sdk/index.mjs +11 -8
- package/package.json +1 -1
package/dist/cjs/sdk/index.cjs
CHANGED
|
@@ -22255,9 +22255,10 @@ var MarketRegister = class extends SDKConstruct {
|
|
|
22255
22255
|
return this.markets.flatMap((market) => market.creditManagers);
|
|
22256
22256
|
}
|
|
22257
22257
|
findCreditManager(creditManager) {
|
|
22258
|
+
const addr = creditManager.toLowerCase();
|
|
22258
22259
|
for (const market of this.markets) {
|
|
22259
22260
|
for (const cm of market.creditManagers) {
|
|
22260
|
-
if (cm.creditManager.address ===
|
|
22261
|
+
if (cm.creditManager.address.toLowerCase() === addr) {
|
|
22261
22262
|
return cm;
|
|
22262
22263
|
}
|
|
22263
22264
|
}
|
|
@@ -22265,9 +22266,10 @@ var MarketRegister = class extends SDKConstruct {
|
|
|
22265
22266
|
throw new Error(`cannot find credit manager ${creditManager}`);
|
|
22266
22267
|
}
|
|
22267
22268
|
findByCreditManager(creditManager) {
|
|
22269
|
+
const addr = creditManager.toLowerCase();
|
|
22268
22270
|
const market = this.markets.find(
|
|
22269
22271
|
(m) => m.creditManagers.some(
|
|
22270
|
-
(cm) => cm.creditManager.address.toLowerCase() ===
|
|
22272
|
+
(cm) => cm.creditManager.address.toLowerCase() === addr
|
|
22271
22273
|
)
|
|
22272
22274
|
);
|
|
22273
22275
|
if (!market) {
|
|
@@ -22276,8 +22278,9 @@ var MarketRegister = class extends SDKConstruct {
|
|
|
22276
22278
|
return market;
|
|
22277
22279
|
}
|
|
22278
22280
|
findByPriceOracle(address) {
|
|
22281
|
+
const addr = address.toLowerCase();
|
|
22279
22282
|
for (const market of this.markets) {
|
|
22280
|
-
if (market.priceOracle.address.toLowerCase() ===
|
|
22283
|
+
if (market.priceOracle.address.toLowerCase() === addr) {
|
|
22281
22284
|
return market;
|
|
22282
22285
|
}
|
|
22283
22286
|
}
|
|
@@ -22437,9 +22440,9 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
22437
22440
|
* @param slippage
|
|
22438
22441
|
* @returns
|
|
22439
22442
|
*/
|
|
22440
|
-
async closeCreditAccount(operation, ca, assetsToKeep, to, slippage = 50n) {
|
|
22443
|
+
async closeCreditAccount(operation, ca, assetsToKeep, to, slippage = 50n, closeCall) {
|
|
22441
22444
|
const cm = this.sdk.marketRegister.findCreditManager(ca.creditManager);
|
|
22442
|
-
const { calls
|
|
22445
|
+
const { calls } = closeCall ? { calls: closeCall } : await this.#prepareCloseCreditAccount(
|
|
22443
22446
|
ca,
|
|
22444
22447
|
cm,
|
|
22445
22448
|
assetsToKeep,
|
|
@@ -22447,7 +22450,7 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
22447
22450
|
slippage
|
|
22448
22451
|
);
|
|
22449
22452
|
const tx = operation === "close" ? cm.creditFacade.closeCreditAccount(ca.creditAccount, calls) : cm.creditFacade.multicall(ca.creditAccount, calls);
|
|
22450
|
-
return { tx
|
|
22453
|
+
return { tx };
|
|
22451
22454
|
}
|
|
22452
22455
|
/**
|
|
22453
22456
|
* Internal wrapper for CreditAccountCompressor.getCreditAccounts + price updates wrapped into multicall
|
|
@@ -22554,7 +22557,7 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
22554
22557
|
(t) => this.#prepareWithdrawToken(ca, t, MAX_UINT256, to)
|
|
22555
22558
|
)
|
|
22556
22559
|
];
|
|
22557
|
-
return { calls
|
|
22560
|
+
return { calls };
|
|
22558
22561
|
}
|
|
22559
22562
|
#prepareDisableQuotas(ca) {
|
|
22560
22563
|
const calls = [];
|
|
@@ -23050,7 +23053,7 @@ var RouterV3Contract = class extends BaseContract {
|
|
|
23050
23053
|
* @dev Finds the path to swap / withdraw all assets from CreditAccount into underlying asset
|
|
23051
23054
|
* Can bu used for closing Credit Account and for liquidations as well.
|
|
23052
23055
|
* @param ca CreditAccountStruct object used for close path computation
|
|
23053
|
-
* @param cm CreditManagerSlice for
|
|
23056
|
+
* @param cm CreditManagerSlice for corresponding credit manager
|
|
23054
23057
|
* @param slippage Slippage in PERCENTAGE_FORMAT (100% = 10_000) per operation
|
|
23055
23058
|
* @return The best option in PathFinderCloseResult format, which
|
|
23056
23059
|
* - underlyingBalance - total balance of underlying token
|
package/dist/cjs/sdk/index.d.ts
CHANGED
|
@@ -24946,6 +24946,7 @@ interface CreditManagerSlice {
|
|
|
24946
24946
|
address: Address;
|
|
24947
24947
|
collateralTokens: Address[];
|
|
24948
24948
|
}
|
|
24949
|
+
type CreditAccountDataSlice = Pick<CreditAccountData, "tokens" | "enabledTokensMask" | "underlying" | "creditAccount" | "creditFacade" | "totalDebtUSD" | "creditManager">;
|
|
24949
24950
|
declare class RouterV3Contract extends BaseContract<abi> implements IHooks<RouterHooks> {
|
|
24950
24951
|
#private;
|
|
24951
24952
|
constructor(sdk: GearboxSDK, address: Address);
|
|
@@ -24963,7 +24964,7 @@ declare class RouterV3Contract extends BaseContract<abi> implements IHooks<Route
|
|
|
24963
24964
|
* @param slippage
|
|
24964
24965
|
* @returns
|
|
24965
24966
|
*/
|
|
24966
|
-
findAllSwaps(ca:
|
|
24967
|
+
findAllSwaps(ca: CreditAccountDataSlice, cm: CreditManagerSlice, swapOperation: SwapOperation, tokenIn: Address, tokenOut: Address, amount: bigint, leftoverAmount: bigint, slippage: number | bigint): Promise<RouterResult[]>;
|
|
24967
24968
|
/**
|
|
24968
24969
|
* Finds best path to swap all Normal tokens and tokens "on the way" to target one and vice versa
|
|
24969
24970
|
* @param ca
|
|
@@ -24974,7 +24975,7 @@ declare class RouterV3Contract extends BaseContract<abi> implements IHooks<Route
|
|
|
24974
24975
|
* @param slippage
|
|
24975
24976
|
* @returns
|
|
24976
24977
|
*/
|
|
24977
|
-
findOneTokenPath(ca:
|
|
24978
|
+
findOneTokenPath(ca: CreditAccountDataSlice, cm: CreditManagerSlice, tokenIn: Address, tokenOut: Address, amount: bigint, slippage: number | bigint): Promise<RouterResult>;
|
|
24978
24979
|
/**
|
|
24979
24980
|
* @dev Finds the best path for opening Credit Account and converting all NORMAL tokens and LP token in the way to TARGET
|
|
24980
24981
|
* @param cm CreditManagerData which represents credit manager you want to use to open Credit Account
|
|
@@ -24991,21 +24992,21 @@ declare class RouterV3Contract extends BaseContract<abi> implements IHooks<Route
|
|
|
24991
24992
|
* @dev Finds the path to swap / withdraw all assets from CreditAccount into underlying asset
|
|
24992
24993
|
* Can bu used for closing Credit Account and for liquidations as well.
|
|
24993
24994
|
* @param ca CreditAccountStruct object used for close path computation
|
|
24994
|
-
* @param cm CreditManagerSlice for
|
|
24995
|
+
* @param cm CreditManagerSlice for corresponding credit manager
|
|
24995
24996
|
* @param slippage Slippage in PERCENTAGE_FORMAT (100% = 10_000) per operation
|
|
24996
24997
|
* @return The best option in PathFinderCloseResult format, which
|
|
24997
24998
|
* - underlyingBalance - total balance of underlying token
|
|
24998
24999
|
* - calls - list of calls which should be done to swap & unwrap everything to underlying token
|
|
24999
25000
|
*/
|
|
25000
|
-
findBestClosePath(ca:
|
|
25001
|
+
findBestClosePath(ca: CreditAccountDataSlice, cm: CreditManagerSlice, slippage: bigint | number, balances?: ClosePathBalances): Promise<RouterCloseResult>;
|
|
25001
25002
|
/**
|
|
25002
25003
|
* Finds input to be used with findBestClosePath
|
|
25003
25004
|
* @param ca
|
|
25004
25005
|
* @param cm
|
|
25005
25006
|
* @returns
|
|
25006
25007
|
*/
|
|
25007
|
-
getFindClosePathInput(ca:
|
|
25008
|
-
getDefaultExpectedAndLeftover(ca:
|
|
25008
|
+
getFindClosePathInput(ca: CreditAccountDataSlice, cm: CreditManagerSlice, balances?: ReturnType<RouterV3Contract["getDefaultExpectedAndLeftover"]>): FindClosePathInput;
|
|
25009
|
+
getDefaultExpectedAndLeftover(ca: CreditAccountDataSlice): {
|
|
25009
25010
|
expectedBalances: AddressMap<Asset>;
|
|
25010
25011
|
leftoverBalances: AddressMap<Asset>;
|
|
25011
25012
|
};
|
|
@@ -25183,7 +25184,6 @@ interface FullyLiquidateAccountResult {
|
|
|
25183
25184
|
}
|
|
25184
25185
|
interface CloseCreditAccountResult {
|
|
25185
25186
|
tx: RawTx;
|
|
25186
|
-
routerCloseResult: RouterCloseResult;
|
|
25187
25187
|
}
|
|
25188
25188
|
declare class CreditAccountsService extends SDKConstruct {
|
|
25189
25189
|
#private;
|
|
@@ -25215,7 +25215,7 @@ declare class CreditAccountsService extends SDKConstruct {
|
|
|
25215
25215
|
* @param slippage
|
|
25216
25216
|
* @returns
|
|
25217
25217
|
*/
|
|
25218
|
-
fullyLiquidate(account:
|
|
25218
|
+
fullyLiquidate(account: CreditAccountDataSlice, to: Address, slippage?: bigint): Promise<FullyLiquidateAccountResult>;
|
|
25219
25219
|
/**
|
|
25220
25220
|
* Closes credit account or sets debt to zero (but keep account)
|
|
25221
25221
|
* @param operation
|
|
@@ -25225,25 +25225,25 @@ declare class CreditAccountsService extends SDKConstruct {
|
|
|
25225
25225
|
* @param slippage
|
|
25226
25226
|
* @returns
|
|
25227
25227
|
*/
|
|
25228
|
-
closeCreditAccount(operation: "close" | "zeroDebt", ca:
|
|
25228
|
+
closeCreditAccount(operation: "close" | "zeroDebt", ca: CreditAccountDataSlice, assetsToKeep: Address[], to: Address, slippage?: bigint, closeCall?: Array<MultiCall>): Promise<CloseCreditAccountResult>;
|
|
25229
25229
|
/**
|
|
25230
25230
|
* Returns raw txs that are needed to update all price feeds so that all credit accounts (possibly from different markets) compute
|
|
25231
25231
|
* @param accounts
|
|
25232
25232
|
* @returns
|
|
25233
25233
|
*/
|
|
25234
|
-
getUpdateForAccounts(accounts:
|
|
25234
|
+
getUpdateForAccounts(accounts: CreditAccountDataSlice[]): Promise<UpdatePriceFeedsResult>;
|
|
25235
25235
|
/**
|
|
25236
25236
|
* Returns account price updates in a non-encoded format
|
|
25237
25237
|
* @param acc
|
|
25238
25238
|
* @returns
|
|
25239
25239
|
*/
|
|
25240
|
-
getOnDemandPriceUpdates(acc:
|
|
25240
|
+
getOnDemandPriceUpdates(acc: CreditAccountDataSlice): Promise<OnDemandPriceUpdate[]>;
|
|
25241
25241
|
/**
|
|
25242
25242
|
* Returns price updates in format that is accepted by various credit facade methods (multicall, close/liquidate, etc...)
|
|
25243
25243
|
* @param acc
|
|
25244
25244
|
* @returns
|
|
25245
25245
|
*/
|
|
25246
|
-
getPriceUpdatesForFacade(acc:
|
|
25246
|
+
getPriceUpdatesForFacade(acc: CreditAccountDataSlice): Promise<MultiCall[]>;
|
|
25247
25247
|
/**
|
|
25248
25248
|
* Returns addresses of pools of attached markets
|
|
25249
25249
|
*/
|
|
@@ -25357,4 +25357,4 @@ type MulticallErrorType = GetChainContractAddressErrorType | ReadContractErrorTy
|
|
|
25357
25357
|
*/
|
|
25358
25358
|
declare function simulateMulticall<const contracts extends readonly unknown[], chain extends Chain | undefined, allowFailure extends boolean = true>(client: Client<Transport, chain>, parameters: MulticallParameters<contracts, allowFailure>): Promise<MulticallReturnType<contracts, allowFailure>>;
|
|
25359
25359
|
|
|
25360
|
-
export { ADDRESS_0X0, ADDRESS_PROVIDER, ADDRESS_PROVIDER_BLOCK, AP_ACCOUNT_FACTORY, AP_ACL, AP_ADAPTER_COMPRESSOR, AP_BOT_LIST, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DEGEN_DISTRIBUTOR, AP_DEGEN_NFT, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_MULTI_PAUSE, AP_PARTIAL_LIQUIDATION_BOT, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_ORACLE, AP_ROUTER, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractPriceFeedContract, type AdapterContractType, type AdapterData, AddressLabeller, AddressMap, AddressProviderContractV3_1, type AddressProviderV3StateHuman, type Asset, type AssetPriceFeedStateHuman, BalancerStablePriceFeedContract, BalancerV2VaultAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, type BaseContractOptions, type BaseContractStateHuman, type BaseParams, type BasePriceFeedStateHuman, BotListContract, type BotListStateHuman, BotPermissions, type BoundedOracleStateHuman, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainlinkPriceFeedContract, type CloseCreditAccountResult, CompositePriceFeedContract, type ConnectionOptions, type ContractMethod, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, type CoreStateHuman, type CreditAccountData, type CreditAccountFilter, CreditAccountsService, CreditConfiguratorContract, type CreditConfiguratorState, type CreditConfiguratorStateHuman, type CreditFacadeState, type CreditFacadeStateHuman, CreditFacadeV300Contract, CreditFacadeV310Contract, CreditFactory, type CreditFactoryStateHuman, CreditManagerContract, type CreditManagerData, type CreditManagerDebtParams, type CreditManagerDebtParamsHuman, type CreditManagerState, type CreditManagerStateHuman, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, type CurvePoolStruct, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1AdapterStableNGContract, ERC4626AdapterContract, Erc4626PriceFeedContract, type EtherscanURLParam, type FindClosePathInput, type FullyLiquidateAccountResult, GaugeContract, type GaugeParams, type GaugeParamsHuman, type GaugeStateHuman, GearStakingContract, type GearStakingV3StateHuman, GearboxSDK, type GearboxStateHuman, type IAdapterContract, type IBaseContract, type ILPPriceFeedContract, type ILogger, type IPriceFeedContract, LinearModelContract, type LinearModelStateHuman, type LogFn, MAX_UINT16, MAX_UINT256, MIN_INT96, type MarketData, MarketFactory, MarketRegister, type MarketStateHuman, MellowLRTPriceFeedContract, type MultiCall, type MulticallErrorType, type MulticallParameters, type MulticallReturnType, NOT_DEPLOYED, NO_VERSION, type NetworkOptions, type NetworkType, type OnDemandPriceUpdate, type OpenStrategyResult, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PRICE_DECIMALS, PRICE_DECIMALS_POW, type PartialPriceFeedTreeNode, type PathOption, type PathOptionSerie, PoolContract, type PoolData, PoolFactory, type PoolFactoryStateHuman, PoolQuotaKeeperContract, type PoolQuotaKeeperData, type PoolQuotaKeeperStateHuman, type PoolStateHuman, type PriceFeedConstructorArgs, type PriceFeedContractType, type PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, type PriceFeedRegisterHooks, type PriceFeedStateHuman, type PriceFeedTreeNode, type PriceFeedUsageType, PriceOracleContract, type PriceOracleData, type PriceOracleV3StateHuman, Provider, type QuotaParamsHuman, type QuotaState, RAY, RAY_DECIMALS_POW, type RateKeeperData, type RawTx, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, type RouterCloseResult, type RouterHooks, type RouterResult, RouterV3Contract, SDKConstruct, type SDKHooks, type SDKOptions, SUPPORTED_CHAINS, type SwapOperation, type SwapTask, type SyncStateOptions, TIMELOCK, type TVL, type TokenMetaData, TokensMeta, type TransportOptions, USDC, UniswapV2AdapterContract, UniswapV3AdapterContract, type UpdatePriceFeedsResult, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, YearnV2RouterAdapterContract, type ZapperData, type ZapperStateHuman, ZeroPriceFeedContract, botPermissionsToString, bytes32ToString, chains, childLogger, createAdapter, createRawTx, createTransport, detectNetwork, etherscanUrl, filterDust, fmtBinaryMask, formatBN, formatBNvalue, formatBn4dig, formatDuration, formatNumberToString_, halfRAY, json_parse, json_stringify, numberWithCommas, percentFmt, rawTxToMulticallPriceUpdate, simulateMulticall, toHumanFormat };
|
|
25360
|
+
export { ADDRESS_0X0, ADDRESS_PROVIDER, ADDRESS_PROVIDER_BLOCK, AP_ACCOUNT_FACTORY, AP_ACL, AP_ADAPTER_COMPRESSOR, AP_BOT_LIST, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DEGEN_DISTRIBUTOR, AP_DEGEN_NFT, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_MULTI_PAUSE, AP_PARTIAL_LIQUIDATION_BOT, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_ORACLE, AP_ROUTER, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractPriceFeedContract, type AdapterContractType, type AdapterData, AddressLabeller, AddressMap, AddressProviderContractV3_1, type AddressProviderV3StateHuman, type Asset, type AssetPriceFeedStateHuman, BalancerStablePriceFeedContract, BalancerV2VaultAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, type BaseContractOptions, type BaseContractStateHuman, type BaseParams, type BasePriceFeedStateHuman, BotListContract, type BotListStateHuman, BotPermissions, type BoundedOracleStateHuman, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainlinkPriceFeedContract, type CloseCreditAccountResult, type ClosePathBalances, CompositePriceFeedContract, type ConnectionOptions, type ContractMethod, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, type CoreStateHuman, type CreditAccountData, type CreditAccountDataSlice, type CreditAccountFilter, CreditAccountsService, CreditConfiguratorContract, type CreditConfiguratorState, type CreditConfiguratorStateHuman, type CreditFacadeState, type CreditFacadeStateHuman, CreditFacadeV300Contract, CreditFacadeV310Contract, CreditFactory, type CreditFactoryStateHuman, CreditManagerContract, type CreditManagerData, type CreditManagerDebtParams, type CreditManagerDebtParamsHuman, type CreditManagerState, type CreditManagerStateHuman, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, type CurvePoolStruct, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1AdapterStableNGContract, ERC4626AdapterContract, Erc4626PriceFeedContract, type EtherscanURLParam, type FindClosePathInput, type FullyLiquidateAccountResult, GaugeContract, type GaugeParams, type GaugeParamsHuman, type GaugeStateHuman, GearStakingContract, type GearStakingV3StateHuman, GearboxSDK, type GearboxStateHuman, type IAdapterContract, type IBaseContract, type ILPPriceFeedContract, type ILogger, type IPriceFeedContract, LinearModelContract, type LinearModelStateHuman, type LogFn, MAX_UINT16, MAX_UINT256, MIN_INT96, type MarketData, MarketFactory, MarketRegister, type MarketStateHuman, MellowLRTPriceFeedContract, type MultiCall, type MulticallErrorType, type MulticallParameters, type MulticallReturnType, NOT_DEPLOYED, NO_VERSION, type NetworkOptions, type NetworkType, type OnDemandPriceUpdate, type OpenStrategyResult, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PRICE_DECIMALS, PRICE_DECIMALS_POW, type PartialPriceFeedTreeNode, type PathOption, type PathOptionSerie, PoolContract, type PoolData, PoolFactory, type PoolFactoryStateHuman, PoolQuotaKeeperContract, type PoolQuotaKeeperData, type PoolQuotaKeeperStateHuman, type PoolStateHuman, type PriceFeedConstructorArgs, type PriceFeedContractType, type PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, type PriceFeedRegisterHooks, type PriceFeedStateHuman, type PriceFeedTreeNode, type PriceFeedUsageType, PriceOracleContract, type PriceOracleData, type PriceOracleV3StateHuman, Provider, type QuotaParamsHuman, type QuotaState, RAY, RAY_DECIMALS_POW, type RateKeeperData, type RawTx, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, type RouterCloseResult, type RouterHooks, type RouterResult, RouterV3Contract, SDKConstruct, type SDKHooks, type SDKOptions, SUPPORTED_CHAINS, type SwapOperation, type SwapTask, type SyncStateOptions, TIMELOCK, type TVL, type TokenMetaData, TokensMeta, type TransportOptions, USDC, UniswapV2AdapterContract, UniswapV3AdapterContract, type UpdatePriceFeedsResult, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, YearnV2RouterAdapterContract, type ZapperData, type ZapperStateHuman, ZeroPriceFeedContract, botPermissionsToString, bytes32ToString, chains, childLogger, createAdapter, createRawTx, createTransport, detectNetwork, etherscanUrl, filterDust, fmtBinaryMask, formatBN, formatBNvalue, formatBn4dig, formatDuration, formatNumberToString_, halfRAY, json_parse, json_stringify, numberWithCommas, percentFmt, rawTxToMulticallPriceUpdate, simulateMulticall, toHumanFormat };
|
package/dist/esm/sdk/index.d.mts
CHANGED
|
@@ -24946,6 +24946,7 @@ interface CreditManagerSlice {
|
|
|
24946
24946
|
address: Address;
|
|
24947
24947
|
collateralTokens: Address[];
|
|
24948
24948
|
}
|
|
24949
|
+
type CreditAccountDataSlice = Pick<CreditAccountData, "tokens" | "enabledTokensMask" | "underlying" | "creditAccount" | "creditFacade" | "totalDebtUSD" | "creditManager">;
|
|
24949
24950
|
declare class RouterV3Contract extends BaseContract<abi> implements IHooks<RouterHooks> {
|
|
24950
24951
|
#private;
|
|
24951
24952
|
constructor(sdk: GearboxSDK, address: Address);
|
|
@@ -24963,7 +24964,7 @@ declare class RouterV3Contract extends BaseContract<abi> implements IHooks<Route
|
|
|
24963
24964
|
* @param slippage
|
|
24964
24965
|
* @returns
|
|
24965
24966
|
*/
|
|
24966
|
-
findAllSwaps(ca:
|
|
24967
|
+
findAllSwaps(ca: CreditAccountDataSlice, cm: CreditManagerSlice, swapOperation: SwapOperation, tokenIn: Address, tokenOut: Address, amount: bigint, leftoverAmount: bigint, slippage: number | bigint): Promise<RouterResult[]>;
|
|
24967
24968
|
/**
|
|
24968
24969
|
* Finds best path to swap all Normal tokens and tokens "on the way" to target one and vice versa
|
|
24969
24970
|
* @param ca
|
|
@@ -24974,7 +24975,7 @@ declare class RouterV3Contract extends BaseContract<abi> implements IHooks<Route
|
|
|
24974
24975
|
* @param slippage
|
|
24975
24976
|
* @returns
|
|
24976
24977
|
*/
|
|
24977
|
-
findOneTokenPath(ca:
|
|
24978
|
+
findOneTokenPath(ca: CreditAccountDataSlice, cm: CreditManagerSlice, tokenIn: Address, tokenOut: Address, amount: bigint, slippage: number | bigint): Promise<RouterResult>;
|
|
24978
24979
|
/**
|
|
24979
24980
|
* @dev Finds the best path for opening Credit Account and converting all NORMAL tokens and LP token in the way to TARGET
|
|
24980
24981
|
* @param cm CreditManagerData which represents credit manager you want to use to open Credit Account
|
|
@@ -24991,21 +24992,21 @@ declare class RouterV3Contract extends BaseContract<abi> implements IHooks<Route
|
|
|
24991
24992
|
* @dev Finds the path to swap / withdraw all assets from CreditAccount into underlying asset
|
|
24992
24993
|
* Can bu used for closing Credit Account and for liquidations as well.
|
|
24993
24994
|
* @param ca CreditAccountStruct object used for close path computation
|
|
24994
|
-
* @param cm CreditManagerSlice for
|
|
24995
|
+
* @param cm CreditManagerSlice for corresponding credit manager
|
|
24995
24996
|
* @param slippage Slippage in PERCENTAGE_FORMAT (100% = 10_000) per operation
|
|
24996
24997
|
* @return The best option in PathFinderCloseResult format, which
|
|
24997
24998
|
* - underlyingBalance - total balance of underlying token
|
|
24998
24999
|
* - calls - list of calls which should be done to swap & unwrap everything to underlying token
|
|
24999
25000
|
*/
|
|
25000
|
-
findBestClosePath(ca:
|
|
25001
|
+
findBestClosePath(ca: CreditAccountDataSlice, cm: CreditManagerSlice, slippage: bigint | number, balances?: ClosePathBalances): Promise<RouterCloseResult>;
|
|
25001
25002
|
/**
|
|
25002
25003
|
* Finds input to be used with findBestClosePath
|
|
25003
25004
|
* @param ca
|
|
25004
25005
|
* @param cm
|
|
25005
25006
|
* @returns
|
|
25006
25007
|
*/
|
|
25007
|
-
getFindClosePathInput(ca:
|
|
25008
|
-
getDefaultExpectedAndLeftover(ca:
|
|
25008
|
+
getFindClosePathInput(ca: CreditAccountDataSlice, cm: CreditManagerSlice, balances?: ReturnType<RouterV3Contract["getDefaultExpectedAndLeftover"]>): FindClosePathInput;
|
|
25009
|
+
getDefaultExpectedAndLeftover(ca: CreditAccountDataSlice): {
|
|
25009
25010
|
expectedBalances: AddressMap<Asset>;
|
|
25010
25011
|
leftoverBalances: AddressMap<Asset>;
|
|
25011
25012
|
};
|
|
@@ -25183,7 +25184,6 @@ interface FullyLiquidateAccountResult {
|
|
|
25183
25184
|
}
|
|
25184
25185
|
interface CloseCreditAccountResult {
|
|
25185
25186
|
tx: RawTx;
|
|
25186
|
-
routerCloseResult: RouterCloseResult;
|
|
25187
25187
|
}
|
|
25188
25188
|
declare class CreditAccountsService extends SDKConstruct {
|
|
25189
25189
|
#private;
|
|
@@ -25215,7 +25215,7 @@ declare class CreditAccountsService extends SDKConstruct {
|
|
|
25215
25215
|
* @param slippage
|
|
25216
25216
|
* @returns
|
|
25217
25217
|
*/
|
|
25218
|
-
fullyLiquidate(account:
|
|
25218
|
+
fullyLiquidate(account: CreditAccountDataSlice, to: Address, slippage?: bigint): Promise<FullyLiquidateAccountResult>;
|
|
25219
25219
|
/**
|
|
25220
25220
|
* Closes credit account or sets debt to zero (but keep account)
|
|
25221
25221
|
* @param operation
|
|
@@ -25225,25 +25225,25 @@ declare class CreditAccountsService extends SDKConstruct {
|
|
|
25225
25225
|
* @param slippage
|
|
25226
25226
|
* @returns
|
|
25227
25227
|
*/
|
|
25228
|
-
closeCreditAccount(operation: "close" | "zeroDebt", ca:
|
|
25228
|
+
closeCreditAccount(operation: "close" | "zeroDebt", ca: CreditAccountDataSlice, assetsToKeep: Address[], to: Address, slippage?: bigint, closeCall?: Array<MultiCall>): Promise<CloseCreditAccountResult>;
|
|
25229
25229
|
/**
|
|
25230
25230
|
* Returns raw txs that are needed to update all price feeds so that all credit accounts (possibly from different markets) compute
|
|
25231
25231
|
* @param accounts
|
|
25232
25232
|
* @returns
|
|
25233
25233
|
*/
|
|
25234
|
-
getUpdateForAccounts(accounts:
|
|
25234
|
+
getUpdateForAccounts(accounts: CreditAccountDataSlice[]): Promise<UpdatePriceFeedsResult>;
|
|
25235
25235
|
/**
|
|
25236
25236
|
* Returns account price updates in a non-encoded format
|
|
25237
25237
|
* @param acc
|
|
25238
25238
|
* @returns
|
|
25239
25239
|
*/
|
|
25240
|
-
getOnDemandPriceUpdates(acc:
|
|
25240
|
+
getOnDemandPriceUpdates(acc: CreditAccountDataSlice): Promise<OnDemandPriceUpdate[]>;
|
|
25241
25241
|
/**
|
|
25242
25242
|
* Returns price updates in format that is accepted by various credit facade methods (multicall, close/liquidate, etc...)
|
|
25243
25243
|
* @param acc
|
|
25244
25244
|
* @returns
|
|
25245
25245
|
*/
|
|
25246
|
-
getPriceUpdatesForFacade(acc:
|
|
25246
|
+
getPriceUpdatesForFacade(acc: CreditAccountDataSlice): Promise<MultiCall[]>;
|
|
25247
25247
|
/**
|
|
25248
25248
|
* Returns addresses of pools of attached markets
|
|
25249
25249
|
*/
|
|
@@ -25357,4 +25357,4 @@ type MulticallErrorType = GetChainContractAddressErrorType | ReadContractErrorTy
|
|
|
25357
25357
|
*/
|
|
25358
25358
|
declare function simulateMulticall<const contracts extends readonly unknown[], chain extends Chain | undefined, allowFailure extends boolean = true>(client: Client<Transport, chain>, parameters: MulticallParameters<contracts, allowFailure>): Promise<MulticallReturnType<contracts, allowFailure>>;
|
|
25359
25359
|
|
|
25360
|
-
export { ADDRESS_0X0, ADDRESS_PROVIDER, ADDRESS_PROVIDER_BLOCK, AP_ACCOUNT_FACTORY, AP_ACL, AP_ADAPTER_COMPRESSOR, AP_BOT_LIST, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DEGEN_DISTRIBUTOR, AP_DEGEN_NFT, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_MULTI_PAUSE, AP_PARTIAL_LIQUIDATION_BOT, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_ORACLE, AP_ROUTER, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractPriceFeedContract, type AdapterContractType, type AdapterData, AddressLabeller, AddressMap, AddressProviderContractV3_1, type AddressProviderV3StateHuman, type Asset, type AssetPriceFeedStateHuman, BalancerStablePriceFeedContract, BalancerV2VaultAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, type BaseContractOptions, type BaseContractStateHuman, type BaseParams, type BasePriceFeedStateHuman, BotListContract, type BotListStateHuman, BotPermissions, type BoundedOracleStateHuman, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainlinkPriceFeedContract, type CloseCreditAccountResult, CompositePriceFeedContract, type ConnectionOptions, type ContractMethod, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, type CoreStateHuman, type CreditAccountData, type CreditAccountFilter, CreditAccountsService, CreditConfiguratorContract, type CreditConfiguratorState, type CreditConfiguratorStateHuman, type CreditFacadeState, type CreditFacadeStateHuman, CreditFacadeV300Contract, CreditFacadeV310Contract, CreditFactory, type CreditFactoryStateHuman, CreditManagerContract, type CreditManagerData, type CreditManagerDebtParams, type CreditManagerDebtParamsHuman, type CreditManagerState, type CreditManagerStateHuman, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, type CurvePoolStruct, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1AdapterStableNGContract, ERC4626AdapterContract, Erc4626PriceFeedContract, type EtherscanURLParam, type FindClosePathInput, type FullyLiquidateAccountResult, GaugeContract, type GaugeParams, type GaugeParamsHuman, type GaugeStateHuman, GearStakingContract, type GearStakingV3StateHuman, GearboxSDK, type GearboxStateHuman, type IAdapterContract, type IBaseContract, type ILPPriceFeedContract, type ILogger, type IPriceFeedContract, LinearModelContract, type LinearModelStateHuman, type LogFn, MAX_UINT16, MAX_UINT256, MIN_INT96, type MarketData, MarketFactory, MarketRegister, type MarketStateHuman, MellowLRTPriceFeedContract, type MultiCall, type MulticallErrorType, type MulticallParameters, type MulticallReturnType, NOT_DEPLOYED, NO_VERSION, type NetworkOptions, type NetworkType, type OnDemandPriceUpdate, type OpenStrategyResult, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PRICE_DECIMALS, PRICE_DECIMALS_POW, type PartialPriceFeedTreeNode, type PathOption, type PathOptionSerie, PoolContract, type PoolData, PoolFactory, type PoolFactoryStateHuman, PoolQuotaKeeperContract, type PoolQuotaKeeperData, type PoolQuotaKeeperStateHuman, type PoolStateHuman, type PriceFeedConstructorArgs, type PriceFeedContractType, type PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, type PriceFeedRegisterHooks, type PriceFeedStateHuman, type PriceFeedTreeNode, type PriceFeedUsageType, PriceOracleContract, type PriceOracleData, type PriceOracleV3StateHuman, Provider, type QuotaParamsHuman, type QuotaState, RAY, RAY_DECIMALS_POW, type RateKeeperData, type RawTx, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, type RouterCloseResult, type RouterHooks, type RouterResult, RouterV3Contract, SDKConstruct, type SDKHooks, type SDKOptions, SUPPORTED_CHAINS, type SwapOperation, type SwapTask, type SyncStateOptions, TIMELOCK, type TVL, type TokenMetaData, TokensMeta, type TransportOptions, USDC, UniswapV2AdapterContract, UniswapV3AdapterContract, type UpdatePriceFeedsResult, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, YearnV2RouterAdapterContract, type ZapperData, type ZapperStateHuman, ZeroPriceFeedContract, botPermissionsToString, bytes32ToString, chains, childLogger, createAdapter, createRawTx, createTransport, detectNetwork, etherscanUrl, filterDust, fmtBinaryMask, formatBN, formatBNvalue, formatBn4dig, formatDuration, formatNumberToString_, halfRAY, json_parse, json_stringify, numberWithCommas, percentFmt, rawTxToMulticallPriceUpdate, simulateMulticall, toHumanFormat };
|
|
25360
|
+
export { ADDRESS_0X0, ADDRESS_PROVIDER, ADDRESS_PROVIDER_BLOCK, AP_ACCOUNT_FACTORY, AP_ACL, AP_ADAPTER_COMPRESSOR, AP_BOT_LIST, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DEGEN_DISTRIBUTOR, AP_DEGEN_NFT, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_MULTI_PAUSE, AP_PARTIAL_LIQUIDATION_BOT, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_ORACLE, AP_ROUTER, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractPriceFeedContract, type AdapterContractType, type AdapterData, AddressLabeller, AddressMap, AddressProviderContractV3_1, type AddressProviderV3StateHuman, type Asset, type AssetPriceFeedStateHuman, BalancerStablePriceFeedContract, BalancerV2VaultAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, type BaseContractOptions, type BaseContractStateHuman, type BaseParams, type BasePriceFeedStateHuman, BotListContract, type BotListStateHuman, BotPermissions, type BoundedOracleStateHuman, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainlinkPriceFeedContract, type CloseCreditAccountResult, type ClosePathBalances, CompositePriceFeedContract, type ConnectionOptions, type ContractMethod, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, type CoreStateHuman, type CreditAccountData, type CreditAccountDataSlice, type CreditAccountFilter, CreditAccountsService, CreditConfiguratorContract, type CreditConfiguratorState, type CreditConfiguratorStateHuman, type CreditFacadeState, type CreditFacadeStateHuman, CreditFacadeV300Contract, CreditFacadeV310Contract, CreditFactory, type CreditFactoryStateHuman, CreditManagerContract, type CreditManagerData, type CreditManagerDebtParams, type CreditManagerDebtParamsHuman, type CreditManagerState, type CreditManagerStateHuman, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, type CurvePoolStruct, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1AdapterStableNGContract, ERC4626AdapterContract, Erc4626PriceFeedContract, type EtherscanURLParam, type FindClosePathInput, type FullyLiquidateAccountResult, GaugeContract, type GaugeParams, type GaugeParamsHuman, type GaugeStateHuman, GearStakingContract, type GearStakingV3StateHuman, GearboxSDK, type GearboxStateHuman, type IAdapterContract, type IBaseContract, type ILPPriceFeedContract, type ILogger, type IPriceFeedContract, LinearModelContract, type LinearModelStateHuman, type LogFn, MAX_UINT16, MAX_UINT256, MIN_INT96, type MarketData, MarketFactory, MarketRegister, type MarketStateHuman, MellowLRTPriceFeedContract, type MultiCall, type MulticallErrorType, type MulticallParameters, type MulticallReturnType, NOT_DEPLOYED, NO_VERSION, type NetworkOptions, type NetworkType, type OnDemandPriceUpdate, type OpenStrategyResult, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PRICE_DECIMALS, PRICE_DECIMALS_POW, type PartialPriceFeedTreeNode, type PathOption, type PathOptionSerie, PoolContract, type PoolData, PoolFactory, type PoolFactoryStateHuman, PoolQuotaKeeperContract, type PoolQuotaKeeperData, type PoolQuotaKeeperStateHuman, type PoolStateHuman, type PriceFeedConstructorArgs, type PriceFeedContractType, type PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, type PriceFeedRegisterHooks, type PriceFeedStateHuman, type PriceFeedTreeNode, type PriceFeedUsageType, PriceOracleContract, type PriceOracleData, type PriceOracleV3StateHuman, Provider, type QuotaParamsHuman, type QuotaState, RAY, RAY_DECIMALS_POW, type RateKeeperData, type RawTx, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, type RouterCloseResult, type RouterHooks, type RouterResult, RouterV3Contract, SDKConstruct, type SDKHooks, type SDKOptions, SUPPORTED_CHAINS, type SwapOperation, type SwapTask, type SyncStateOptions, TIMELOCK, type TVL, type TokenMetaData, TokensMeta, type TransportOptions, USDC, UniswapV2AdapterContract, UniswapV3AdapterContract, type UpdatePriceFeedsResult, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, YearnV2RouterAdapterContract, type ZapperData, type ZapperStateHuman, ZeroPriceFeedContract, botPermissionsToString, bytes32ToString, chains, childLogger, createAdapter, createRawTx, createTransport, detectNetwork, etherscanUrl, filterDust, fmtBinaryMask, formatBN, formatBNvalue, formatBn4dig, formatDuration, formatNumberToString_, halfRAY, json_parse, json_stringify, numberWithCommas, percentFmt, rawTxToMulticallPriceUpdate, simulateMulticall, toHumanFormat };
|
package/dist/esm/sdk/index.mjs
CHANGED
|
@@ -22253,9 +22253,10 @@ var MarketRegister = class extends SDKConstruct {
|
|
|
22253
22253
|
return this.markets.flatMap((market) => market.creditManagers);
|
|
22254
22254
|
}
|
|
22255
22255
|
findCreditManager(creditManager) {
|
|
22256
|
+
const addr = creditManager.toLowerCase();
|
|
22256
22257
|
for (const market of this.markets) {
|
|
22257
22258
|
for (const cm of market.creditManagers) {
|
|
22258
|
-
if (cm.creditManager.address ===
|
|
22259
|
+
if (cm.creditManager.address.toLowerCase() === addr) {
|
|
22259
22260
|
return cm;
|
|
22260
22261
|
}
|
|
22261
22262
|
}
|
|
@@ -22263,9 +22264,10 @@ var MarketRegister = class extends SDKConstruct {
|
|
|
22263
22264
|
throw new Error(`cannot find credit manager ${creditManager}`);
|
|
22264
22265
|
}
|
|
22265
22266
|
findByCreditManager(creditManager) {
|
|
22267
|
+
const addr = creditManager.toLowerCase();
|
|
22266
22268
|
const market = this.markets.find(
|
|
22267
22269
|
(m) => m.creditManagers.some(
|
|
22268
|
-
(cm) => cm.creditManager.address.toLowerCase() ===
|
|
22270
|
+
(cm) => cm.creditManager.address.toLowerCase() === addr
|
|
22269
22271
|
)
|
|
22270
22272
|
);
|
|
22271
22273
|
if (!market) {
|
|
@@ -22274,8 +22276,9 @@ var MarketRegister = class extends SDKConstruct {
|
|
|
22274
22276
|
return market;
|
|
22275
22277
|
}
|
|
22276
22278
|
findByPriceOracle(address) {
|
|
22279
|
+
const addr = address.toLowerCase();
|
|
22277
22280
|
for (const market of this.markets) {
|
|
22278
|
-
if (market.priceOracle.address.toLowerCase() ===
|
|
22281
|
+
if (market.priceOracle.address.toLowerCase() === addr) {
|
|
22279
22282
|
return market;
|
|
22280
22283
|
}
|
|
22281
22284
|
}
|
|
@@ -22435,9 +22438,9 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
22435
22438
|
* @param slippage
|
|
22436
22439
|
* @returns
|
|
22437
22440
|
*/
|
|
22438
|
-
async closeCreditAccount(operation, ca, assetsToKeep, to, slippage = 50n) {
|
|
22441
|
+
async closeCreditAccount(operation, ca, assetsToKeep, to, slippage = 50n, closeCall) {
|
|
22439
22442
|
const cm = this.sdk.marketRegister.findCreditManager(ca.creditManager);
|
|
22440
|
-
const { calls
|
|
22443
|
+
const { calls } = closeCall ? { calls: closeCall } : await this.#prepareCloseCreditAccount(
|
|
22441
22444
|
ca,
|
|
22442
22445
|
cm,
|
|
22443
22446
|
assetsToKeep,
|
|
@@ -22445,7 +22448,7 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
22445
22448
|
slippage
|
|
22446
22449
|
);
|
|
22447
22450
|
const tx = operation === "close" ? cm.creditFacade.closeCreditAccount(ca.creditAccount, calls) : cm.creditFacade.multicall(ca.creditAccount, calls);
|
|
22448
|
-
return { tx
|
|
22451
|
+
return { tx };
|
|
22449
22452
|
}
|
|
22450
22453
|
/**
|
|
22451
22454
|
* Internal wrapper for CreditAccountCompressor.getCreditAccounts + price updates wrapped into multicall
|
|
@@ -22552,7 +22555,7 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
22552
22555
|
(t) => this.#prepareWithdrawToken(ca, t, MAX_UINT256, to)
|
|
22553
22556
|
)
|
|
22554
22557
|
];
|
|
22555
|
-
return { calls
|
|
22558
|
+
return { calls };
|
|
22556
22559
|
}
|
|
22557
22560
|
#prepareDisableQuotas(ca) {
|
|
22558
22561
|
const calls = [];
|
|
@@ -23048,7 +23051,7 @@ var RouterV3Contract = class extends BaseContract {
|
|
|
23048
23051
|
* @dev Finds the path to swap / withdraw all assets from CreditAccount into underlying asset
|
|
23049
23052
|
* Can bu used for closing Credit Account and for liquidations as well.
|
|
23050
23053
|
* @param ca CreditAccountStruct object used for close path computation
|
|
23051
|
-
* @param cm CreditManagerSlice for
|
|
23054
|
+
* @param cm CreditManagerSlice for corresponding credit manager
|
|
23052
23055
|
* @param slippage Slippage in PERCENTAGE_FORMAT (100% = 10_000) per operation
|
|
23053
23056
|
* @return The best option in PathFinderCloseResult format, which
|
|
23054
23057
|
* - underlyingBalance - total balance of underlying token
|