@gearbox-protocol/sdk 15.1.0-next.8 → 15.1.0-next.9

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.
Files changed (41) hide show
  1. package/dist/cjs/common-utils/utils/creditAccount/get-time-to-liquidation.js +3 -1
  2. package/dist/cjs/sdk/accounts/intents/intents/resume/add-collateral/add-collateral.fixtures.js +23 -23
  3. package/dist/cjs/sdk/accounts/intents/intents/resume/close/close.fixtures.js +14 -14
  4. package/dist/cjs/sdk/accounts/intents/intents/resume/decrease-leverage/decrease-leverage.fixtures.js +12 -12
  5. package/dist/cjs/sdk/accounts/intents/intents/resume/deposit/deposit.fixtures.js +17 -17
  6. package/dist/cjs/sdk/accounts/intents/intents/resume/increase-leverage/increase-leverage.fixtures.js +12 -12
  7. package/dist/cjs/sdk/accounts/intents/intents/resume/withdraw/withdraw.fixtures.js +9 -9
  8. package/dist/cjs/sdk/accounts/intents/testing/resume.js +3 -18
  9. package/dist/cjs/sdk/accounts/intents/testing/sdk-mock.js +0 -1
  10. package/dist/cjs/sdk/positions/calcTimeToLiquidationMs.js +6 -5
  11. package/dist/esm/common-utils/utils/creditAccount/get-time-to-liquidation.js +3 -1
  12. package/dist/esm/dev/AccountOpener.js +1 -1
  13. package/dist/esm/dev/withdrawalUtils.js +1 -1
  14. package/dist/esm/plugins/adapters/contracts/ERC4626AdapterContract.js +1 -1
  15. package/dist/esm/preview/simulate/simulatePoolOperation.js +1 -1
  16. package/dist/esm/preview/trace/extractTransfers.js +1 -1
  17. package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +2 -2
  18. package/dist/esm/sdk/accounts/intents/testing/resume.js +1 -13
  19. package/dist/esm/sdk/accounts/liquidations/LiquidationsService.js +1 -1
  20. package/dist/esm/sdk/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +1 -1
  21. package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +1 -1
  22. package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +1 -1
  23. package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +1 -1
  24. package/dist/esm/sdk/base/TokensMeta.js +3 -3
  25. package/dist/esm/sdk/chain/detectNetwork.js +1 -1
  26. package/dist/esm/sdk/core/createAddressProvider.js +1 -1
  27. package/dist/esm/sdk/market/credit/CreditFacadeV310BaseContract.js +1 -1
  28. package/dist/esm/sdk/market/pool/PoolV310Contract.js +1 -1
  29. package/dist/esm/sdk/market/zapper/IETHZapperContract.js +1 -1
  30. package/dist/esm/sdk/market/zapper/ZapperContract.js +1 -1
  31. package/dist/esm/sdk/pools/PoolService.js +1 -1
  32. package/dist/esm/sdk/positions/calcTimeToLiquidationMs.js +7 -6
  33. package/dist/esm/sdk/utils/viem/simulateWithPriceUpdates.js +1 -1
  34. package/dist/types/common-utils/utils/creditAccount/get-time-to-liquidation.d.ts +3 -1
  35. package/dist/types/sdk/accounts/intents/testing/expect.d.ts +1 -1
  36. package/dist/types/sdk/accounts/intents/testing/resume.d.ts +1 -1
  37. package/dist/types/sdk/positions/calcTimeToLiquidationMs.d.ts +5 -4
  38. package/package.json +1 -1
  39. package/dist/cjs/sdk/accounts/intents/testing/expect.js +0 -167
  40. package/dist/esm/sdk/accounts/intents/testing/expect.js +0 -162
  41. package/dist/types/sdk/accounts/intents/testing/sdk-mock.d.ts +0 -96
