@gearbox-protocol/sdk 14.12.0-next.69 → 14.12.0-next.70
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/common-utils/charts/credit-session.js +0 -1
- package/dist/cjs/common-utils/index.js +1 -1
- package/dist/cjs/common-utils/utils/creditAccount/index.js +1 -1
- package/dist/cjs/common-utils/utils/creditAccount/quota-utils.js +0 -1
- package/dist/cjs/common-utils/utils/index.js +1 -1
- package/dist/cjs/common-utils/utils/strategies/strategy-info/get-cm-you-can-earn.js +1 -1
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +81 -66
- package/dist/cjs/sdk/accounts/index.js +2 -0
- package/dist/cjs/sdk/accounts/intents/index.js +388 -0
- package/dist/cjs/sdk/accounts/intents/intents/index.js +14 -0
- package/dist/cjs/sdk/accounts/intents/intents/resume/add-collateral/add-collateral.fixtures.js +121 -0
- package/dist/cjs/sdk/accounts/intents/intents/resume/add-collateral/add-collateral.js +15 -0
- package/dist/cjs/sdk/accounts/intents/intents/resume/close/close.fixtures.js +108 -0
- package/dist/cjs/sdk/accounts/intents/intents/resume/close/close.js +51 -0
- package/dist/cjs/sdk/accounts/intents/intents/resume/decrease-leverage/decrease-leverage.fixtures.js +130 -0
- package/dist/cjs/sdk/accounts/intents/intents/resume/decrease-leverage/decrease-leverage.js +83 -0
- package/dist/cjs/sdk/accounts/intents/intents/resume/deposit/deposit.fixtures.js +117 -0
- package/dist/cjs/sdk/accounts/intents/intents/resume/deposit/deposit.js +15 -0
- package/dist/cjs/sdk/accounts/intents/intents/resume/increase-leverage/increase-leverage.fixtures.js +95 -0
- package/dist/cjs/sdk/accounts/intents/intents/resume/increase-leverage/increase-leverage.js +15 -0
- package/dist/cjs/sdk/accounts/intents/intents/resume/index.js +13 -0
- package/dist/cjs/sdk/accounts/intents/intents/resume/withdraw/withdraw.fixtures.js +138 -0
- package/dist/cjs/sdk/accounts/intents/intents/resume/withdraw/withdraw.js +161 -0
- package/dist/cjs/sdk/accounts/intents/operations/add-collateral/index.js +17 -0
- package/dist/cjs/sdk/accounts/intents/operations/claim-delayed/index.js +54 -0
- package/dist/cjs/sdk/accounts/intents/operations/close-credit-account/index.js +26 -0
- package/dist/cjs/sdk/accounts/intents/operations/decrease-debt/index.js +12 -0
- package/dist/cjs/sdk/accounts/intents/operations/increase-debt/index.js +12 -0
- package/dist/cjs/sdk/accounts/intents/operations/index.js +27 -0
- package/dist/cjs/sdk/accounts/intents/operations/quota-update/index.js +22 -0
- package/dist/cjs/sdk/accounts/intents/operations/repay-credit-account/index.js +22 -0
- package/dist/cjs/sdk/accounts/intents/operations/start-delayed-withdrawal/index.js +18 -0
- package/dist/cjs/sdk/accounts/intents/operations/swap/index.js +18 -0
- package/dist/cjs/sdk/accounts/intents/operations/types.js +1 -0
- package/dist/cjs/sdk/accounts/intents/operations/unwrap-rwa-collateral/index.js +27 -0
- package/dist/cjs/sdk/accounts/intents/operations/withdraw-collateral/index.js +43 -0
- package/dist/cjs/sdk/accounts/intents/operations/wrap-rwa-collateral/index.js +27 -0
- package/dist/cjs/sdk/accounts/intents/quoters/close.js +58 -0
- package/dist/cjs/sdk/accounts/intents/quoters/index.js +7 -0
- package/dist/cjs/sdk/accounts/intents/quoters/swap.js +79 -0
- package/dist/cjs/sdk/accounts/intents/testing/expect.js +167 -0
- package/dist/cjs/sdk/accounts/intents/testing/resume.js +172 -0
- package/dist/cjs/sdk/accounts/intents/testing/sdk-mock.js +179 -0
- package/dist/cjs/sdk/accounts/intents/types.js +1 -0
- package/dist/cjs/sdk/accounts/intents/utils/assemble-operation-calls.js +7 -0
- package/dist/cjs/sdk/accounts/intents/utils/borrowed-amount-plus-interest-and-fees.js +13 -0
- package/dist/cjs/sdk/accounts/intents/utils/common.js +43 -0
- package/dist/cjs/sdk/accounts/intents/utils/convert-amount.js +37 -0
- package/dist/cjs/sdk/accounts/intents/utils/index.js +19 -0
- package/dist/cjs/sdk/accounts/intents/utils/quotas-for-update.js +122 -0
- package/dist/cjs/sdk/accounts/intents/utils/simulate-adjust-state.js +39 -0
- package/dist/cjs/sdk/accounts/intents/utils/simulate-assets.js +69 -0
- package/dist/cjs/sdk/accounts/intents/utils/with-quota-update.js +13 -0
- package/dist/cjs/sdk/index.js +2 -0
- package/dist/esm/common-utils/charts/credit-session.js +0 -1
- package/dist/esm/common-utils/index.js +1 -1
- package/dist/esm/common-utils/utils/creditAccount/index.js +1 -1
- package/dist/esm/common-utils/utils/creditAccount/quota-utils.js +0 -1
- package/dist/esm/common-utils/utils/index.js +1 -1
- package/dist/esm/common-utils/utils/strategies/strategy-info/get-cm-you-can-earn.js +1 -1
- package/dist/esm/dev/AccountOpener.js +1 -1
- package/dist/esm/dev/withdrawalUtils.js +1 -1
- package/dist/esm/preview/simulate/simulatePoolOperation.js +1 -1
- package/dist/esm/preview/trace/extractTransfers.js +1 -1
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +83 -68
- package/dist/esm/sdk/accounts/index.js +2 -1
- package/dist/esm/sdk/accounts/intents/index.js +387 -0
- package/dist/esm/sdk/accounts/intents/intents/index.js +8 -0
- package/dist/esm/sdk/accounts/intents/intents/resume/add-collateral/add-collateral.fixtures.js +107 -0
- package/dist/esm/sdk/accounts/intents/intents/resume/add-collateral/add-collateral.js +14 -0
- package/dist/esm/sdk/accounts/intents/intents/resume/close/close.fixtures.js +94 -0
- package/dist/esm/sdk/accounts/intents/intents/resume/close/close.js +50 -0
- package/dist/esm/sdk/accounts/intents/intents/resume/decrease-leverage/decrease-leverage.fixtures.js +114 -0
- package/dist/esm/sdk/accounts/intents/intents/resume/decrease-leverage/decrease-leverage.js +82 -0
- package/dist/esm/sdk/accounts/intents/intents/resume/deposit/deposit.fixtures.js +110 -0
- package/dist/esm/sdk/accounts/intents/intents/resume/deposit/deposit.js +14 -0
- package/dist/esm/sdk/accounts/intents/intents/resume/increase-leverage/increase-leverage.fixtures.js +88 -0
- package/dist/esm/sdk/accounts/intents/intents/resume/increase-leverage/increase-leverage.js +14 -0
- package/dist/esm/sdk/accounts/intents/intents/resume/index.js +7 -0
- package/dist/esm/sdk/accounts/intents/intents/resume/withdraw/withdraw.fixtures.js +121 -0
- package/dist/esm/sdk/accounts/intents/intents/resume/withdraw/withdraw.js +160 -0
- package/dist/esm/sdk/accounts/intents/operations/add-collateral/index.js +16 -0
- package/dist/esm/sdk/accounts/intents/operations/claim-delayed/index.js +52 -0
- package/dist/esm/sdk/accounts/intents/operations/close-credit-account/index.js +25 -0
- package/dist/esm/sdk/accounts/intents/operations/decrease-debt/index.js +11 -0
- package/dist/esm/sdk/accounts/intents/operations/increase-debt/index.js +11 -0
- package/dist/esm/sdk/accounts/intents/operations/index.js +14 -0
- package/dist/esm/sdk/accounts/intents/operations/quota-update/index.js +21 -0
- package/dist/esm/sdk/accounts/intents/operations/repay-credit-account/index.js +21 -0
- package/dist/esm/sdk/accounts/intents/operations/start-delayed-withdrawal/index.js +17 -0
- package/dist/esm/sdk/accounts/intents/operations/swap/index.js +17 -0
- package/dist/esm/sdk/accounts/intents/operations/types.js +1 -0
- package/dist/esm/sdk/accounts/intents/operations/unwrap-rwa-collateral/index.js +26 -0
- package/dist/esm/sdk/accounts/intents/operations/withdraw-collateral/index.js +42 -0
- package/dist/esm/sdk/accounts/intents/operations/wrap-rwa-collateral/index.js +26 -0
- package/dist/esm/sdk/accounts/intents/quoters/close.js +56 -0
- package/dist/esm/sdk/accounts/intents/quoters/index.js +3 -0
- package/dist/esm/sdk/accounts/intents/quoters/swap.js +77 -0
- package/dist/esm/sdk/accounts/intents/testing/expect.js +162 -0
- package/dist/esm/sdk/accounts/intents/testing/resume.js +157 -0
- package/dist/esm/sdk/accounts/intents/testing/sdk-mock.js +172 -0
- package/dist/esm/sdk/accounts/intents/types.js +1 -0
- package/dist/esm/sdk/accounts/intents/utils/assemble-operation-calls.js +6 -0
- package/dist/esm/sdk/accounts/intents/utils/borrowed-amount-plus-interest-and-fees.js +12 -0
- package/dist/esm/sdk/accounts/intents/utils/common.js +40 -0
- package/dist/esm/sdk/accounts/intents/utils/convert-amount.js +36 -0
- package/dist/esm/sdk/accounts/intents/utils/index.js +9 -0
- package/dist/esm/sdk/accounts/intents/utils/quotas-for-update.js +121 -0
- package/dist/esm/sdk/accounts/intents/utils/simulate-adjust-state.js +38 -0
- package/dist/esm/sdk/accounts/intents/utils/simulate-assets.js +68 -0
- package/dist/esm/sdk/accounts/intents/utils/with-quota-update.js +12 -0
- package/dist/esm/sdk/accounts/liquidations/LiquidationsService.js +1 -1
- package/dist/esm/sdk/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +1 -1
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +1 -1
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +1 -1
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +1 -1
- package/dist/esm/sdk/base/TokensMeta.js +2 -2
- package/dist/esm/sdk/chain/detectNetwork.js +1 -1
- package/dist/esm/sdk/core/createAddressProvider.js +1 -1
- package/dist/esm/sdk/index.js +2 -1
- package/dist/esm/sdk/market/credit/CreditFacadeV310BaseContract.js +1 -1
- package/dist/esm/sdk/market/pool/PoolV310Contract.js +1 -1
- package/dist/esm/sdk/market/zapper/IETHZapperContract.js +1 -1
- package/dist/esm/sdk/market/zapper/ZapperContract.js +1 -1
- package/dist/esm/sdk/pools/PoolService.js +1 -1
- package/dist/esm/sdk/utils/viem/simulateWithPriceUpdates.js +1 -1
- package/dist/types/common-utils/index.d.ts +19 -19
- package/dist/types/common-utils/static/index.d.ts +1 -1
- package/dist/types/common-utils/utils/apy/index.d.ts +1 -1
- package/dist/types/common-utils/utils/creditAccount/calc-health-factor.d.ts +1 -1
- package/dist/types/common-utils/utils/creditAccount/calc-overall-apy.d.ts +1 -1
- package/dist/types/common-utils/utils/creditAccount/calc-quota-borrow-rate.d.ts +1 -1
- package/dist/types/common-utils/utils/creditAccount/debt.d.ts +1 -1
- package/dist/types/common-utils/utils/creditAccount/index.d.ts +1 -1
- package/dist/types/common-utils/utils/creditAccount/liquidation-price.d.ts +1 -1
- package/dist/types/common-utils/utils/creditAccount/quota-utils.d.ts +0 -1
- package/dist/types/common-utils/utils/creditAccount/sort.d.ts +1 -1
- package/dist/types/common-utils/utils/index.d.ts +3 -3
- package/dist/types/common-utils/utils/strategies/credit-managers/get-wallet-balances-allowed-on-cm.d.ts +1 -1
- package/dist/types/common-utils/utils/strategies/strategy-info/calculate-total-apy.d.ts +1 -1
- package/dist/types/common-utils/utils/strategies/strategy-info/calculate-total-points.d.ts +1 -1
- package/dist/types/common-utils/utils/strategies/strategy-info/types.d.ts +1 -1
- package/dist/types/common-utils/utils/strategies/tokens/add-amount-in-target.d.ts +1 -1
- package/dist/types/common-utils/utils/strategies/tokens/get-list-with-amount-in-target.d.ts +1 -1
- package/dist/types/common-utils/utils/strategies/types/credit-manager-data-legacy.d.ts +1 -1
- package/dist/types/common-utils/utils/strategies/types/strategies-cm-list.d.ts +1 -1
- package/dist/types/common-utils/utils/strategies/types/strategy-earnings.d.ts +1 -1
- package/dist/types/common-utils/utils/strategies/types/strategy.d.ts +1 -1
- package/dist/types/common-utils/utils/validation/validate-open-account.d.ts +1 -1
- package/dist/types/common-utils/utils/validation/validate-quota.d.ts +1 -1
- package/dist/types/plugins/apy/ApyPlugin.d.ts +1 -1
- package/dist/types/plugins/apy/pool-apy-utils.d.ts +1 -1
- package/dist/types/plugins/apy/strategy-data-source.d.ts +1 -1
- package/dist/types/plugins/apy/types.d.ts +1 -1
- package/dist/types/plugins/remote-configs/CustomConfigSource.d.ts +1 -1
- package/dist/types/plugins/remote-configs/RemoteConfigSource.d.ts +1 -1
- package/dist/types/plugins/remote-configs/RemoteConfigsPlugin.d.ts +1 -1
- package/dist/types/plugins/remote-configs/index.d.ts +1 -1
- package/dist/types/plugins/remote-configs/types.d.ts +1 -1
- package/dist/types/rewards/rewards/extra-apy.d.ts +1 -1
- package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +30 -10
- package/dist/types/sdk/accounts/index.d.ts +2 -1
- package/dist/types/sdk/accounts/intents/index.d.ts +22 -0
- package/dist/types/sdk/accounts/intents/intents/index.d.ts +8 -0
- package/dist/types/sdk/accounts/intents/intents/resume/add-collateral/add-collateral.d.ts +13 -0
- package/dist/types/sdk/accounts/intents/intents/resume/add-collateral/add-collateral.fixtures.d.ts +38 -0
- package/dist/types/sdk/accounts/intents/intents/resume/close/close.d.ts +26 -0
- package/dist/types/sdk/accounts/intents/intents/resume/close/close.fixtures.d.ts +63 -0
- package/dist/types/sdk/accounts/intents/intents/resume/decrease-leverage/decrease-leverage.d.ts +26 -0
- package/dist/types/sdk/accounts/intents/intents/resume/decrease-leverage/decrease-leverage.fixtures.d.ts +86 -0
- package/dist/types/sdk/accounts/intents/intents/resume/deposit/deposit.d.ts +13 -0
- package/dist/types/sdk/accounts/intents/intents/resume/deposit/deposit.fixtures.d.ts +48 -0
- package/dist/types/sdk/accounts/intents/intents/resume/increase-leverage/increase-leverage.d.ts +13 -0
- package/dist/types/sdk/accounts/intents/intents/resume/increase-leverage/increase-leverage.fixtures.d.ts +46 -0
- package/dist/types/sdk/accounts/intents/intents/resume/index.d.ts +7 -0
- package/dist/types/sdk/accounts/intents/intents/resume/withdraw/withdraw.d.ts +33 -0
- package/dist/types/sdk/accounts/intents/intents/resume/withdraw/withdraw.fixtures.d.ts +68 -0
- package/dist/types/sdk/accounts/intents/operations/add-collateral/index.d.ts +23 -0
- package/dist/types/sdk/accounts/intents/operations/claim-delayed/index.d.ts +55 -0
- package/dist/types/sdk/accounts/intents/operations/close-credit-account/index.d.ts +22 -0
- package/dist/types/sdk/accounts/intents/operations/decrease-debt/index.d.ts +18 -0
- package/dist/types/sdk/accounts/intents/operations/increase-debt/index.d.ts +18 -0
- package/dist/types/sdk/accounts/intents/operations/index.d.ts +14 -0
- package/dist/types/sdk/accounts/intents/operations/quota-update/index.d.ts +24 -0
- package/dist/types/sdk/accounts/intents/operations/repay-credit-account/index.d.ts +32 -0
- package/dist/types/sdk/accounts/intents/operations/start-delayed-withdrawal/index.d.ts +23 -0
- package/dist/types/sdk/accounts/intents/operations/swap/index.d.ts +28 -0
- package/dist/types/sdk/accounts/intents/operations/types.d.ts +21 -0
- package/dist/types/sdk/accounts/intents/operations/unwrap-rwa-collateral/index.d.ts +30 -0
- package/dist/types/sdk/accounts/intents/operations/withdraw-collateral/index.d.ts +36 -0
- package/dist/types/sdk/accounts/intents/operations/wrap-rwa-collateral/index.d.ts +30 -0
- package/dist/types/sdk/accounts/intents/quoters/close.d.ts +43 -0
- package/dist/types/sdk/accounts/intents/quoters/index.d.ts +3 -0
- package/dist/types/sdk/accounts/intents/quoters/swap.d.ts +43 -0
- package/dist/types/sdk/accounts/intents/testing/expect.d.ts +52 -0
- package/dist/types/sdk/accounts/intents/testing/resume.d.ts +84 -0
- package/dist/types/sdk/accounts/intents/testing/sdk-mock.d.ts +90 -0
- package/dist/types/sdk/accounts/intents/types.d.ts +75 -0
- package/dist/types/sdk/accounts/intents/utils/assemble-operation-calls.d.ts +10 -0
- package/dist/types/sdk/accounts/intents/utils/borrowed-amount-plus-interest-and-fees.d.ts +17 -0
- package/dist/types/sdk/accounts/intents/utils/common.d.ts +19 -0
- package/dist/types/sdk/accounts/intents/utils/convert-amount.d.ts +13 -0
- package/dist/types/sdk/accounts/intents/utils/index.d.ts +9 -0
- package/dist/types/sdk/accounts/intents/utils/quotas-for-update.d.ts +35 -0
- package/dist/types/sdk/accounts/intents/utils/simulate-adjust-state.d.ts +19 -0
- package/dist/types/sdk/accounts/intents/utils/simulate-assets.d.ts +21 -0
- package/dist/types/sdk/accounts/intents/utils/with-quota-update.d.ts +16 -0
- package/dist/types/sdk/accounts/types.d.ts +20 -0
- package/dist/types/sdk/index.d.ts +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent } from "../../../../withdrawal-compressor/types.js";
|
|
2
|
+
import { OnchainSDK } from "../../../../../OnchainSDK.js";
|
|
3
|
+
import { CreditAccountSlice } from "../../../types.js";
|
|
4
|
+
import { ClaimDelayedOption } from "../../../operations/claim-delayed/index.js";
|
|
5
|
+
import "../../../operations/index.js";
|
|
6
|
+
import "../../../../../index.js";
|
|
7
|
+
import { ResumeCase } from "../../../testing/resume.js";
|
|
8
|
+
//#region src/sdk/accounts/intents/intents/resume/deposit/deposit.fixtures.d.ts
|
|
9
|
+
/**
|
|
10
|
+
* Resume deposit fixtures, ported from intent-calculator
|
|
11
|
+
* `deposit.flowFixtures.ts` (resume cases only). Shared by DEPOSIT and
|
|
12
|
+
* DEPOSIT_AND_INCREASE_LEVERAGE (mirrors legacy `buildDepositResumeLogicalOps`).
|
|
13
|
+
* Shared token / sdk / options helpers live in `testing/resume.ts`.
|
|
14
|
+
*/
|
|
15
|
+
type DepositLikeDelayedIntent = DelayedDepositIntent | DelayedDepositAndIncreaseLeverageIntent;
|
|
16
|
+
/** Shared op amounts from deposit.flow (fixed-L collateral-up). */
|
|
17
|
+
declare const DEPOSIT_ADD_UND = 100000000000n;
|
|
18
|
+
declare const ANY_SWAP_OUT = 10000000000000000000000n;
|
|
19
|
+
declare const QUOTA_INCREASE = 460000000000n;
|
|
20
|
+
/**
|
|
21
|
+
* Flow B non-RWA: C=und, T=any.
|
|
22
|
+
* Full: add + increaseDebt + swap(und→any) + changeQuota
|
|
23
|
+
* Resume: changeQuota only
|
|
24
|
+
*/
|
|
25
|
+
declare const case_b_und_any: ResumeCase;
|
|
26
|
+
/**
|
|
27
|
+
* Flow B RWA: C=und, T=asset.
|
|
28
|
+
* Full: add + increaseDebt + swap + unwrap + changeQuota
|
|
29
|
+
* Resume: changeQuota only
|
|
30
|
+
*/
|
|
31
|
+
declare const case_b_und_rwa: ResumeCase;
|
|
32
|
+
/** Claimed und — no active quota-buy path. */
|
|
33
|
+
declare const case_claimed_und: ResumeCase;
|
|
34
|
+
declare function buildResumeDepositProps<T extends DepositLikeDelayedIntent>(args: {
|
|
35
|
+
case: ResumeCase;
|
|
36
|
+
sdk: OnchainSDK;
|
|
37
|
+
options: ClaimDelayedOption;
|
|
38
|
+
delayedIntent: T;
|
|
39
|
+
}): {
|
|
40
|
+
intent: T;
|
|
41
|
+
creditAccount: CreditAccountSlice;
|
|
42
|
+
sdk: OnchainSDK<{}>;
|
|
43
|
+
quotaReserve: undefined;
|
|
44
|
+
options: ClaimDelayedOption;
|
|
45
|
+
slippage: undefined;
|
|
46
|
+
};
|
|
47
|
+
//#endregion
|
|
48
|
+
export { ANY_SWAP_OUT, DEPOSIT_ADD_UND, DepositLikeDelayedIntent, QUOTA_INCREASE, buildResumeDepositProps, case_b_und_any, case_b_und_rwa, case_claimed_und };
|
package/dist/types/sdk/accounts/intents/intents/resume/increase-leverage/increase-leverage.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { OnchainSDK } from "../../../../../OnchainSDK.js";
|
|
2
|
+
import { CreditAccountSlice } from "../../../types.js";
|
|
3
|
+
import { ClaimDelayedOption } from "../../../operations/claim-delayed/index.js";
|
|
4
|
+
import { AccountCalculatorOperation } from "../../../operations/types.js";
|
|
5
|
+
import "../../../operations/index.js";
|
|
6
|
+
import "../../../../../index.js";
|
|
7
|
+
//#region src/sdk/accounts/intents/intents/resume/increase-leverage/increase-leverage.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Resume increase-leverage: claim only
|
|
10
|
+
*/
|
|
11
|
+
declare function buildResumeIncreaseLeverageOperations(creditAccount: CreditAccountSlice, options: ClaimDelayedOption, sdk: OnchainSDK): Array<AccountCalculatorOperation>;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { buildResumeIncreaseLeverageOperations };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { DelayedIncreaseLeverageIntent } from "../../../../withdrawal-compressor/types.js";
|
|
2
|
+
import { OnchainSDK } from "../../../../../OnchainSDK.js";
|
|
3
|
+
import { CreditAccountSlice } from "../../../types.js";
|
|
4
|
+
import { ClaimDelayedOption } from "../../../operations/claim-delayed/index.js";
|
|
5
|
+
import "../../../operations/index.js";
|
|
6
|
+
import "../../../../../index.js";
|
|
7
|
+
import { ResumeCase } from "../../../testing/resume.js";
|
|
8
|
+
//#region src/sdk/accounts/intents/intents/resume/increase-leverage/increase-leverage.fixtures.d.ts
|
|
9
|
+
/**
|
|
10
|
+
* Resume increase-leverage fixtures, ported from intent-calculator
|
|
11
|
+
* `increaseLeverage.flowFixtures.ts` (resume cases only). Shared token / sdk /
|
|
12
|
+
* options helpers live in `testing/resume.ts`.
|
|
13
|
+
*/
|
|
14
|
+
/** Borrow delta for L0→L1_SIX with fixed collateral. */
|
|
15
|
+
declare const INCREASE_DEBT_AMOUNT = 1000000000000n;
|
|
16
|
+
/** Quota increase for obtained ANY / RWA asset (buyQuotaMode excess). */
|
|
17
|
+
declare const QUOTA_INCREASE = 920000000000n;
|
|
18
|
+
/** Post-borrow / post-claim CA metrics (fixed C). */
|
|
19
|
+
declare const INCREASE_POST_T = 6000000000000n;
|
|
20
|
+
declare const INCREASE_POST_D = 5000000000000n;
|
|
21
|
+
/**
|
|
22
|
+
* Case 2.1 — NON RWA, target=ANY (borrow stays on CA).
|
|
23
|
+
* Full: increaseDebt → swap(und→any) → changeQuota(any)
|
|
24
|
+
* Resume: claim → changeQuota(any)
|
|
25
|
+
*/
|
|
26
|
+
declare const case_2_1_any: ResumeCase;
|
|
27
|
+
/**
|
|
28
|
+
* Case 1.2 — RWA, target=asset.
|
|
29
|
+
* Full: increaseDebt → unwrap(und→asset) → changeQuota(asset)
|
|
30
|
+
* Resume: claim(asset) → changeQuota(asset)
|
|
31
|
+
*/
|
|
32
|
+
declare const case_1_2_asset_rwa: ResumeCase;
|
|
33
|
+
declare function buildResumeIncreaseLeverageProps(args: {
|
|
34
|
+
case: ResumeCase;
|
|
35
|
+
sdk: OnchainSDK;
|
|
36
|
+
options: ClaimDelayedOption;
|
|
37
|
+
}): {
|
|
38
|
+
intent: DelayedIncreaseLeverageIntent;
|
|
39
|
+
creditAccount: CreditAccountSlice;
|
|
40
|
+
sdk: OnchainSDK<{}>;
|
|
41
|
+
quotaReserve: undefined;
|
|
42
|
+
options: ClaimDelayedOption;
|
|
43
|
+
slippage: undefined;
|
|
44
|
+
};
|
|
45
|
+
//#endregion
|
|
46
|
+
export { INCREASE_DEBT_AMOUNT, INCREASE_POST_D, INCREASE_POST_T, QUOTA_INCREASE, buildResumeIncreaseLeverageProps, case_1_2_asset_rwa, case_2_1_any };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { buildResumeAddCollateralOperations } from "./add-collateral/add-collateral.js";
|
|
2
|
+
import { buildResumeCloseOperations } from "./close/close.js";
|
|
3
|
+
import { buildResumeDecreaseLeverageOperations } from "./decrease-leverage/decrease-leverage.js";
|
|
4
|
+
import { buildResumeDepositOperations } from "./deposit/deposit.js";
|
|
5
|
+
import { buildResumeIncreaseLeverageOperations } from "./increase-leverage/increase-leverage.js";
|
|
6
|
+
import { buildResumeWithdrawOperations } from "./withdraw/withdraw.js";
|
|
7
|
+
export { buildResumeAddCollateralOperations, buildResumeCloseOperations, buildResumeDecreaseLeverageOperations, buildResumeDepositOperations, buildResumeIncreaseLeverageOperations, buildResumeWithdrawOperations };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { DelayedWithdrawCollateralIntent } from "../../../../withdrawal-compressor/types.js";
|
|
2
|
+
import { OnchainSDK } from "../../../../../OnchainSDK.js";
|
|
3
|
+
import { CreditAccountSlice } from "../../../types.js";
|
|
4
|
+
import { ClaimDelayedOption } from "../../../operations/claim-delayed/index.js";
|
|
5
|
+
import { SwapQuoter } from "../../../quoters/swap.js";
|
|
6
|
+
import "../../../quoters/index.js";
|
|
7
|
+
import { AccountCalculatorOperation } from "../../../operations/types.js";
|
|
8
|
+
import "../../../operations/index.js";
|
|
9
|
+
import "../../../../../index.js";
|
|
10
|
+
//#region src/sdk/accounts/intents/intents/resume/withdraw/withdraw.d.ts
|
|
11
|
+
/**
|
|
12
|
+
* Resume withdraw — linear op chain following the W-first matrix:
|
|
13
|
+
* claim → (swap?) → decreaseDebt? → (unwrapRwa?) → withdrawCollateral.
|
|
14
|
+
* Only the underlying token (or the unwrapped rwa.asset on RWA markets) can
|
|
15
|
+
* be withdrawn (enforced below).
|
|
16
|
+
* The delayed lean intent records debt already paid at start; only its
|
|
17
|
+
* residual `debtRepaid` may consume claimed proceeds.
|
|
18
|
+
*
|
|
19
|
+
* Matrix arithmetic (split sizing) is oracle-priced; emitted swap legs go
|
|
20
|
+
* through the given quoter (`amountOut` on the op, `minAmountOut` caps the
|
|
21
|
+
* debt repay funded by the leg). Mirrors legacy
|
|
22
|
+
* `buildWithdrawResumeLogicalOps` + `resolveSwapBranches` (simplified: no
|
|
23
|
+
* min/avg op branches).
|
|
24
|
+
*/
|
|
25
|
+
declare function buildResumeWithdrawOperations(props: {
|
|
26
|
+
intent: DelayedWithdrawCollateralIntent;
|
|
27
|
+
options: ClaimDelayedOption;
|
|
28
|
+
creditAccount: CreditAccountSlice;
|
|
29
|
+
sdk: OnchainSDK;
|
|
30
|
+
quotaReserve: number | undefined;
|
|
31
|
+
}, quoter: SwapQuoter): Promise<AccountCalculatorOperation[]>;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { buildResumeWithdrawOperations };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { DelayedWithdrawCollateralIntent } from "../../../../withdrawal-compressor/types.js";
|
|
2
|
+
import { OnchainSDK } from "../../../../../OnchainSDK.js";
|
|
3
|
+
import { CreditAccountSlice } from "../../../types.js";
|
|
4
|
+
import { ClaimDelayedOption } from "../../../operations/claim-delayed/index.js";
|
|
5
|
+
import "../../../operations/index.js";
|
|
6
|
+
import "../../../../../index.js";
|
|
7
|
+
import { Address } from "viem";
|
|
8
|
+
//#region src/sdk/accounts/intents/intents/resume/withdraw/withdraw.fixtures.d.ts
|
|
9
|
+
/**
|
|
10
|
+
* Resume withdraw fixtures, ported from intent-calculator
|
|
11
|
+
* `withdraw.flowFixtures.ts` (resume cases only).
|
|
12
|
+
*/
|
|
13
|
+
declare const WITHDRAW_UND: bigint;
|
|
14
|
+
declare const WITHDRAW_ANY: bigint;
|
|
15
|
+
declare const WITHDRAW_ANY2: bigint;
|
|
16
|
+
/** Withdraw amount in rwa.asset units (8 decimals, priced 1:1 with UND). */
|
|
17
|
+
declare const WITHDRAW_RWA: bigint;
|
|
18
|
+
declare const DEBT_DELTA: bigint;
|
|
19
|
+
declare const PHANTOM: Address;
|
|
20
|
+
/** Per-token CA balance (legacy `A0_TOK` / und balance). */
|
|
21
|
+
declare const A0: bigint;
|
|
22
|
+
declare const A0_UND: bigint;
|
|
23
|
+
declare const QUOTA0: bigint;
|
|
24
|
+
/** Starting account debt on the fixture CA. */
|
|
25
|
+
declare const WITHDRAW_PRE_D: bigint;
|
|
26
|
+
/**
|
|
27
|
+
* Starting TVL of the fixture CA tokens (ANY + ANY2 + UND). Claim may add
|
|
28
|
+
* value when the phantom is absent from `tokens` (current fixtures).
|
|
29
|
+
*/
|
|
30
|
+
declare const WITHDRAW_BASE_TV = 20000000000000n;
|
|
31
|
+
declare const WITHDRAW_TO: Address;
|
|
32
|
+
declare function withdrawAmountFor(token: Address): bigint;
|
|
33
|
+
declare function buildWithdrawSdk(args: {
|
|
34
|
+
claimedToken: Address;
|
|
35
|
+
extraPrices?: Record<Address, bigint>;
|
|
36
|
+
extraDecimals?: Record<Address, number>;
|
|
37
|
+
rwaAssets?: Record<Address, Address>;
|
|
38
|
+
}): OnchainSDK;
|
|
39
|
+
declare function buildWithdrawOffchainOptions(args: {
|
|
40
|
+
claimedToken: Address;
|
|
41
|
+
claimedAmount: bigint;
|
|
42
|
+
}): ClaimDelayedOption;
|
|
43
|
+
declare function buildWithdrawOnchainOptions(args: {
|
|
44
|
+
claimedToken: Address;
|
|
45
|
+
claimedAmount: bigint;
|
|
46
|
+
}): ClaimDelayedOption;
|
|
47
|
+
declare function buildWithdrawResumeProps(args: {
|
|
48
|
+
sourceToken: Address;
|
|
49
|
+
withdrawToken: Address;
|
|
50
|
+
claimedToken: Address;
|
|
51
|
+
claimedAmount: bigint;
|
|
52
|
+
debtRepaid: bigint;
|
|
53
|
+
options: ClaimDelayedOption;
|
|
54
|
+
sdk: OnchainSDK;
|
|
55
|
+
/** Overrides `withdrawAmountFor(withdrawToken)` when set. */
|
|
56
|
+
withdrawAmount?: bigint;
|
|
57
|
+
tokens?: CreditAccountSlice["tokens"];
|
|
58
|
+
slippage?: number;
|
|
59
|
+
}): {
|
|
60
|
+
intent: DelayedWithdrawCollateralIntent;
|
|
61
|
+
creditAccount: CreditAccountSlice;
|
|
62
|
+
sdk: OnchainSDK<{}>;
|
|
63
|
+
quotaReserve: undefined;
|
|
64
|
+
options: ClaimDelayedOption;
|
|
65
|
+
slippage: number;
|
|
66
|
+
};
|
|
67
|
+
//#endregion
|
|
68
|
+
export { A0, A0_UND, DEBT_DELTA, PHANTOM, QUOTA0, WITHDRAW_ANY, WITHDRAW_ANY2, WITHDRAW_BASE_TV, WITHDRAW_PRE_D, WITHDRAW_RWA, WITHDRAW_TO, WITHDRAW_UND, buildWithdrawOffchainOptions, buildWithdrawOnchainOptions, buildWithdrawResumeProps, buildWithdrawSdk, withdrawAmountFor };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { MultiCall } from "../../../../types/transactions.js";
|
|
2
|
+
import { OnchainSDK } from "../../../../OnchainSDK.js";
|
|
3
|
+
import { CreditAccountSlice } from "../../types.js";
|
|
4
|
+
import { OperationBuilderOption } from "../types.js";
|
|
5
|
+
import "../../../../index.js";
|
|
6
|
+
import { Address } from "viem";
|
|
7
|
+
//#region src/sdk/accounts/intents/operations/add-collateral/index.d.ts
|
|
8
|
+
interface AddCollateralOperation {
|
|
9
|
+
type: "addCollateral";
|
|
10
|
+
token: Address;
|
|
11
|
+
amount: bigint;
|
|
12
|
+
value?: bigint;
|
|
13
|
+
calls: MultiCall[];
|
|
14
|
+
}
|
|
15
|
+
declare function buildAddCollateralOperation(input: {
|
|
16
|
+
token: Address;
|
|
17
|
+
amount: bigint;
|
|
18
|
+
value?: bigint;
|
|
19
|
+
creditAccount: CreditAccountSlice;
|
|
20
|
+
sdk: OnchainSDK;
|
|
21
|
+
}, option: OperationBuilderOption): AddCollateralOperation;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { AddCollateralOperation, buildAddCollateralOperation };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ClaimableWithdrawal, WithdrawableAsset, WithdrawalOutput } from "../../../withdrawal-compressor/types.js";
|
|
2
|
+
import { MultiCall } from "../../../../types/transactions.js";
|
|
3
|
+
import { OnchainSDK } from "../../../../OnchainSDK.js";
|
|
4
|
+
import { CreditAccountSlice } from "../../types.js";
|
|
5
|
+
import "../../../../index.js";
|
|
6
|
+
import { Address } from "viem";
|
|
7
|
+
//#region src/sdk/accounts/intents/operations/claim-delayed/index.d.ts
|
|
8
|
+
interface OnchainOption {
|
|
9
|
+
kind: "onchain";
|
|
10
|
+
claimableWithdrawal: ClaimableWithdrawal;
|
|
11
|
+
}
|
|
12
|
+
interface OffchainOption {
|
|
13
|
+
kind: "offchain";
|
|
14
|
+
phantomSpent: bigint;
|
|
15
|
+
withdrawalConfig: WithdrawableAsset;
|
|
16
|
+
}
|
|
17
|
+
type ClaimDelayedOption = OnchainOption | OffchainOption;
|
|
18
|
+
/**
|
|
19
|
+
* Logical claim op for resume previews.
|
|
20
|
+
* Simulation burns the phantom and credits outputs.
|
|
21
|
+
*/
|
|
22
|
+
type ClaimDelayedWithdrawalOperation = {
|
|
23
|
+
type: "claimDelayedWithdrawal";
|
|
24
|
+
/** Source token the delayed withdrawal was requested from. */
|
|
25
|
+
token: Address;
|
|
26
|
+
withdrawalPhantomToken: Address;
|
|
27
|
+
withdrawalTokenSpent: bigint;
|
|
28
|
+
/** Claim outputs as returned by the compressor (incl. `isDelayed`). */
|
|
29
|
+
outputs: WithdrawalOutput[];
|
|
30
|
+
/**
|
|
31
|
+
* Compressor claimCalls. Empty for instant-only / fixture simulation when
|
|
32
|
+
* the full claimable payload is unavailable — refined then keeps calls: [].
|
|
33
|
+
*/
|
|
34
|
+
calls: MultiCall[];
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Build the claim op from a matured claimable, or a simulation-only op from
|
|
38
|
+
* resume claimedToken/amount when claimable is not attached.
|
|
39
|
+
* Stores balances for raw call
|
|
40
|
+
*/
|
|
41
|
+
declare function buildClaimDelayedWithdrawalOperation(input: {
|
|
42
|
+
creditAccount: CreditAccountSlice;
|
|
43
|
+
sdk: OnchainSDK;
|
|
44
|
+
}, option: ClaimDelayedOption): ClaimDelayedWithdrawalOperation;
|
|
45
|
+
/** First positive non-delayed output (optionally restricted to `token`). */
|
|
46
|
+
declare function primaryInstantOutput(outputs: Array<{
|
|
47
|
+
token: Address;
|
|
48
|
+
amount: bigint;
|
|
49
|
+
isDelayed: boolean;
|
|
50
|
+
}>, token?: Address): {
|
|
51
|
+
token: Address;
|
|
52
|
+
amount: bigint;
|
|
53
|
+
} | undefined;
|
|
54
|
+
//#endregion
|
|
55
|
+
export { ClaimDelayedOption, ClaimDelayedWithdrawalOperation, OffchainOption, OnchainOption, buildClaimDelayedWithdrawalOperation, primaryInstantOutput };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { RouterCASlice } from "../../../../router/types.js";
|
|
2
|
+
import { OnchainSDK } from "../../../../OnchainSDK.js";
|
|
3
|
+
import { CloseQuote } from "../../quoters/close.js";
|
|
4
|
+
import "../../quoters/index.js";
|
|
5
|
+
import "../../../../index.js";
|
|
6
|
+
import { Address } from "viem";
|
|
7
|
+
//#region src/sdk/accounts/intents/operations/close-credit-account/index.d.ts
|
|
8
|
+
interface CloseCreditAccountOperation extends CloseQuote {
|
|
9
|
+
type: "closeCreditAccount";
|
|
10
|
+
}
|
|
11
|
+
declare function buildCloseCreditAccountOperation(input: {
|
|
12
|
+
quote: CloseQuote;
|
|
13
|
+
sdk: OnchainSDK;
|
|
14
|
+
}, option: {
|
|
15
|
+
kind: "offchain";
|
|
16
|
+
} | {
|
|
17
|
+
kind: "onchain";
|
|
18
|
+
to: Address;
|
|
19
|
+
creditAccount: RouterCASlice;
|
|
20
|
+
}): Promise<CloseCreditAccountOperation>;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { CloseCreditAccountOperation, buildCloseCreditAccountOperation };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { MultiCall } from "../../../../types/transactions.js";
|
|
2
|
+
import { OnchainSDK } from "../../../../OnchainSDK.js";
|
|
3
|
+
import { CreditAccountSlice } from "../../types.js";
|
|
4
|
+
import { OperationBuilderOption } from "../types.js";
|
|
5
|
+
import "../../../../index.js";
|
|
6
|
+
//#region src/sdk/accounts/intents/operations/decrease-debt/index.d.ts
|
|
7
|
+
interface DecreaseDebtOperation {
|
|
8
|
+
type: "decreaseDebt";
|
|
9
|
+
amount: bigint;
|
|
10
|
+
calls: MultiCall[];
|
|
11
|
+
}
|
|
12
|
+
declare function buildDecreaseDebtOperation(input: {
|
|
13
|
+
amount: bigint;
|
|
14
|
+
creditAccount: CreditAccountSlice;
|
|
15
|
+
sdk: OnchainSDK;
|
|
16
|
+
}, option: OperationBuilderOption): DecreaseDebtOperation;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { DecreaseDebtOperation, buildDecreaseDebtOperation };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { MultiCall } from "../../../../types/transactions.js";
|
|
2
|
+
import { OnchainSDK } from "../../../../OnchainSDK.js";
|
|
3
|
+
import { CreditAccountSlice } from "../../types.js";
|
|
4
|
+
import { OperationBuilderOption } from "../types.js";
|
|
5
|
+
import "../../../../index.js";
|
|
6
|
+
//#region src/sdk/accounts/intents/operations/increase-debt/index.d.ts
|
|
7
|
+
interface IncreaseDebtOperation {
|
|
8
|
+
type: "increaseDebt";
|
|
9
|
+
amount: bigint;
|
|
10
|
+
calls: MultiCall[];
|
|
11
|
+
}
|
|
12
|
+
declare function buildIncreaseDebtOperation(input: {
|
|
13
|
+
amount: bigint;
|
|
14
|
+
creditAccount: CreditAccountSlice;
|
|
15
|
+
sdk: OnchainSDK;
|
|
16
|
+
}, option: OperationBuilderOption): IncreaseDebtOperation;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { IncreaseDebtOperation, buildIncreaseDebtOperation };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ClaimDelayedOption, ClaimDelayedWithdrawalOperation, OffchainOption, OnchainOption, buildClaimDelayedWithdrawalOperation, primaryInstantOutput } from "./claim-delayed/index.js";
|
|
2
|
+
import { CloseCreditAccountOperation, buildCloseCreditAccountOperation } from "./close-credit-account/index.js";
|
|
3
|
+
import { DecreaseDebtOperation, buildDecreaseDebtOperation } from "./decrease-debt/index.js";
|
|
4
|
+
import { IncreaseDebtOperation, buildIncreaseDebtOperation } from "./increase-debt/index.js";
|
|
5
|
+
import { QuotaUpdateOperation, QuotaUpdateState, buildQuotaUpdateOperation } from "./quota-update/index.js";
|
|
6
|
+
import { RepayCreditAccountOperation, buildRepayCreditAccountOperation } from "./repay-credit-account/index.js";
|
|
7
|
+
import { StartDelayedWithdrawalOperation, buildStartDelayedWithdrawalOperation } from "./start-delayed-withdrawal/index.js";
|
|
8
|
+
import { SwapOperation, buildSwapOperation } from "./swap/index.js";
|
|
9
|
+
import { UnwrapRwaCollateralOperation, buildUnwrapRwaCollateralOperation } from "./unwrap-rwa-collateral/index.js";
|
|
10
|
+
import { WithdrawCollateralOperation, buildWithdrawCollateralOperation } from "./withdraw-collateral/index.js";
|
|
11
|
+
import { WrapRwaCollateralOperation, buildWrapRwaCollateralOperation } from "./wrap-rwa-collateral/index.js";
|
|
12
|
+
import { AccountCalculatorOperation, OperationBuilderOption } from "./types.js";
|
|
13
|
+
import { AddCollateralOperation, buildAddCollateralOperation } from "./add-collateral/index.js";
|
|
14
|
+
export { AccountCalculatorOperation, AddCollateralOperation, ClaimDelayedOption, ClaimDelayedWithdrawalOperation, CloseCreditAccountOperation, DecreaseDebtOperation, IncreaseDebtOperation, OffchainOption, OnchainOption, OperationBuilderOption, QuotaUpdateOperation, QuotaUpdateState, RepayCreditAccountOperation, StartDelayedWithdrawalOperation, SwapOperation, UnwrapRwaCollateralOperation, WithdrawCollateralOperation, WrapRwaCollateralOperation, buildAddCollateralOperation, buildClaimDelayedWithdrawalOperation, buildCloseCreditAccountOperation, buildDecreaseDebtOperation, buildIncreaseDebtOperation, buildQuotaUpdateOperation, buildRepayCreditAccountOperation, buildStartDelayedWithdrawalOperation, buildSwapOperation, buildUnwrapRwaCollateralOperation, buildWithdrawCollateralOperation, buildWrapRwaCollateralOperation, primaryInstantOutput };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Asset } from "../../../../base/types.js";
|
|
2
|
+
import { MultiCall } from "../../../../types/transactions.js";
|
|
3
|
+
import { OnchainSDK } from "../../../../OnchainSDK.js";
|
|
4
|
+
import { CreditAccountSlice } from "../../types.js";
|
|
5
|
+
import { calcQuotaUpdate } from "../../../../../common-utils/utils/creditAccount/quota-utils.js";
|
|
6
|
+
import { OperationBuilderOption } from "../types.js";
|
|
7
|
+
import "../../../../index.js";
|
|
8
|
+
import { Address } from "viem";
|
|
9
|
+
//#region src/sdk/accounts/intents/operations/quota-update/index.d.ts
|
|
10
|
+
interface QuotaUpdateOperation {
|
|
11
|
+
type: "changeQuota";
|
|
12
|
+
desiredQuota: Record<Address, Asset>;
|
|
13
|
+
quotaIncrease: Asset[];
|
|
14
|
+
quotaDecrease: Asset[];
|
|
15
|
+
calls: MultiCall[];
|
|
16
|
+
}
|
|
17
|
+
type QuotaUpdateState = ReturnType<typeof calcQuotaUpdate>;
|
|
18
|
+
declare function buildQuotaUpdateOperation(input: {
|
|
19
|
+
update: QuotaUpdateState;
|
|
20
|
+
creditAccount: CreditAccountSlice;
|
|
21
|
+
sdk: OnchainSDK;
|
|
22
|
+
}, option: OperationBuilderOption): QuotaUpdateOperation;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { QuotaUpdateOperation, QuotaUpdateState, buildQuotaUpdateOperation };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Asset } from "../../../../base/types.js";
|
|
2
|
+
import { RouterCASlice } from "../../../../router/types.js";
|
|
3
|
+
import { PermitResult } from "../../../types.js";
|
|
4
|
+
import { MultiCall } from "../../../../types/transactions.js";
|
|
5
|
+
import { OnchainSDK } from "../../../../OnchainSDK.js";
|
|
6
|
+
import "../../../../index.js";
|
|
7
|
+
import { Address } from "viem";
|
|
8
|
+
//#region src/sdk/accounts/intents/operations/repay-credit-account/index.d.ts
|
|
9
|
+
interface RepayCreditAccountOperation {
|
|
10
|
+
type: "repayCreditAccount";
|
|
11
|
+
expectedRepayAsset?: Asset[];
|
|
12
|
+
expectedWithdrawAssets?: Asset[];
|
|
13
|
+
value?: bigint;
|
|
14
|
+
calls: MultiCall[];
|
|
15
|
+
}
|
|
16
|
+
declare function buildRepayCreditAccountOperation(input: {
|
|
17
|
+
expectedRepayAsset?: Asset[];
|
|
18
|
+
expectedWithdrawAssets?: Asset[];
|
|
19
|
+
value?: bigint;
|
|
20
|
+
sdk: OnchainSDK;
|
|
21
|
+
}, option: {
|
|
22
|
+
kind: "offchain";
|
|
23
|
+
} | {
|
|
24
|
+
kind: "onchain";
|
|
25
|
+
to: Address;
|
|
26
|
+
permits: Record<string, PermitResult>;
|
|
27
|
+
creditAccount: RouterCASlice;
|
|
28
|
+
tokensToClaim: Asset[];
|
|
29
|
+
wrapCalls?: MultiCall[];
|
|
30
|
+
}): Promise<RepayCreditAccountOperation>;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { RepayCreditAccountOperation, buildRepayCreditAccountOperation };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { RequestableWithdrawal } from "../../../withdrawal-compressor/types.js";
|
|
2
|
+
import { MultiCall } from "../../../../types/transactions.js";
|
|
3
|
+
import { OnchainSDK } from "../../../../OnchainSDK.js";
|
|
4
|
+
import { CreditAccountSlice } from "../../types.js";
|
|
5
|
+
import { OperationBuilderOption } from "../types.js";
|
|
6
|
+
import "../../../../index.js";
|
|
7
|
+
//#region src/sdk/accounts/intents/operations/start-delayed-withdrawal/index.d.ts
|
|
8
|
+
interface StartDelayedWithdrawalOperation {
|
|
9
|
+
type: "startDelayedWithdrawal";
|
|
10
|
+
token: RequestableWithdrawal["token"];
|
|
11
|
+
amountIn: bigint;
|
|
12
|
+
outputs: RequestableWithdrawal["outputs"];
|
|
13
|
+
settlement: "instant" | "delayed";
|
|
14
|
+
calls: MultiCall[];
|
|
15
|
+
}
|
|
16
|
+
declare function buildStartDelayedWithdrawalOperation(input: {
|
|
17
|
+
preview: RequestableWithdrawal;
|
|
18
|
+
settlement: "instant" | "delayed";
|
|
19
|
+
creditAccount: CreditAccountSlice;
|
|
20
|
+
sdk: OnchainSDK;
|
|
21
|
+
}, option: OperationBuilderOption): StartDelayedWithdrawalOperation;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { StartDelayedWithdrawalOperation, buildStartDelayedWithdrawalOperation };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Asset } from "../../../../base/types.js";
|
|
2
|
+
import { MultiCall } from "../../../../types/transactions.js";
|
|
3
|
+
import { OnchainSDK } from "../../../../OnchainSDK.js";
|
|
4
|
+
import { CreditAccountSlice } from "../../types.js";
|
|
5
|
+
import { OperationBuilderOption } from "../types.js";
|
|
6
|
+
import "../../../../index.js";
|
|
7
|
+
import { Address } from "viem";
|
|
8
|
+
//#region src/sdk/accounts/intents/operations/swap/index.d.ts
|
|
9
|
+
/** Single-in swap (one token in, one token out). */
|
|
10
|
+
interface SwapOperation {
|
|
11
|
+
type: "swap";
|
|
12
|
+
from: [Asset];
|
|
13
|
+
tokenOut: Address;
|
|
14
|
+
amountOut: bigint;
|
|
15
|
+
calls: MultiCall[];
|
|
16
|
+
}
|
|
17
|
+
/** One-to-one swap op (withdraw resume conversion legs). */
|
|
18
|
+
declare function buildSwapOperation(input: {
|
|
19
|
+
tokenIn: Address;
|
|
20
|
+
amountIn: bigint;
|
|
21
|
+
tokenOut: Address;
|
|
22
|
+
amountOut: bigint;
|
|
23
|
+
calls: MultiCall[];
|
|
24
|
+
creditAccount: CreditAccountSlice;
|
|
25
|
+
sdk: OnchainSDK;
|
|
26
|
+
}, option: OperationBuilderOption): SwapOperation;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { SwapOperation, buildSwapOperation };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ClaimDelayedWithdrawalOperation } from "./claim-delayed/index.js";
|
|
2
|
+
import { CloseCreditAccountOperation } from "./close-credit-account/index.js";
|
|
3
|
+
import { DecreaseDebtOperation } from "./decrease-debt/index.js";
|
|
4
|
+
import { IncreaseDebtOperation } from "./increase-debt/index.js";
|
|
5
|
+
import { QuotaUpdateOperation } from "./quota-update/index.js";
|
|
6
|
+
import { RepayCreditAccountOperation } from "./repay-credit-account/index.js";
|
|
7
|
+
import { StartDelayedWithdrawalOperation } from "./start-delayed-withdrawal/index.js";
|
|
8
|
+
import { SwapOperation } from "./swap/index.js";
|
|
9
|
+
import { UnwrapRwaCollateralOperation } from "./unwrap-rwa-collateral/index.js";
|
|
10
|
+
import { WithdrawCollateralOperation } from "./withdraw-collateral/index.js";
|
|
11
|
+
import { WrapRwaCollateralOperation } from "./wrap-rwa-collateral/index.js";
|
|
12
|
+
import { AddCollateralOperation } from "./add-collateral/index.js";
|
|
13
|
+
//#region src/sdk/accounts/intents/operations/types.d.ts
|
|
14
|
+
type AccountCalculatorOperation = AddCollateralOperation | IncreaseDebtOperation | DecreaseDebtOperation | SwapOperation | WithdrawCollateralOperation | QuotaUpdateOperation | CloseCreditAccountOperation | RepayCreditAccountOperation | WrapRwaCollateralOperation | UnwrapRwaCollateralOperation | StartDelayedWithdrawalOperation | ClaimDelayedWithdrawalOperation;
|
|
15
|
+
type OperationBuilderOption = {
|
|
16
|
+
kind: "offchain";
|
|
17
|
+
} | {
|
|
18
|
+
kind: "onchain";
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
export { AccountCalculatorOperation, OperationBuilderOption };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { MultiCall } from "../../../../types/transactions.js";
|
|
2
|
+
import { OnchainSDK } from "../../../../OnchainSDK.js";
|
|
3
|
+
import { CreditAccountSlice } from "../../types.js";
|
|
4
|
+
import { OperationBuilderOption } from "../types.js";
|
|
5
|
+
import "../../../../index.js";
|
|
6
|
+
import { Address } from "viem";
|
|
7
|
+
//#region src/sdk/accounts/intents/operations/unwrap-rwa-collateral/index.d.ts
|
|
8
|
+
interface UnwrapRwaCollateralOperation {
|
|
9
|
+
type: "unwrapRwaCollateral";
|
|
10
|
+
/** Amount of wrapped underlying unwrapped. */
|
|
11
|
+
amount: bigint;
|
|
12
|
+
/** Wrapped underlying token (unwrap source). */
|
|
13
|
+
tokenIn: Address;
|
|
14
|
+
/** RWA asset received after unwrap. */
|
|
15
|
+
tokenOut: Address;
|
|
16
|
+
/** RWA asset amount after unwrap (1:1, decimals rescale only). */
|
|
17
|
+
amountOut: bigint;
|
|
18
|
+
calls: MultiCall[];
|
|
19
|
+
}
|
|
20
|
+
/** One-to-one swap op (withdraw resume conversion legs). */
|
|
21
|
+
declare function buildUnwrapRwaCollateralOperation(input: {
|
|
22
|
+
tokenIn: Address;
|
|
23
|
+
amountIn: bigint;
|
|
24
|
+
tokenOut: Address;
|
|
25
|
+
amountOut: bigint;
|
|
26
|
+
creditAccount: CreditAccountSlice;
|
|
27
|
+
sdk: OnchainSDK;
|
|
28
|
+
}, option: OperationBuilderOption): Promise<UnwrapRwaCollateralOperation>;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { UnwrapRwaCollateralOperation, buildUnwrapRwaCollateralOperation };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { MultiCall } from "../../../../types/transactions.js";
|
|
2
|
+
import { OnchainSDK } from "../../../../OnchainSDK.js";
|
|
3
|
+
import { CreditAccountSlice } from "../../types.js";
|
|
4
|
+
import { UnwrapRwaCollateralOperation } from "../unwrap-rwa-collateral/index.js";
|
|
5
|
+
import { OperationBuilderOption } from "../types.js";
|
|
6
|
+
import "../../../../index.js";
|
|
7
|
+
import { Address } from "viem";
|
|
8
|
+
//#region src/sdk/accounts/intents/operations/withdraw-collateral/index.d.ts
|
|
9
|
+
interface WithdrawCollateralOperation {
|
|
10
|
+
type: "withdrawCollateral";
|
|
11
|
+
token: Address;
|
|
12
|
+
amount: bigint;
|
|
13
|
+
/**
|
|
14
|
+
* Wallet recipient for withdrawn tokens — never a token address.
|
|
15
|
+
* Set when known; may be undefined for disconnected preview (no assemble).
|
|
16
|
+
*/
|
|
17
|
+
to?: Address;
|
|
18
|
+
calls: MultiCall[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Partial-withdraw tail: RWA forced unwrap, then withdrawCollateral to wallet.
|
|
22
|
+
*
|
|
23
|
+
* When withdrawing the wrapped RWA underlying, forces unwrap to `rwa.asset`
|
|
24
|
+
* and withdraws the unwrapped asset instead — even if the intent asked for
|
|
25
|
+
* underlying (mirrors legacy `resolveRwaForcedUnwrapWithdraw`).
|
|
26
|
+
*/
|
|
27
|
+
declare function buildWithdrawCollateralOperation(input: {
|
|
28
|
+
token: Address;
|
|
29
|
+
amount: bigint;
|
|
30
|
+
to: Address | undefined;
|
|
31
|
+
underlying: Address;
|
|
32
|
+
creditAccount: CreditAccountSlice;
|
|
33
|
+
sdk: OnchainSDK;
|
|
34
|
+
}, option: OperationBuilderOption): Promise<[WithdrawCollateralOperation] | [UnwrapRwaCollateralOperation, WithdrawCollateralOperation]>;
|
|
35
|
+
//#endregion
|
|
36
|
+
export { WithdrawCollateralOperation, buildWithdrawCollateralOperation };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { MultiCall } from "../../../../types/transactions.js";
|
|
2
|
+
import { OnchainSDK } from "../../../../OnchainSDK.js";
|
|
3
|
+
import { CreditAccountSlice } from "../../types.js";
|
|
4
|
+
import { OperationBuilderOption } from "../types.js";
|
|
5
|
+
import "../../../../index.js";
|
|
6
|
+
import { Address } from "viem";
|
|
7
|
+
//#region src/sdk/accounts/intents/operations/wrap-rwa-collateral/index.d.ts
|
|
8
|
+
interface WrapRwaCollateralOperation {
|
|
9
|
+
type: "wrapRwaCollateral";
|
|
10
|
+
/** Amount of RWA asset deposited / wrapped. */
|
|
11
|
+
amount: bigint;
|
|
12
|
+
/** RWA asset token (wallet / wrap source). */
|
|
13
|
+
tokenIn: Address;
|
|
14
|
+
/** Underlying received after wrap. */
|
|
15
|
+
tokenOut: Address;
|
|
16
|
+
/** Underlying amount after wrap (1:1, decimals rescale only). */
|
|
17
|
+
amountOut: bigint;
|
|
18
|
+
calls: MultiCall[];
|
|
19
|
+
}
|
|
20
|
+
/** One-to-one wrap op (decrease-leverage resume repay from rwa.asset). */
|
|
21
|
+
declare function buildWrapRwaCollateralOperation(input: {
|
|
22
|
+
tokenIn: Address;
|
|
23
|
+
amountIn: bigint;
|
|
24
|
+
tokenOut: Address;
|
|
25
|
+
amountOut: bigint;
|
|
26
|
+
creditAccount: CreditAccountSlice;
|
|
27
|
+
sdk: OnchainSDK;
|
|
28
|
+
}, option: OperationBuilderOption): Promise<WrapRwaCollateralOperation>;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { WrapRwaCollateralOperation, buildWrapRwaCollateralOperation };
|