@gearbox-protocol/sdk 3.0.0-vfour.86 → 3.0.0-vfour.87
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 +74 -53
- package/dist/cjs/sdk/index.d.ts +17 -8
- package/dist/esm/sdk/index.d.mts +17 -8
- package/dist/esm/sdk/index.mjs +74 -53
- package/package.json +1 -1
package/dist/cjs/sdk/index.cjs
CHANGED
|
@@ -22438,17 +22438,29 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
22438
22438
|
* @param assetsToWithdraw Tokens to withdraw from credit account
|
|
22439
22439
|
* @param to Address to withdraw underlying to
|
|
22440
22440
|
* @param slippage
|
|
22441
|
+
* @param closePath
|
|
22441
22442
|
* @returns
|
|
22442
22443
|
*/
|
|
22443
|
-
async closeCreditAccount(
|
|
22444
|
-
|
|
22445
|
-
|
|
22446
|
-
|
|
22447
|
-
|
|
22448
|
-
|
|
22449
|
-
|
|
22450
|
-
|
|
22451
|
-
const
|
|
22444
|
+
async closeCreditAccount({
|
|
22445
|
+
operation,
|
|
22446
|
+
assetsToWithdraw,
|
|
22447
|
+
ca,
|
|
22448
|
+
to,
|
|
22449
|
+
slippage = 50n,
|
|
22450
|
+
closePath
|
|
22451
|
+
}) {
|
|
22452
|
+
const cm = this.sdk.marketRegister.findCreditManager(ca.creditManager);
|
|
22453
|
+
const routerCloseResult = closePath || await this.sdk.router.findBestClosePath(ca, cm.creditManager, slippage);
|
|
22454
|
+
const calls = [
|
|
22455
|
+
...routerCloseResult.calls,
|
|
22456
|
+
...this.#prepareDisableQuotas(ca),
|
|
22457
|
+
...this.#prepareDecreaseDebt(ca),
|
|
22458
|
+
...this.#prepareDisableTokens(ca),
|
|
22459
|
+
...assetsToWithdraw.map(
|
|
22460
|
+
(t) => this.#prepareWithdrawToken(ca, t, MAX_UINT256, to)
|
|
22461
|
+
)
|
|
22462
|
+
];
|
|
22463
|
+
const tx = operation === "close" ? cm.creditFacade.closeCreditAccount(ca.creditAccount, calls) : cm.creditFacade.multicall(ca.creditAccount, calls);
|
|
22452
22464
|
return { tx, calls, routerCloseResult };
|
|
22453
22465
|
}
|
|
22454
22466
|
/**
|
|
@@ -22459,14 +22471,62 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
22459
22471
|
* @param collateralAssets Tokens to pay for
|
|
22460
22472
|
* @param to Address to withdraw underlying to
|
|
22461
22473
|
* @param slippage
|
|
22474
|
+
* @param permits
|
|
22475
|
+
* @returns
|
|
22476
|
+
*/
|
|
22477
|
+
async repayCreditAccount({
|
|
22478
|
+
operation,
|
|
22479
|
+
collateralAssets,
|
|
22480
|
+
assetsToWithdraw,
|
|
22481
|
+
ca,
|
|
22482
|
+
permits,
|
|
22483
|
+
to
|
|
22484
|
+
}) {
|
|
22485
|
+
const cm = this.sdk.marketRegister.findCreditManager(ca.creditManager);
|
|
22486
|
+
const addCollateral = collateralAssets.filter((a) => a.balance > 0);
|
|
22487
|
+
const calls = [
|
|
22488
|
+
...this.#prepareAddCollateralCalls(addCollateral, ca, permits),
|
|
22489
|
+
...this.#prepareDisableQuotas(ca),
|
|
22490
|
+
...this.#prepareDecreaseDebt(ca),
|
|
22491
|
+
...this.#prepareDisableTokens(ca),
|
|
22492
|
+
...assetsToWithdraw.map(
|
|
22493
|
+
(t) => this.#prepareWithdrawToken(ca, t, MAX_UINT256, to)
|
|
22494
|
+
)
|
|
22495
|
+
];
|
|
22496
|
+
const tx = operation === "close" ? cm.creditFacade.closeCreditAccount(ca.creditAccount, calls) : cm.creditFacade.multicall(ca.creditAccount, calls);
|
|
22497
|
+
return { tx, calls };
|
|
22498
|
+
}
|
|
22499
|
+
/**
|
|
22500
|
+
* Repays liquidatable credit account
|
|
22501
|
+
* @param ca
|
|
22502
|
+
* @param assetsToWithdraw Tokens to withdraw from credit account
|
|
22503
|
+
* @param collateralAssets Tokens to pay for
|
|
22504
|
+
* @param to Address to withdraw underlying to
|
|
22505
|
+
* @param slippage
|
|
22462
22506
|
* @returns
|
|
22463
22507
|
*/
|
|
22464
|
-
async
|
|
22465
|
-
|
|
22466
|
-
|
|
22508
|
+
async repayAndLiquidateCreditAccount({
|
|
22509
|
+
collateralAssets,
|
|
22510
|
+
assetsToWithdraw,
|
|
22511
|
+
ca,
|
|
22512
|
+
permits,
|
|
22513
|
+
to
|
|
22514
|
+
}) {
|
|
22515
|
+
const cm = this.sdk.marketRegister.findCreditManager(ca.creditManager);
|
|
22516
|
+
const priceUpdates = await this.getPriceUpdatesForFacade(ca);
|
|
22517
|
+
const addCollateral = collateralAssets.filter((a) => a.balance > 0);
|
|
22518
|
+
const calls = [
|
|
22519
|
+
...priceUpdates,
|
|
22520
|
+
...this.#prepareAddCollateralCalls(addCollateral, ca, permits),
|
|
22521
|
+
...assetsToWithdraw.map(
|
|
22522
|
+
(t) => this.#prepareWithdrawToken(ca, t, MAX_UINT256, to)
|
|
22523
|
+
)
|
|
22524
|
+
];
|
|
22525
|
+
const tx = cm.creditFacade.liquidateCreditAccount(
|
|
22526
|
+
ca.creditAccount,
|
|
22527
|
+
to,
|
|
22528
|
+
calls
|
|
22467
22529
|
);
|
|
22468
|
-
const { calls } = await this.#prepareRepayCreditAccount(props);
|
|
22469
|
-
const tx = props.operation === "close" ? cm.creditFacade.closeCreditAccount(props.ca.creditAccount, calls) : cm.creditFacade.multicall(props.ca.creditAccount, calls);
|
|
22470
22530
|
return { tx, calls };
|
|
22471
22531
|
}
|
|
22472
22532
|
/**
|
|
@@ -22557,45 +22617,6 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
22557
22617
|
const updates = await this.getOnDemandPriceUpdates(acc);
|
|
22558
22618
|
return cm.creditFacade.encodeOnDemandPriceUpdates(updates);
|
|
22559
22619
|
}
|
|
22560
|
-
async #prepareCloseCreditAccount({
|
|
22561
|
-
ca,
|
|
22562
|
-
cm,
|
|
22563
|
-
assetsToWithdraw,
|
|
22564
|
-
to,
|
|
22565
|
-
slippage = 50n,
|
|
22566
|
-
closePath
|
|
22567
|
-
}) {
|
|
22568
|
-
const routerCloseResult = closePath || await this.sdk.router.findBestClosePath(ca, cm.creditManager, slippage);
|
|
22569
|
-
const calls = [
|
|
22570
|
-
...routerCloseResult.calls,
|
|
22571
|
-
...this.#prepareDisableQuotas(ca),
|
|
22572
|
-
...this.#prepareDecreaseDebt(ca),
|
|
22573
|
-
...this.#prepareDisableTokens(ca),
|
|
22574
|
-
...assetsToWithdraw.map(
|
|
22575
|
-
(t) => this.#prepareWithdrawToken(ca, t, MAX_UINT256, to)
|
|
22576
|
-
)
|
|
22577
|
-
];
|
|
22578
|
-
return { calls, routerCloseResult };
|
|
22579
|
-
}
|
|
22580
|
-
async #prepareRepayCreditAccount({
|
|
22581
|
-
ca,
|
|
22582
|
-
assetsToWithdraw,
|
|
22583
|
-
to,
|
|
22584
|
-
collateralAssets,
|
|
22585
|
-
permits
|
|
22586
|
-
}) {
|
|
22587
|
-
const addCollateral = collateralAssets.filter((a) => a.balance > 0);
|
|
22588
|
-
const calls = [
|
|
22589
|
-
...this.#prepareAddCollateralCalls(addCollateral, ca, permits),
|
|
22590
|
-
...this.#prepareDisableQuotas(ca),
|
|
22591
|
-
...this.#prepareDecreaseDebt(ca),
|
|
22592
|
-
...this.#prepareDisableTokens(ca),
|
|
22593
|
-
...assetsToWithdraw.map(
|
|
22594
|
-
(t) => this.#prepareWithdrawToken(ca, t, MAX_UINT256, to)
|
|
22595
|
-
)
|
|
22596
|
-
];
|
|
22597
|
-
return { calls };
|
|
22598
|
-
}
|
|
22599
22620
|
#prepareDisableQuotas(ca) {
|
|
22600
22621
|
const calls = [];
|
|
22601
22622
|
for (const { token, quota } of ca.tokens) {
|
package/dist/cjs/sdk/index.d.ts
CHANGED
|
@@ -25192,21 +25192,18 @@ interface RepayCreditAccountResult {
|
|
|
25192
25192
|
calls: Array<MultiCall>;
|
|
25193
25193
|
}
|
|
25194
25194
|
type CloseOptions = "close" | "zeroDebt";
|
|
25195
|
-
interface CloseCreditAccountProps
|
|
25195
|
+
interface CloseCreditAccountProps {
|
|
25196
25196
|
operation: CloseOptions;
|
|
25197
|
-
}
|
|
25198
|
-
interface PrepareCloseCreditAccountProps {
|
|
25199
|
-
cm: CreditFactory;
|
|
25200
25197
|
ca: CreditAccountDataSlice;
|
|
25201
25198
|
assetsToWithdraw: Address[];
|
|
25202
25199
|
to: Address;
|
|
25203
25200
|
slippage?: bigint;
|
|
25204
25201
|
closePath?: RouterCloseResult;
|
|
25205
25202
|
}
|
|
25206
|
-
interface RepayCreditAccountProps extends
|
|
25203
|
+
interface RepayCreditAccountProps extends RepayAndLiquidateCreditAccountProps {
|
|
25207
25204
|
operation: CloseOptions;
|
|
25208
25205
|
}
|
|
25209
|
-
interface
|
|
25206
|
+
interface RepayAndLiquidateCreditAccountProps {
|
|
25210
25207
|
collateralAssets: Asset[];
|
|
25211
25208
|
assetsToWithdraw: Address[];
|
|
25212
25209
|
ca: CreditAccountDataSlice;
|
|
@@ -25262,9 +25259,10 @@ declare class CreditAccountsService extends SDKConstruct {
|
|
|
25262
25259
|
* @param assetsToWithdraw Tokens to withdraw from credit account
|
|
25263
25260
|
* @param to Address to withdraw underlying to
|
|
25264
25261
|
* @param slippage
|
|
25262
|
+
* @param closePath
|
|
25265
25263
|
* @returns
|
|
25266
25264
|
*/
|
|
25267
|
-
closeCreditAccount(
|
|
25265
|
+
closeCreditAccount({ operation, assetsToWithdraw, ca, to, slippage, closePath, }: CloseCreditAccountProps): Promise<CloseCreditAccountResult>;
|
|
25268
25266
|
/**
|
|
25269
25267
|
* Repays credit account or sets debt to zero (but keep account)
|
|
25270
25268
|
* @param operation
|
|
@@ -25273,9 +25271,20 @@ declare class CreditAccountsService extends SDKConstruct {
|
|
|
25273
25271
|
* @param collateralAssets Tokens to pay for
|
|
25274
25272
|
* @param to Address to withdraw underlying to
|
|
25275
25273
|
* @param slippage
|
|
25274
|
+
* @param permits
|
|
25275
|
+
* @returns
|
|
25276
|
+
*/
|
|
25277
|
+
repayCreditAccount({ operation, collateralAssets, assetsToWithdraw, ca, permits, to, }: RepayCreditAccountProps): Promise<RepayCreditAccountResult>;
|
|
25278
|
+
/**
|
|
25279
|
+
* Repays liquidatable credit account
|
|
25280
|
+
* @param ca
|
|
25281
|
+
* @param assetsToWithdraw Tokens to withdraw from credit account
|
|
25282
|
+
* @param collateralAssets Tokens to pay for
|
|
25283
|
+
* @param to Address to withdraw underlying to
|
|
25284
|
+
* @param slippage
|
|
25276
25285
|
* @returns
|
|
25277
25286
|
*/
|
|
25278
|
-
|
|
25287
|
+
repayAndLiquidateCreditAccount({ collateralAssets, assetsToWithdraw, ca, permits, to, }: RepayAndLiquidateCreditAccountProps): Promise<RepayCreditAccountResult>;
|
|
25279
25288
|
/**
|
|
25280
25289
|
* Returns raw txs that are needed to update all price feeds so that all credit accounts (possibly from different markets) compute
|
|
25281
25290
|
* @param accounts
|
package/dist/esm/sdk/index.d.mts
CHANGED
|
@@ -25192,21 +25192,18 @@ interface RepayCreditAccountResult {
|
|
|
25192
25192
|
calls: Array<MultiCall>;
|
|
25193
25193
|
}
|
|
25194
25194
|
type CloseOptions = "close" | "zeroDebt";
|
|
25195
|
-
interface CloseCreditAccountProps
|
|
25195
|
+
interface CloseCreditAccountProps {
|
|
25196
25196
|
operation: CloseOptions;
|
|
25197
|
-
}
|
|
25198
|
-
interface PrepareCloseCreditAccountProps {
|
|
25199
|
-
cm: CreditFactory;
|
|
25200
25197
|
ca: CreditAccountDataSlice;
|
|
25201
25198
|
assetsToWithdraw: Address[];
|
|
25202
25199
|
to: Address;
|
|
25203
25200
|
slippage?: bigint;
|
|
25204
25201
|
closePath?: RouterCloseResult;
|
|
25205
25202
|
}
|
|
25206
|
-
interface RepayCreditAccountProps extends
|
|
25203
|
+
interface RepayCreditAccountProps extends RepayAndLiquidateCreditAccountProps {
|
|
25207
25204
|
operation: CloseOptions;
|
|
25208
25205
|
}
|
|
25209
|
-
interface
|
|
25206
|
+
interface RepayAndLiquidateCreditAccountProps {
|
|
25210
25207
|
collateralAssets: Asset[];
|
|
25211
25208
|
assetsToWithdraw: Address[];
|
|
25212
25209
|
ca: CreditAccountDataSlice;
|
|
@@ -25262,9 +25259,10 @@ declare class CreditAccountsService extends SDKConstruct {
|
|
|
25262
25259
|
* @param assetsToWithdraw Tokens to withdraw from credit account
|
|
25263
25260
|
* @param to Address to withdraw underlying to
|
|
25264
25261
|
* @param slippage
|
|
25262
|
+
* @param closePath
|
|
25265
25263
|
* @returns
|
|
25266
25264
|
*/
|
|
25267
|
-
closeCreditAccount(
|
|
25265
|
+
closeCreditAccount({ operation, assetsToWithdraw, ca, to, slippage, closePath, }: CloseCreditAccountProps): Promise<CloseCreditAccountResult>;
|
|
25268
25266
|
/**
|
|
25269
25267
|
* Repays credit account or sets debt to zero (but keep account)
|
|
25270
25268
|
* @param operation
|
|
@@ -25273,9 +25271,20 @@ declare class CreditAccountsService extends SDKConstruct {
|
|
|
25273
25271
|
* @param collateralAssets Tokens to pay for
|
|
25274
25272
|
* @param to Address to withdraw underlying to
|
|
25275
25273
|
* @param slippage
|
|
25274
|
+
* @param permits
|
|
25275
|
+
* @returns
|
|
25276
|
+
*/
|
|
25277
|
+
repayCreditAccount({ operation, collateralAssets, assetsToWithdraw, ca, permits, to, }: RepayCreditAccountProps): Promise<RepayCreditAccountResult>;
|
|
25278
|
+
/**
|
|
25279
|
+
* Repays liquidatable credit account
|
|
25280
|
+
* @param ca
|
|
25281
|
+
* @param assetsToWithdraw Tokens to withdraw from credit account
|
|
25282
|
+
* @param collateralAssets Tokens to pay for
|
|
25283
|
+
* @param to Address to withdraw underlying to
|
|
25284
|
+
* @param slippage
|
|
25276
25285
|
* @returns
|
|
25277
25286
|
*/
|
|
25278
|
-
|
|
25287
|
+
repayAndLiquidateCreditAccount({ collateralAssets, assetsToWithdraw, ca, permits, to, }: RepayAndLiquidateCreditAccountProps): Promise<RepayCreditAccountResult>;
|
|
25279
25288
|
/**
|
|
25280
25289
|
* Returns raw txs that are needed to update all price feeds so that all credit accounts (possibly from different markets) compute
|
|
25281
25290
|
* @param accounts
|
package/dist/esm/sdk/index.mjs
CHANGED
|
@@ -22436,17 +22436,29 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
22436
22436
|
* @param assetsToWithdraw Tokens to withdraw from credit account
|
|
22437
22437
|
* @param to Address to withdraw underlying to
|
|
22438
22438
|
* @param slippage
|
|
22439
|
+
* @param closePath
|
|
22439
22440
|
* @returns
|
|
22440
22441
|
*/
|
|
22441
|
-
async closeCreditAccount(
|
|
22442
|
-
|
|
22443
|
-
|
|
22444
|
-
|
|
22445
|
-
|
|
22446
|
-
|
|
22447
|
-
|
|
22448
|
-
|
|
22449
|
-
const
|
|
22442
|
+
async closeCreditAccount({
|
|
22443
|
+
operation,
|
|
22444
|
+
assetsToWithdraw,
|
|
22445
|
+
ca,
|
|
22446
|
+
to,
|
|
22447
|
+
slippage = 50n,
|
|
22448
|
+
closePath
|
|
22449
|
+
}) {
|
|
22450
|
+
const cm = this.sdk.marketRegister.findCreditManager(ca.creditManager);
|
|
22451
|
+
const routerCloseResult = closePath || await this.sdk.router.findBestClosePath(ca, cm.creditManager, slippage);
|
|
22452
|
+
const calls = [
|
|
22453
|
+
...routerCloseResult.calls,
|
|
22454
|
+
...this.#prepareDisableQuotas(ca),
|
|
22455
|
+
...this.#prepareDecreaseDebt(ca),
|
|
22456
|
+
...this.#prepareDisableTokens(ca),
|
|
22457
|
+
...assetsToWithdraw.map(
|
|
22458
|
+
(t) => this.#prepareWithdrawToken(ca, t, MAX_UINT256, to)
|
|
22459
|
+
)
|
|
22460
|
+
];
|
|
22461
|
+
const tx = operation === "close" ? cm.creditFacade.closeCreditAccount(ca.creditAccount, calls) : cm.creditFacade.multicall(ca.creditAccount, calls);
|
|
22450
22462
|
return { tx, calls, routerCloseResult };
|
|
22451
22463
|
}
|
|
22452
22464
|
/**
|
|
@@ -22457,14 +22469,62 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
22457
22469
|
* @param collateralAssets Tokens to pay for
|
|
22458
22470
|
* @param to Address to withdraw underlying to
|
|
22459
22471
|
* @param slippage
|
|
22472
|
+
* @param permits
|
|
22473
|
+
* @returns
|
|
22474
|
+
*/
|
|
22475
|
+
async repayCreditAccount({
|
|
22476
|
+
operation,
|
|
22477
|
+
collateralAssets,
|
|
22478
|
+
assetsToWithdraw,
|
|
22479
|
+
ca,
|
|
22480
|
+
permits,
|
|
22481
|
+
to
|
|
22482
|
+
}) {
|
|
22483
|
+
const cm = this.sdk.marketRegister.findCreditManager(ca.creditManager);
|
|
22484
|
+
const addCollateral = collateralAssets.filter((a) => a.balance > 0);
|
|
22485
|
+
const calls = [
|
|
22486
|
+
...this.#prepareAddCollateralCalls(addCollateral, ca, permits),
|
|
22487
|
+
...this.#prepareDisableQuotas(ca),
|
|
22488
|
+
...this.#prepareDecreaseDebt(ca),
|
|
22489
|
+
...this.#prepareDisableTokens(ca),
|
|
22490
|
+
...assetsToWithdraw.map(
|
|
22491
|
+
(t) => this.#prepareWithdrawToken(ca, t, MAX_UINT256, to)
|
|
22492
|
+
)
|
|
22493
|
+
];
|
|
22494
|
+
const tx = operation === "close" ? cm.creditFacade.closeCreditAccount(ca.creditAccount, calls) : cm.creditFacade.multicall(ca.creditAccount, calls);
|
|
22495
|
+
return { tx, calls };
|
|
22496
|
+
}
|
|
22497
|
+
/**
|
|
22498
|
+
* Repays liquidatable credit account
|
|
22499
|
+
* @param ca
|
|
22500
|
+
* @param assetsToWithdraw Tokens to withdraw from credit account
|
|
22501
|
+
* @param collateralAssets Tokens to pay for
|
|
22502
|
+
* @param to Address to withdraw underlying to
|
|
22503
|
+
* @param slippage
|
|
22460
22504
|
* @returns
|
|
22461
22505
|
*/
|
|
22462
|
-
async
|
|
22463
|
-
|
|
22464
|
-
|
|
22506
|
+
async repayAndLiquidateCreditAccount({
|
|
22507
|
+
collateralAssets,
|
|
22508
|
+
assetsToWithdraw,
|
|
22509
|
+
ca,
|
|
22510
|
+
permits,
|
|
22511
|
+
to
|
|
22512
|
+
}) {
|
|
22513
|
+
const cm = this.sdk.marketRegister.findCreditManager(ca.creditManager);
|
|
22514
|
+
const priceUpdates = await this.getPriceUpdatesForFacade(ca);
|
|
22515
|
+
const addCollateral = collateralAssets.filter((a) => a.balance > 0);
|
|
22516
|
+
const calls = [
|
|
22517
|
+
...priceUpdates,
|
|
22518
|
+
...this.#prepareAddCollateralCalls(addCollateral, ca, permits),
|
|
22519
|
+
...assetsToWithdraw.map(
|
|
22520
|
+
(t) => this.#prepareWithdrawToken(ca, t, MAX_UINT256, to)
|
|
22521
|
+
)
|
|
22522
|
+
];
|
|
22523
|
+
const tx = cm.creditFacade.liquidateCreditAccount(
|
|
22524
|
+
ca.creditAccount,
|
|
22525
|
+
to,
|
|
22526
|
+
calls
|
|
22465
22527
|
);
|
|
22466
|
-
const { calls } = await this.#prepareRepayCreditAccount(props);
|
|
22467
|
-
const tx = props.operation === "close" ? cm.creditFacade.closeCreditAccount(props.ca.creditAccount, calls) : cm.creditFacade.multicall(props.ca.creditAccount, calls);
|
|
22468
22528
|
return { tx, calls };
|
|
22469
22529
|
}
|
|
22470
22530
|
/**
|
|
@@ -22555,45 +22615,6 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
22555
22615
|
const updates = await this.getOnDemandPriceUpdates(acc);
|
|
22556
22616
|
return cm.creditFacade.encodeOnDemandPriceUpdates(updates);
|
|
22557
22617
|
}
|
|
22558
|
-
async #prepareCloseCreditAccount({
|
|
22559
|
-
ca,
|
|
22560
|
-
cm,
|
|
22561
|
-
assetsToWithdraw,
|
|
22562
|
-
to,
|
|
22563
|
-
slippage = 50n,
|
|
22564
|
-
closePath
|
|
22565
|
-
}) {
|
|
22566
|
-
const routerCloseResult = closePath || await this.sdk.router.findBestClosePath(ca, cm.creditManager, slippage);
|
|
22567
|
-
const calls = [
|
|
22568
|
-
...routerCloseResult.calls,
|
|
22569
|
-
...this.#prepareDisableQuotas(ca),
|
|
22570
|
-
...this.#prepareDecreaseDebt(ca),
|
|
22571
|
-
...this.#prepareDisableTokens(ca),
|
|
22572
|
-
...assetsToWithdraw.map(
|
|
22573
|
-
(t) => this.#prepareWithdrawToken(ca, t, MAX_UINT256, to)
|
|
22574
|
-
)
|
|
22575
|
-
];
|
|
22576
|
-
return { calls, routerCloseResult };
|
|
22577
|
-
}
|
|
22578
|
-
async #prepareRepayCreditAccount({
|
|
22579
|
-
ca,
|
|
22580
|
-
assetsToWithdraw,
|
|
22581
|
-
to,
|
|
22582
|
-
collateralAssets,
|
|
22583
|
-
permits
|
|
22584
|
-
}) {
|
|
22585
|
-
const addCollateral = collateralAssets.filter((a) => a.balance > 0);
|
|
22586
|
-
const calls = [
|
|
22587
|
-
...this.#prepareAddCollateralCalls(addCollateral, ca, permits),
|
|
22588
|
-
...this.#prepareDisableQuotas(ca),
|
|
22589
|
-
...this.#prepareDecreaseDebt(ca),
|
|
22590
|
-
...this.#prepareDisableTokens(ca),
|
|
22591
|
-
...assetsToWithdraw.map(
|
|
22592
|
-
(t) => this.#prepareWithdrawToken(ca, t, MAX_UINT256, to)
|
|
22593
|
-
)
|
|
22594
|
-
];
|
|
22595
|
-
return { calls };
|
|
22596
|
-
}
|
|
22597
22618
|
#prepareDisableQuotas(ca) {
|
|
22598
22619
|
const calls = [];
|
|
22599
22620
|
for (const { token, quota } of ca.tokens) {
|