@@ -8,7 +8,9 @@ const require_sdk_positions_calcTimeToLiquidationMs = require("../../../sdk/posi
8
8
  * and returns a millisecond duration until `healthFactor` decays to `1.0`
9
9
  * (`PERCENTAGE_FACTOR` in internal scale).
10
10
  *
11
- * @param props Current health factor and `totalBorrowRate * debt` term.
11
+ * @param props Current health factor and `totalBorrowRate_debt`, both `Bps`
12
+ * (`10000` = 100%) — not the legacy `PERCENTAGE_FACTOR_1KK` (`1_000_000` =
13
+ * 100%) scale the pre-rewrite frontend fed this under the same name.
12
14
  * @returns Milliseconds to liquidation as `bigint`, or `null` when already at/under
13
15
  * liquidation threshold or when borrow-rate exposure is zero.
14
16
  *
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sdk_accounts_intents_testing_resume = require("../../../testing/resume.js");
2
+ const require_resume = require("../../../testing/resume.js");
3
3
  //#region src/sdk/accounts/intents/intents/resume/add-collateral/add-collateral.fixtures.ts
4
4
  const ADD_UND = 100000000000n;
5
5
  const ANY_CLAIMED = 2000000000000000000000n;
@@ -13,17 +13,17 @@ const ADD_D1 = 4000000000000n;
13
13
  * Resume: changeQuota(ANY) only.
14
14
  */
15
15
  const case_1_2_und_any = {
16
- claimedToken: require_sdk_accounts_intents_testing_resume.ANY,
16
+ claimedToken: require_resume.ANY,
17
17
  claimedAmount: ANY_CLAIMED,
18
18
  postClaimTotalValue: ADD_T1,
19
19
  postClaimDebt: ADD_D1,
20
20
  resumeOps: [{
21
21
  type: "claimDelayedWithdrawal",
22
- token: require_sdk_accounts_intents_testing_resume.ANY,
23
- withdrawalPhantomToken: require_sdk_accounts_intents_testing_resume.RESUME_FIXTURE_PHANTOM,
22
+ token: require_resume.ANY,
23
+ withdrawalPhantomToken: require_resume.RESUME_FIXTURE_PHANTOM,
24
24
  withdrawalTokenSpent: ANY_CLAIMED,
25
25
  outputs: [{
26
- token: require_sdk_accounts_intents_testing_resume.ANY,
26
+ token: require_resume.ANY,
27
27
  amount: ANY_CLAIMED,
28
28
  isDelayed: false
29
29
  }],
@@ -31,7 +31,7 @@ const case_1_2_und_any = {
31
31
  }, {
32
32
  type: "changeQuota",
33
33
  quotaIncrease: [{
34
- token: require_sdk_accounts_intents_testing_resume.ANY,
34
+ token: require_resume.ANY,
35
35
  balance: QUOTA_INCREASE
36
36
  }],
37
37
  quotaDecrease: [],
@@ -44,17 +44,17 @@ const case_1_2_und_any = {
44
44
  * Resume: changeQuota(RWA) only.
45
45
  */
46
46
  const case_1_7_any_rwa = {
47
- claimedToken: require_sdk_accounts_intents_testing_resume.RWA_ASSET,
47
+ claimedToken: require_resume.RWA_ASSET,
48
48
  claimedAmount: RWA_CLAIMED,
49
49
  postClaimTotalValue: ADD_T1,
50
50
  postClaimDebt: ADD_D1,
51
51
  resumeOps: [{
52
52
  type: "claimDelayedWithdrawal",
53
- token: require_sdk_accounts_intents_testing_resume.RWA_ASSET,
54
- withdrawalPhantomToken: require_sdk_accounts_intents_testing_resume.RESUME_FIXTURE_PHANTOM,
53
+ token: require_resume.RWA_ASSET,
54
+ withdrawalPhantomToken: require_resume.RESUME_FIXTURE_PHANTOM,
55
55
  withdrawalTokenSpent: RWA_CLAIMED,
56
56
  outputs: [{
57
- token: require_sdk_accounts_intents_testing_resume.RWA_ASSET,
57
+ token: require_resume.RWA_ASSET,
58
58
  amount: RWA_CLAIMED,
59
59
  isDelayed: false
60
60
  }],
@@ -62,7 +62,7 @@ const case_1_7_any_rwa = {
62
62
  }, {
63
63
  type: "changeQuota",
64
64
  quotaIncrease: [{
65
- token: require_sdk_accounts_intents_testing_resume.RWA_ASSET,
65
+ token: require_resume.RWA_ASSET,
66
66
  balance: QUOTA_INCREASE
67
67
  }],
68
68
  quotaDecrease: [],
@@ -72,12 +72,12 @@ const case_1_7_any_rwa = {
72
72
  };
73
73
  /** Claimed und — no active quota-buy path. */
74
74
  const case_claimed_und = {
75
- claimedToken: require_sdk_accounts_intents_testing_resume.UND,
75
+ claimedToken: require_resume.UND,
76
76
  claimedAmount: ADD_UND,
77
77
  postClaimTotalValue: 5000000000000n,
78
78
  postClaimDebt: 4000000000000n,
79
79
  baseAssets: [{
80
- token: require_sdk_accounts_intents_testing_resume.ANY,
80
+ token: require_resume.ANY,
81
81
  balance: 98000000000000000000000n,
82
82
  quota: 0n,
83
83
  mask: 0n,
@@ -85,11 +85,11 @@ const case_claimed_und = {
85
85
  }],
86
86
  resumeOps: [{
87
87
  type: "claimDelayedWithdrawal",
88
- token: require_sdk_accounts_intents_testing_resume.UND,
89
- withdrawalPhantomToken: require_sdk_accounts_intents_testing_resume.RESUME_FIXTURE_PHANTOM,
88
+ token: require_resume.UND,
89
+ withdrawalPhantomToken: require_resume.RESUME_FIXTURE_PHANTOM,
90
90
  withdrawalTokenSpent: ADD_UND,
91
91
  outputs: [{
92
- token: require_sdk_accounts_intents_testing_resume.UND,
92
+ token: require_resume.UND,
93
93
  amount: ADD_UND,
94
94
  isDelayed: false
95
95
  }],
@@ -97,7 +97,7 @@ const case_claimed_und = {
97
97
  }]
98
98
  };
99
99
  function buildResumeAddCollateralProps(args) {
100
- return require_sdk_accounts_intents_testing_resume.buildClaimResumeProps({
100
+ return require_resume.buildClaimResumeProps({
101
101
  intent: { type: "ADD_COLLATERAL" },
102
102
  case: args.case,
103
103
  sdk: args.sdk,
@@ -106,16 +106,16 @@ function buildResumeAddCollateralProps(args) {
106
106
  }
107
107
  //#endregion
108
108
  exports.ADD_UND = ADD_UND;
109
- exports.ANY = require_sdk_accounts_intents_testing_resume.ANY;
109
+ exports.ANY = require_resume.ANY;
110
110
  exports.ANY_CLAIMED = ANY_CLAIMED;
111
111
  exports.QUOTA_INCREASE = QUOTA_INCREASE;
112
- exports.RWA_ASSET = require_sdk_accounts_intents_testing_resume.RWA_ASSET;
112
+ exports.RWA_ASSET = require_resume.RWA_ASSET;
113
113
  exports.RWA_CLAIMED = RWA_CLAIMED;
114
- exports.UND = require_sdk_accounts_intents_testing_resume.UND;
115
- exports.buildOffchainOptions = require_sdk_accounts_intents_testing_resume.buildOffchainOptions;
116
- exports.buildOnchainOptions = require_sdk_accounts_intents_testing_resume.buildOnchainOptions;
114
+ exports.UND = require_resume.UND;
115
+ exports.buildOffchainOptions = require_resume.buildOffchainOptions;
116
+ exports.buildOnchainOptions = require_resume.buildOnchainOptions;
117
117
  exports.buildResumeAddCollateralProps = buildResumeAddCollateralProps;
118
- exports.buildResumeSdk = require_sdk_accounts_intents_testing_resume.buildResumeSdk;
118
+ exports.buildResumeSdk = require_resume.buildResumeSdk;
119
119
  exports.case_1_2_und_any = case_1_2_und_any;
120
120
  exports.case_1_7_any_rwa = case_1_7_any_rwa;
121
121
  exports.case_claimed_und = case_claimed_und;
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_sdk_utils_formatter = require("../../../../../utils/formatter.js");
3
3
  require("../../../../../index.js");
4
- const require_sdk_accounts_intents_testing_resume = require("../../../testing/resume.js");
4
+ const require_resume = require("../../../testing/resume.js");
5
5
  //#region src/sdk/accounts/intents/intents/resume/close/close.fixtures.ts
6
6
  /**
7
7
  * Resume close fixtures, ported from intent-calculator
@@ -21,15 +21,15 @@ const A0_TOK = require_sdk_utils_formatter.toBN("100000", 18);
21
21
  const BASE_TOK = require_sdk_utils_formatter.toBN("100000", 18);
22
22
  /** Wallet recipient of the close withdraw (legacy `mockAccount`). */
23
23
  const CLOSE_TO = "0x1234567890123456789012345678901234567890";
24
- const rwaUnderlyingMeta = { asset: require_sdk_accounts_intents_testing_resume.RWA_ASSET };
24
+ const rwaUnderlyingMeta = { asset: require_resume.RWA_ASSET };
25
25
  /** Resume: claim first, then same close op as full flow. */
26
26
  const closeResumeOps = [{
27
27
  type: "claimDelayedWithdrawal",
28
- token: require_sdk_accounts_intents_testing_resume.UND,
29
- withdrawalPhantomToken: require_sdk_accounts_intents_testing_resume.RESUME_FIXTURE_PHANTOM,
28
+ token: require_resume.UND,
29
+ withdrawalPhantomToken: require_resume.RESUME_FIXTURE_PHANTOM,
30
30
  withdrawalTokenSpent: 0n,
31
31
  outputs: [{
32
- token: require_sdk_accounts_intents_testing_resume.UND,
32
+ token: require_resume.UND,
33
33
  amount: 0n,
34
34
  isDelayed: false
35
35
  }],
@@ -48,7 +48,7 @@ const closePreviewState = {
48
48
  underlyingBalance: CLOSE_EQUITY
49
49
  };
50
50
  function buildCloseSdk(args) {
51
- return require_sdk_accounts_intents_testing_resume.buildResumeSdk({ claimedToken: args.claimedToken }, {
51
+ return require_resume.buildResumeSdk({ claimedToken: args.claimedToken }, {
52
52
  closePath: args.closePath,
53
53
  rwaAssets: args.rwaAssets
54
54
  });
@@ -58,10 +58,10 @@ function buildCloseResumeProps(args) {
58
58
  const claimedToken = args.claimedToken ?? "0x3333333333333333333333333333333333333333";
59
59
  const claimedAmount = args.claimedAmount ?? 0n;
60
60
  const creditAccount = {
61
- creditAccount: require_sdk_accounts_intents_testing_resume.CREDIT_ACCOUNT,
62
- creditManager: require_sdk_accounts_intents_testing_resume.CREDIT_MANAGER,
63
- creditFacade: require_sdk_accounts_intents_testing_resume.CREDIT_FACADE,
64
- underlying: require_sdk_accounts_intents_testing_resume.UND,
61
+ creditAccount: require_resume.CREDIT_ACCOUNT,
62
+ creditManager: require_resume.CREDIT_MANAGER,
63
+ creditFacade: require_resume.CREDIT_FACADE,
64
+ underlying: require_resume.UND,
65
65
  enabledTokensMask: 0n,
66
66
  totalDebtUSD: 0n,
67
67
  accountDebt: CLOSE_D0,
@@ -73,7 +73,7 @@ function buildCloseResumeProps(args) {
73
73
  success: true
74
74
  }, {
75
75
  token: "0x1111111111111111111111111111111111111111",
76
- balance: claimedToken === "0x3333333333333333333333333333333333333333" ? BASE_TOK : BASE_TOK - require_sdk_accounts_intents_testing_resume.claimedValueInUnd(claimedAmount, claimedToken) * 20000000000n,
76
+ balance: claimedToken === "0x3333333333333333333333333333333333333333" ? BASE_TOK : BASE_TOK - require_resume.claimedValueInUnd(claimedAmount, claimedToken) * 20000000000n,
77
77
  quota: 0n,
78
78
  mask: 0n,
79
79
  success: true
@@ -98,11 +98,11 @@ exports.CLOSE_D0 = CLOSE_D0;
98
98
  exports.CLOSE_EQUITY = CLOSE_EQUITY;
99
99
  exports.CLOSE_T0 = CLOSE_T0;
100
100
  exports.CLOSE_TO = CLOSE_TO;
101
- exports.CREDIT_ACCOUNT = require_sdk_accounts_intents_testing_resume.CREDIT_ACCOUNT;
101
+ exports.CREDIT_ACCOUNT = require_resume.CREDIT_ACCOUNT;
102
102
  exports.buildCloseResumeProps = buildCloseResumeProps;
103
103
  exports.buildCloseSdk = buildCloseSdk;
104
- exports.buildOffchainOptions = require_sdk_accounts_intents_testing_resume.buildOffchainOptions;
105
- exports.buildOnchainOptions = require_sdk_accounts_intents_testing_resume.buildOnchainOptions;
104
+ exports.buildOffchainOptions = require_resume.buildOffchainOptions;
105
+ exports.buildOnchainOptions = require_resume.buildOnchainOptions;
106
106
  exports.closePreviewState = closePreviewState;
107
107
  exports.closeResumeOps = closeResumeOps;
108
108
  exports.rwaUnderlyingMeta = rwaUnderlyingMeta;
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sdk_accounts_intents_testing_sdk_mock = require("../../../testing/sdk-mock.js");
3
- const require_sdk_accounts_intents_testing_resume = require("../../../testing/resume.js");
2
+ const require_sdk_mock = require("../../../testing/sdk-mock.js");
3
+ const require_resume = require("../../../testing/resume.js");
4
4
  //#region src/sdk/accounts/intents/intents/resume/decrease-leverage/decrease-leverage.fixtures.ts
5
5
  /**
6
6
  * Resume decrease-leverage fixtures, ported from intent-calculator
@@ -19,7 +19,7 @@ const DECREASE_PRE_D = 4000000000000n;
19
19
  const DECREASE_PRE_T = 5000000000000n;
20
20
  const PHANTOM = "0xb1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1";
21
21
  function buildDecreaseSdk(args) {
22
- return require_sdk_accounts_intents_testing_resume.buildResumeSdk({ claimedToken: args.claimedToken }, {
22
+ return require_resume.buildResumeSdk({ claimedToken: args.claimedToken }, {
23
23
  rwaAssets: args.rwaAssets,
24
24
  phantom: PHANTOM
25
25
  });
@@ -29,7 +29,7 @@ function buildDecreaseOffchainOptions(args) {
29
29
  kind: "offchain",
30
30
  phantomSpent: args.claimedAmount,
31
31
  withdrawalConfig: {
32
- creditManager: require_sdk_accounts_intents_testing_resume.CREDIT_MANAGER,
32
+ creditManager: require_resume.CREDIT_MANAGER,
33
33
  token: args.claimedToken,
34
34
  withdrawalPhantomToken: PHANTOM,
35
35
  underlying: args.claimedToken,
@@ -49,7 +49,7 @@ function buildDecreaseOnchainOptions(args) {
49
49
  amount: args.claimedAmount,
50
50
  isDelayed: false
51
51
  }],
52
- claimCalls: [require_sdk_accounts_intents_testing_sdk_mock.MOCK_CLAIM_CALL]
52
+ claimCalls: [require_sdk_mock.MOCK_CLAIM_CALL]
53
53
  }
54
54
  };
55
55
  }
@@ -57,10 +57,10 @@ function buildDecreaseResumeProps(args) {
57
57
  return {
58
58
  intent: { type: "DECREASE_LEVERAGE" },
59
59
  creditAccount: {
60
- creditAccount: require_sdk_accounts_intents_testing_resume.CREDIT_ACCOUNT,
61
- creditManager: require_sdk_accounts_intents_testing_resume.CREDIT_MANAGER,
62
- creditFacade: require_sdk_accounts_intents_testing_resume.CREDIT_FACADE,
63
- underlying: require_sdk_accounts_intents_testing_resume.UND,
60
+ creditAccount: require_resume.CREDIT_ACCOUNT,
61
+ creditManager: require_resume.CREDIT_MANAGER,
62
+ creditFacade: require_resume.CREDIT_FACADE,
63
+ underlying: require_resume.UND,
64
64
  enabledTokensMask: 0n,
65
65
  totalDebtUSD: 0n,
66
66
  accountDebt: DECREASE_PRE_D,
@@ -112,7 +112,7 @@ function buildDecreaseOnchainResumeProps(args) {
112
112
  });
113
113
  }
114
114
  //#endregion
115
- exports.ANY = require_sdk_accounts_intents_testing_resume.ANY;
115
+ exports.ANY = require_resume.ANY;
116
116
  exports.DECREASE_AMOUNT_S = DECREASE_AMOUNT_S;
117
117
  exports.DECREASE_POST_D = DECREASE_POST_D;
118
118
  exports.DECREASE_POST_T = DECREASE_POST_T;
@@ -120,8 +120,8 @@ exports.DECREASE_PRE_D = DECREASE_PRE_D;
120
120
  exports.DECREASE_PRE_T = DECREASE_PRE_T;
121
121
  exports.DECREASE_REPAY = DECREASE_REPAY;
122
122
  exports.PHANTOM = PHANTOM;
123
- exports.RWA_ASSET = require_sdk_accounts_intents_testing_resume.RWA_ASSET;
124
- exports.UND = require_sdk_accounts_intents_testing_resume.UND;
123
+ exports.RWA_ASSET = require_resume.RWA_ASSET;
124
+ exports.UND = require_resume.UND;
125
125
  exports.buildDecreaseOffchainOptions = buildDecreaseOffchainOptions;
126
126
  exports.buildDecreaseOffchainResumeProps = buildDecreaseOffchainResumeProps;
127
127
  exports.buildDecreaseOnchainOptions = buildDecreaseOnchainOptions;
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sdk_accounts_intents_testing_resume = require("../../../testing/resume.js");
2
+ const require_resume = require("../../../testing/resume.js");
3
3
  //#region src/sdk/accounts/intents/intents/resume/deposit/deposit.fixtures.ts
4
4
  /** Shared op amounts from deposit.flow (fixed-L collateral-up). */
5
5
  const DEPOSIT_ADD_UND = 100000000000n;
@@ -15,17 +15,17 @@ const DEPOSIT_D1 = 4400000000000n;
15
15
  * Resume: changeQuota only
16
16
  */
17
17
  const case_b_und_any = {
18
- claimedToken: require_sdk_accounts_intents_testing_resume.ANY,
18
+ claimedToken: require_resume.ANY,
19
19
  claimedAmount: ANY_SWAP_OUT,
20
20
  postClaimTotalValue: DEPOSIT_T1,
21
21
  postClaimDebt: DEPOSIT_D1,
22
22
  resumeOps: [{
23
23
  type: "claimDelayedWithdrawal",
24
- token: require_sdk_accounts_intents_testing_resume.ANY,
25
- withdrawalPhantomToken: require_sdk_accounts_intents_testing_resume.RESUME_FIXTURE_PHANTOM,
24
+ token: require_resume.ANY,
25
+ withdrawalPhantomToken: require_resume.RESUME_FIXTURE_PHANTOM,
26
26
  withdrawalTokenSpent: ANY_SWAP_OUT,
27
27
  outputs: [{
28
- token: require_sdk_accounts_intents_testing_resume.ANY,
28
+ token: require_resume.ANY,
29
29
  amount: ANY_SWAP_OUT,
30
30
  isDelayed: false
31
31
  }],
@@ -33,7 +33,7 @@ const case_b_und_any = {
33
33
  }, {
34
34
  type: "changeQuota",
35
35
  quotaIncrease: [{
36
- token: require_sdk_accounts_intents_testing_resume.ANY,
36
+ token: require_resume.ANY,
37
37
  balance: QUOTA_INCREASE
38
38
  }],
39
39
  quotaDecrease: [],
@@ -47,17 +47,17 @@ const case_b_und_any = {
47
47
  * Resume: changeQuota only
48
48
  */
49
49
  const case_b_und_rwa = {
50
- claimedToken: require_sdk_accounts_intents_testing_resume.RWA_ASSET,
50
+ claimedToken: require_resume.RWA_ASSET,
51
51
  claimedAmount: RWA_CLAIMED,
52
52
  postClaimTotalValue: DEPOSIT_T1,
53
53
  postClaimDebt: DEPOSIT_D1,
54
54
  resumeOps: [{
55
55
  type: "claimDelayedWithdrawal",
56
- token: require_sdk_accounts_intents_testing_resume.RWA_ASSET,
57
- withdrawalPhantomToken: require_sdk_accounts_intents_testing_resume.RESUME_FIXTURE_PHANTOM,
56
+ token: require_resume.RWA_ASSET,
57
+ withdrawalPhantomToken: require_resume.RESUME_FIXTURE_PHANTOM,
58
58
  withdrawalTokenSpent: RWA_CLAIMED,
59
59
  outputs: [{
60
- token: require_sdk_accounts_intents_testing_resume.RWA_ASSET,
60
+ token: require_resume.RWA_ASSET,
61
61
  amount: RWA_CLAIMED,
62
62
  isDelayed: false
63
63
  }],
@@ -65,7 +65,7 @@ const case_b_und_rwa = {
65
65
  }, {
66
66
  type: "changeQuota",
67
67
  quotaIncrease: [{
68
- token: require_sdk_accounts_intents_testing_resume.RWA_ASSET,
68
+ token: require_resume.RWA_ASSET,
69
69
  balance: QUOTA_INCREASE
70
70
  }],
71
71
  quotaDecrease: [],
@@ -75,12 +75,12 @@ const case_b_und_rwa = {
75
75
  };
76
76
  /** Claimed und — no active quota-buy path. */
77
77
  const case_claimed_und = {
78
- claimedToken: require_sdk_accounts_intents_testing_resume.UND,
78
+ claimedToken: require_resume.UND,
79
79
  claimedAmount: DEPOSIT_ADD_UND,
80
80
  postClaimTotalValue: 5000000000000n,
81
81
  postClaimDebt: 4000000000000n,
82
82
  baseAssets: [{
83
- token: require_sdk_accounts_intents_testing_resume.ANY,
83
+ token: require_resume.ANY,
84
84
  balance: 98000000000000000000000n,
85
85
  quota: 0n,
86
86
  mask: 0n,
@@ -88,11 +88,11 @@ const case_claimed_und = {
88
88
  }],
89
89
  resumeOps: [{
90
90
  type: "claimDelayedWithdrawal",
91
- token: require_sdk_accounts_intents_testing_resume.UND,
92
- withdrawalPhantomToken: require_sdk_accounts_intents_testing_resume.RESUME_FIXTURE_PHANTOM,
91
+ token: require_resume.UND,
92
+ withdrawalPhantomToken: require_resume.RESUME_FIXTURE_PHANTOM,
93
93
  withdrawalTokenSpent: DEPOSIT_ADD_UND,
94
94
  outputs: [{
95
- token: require_sdk_accounts_intents_testing_resume.UND,
95
+ token: require_resume.UND,
96
96
  amount: DEPOSIT_ADD_UND,
97
97
  isDelayed: false
98
98
  }],
@@ -100,7 +100,7 @@ const case_claimed_und = {
100
100
  }]
101
101
  };
102
102
  function buildResumeDepositProps(args) {
103
- return require_sdk_accounts_intents_testing_resume.buildClaimResumeProps({
103
+ return require_resume.buildClaimResumeProps({
104
104
  intent: args.delayedIntent,
105
105
  case: args.case,
106
106
  sdk: args.sdk,
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sdk_accounts_intents_testing_resume = require("../../../testing/resume.js");
2
+ const require_resume = require("../../../testing/resume.js");
3
3
  //#region src/sdk/accounts/intents/intents/resume/increase-leverage/increase-leverage.fixtures.ts
4
4
  /**
5
5
  * Resume increase-leverage fixtures, ported from intent-calculator
@@ -21,17 +21,17 @@ const INCREASE_POST_D = 5000000000000n;
21
21
  * Resume: claim → changeQuota(any)
22
22
  */
23
23
  const case_2_1_any = {
24
- claimedToken: require_sdk_accounts_intents_testing_resume.ANY,
24
+ claimedToken: require_resume.ANY,
25
25
  claimedAmount: ANY_SWAP_AMOUNT_OUT,
26
26
  postClaimTotalValue: INCREASE_POST_T,
27
27
  postClaimDebt: INCREASE_POST_D,
28
28
  resumeOps: [{
29
29
  type: "claimDelayedWithdrawal",
30
- token: require_sdk_accounts_intents_testing_resume.ANY,
31
- withdrawalPhantomToken: require_sdk_accounts_intents_testing_resume.RESUME_FIXTURE_PHANTOM,
30
+ token: require_resume.ANY,
31
+ withdrawalPhantomToken: require_resume.RESUME_FIXTURE_PHANTOM,
32
32
  withdrawalTokenSpent: ANY_SWAP_AMOUNT_OUT,
33
33
  outputs: [{
34
- token: require_sdk_accounts_intents_testing_resume.ANY,
34
+ token: require_resume.ANY,
35
35
  amount: ANY_SWAP_AMOUNT_OUT,
36
36
  isDelayed: false
37
37
  }],
@@ -39,7 +39,7 @@ const case_2_1_any = {
39
39
  }, {
40
40
  type: "changeQuota",
41
41
  quotaIncrease: [{
42
- token: require_sdk_accounts_intents_testing_resume.ANY,
42
+ token: require_resume.ANY,
43
43
  balance: QUOTA_INCREASE
44
44
  }],
45
45
  quotaDecrease: [],
@@ -52,17 +52,17 @@ const case_2_1_any = {
52
52
  * Resume: claim(asset) → changeQuota(asset)
53
53
  */
54
54
  const case_1_2_asset_rwa = {
55
- claimedToken: require_sdk_accounts_intents_testing_resume.RWA_ASSET,
55
+ claimedToken: require_resume.RWA_ASSET,
56
56
  claimedAmount: INCREASE_DEBT_AMOUNT,
57
57
  postClaimTotalValue: INCREASE_POST_T,
58
58
  postClaimDebt: INCREASE_POST_D,
59
59
  resumeOps: [{
60
60
  type: "claimDelayedWithdrawal",
61
- token: require_sdk_accounts_intents_testing_resume.RWA_ASSET,
62
- withdrawalPhantomToken: require_sdk_accounts_intents_testing_resume.RESUME_FIXTURE_PHANTOM,
61
+ token: require_resume.RWA_ASSET,
62
+ withdrawalPhantomToken: require_resume.RESUME_FIXTURE_PHANTOM,
63
63
  withdrawalTokenSpent: INCREASE_DEBT_AMOUNT,
64
64
  outputs: [{
65
- token: require_sdk_accounts_intents_testing_resume.RWA_ASSET,
65
+ token: require_resume.RWA_ASSET,
66
66
  amount: INCREASE_DEBT_AMOUNT,
67
67
  isDelayed: false
68
68
  }],
@@ -70,7 +70,7 @@ const case_1_2_asset_rwa = {
70
70
  }, {
71
71
  type: "changeQuota",
72
72
  quotaIncrease: [{
73
- token: require_sdk_accounts_intents_testing_resume.RWA_ASSET,
73
+ token: require_resume.RWA_ASSET,
74
74
  balance: QUOTA_INCREASE
75
75
  }],
76
76
  quotaDecrease: [],
@@ -78,7 +78,7 @@ const case_1_2_asset_rwa = {
78
78
  }]
79
79
  };
80
80
  function buildResumeIncreaseLeverageProps(args) {
81
- return require_sdk_accounts_intents_testing_resume.buildClaimResumeProps({
81
+ return require_resume.buildClaimResumeProps({
82
82
  intent: { type: "INCREASE_LEVERAGE" },
83
83
  case: args.case,
84
84
  sdk: args.sdk,
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_sdk_utils_formatter = require("../../../../../utils/formatter.js");
3
3
  require("../../../../../index.js");
4
- const require_sdk_accounts_intents_testing_sdk_mock = require("../../../testing/sdk-mock.js");
5
- const require_sdk_accounts_intents_testing_resume = require("../../../testing/resume.js");
4
+ const require_sdk_mock = require("../../../testing/sdk-mock.js");
5
+ const require_resume = require("../../../testing/resume.js");
6
6
  //#region src/sdk/accounts/intents/intents/resume/withdraw/withdraw.fixtures.ts
7
7
  /**
8
8
  * Resume withdraw fixtures, ported from intent-calculator
@@ -33,7 +33,7 @@ function withdrawAmountFor(token) {
33
33
  return WITHDRAW_ANY2;
34
34
  }
35
35
  function buildWithdrawSdk(args) {
36
- return require_sdk_accounts_intents_testing_resume.buildResumeSdk({ claimedToken: args.claimedToken }, {
36
+ return require_resume.buildResumeSdk({ claimedToken: args.claimedToken }, {
37
37
  extraPrices: args.extraPrices,
38
38
  extraDecimals: args.extraDecimals,
39
39
  rwaAssets: args.rwaAssets,
@@ -45,7 +45,7 @@ function buildWithdrawOffchainOptions(args) {
45
45
  kind: "offchain",
46
46
  phantomSpent: args.claimedAmount,
47
47
  withdrawalConfig: {
48
- creditManager: require_sdk_accounts_intents_testing_resume.CREDIT_MANAGER,
48
+ creditManager: require_resume.CREDIT_MANAGER,
49
49
  token: args.claimedToken,
50
50
  withdrawalPhantomToken: PHANTOM,
51
51
  underlying: args.claimedToken,
@@ -65,16 +65,16 @@ function buildWithdrawOnchainOptions(args) {
65
65
  amount: args.claimedAmount,
66
66
  isDelayed: false
67
67
  }],
68
- claimCalls: [require_sdk_accounts_intents_testing_sdk_mock.MOCK_CLAIM_CALL]
68
+ claimCalls: [require_sdk_mock.MOCK_CLAIM_CALL]
69
69
  }
70
70
  };
71
71
  }
72
72
  function buildWithdrawResumeProps(args) {
73
73
  const creditAccount = {
74
- creditAccount: require_sdk_accounts_intents_testing_resume.CREDIT_ACCOUNT,
75
- creditManager: require_sdk_accounts_intents_testing_resume.CREDIT_MANAGER,
76
- creditFacade: require_sdk_accounts_intents_testing_resume.CREDIT_FACADE,
77
- underlying: require_sdk_accounts_intents_testing_resume.UND,
74
+ creditAccount: require_resume.CREDIT_ACCOUNT,
75
+ creditManager: require_resume.CREDIT_MANAGER,
76
+ creditFacade: require_resume.CREDIT_FACADE,
77
+ underlying: require_resume.UND,
78
78
  enabledTokensMask: 0n,
79
79
  totalDebtUSD: 0n,
80
80
  accountDebt: WITHDRAW_PRE_D,
@@ -1,19 +1,6 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
1
  const require_sdk_utils_formatter = require("../../../utils/formatter.js");
3
2
  require("../../../index.js");
4
- const require_sdk_accounts_intents_testing_sdk_mock = require("./sdk-mock.js");
5
- //#region src/sdk/accounts/intents/testing/resume.ts
6
- /**
7
- * Shared kit for claim-only resume fixtures (add collateral, increase
8
- * leverage, deposit, deposit+increase).
9
- *
10
- * Unlike the legacy props (which echoed `creditAccount.totalValue`), the
11
- * service computes totalValue from CA token balances via the price oracle.
12
- * Each case's base balance is therefore `postClaimTotalValue − claimed value
13
- * in UND`, so the derived totalValue matches the legacy expectation exactly.
14
- */
15
- const UND_DECIMALS = 8;
16
- const TOK_DECIMALS = 18;
3
+ const require_sdk_mock = require("./sdk-mock.js");
17
4
  const UND = "0x3333333333333333333333333333333333333333";
18
5
  const ANY = "0x1111111111111111111111111111111111111111";
19
6
  const ANY2 = "0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
@@ -73,7 +60,7 @@ function claimedValueInUnd(amount, token) {
73
60
  */
74
61
  function buildResumeSdk(c, extras) {
75
62
  const phantom = extras?.phantom ?? "0xcccccccccccccccccccccccccccccccccccccccc";
76
- return require_sdk_accounts_intents_testing_sdk_mock.buildMockSdk({
63
+ return require_sdk_mock.buildMockSdk({
77
64
  prices: {
78
65
  ...PRICES,
79
66
  ...extras?.extraPrices
@@ -118,7 +105,7 @@ function buildOnchainOptions(c) {
118
105
  amount: c.claimedAmount,
119
106
  isDelayed: false
120
107
  }],
121
- claimCalls: [require_sdk_accounts_intents_testing_sdk_mock.MOCK_CLAIM_CALL]
108
+ claimCalls: [require_sdk_mock.MOCK_CLAIM_CALL]
122
109
  }
123
110
  };
124
111
  }
@@ -162,9 +149,7 @@ exports.CREDIT_FACADE = CREDIT_FACADE;
162
149
  exports.CREDIT_MANAGER = CREDIT_MANAGER;
163
150
  exports.RESUME_FIXTURE_PHANTOM = RESUME_FIXTURE_PHANTOM;
164
151
  exports.RWA_ASSET = RWA_ASSET;
165
- exports.TOK_DECIMALS = TOK_DECIMALS;
166
152
  exports.UND = UND;
167
- exports.UND_DECIMALS = UND_DECIMALS;
168
153
  exports.buildClaimResumeProps = buildClaimResumeProps;
169
154
  exports.buildOffchainOptions = buildOffchainOptions;
170
155
  exports.buildOnchainOptions = buildOnchainOptions;
@@ -1,4 +1,3 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
1
  let vitest = require("vitest");
3
2
  //#region src/sdk/accounts/intents/testing/sdk-mock.ts
4
3
  /**
@@ -3,16 +3,17 @@ const require_sdk_constants_math = require("../constants/math.js");
3
3
  //#region src/sdk/positions/calcTimeToLiquidationMs.ts
4
4
  /**
5
5
  * Estimated milliseconds until `healthFactorBps` decays to `10000` (1.0)
6
- * while the debt grows at `totalBorrowRateOnDebt` (basis points relative to
7
- * the debt, as {@link BorrowRateBreakdown.totalOnDebt} reports it).
6
+ * while the debt grows at `totalBorrowRateOnDebt`, in the same `Bps` scale
7
+ * (`10000` = 100%) as {@link BorrowRateBreakdown.totalOnDebt} reports it
8
+ * not the legacy `PERCENTAGE_FACTOR_1KK` (`1_000_000` = 100%) scale the
9
+ * pre-rewrite frontend fed into its own `getTimeToLiquidation`.
8
10
  *
9
11
  * `null` when the account is already at or under the liquidation threshold,
10
- * or when the debt carries no borrow rate at all. Formula is in parity with
11
- * the legacy `getTimeToLiquidation`.
12
+ * or when the debt carries no borrow rate at all.
12
13
  **/
13
14
  function calcTimeToLiquidationMs(healthFactorBps, totalBorrowRateOnDebt) {
14
15
  if (BigInt(healthFactorBps) <= 10000n || totalBorrowRateOnDebt === 0n) return null;
15
- return (BigInt(healthFactorBps) - require_sdk_constants_math.PERCENTAGE_FACTOR) * (BigInt(require_sdk_constants_math.SECONDS_PER_YEAR) * require_sdk_constants_math.PERCENTAGE_FACTOR * require_sdk_constants_math.PERCENTAGE_DECIMALS / totalBorrowRateOnDebt) * 1000n / require_sdk_constants_math.PERCENTAGE_FACTOR;
16
+ return (BigInt(healthFactorBps) - require_sdk_constants_math.PERCENTAGE_FACTOR) * (BigInt(require_sdk_constants_math.SECONDS_PER_YEAR) * require_sdk_constants_math.PERCENTAGE_FACTOR / totalBorrowRateOnDebt) * 1000n / require_sdk_constants_math.PERCENTAGE_FACTOR;
16
17
  }
17
18
  //#endregion
18
19
  exports.calcTimeToLiquidationMs = calcTimeToLiquidationMs;
@@ -7,7 +7,9 @@ import { calcTimeToLiquidationMs } from "../../../sdk/positions/calcTimeToLiquid
7
7
  * and returns a millisecond duration until `healthFactor` decays to `1.0`
8
8
  * (`PERCENTAGE_FACTOR` in internal scale).
9
9
  *
10
- * @param props Current health factor and `totalBorrowRate * debt` term.
10
+ * @param props Current health factor and `totalBorrowRate_debt`, both `Bps`
11
+ * (`10000` = 100%) — not the legacy `PERCENTAGE_FACTOR_1KK` (`1_000_000` =
12
+ * 100%) scale the pre-rewrite frontend fed this under the same name.
11
13
  * @returns Milliseconds to liquidation as `bigint`, or `null` when already at/under
12
14
  * liquidation threshold or when borrow-rate exposure is zero.
13
15
  *
@@ -1,9 +1,9 @@
1
+ import { ierc20Abi } from "../abi/iERC20.js";
1
2
  import { iCreditFacadeV310Abi } from "../abi/310/generated.js";
2
3
  import { AddressMap } from "../sdk/utils/AddressMap.js";
3
4
  import { AddressSet } from "../sdk/utils/AddressSet.js";
4
5
  import { AssetsMap } from "../sdk/utils/AssetsMap.js";
5
6
  import { childLogger } from "../sdk/utils/childLogger.js";
6
- import { ierc20Abi } from "../abi/iERC20.js";
7
7
  import "../sdk/constants/addresses.js";
8
8
  import { MAX_UINT256, PERCENTAGE_FACTOR } from "../sdk/constants/math.js";
9
9
  import { SDKConstruct } from "../sdk/base/SDKConstruct.js";
@@ -1,6 +1,6 @@
1
+ import { iWithdrawalCompressorV313Abi } from "../abi/IWithdrawalCompressorV313.js";
1
2
  import { getNetworkType } from "../sdk/chain/chains.js";
2
3
  import { getWithdrawalCompressorAddress } from "../sdk/accounts/withdrawal-compressor/addresses.js";
3
- import { iWithdrawalCompressorV313Abi } from "../abi/IWithdrawalCompressorV313.js";
4
4
  import "../sdk/index.js";
5
5
  import { iMidasDataFeedAbi, iMidasRedemptionVaultAbi, midasGatewayAbi, midasRedeemerAbi, midasRedemptionVaultPhantomTokenAbi, securitizeRedeemerAbi, securitizeRedemptionGatewayAbi, securitizeRedemptionPhantomTokenAbi } from "./withdrawalAbi.js";
6
6
  import { erc20Abi, hexToString, parseAbi, parseEther } from "viem";
@@ -1,5 +1,5 @@
1
- import { MissingSerializedParamsError } from "../../../sdk/base/errors.js";
2
1
  import { ierc4626AdapterAbi } from "../../../abi/ierc4626Adapter.js";
2
+ import { MissingSerializedParamsError } from "../../../sdk/base/errors.js";
3
3
  import "../../../sdk/index.js";
4
4
  import { fnSigToName, swapFromTransfers } from "../transferHelpers.js";
5
5
  import { AbstractAdapterContract } from "./AbstractAdapter.js";
@@ -1,5 +1,5 @@
1
- import { iPoolV310Abi } from "../../abi/310/generated.js";
2
1
  import { iZapperAbi } from "../../abi/iZapper.js";
2
+ import { iPoolV310Abi } from "../../abi/310/generated.js";
3
3
  import { asPreviewSimulationError } from "./errors.js";
4
4
  //#region src/preview/simulate/simulatePoolOperation.ts
5
5
  function previewRead(operation) {
@@ -1,6 +1,6 @@
1
+ import { ierc20Abi } from "../../abi/iERC20.js";
1
2
  import { iCreditFacadeV310Abi } from "../../abi/310/generated.js";
2
3
  import { AddressMap } from "../../sdk/utils/AddressMap.js";
3
- import { ierc20Abi } from "../../abi/iERC20.js";
4
4
  import "../../sdk/index.js";
5
5
  import { UnexpectedFacadeEventOrderError } from "./errors.js";
6
6
  import { getAddress, isAddressEqual, parseEventLogs } from "viem";