@gearbox-protocol/sdk 14.12.0-next.22 → 14.12.0-next.24
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/abi/IWithdrawalCompressorV313.js +2 -1
- package/dist/cjs/abi/compressors/withdrawalCompressor.js +2 -1
- package/dist/cjs/plugins/adapters/contracts/AbstractAdapter.js +31 -9
- package/dist/cjs/plugins/adapters/contracts/AbstractCurveAdapter.js +8 -5
- package/dist/cjs/plugins/adapters/contracts/BalancerV3RouterAdapterContract.js +6 -4
- package/dist/cjs/plugins/adapters/contracts/BalancerV3WrapperAdapterContract.js +6 -4
- package/dist/cjs/plugins/adapters/contracts/CamelotV3AdapterContract.js +6 -9
- package/dist/cjs/plugins/adapters/contracts/ConvexV1BaseRewardPoolAdapterContract.js +7 -5
- package/dist/cjs/plugins/adapters/contracts/ConvexV1BoosterAdapterContract.js +6 -4
- package/dist/cjs/plugins/adapters/contracts/DaiUsdsAdapterContract.js +6 -4
- package/dist/cjs/plugins/adapters/contracts/ERC4626AdapterContract.js +13 -4
- package/dist/cjs/plugins/adapters/contracts/ERC4626ReferralAdapterContract.js +6 -4
- package/dist/cjs/plugins/adapters/contracts/FluidDexAdapterContract.js +8 -8
- package/dist/cjs/plugins/adapters/contracts/InfinifiGatewayAdapterContract.js +8 -5
- package/dist/cjs/plugins/adapters/contracts/KelpLRTDepositPoolAdapterContract.js +4 -3
- package/dist/cjs/plugins/adapters/contracts/LidoV1AdapterContract.js +4 -3
- package/dist/cjs/plugins/adapters/contracts/MellowClaimerAdapterContract.js +29 -0
- package/dist/cjs/plugins/adapters/contracts/MellowDVVAdapterContract.js +6 -4
- package/dist/cjs/plugins/adapters/contracts/MellowERC4626VaultAdapterContract.js +11 -4
- package/dist/cjs/plugins/adapters/contracts/MellowWrapperAdapterContract.js +4 -3
- package/dist/cjs/plugins/adapters/contracts/MidasGatewayAdapterContract.js +31 -4
- package/dist/cjs/plugins/adapters/contracts/MidasIssuanceVaultAdapterContract.js +4 -3
- package/dist/cjs/plugins/adapters/contracts/MidasRedemptionVaultAdapterContract.js +4 -3
- package/dist/cjs/plugins/adapters/contracts/PendleRouterAdapterContract.js +14 -16
- package/dist/cjs/plugins/adapters/contracts/SecuritizeOnRampAdapterContract.js +4 -3
- package/dist/cjs/plugins/adapters/contracts/SecuritizeRedemptionGatewayAdapterContract.js +14 -13
- package/dist/cjs/plugins/adapters/contracts/StakingRewardsAdapterContract.js +7 -5
- package/dist/cjs/plugins/adapters/contracts/TraderJoeRouterAdapterContract.js +4 -3
- package/dist/cjs/plugins/adapters/contracts/UniswapV2AdapterContract.js +4 -3
- package/dist/cjs/plugins/adapters/contracts/UniswapV3AdapterContract.js +6 -9
- package/dist/cjs/plugins/adapters/contracts/UniswapV4AdapterContract.js +8 -8
- package/dist/cjs/plugins/adapters/contracts/UpshiftVaultAdapterContract.js +6 -4
- package/dist/cjs/plugins/adapters/contracts/VelodromeV2AdapterContract.js +4 -3
- package/dist/cjs/plugins/adapters/contracts/WstETHV1AdapterContract.js +6 -4
- package/dist/cjs/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.js +1 -5
- package/dist/cjs/preview/preview/applyInnerOperations.js +83 -58
- package/dist/cjs/preview/preview/applyQuotaChanges.js +43 -0
- package/dist/cjs/preview/preview/errors.js +0 -16
- package/dist/cjs/preview/preview/index.js +2 -0
- package/dist/cjs/preview/preview/previewAdjustCreditAccount.js +19 -8
- package/dist/cjs/preview/preview/previewCloseOrRepayCreditAccount.js +18 -7
- package/dist/cjs/preview/preview/previewOpenCreditAccount.js +18 -6
- package/dist/cjs/preview/preview/types.js +30 -0
- package/dist/cjs/preview/preview/unwrapNativeCollateral.js +10 -4
- package/dist/cjs/sdk/OnchainSDK.js +3 -6
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +2 -4
- package/dist/cjs/sdk/accounts/withdrawal-compressor/AbstractWithdrawalCompressorContract.js +14 -22
- package/dist/cjs/sdk/accounts/withdrawal-compressor/addresses.js +6 -18
- package/dist/cjs/sdk/accounts/withdrawal-compressor/createWithdrawalCompressor.js +3 -5
- package/dist/esm/abi/IWithdrawalCompressorV313.js +2 -1
- package/dist/esm/abi/compressors/withdrawalCompressor.js +2 -1
- package/dist/esm/plugins/adapters/contracts/AbstractAdapter.js +31 -9
- package/dist/esm/plugins/adapters/contracts/AbstractCurveAdapter.js +8 -5
- package/dist/esm/plugins/adapters/contracts/BalancerV3RouterAdapterContract.js +6 -4
- package/dist/esm/plugins/adapters/contracts/BalancerV3WrapperAdapterContract.js +6 -4
- package/dist/esm/plugins/adapters/contracts/CamelotV3AdapterContract.js +6 -9
- package/dist/esm/plugins/adapters/contracts/ConvexV1BaseRewardPoolAdapterContract.js +7 -5
- package/dist/esm/plugins/adapters/contracts/ConvexV1BoosterAdapterContract.js +6 -4
- package/dist/esm/plugins/adapters/contracts/DaiUsdsAdapterContract.js +6 -4
- package/dist/esm/plugins/adapters/contracts/ERC4626AdapterContract.js +13 -4
- package/dist/esm/plugins/adapters/contracts/ERC4626ReferralAdapterContract.js +6 -4
- package/dist/esm/plugins/adapters/contracts/FluidDexAdapterContract.js +8 -8
- package/dist/esm/plugins/adapters/contracts/InfinifiGatewayAdapterContract.js +8 -5
- package/dist/esm/plugins/adapters/contracts/KelpLRTDepositPoolAdapterContract.js +4 -3
- package/dist/esm/plugins/adapters/contracts/LidoV1AdapterContract.js +4 -3
- package/dist/esm/plugins/adapters/contracts/MellowClaimerAdapterContract.js +32 -1
- package/dist/esm/plugins/adapters/contracts/MellowDVVAdapterContract.js +6 -4
- package/dist/esm/plugins/adapters/contracts/MellowERC4626VaultAdapterContract.js +11 -4
- package/dist/esm/plugins/adapters/contracts/MellowWrapperAdapterContract.js +4 -3
- package/dist/esm/plugins/adapters/contracts/MidasGatewayAdapterContract.js +33 -5
- package/dist/esm/plugins/adapters/contracts/MidasIssuanceVaultAdapterContract.js +4 -3
- package/dist/esm/plugins/adapters/contracts/MidasRedemptionVaultAdapterContract.js +4 -3
- package/dist/esm/plugins/adapters/contracts/PendleRouterAdapterContract.js +14 -16
- package/dist/esm/plugins/adapters/contracts/SecuritizeOnRampAdapterContract.js +4 -3
- package/dist/esm/plugins/adapters/contracts/SecuritizeRedemptionGatewayAdapterContract.js +14 -13
- package/dist/esm/plugins/adapters/contracts/StakingRewardsAdapterContract.js +7 -5
- package/dist/esm/plugins/adapters/contracts/TraderJoeRouterAdapterContract.js +4 -3
- package/dist/esm/plugins/adapters/contracts/UniswapV2AdapterContract.js +4 -3
- package/dist/esm/plugins/adapters/contracts/UniswapV3AdapterContract.js +6 -9
- package/dist/esm/plugins/adapters/contracts/UniswapV4AdapterContract.js +8 -8
- package/dist/esm/plugins/adapters/contracts/UpshiftVaultAdapterContract.js +6 -4
- package/dist/esm/plugins/adapters/contracts/VelodromeV2AdapterContract.js +4 -3
- package/dist/esm/plugins/adapters/contracts/WstETHV1AdapterContract.js +6 -4
- package/dist/esm/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.js +2 -9
- package/dist/esm/preview/preview/applyInnerOperations.js +90 -59
- package/dist/esm/preview/preview/applyQuotaChanges.js +19 -0
- package/dist/esm/preview/preview/errors.js +0 -15
- package/dist/esm/preview/preview/index.js +1 -0
- package/dist/esm/preview/preview/previewAdjustCreditAccount.js +20 -8
- package/dist/esm/preview/preview/previewCloseOrRepayCreditAccount.js +18 -7
- package/dist/esm/preview/preview/previewOpenCreditAccount.js +20 -6
- package/dist/esm/preview/preview/types.js +16 -0
- package/dist/esm/preview/preview/unwrapNativeCollateral.js +12 -4
- package/dist/esm/sdk/OnchainSDK.js +3 -6
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +2 -4
- package/dist/esm/sdk/accounts/withdrawal-compressor/AbstractWithdrawalCompressorContract.js +14 -22
- package/dist/esm/sdk/accounts/withdrawal-compressor/addresses.js +6 -18
- package/dist/esm/sdk/accounts/withdrawal-compressor/createWithdrawalCompressor.js +3 -5
- package/dist/types/abi/IWithdrawalCompressorV313.d.ts +4 -0
- package/dist/types/abi/compressors/withdrawalCompressor.d.ts +4 -0
- package/dist/types/permissionless/bindings/compressors/withdrawal-compressor.d.ts +4 -0
- package/dist/types/plugins/adapters/contracts/AbstractAdapter.d.ts +27 -7
- package/dist/types/plugins/adapters/contracts/AbstractCurveAdapter.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/BalancerV3RouterAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/BalancerV3WrapperAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/CamelotV3AdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/ConvexV1BaseRewardPoolAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/ConvexV1BoosterAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/DaiUsdsAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/ERC4626AdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/ERC4626ReferralAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/FluidDexAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/InfinifiGatewayAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/KelpLRTDepositPoolAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/LidoV1AdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/MellowClaimerAdapterContract.d.ts +3 -2
- package/dist/types/plugins/adapters/contracts/MellowDVVAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/MellowERC4626VaultAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/MellowWrapperAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/MidasGatewayAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/MidasIssuanceVaultAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/MidasRedemptionVaultAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/PendleRouterAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/SecuritizeOnRampAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/SecuritizeRedemptionGatewayAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/StakingRewardsAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/TraderJoeRouterAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/UniswapV2AdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/UniswapV3AdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/UniswapV4AdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/UpshiftVaultAdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/VelodromeV2AdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/contracts/WstETHV1AdapterContract.d.ts +2 -3
- package/dist/types/plugins/adapters/types.d.ts +0 -10
- package/dist/types/preview/preview/applyInnerOperations.d.ts +8 -33
- package/dist/types/preview/preview/applyQuotaChanges.d.ts +24 -0
- package/dist/types/preview/preview/errors.d.ts +0 -12
- package/dist/types/preview/preview/index.d.ts +1 -0
- package/dist/types/preview/preview/previewAdjustCreditAccount.d.ts +1 -1
- package/dist/types/preview/preview/previewOpenCreditAccount.d.ts +1 -1
- package/dist/types/preview/preview/types.d.ts +81 -0
- package/dist/types/preview/preview/unwrapNativeCollateral.d.ts +19 -4
- package/dist/types/sdk/OnchainSDK.d.ts +3 -6
- package/dist/types/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.d.ts +4 -0
- package/dist/types/sdk/accounts/withdrawal-compressor/addresses.d.ts +1 -2
- package/dist/types/sdk/accounts/withdrawal-compressor/createWithdrawalCompressor.d.ts +2 -4
- package/dist/types/sdk/accounts/withdrawal-compressor/types.d.ts +7 -0
- package/package.json +1 -1
|
@@ -50,24 +50,21 @@ class UniswapV3AdapterContract extends AbstractAdapterContract {
|
|
|
50
50
|
}))
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
applyBalanceChanges(balances, decoded) {
|
|
54
54
|
switch (decoded.functionName) {
|
|
55
55
|
case "exactDiffInputSingle": {
|
|
56
56
|
const [params] = decoded.args;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
tokenIn: params.tokenIn,
|
|
60
|
-
leftoverAmount: params.leftoverAmount
|
|
61
|
-
}
|
|
62
|
-
];
|
|
57
|
+
this.setLeftover(balances, params.tokenIn, params.leftoverAmount);
|
|
58
|
+
break;
|
|
63
59
|
}
|
|
64
60
|
case "exactDiffInput": {
|
|
65
61
|
const [params] = decoded.args;
|
|
66
62
|
const tokenIn = `0x${params.path.replace("0x", "").slice(0, 40)}`;
|
|
67
|
-
|
|
63
|
+
this.setLeftover(balances, tokenIn, params.leftoverAmount);
|
|
64
|
+
break;
|
|
68
65
|
}
|
|
69
66
|
default:
|
|
70
|
-
|
|
67
|
+
super.applyBalanceChanges(balances, decoded);
|
|
71
68
|
}
|
|
72
69
|
}
|
|
73
70
|
stringifyFunctionParams(params) {
|
|
@@ -63,19 +63,19 @@ class UniswapV4AdapterContract extends AbstractAdapterContract {
|
|
|
63
63
|
classifyLegacyOperation(_parsed, transfers) {
|
|
64
64
|
return { operation: "UniswapSwap", ...swapFromTransfers(transfers) };
|
|
65
65
|
}
|
|
66
|
-
|
|
66
|
+
applyBalanceChanges(balances, decoded) {
|
|
67
67
|
switch (decoded.functionName) {
|
|
68
68
|
case "swapExactInputSingleDiff": {
|
|
69
69
|
const [poolKey, zeroForOne, leftoverAmount] = decoded.args;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
70
|
+
this.setLeftover(
|
|
71
|
+
balances,
|
|
72
|
+
zeroForOne ? poolKey.token0 : poolKey.token1,
|
|
73
|
+
leftoverAmount
|
|
74
|
+
);
|
|
75
|
+
break;
|
|
76
76
|
}
|
|
77
77
|
default:
|
|
78
|
-
|
|
78
|
+
super.applyBalanceChanges(balances, decoded);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -54,18 +54,20 @@ class UpshiftVaultAdapterContract extends AbstractAdapterContract {
|
|
|
54
54
|
stakedPhantomToken: this.#stakedPhantomToken ? this.labelAddress(this.#stakedPhantomToken) : void 0
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
-
|
|
57
|
+
applyBalanceChanges(balances, decoded) {
|
|
58
58
|
switch (decoded.functionName) {
|
|
59
59
|
case "depositDiff": {
|
|
60
60
|
const [leftoverAmount] = decoded.args;
|
|
61
|
-
|
|
61
|
+
this.setLeftover(balances, this.asset, leftoverAmount);
|
|
62
|
+
break;
|
|
62
63
|
}
|
|
63
64
|
case "redeemDiff": {
|
|
64
65
|
const [leftoverAmount] = decoded.args;
|
|
65
|
-
|
|
66
|
+
this.setLeftover(balances, this.vault, leftoverAmount);
|
|
67
|
+
break;
|
|
66
68
|
}
|
|
67
69
|
default:
|
|
68
|
-
|
|
70
|
+
super.applyBalanceChanges(balances, decoded);
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
73
|
}
|
|
@@ -53,14 +53,15 @@ class VelodromeV2RouterAdapterContract extends AbstractAdapterContract {
|
|
|
53
53
|
}))
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
-
|
|
56
|
+
applyBalanceChanges(balances, decoded) {
|
|
57
57
|
switch (decoded.functionName) {
|
|
58
58
|
case "swapDiffTokensForTokens": {
|
|
59
59
|
const [leftoverAmount, , routes] = decoded.args;
|
|
60
|
-
|
|
60
|
+
this.setLeftover(balances, routes[0].from, leftoverAmount);
|
|
61
|
+
break;
|
|
61
62
|
}
|
|
62
63
|
default:
|
|
63
|
-
|
|
64
|
+
super.applyBalanceChanges(balances, decoded);
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
67
|
}
|
|
@@ -46,19 +46,21 @@ class WstETHV1AdapterContract extends AbstractAdapterContract {
|
|
|
46
46
|
}
|
|
47
47
|
return super.classifyLegacyOperation(parsed, transfers);
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
applyBalanceChanges(balances, decoded) {
|
|
50
50
|
switch (decoded.functionName) {
|
|
51
51
|
case "wrapDiff": {
|
|
52
52
|
const [leftoverAmount] = decoded.args;
|
|
53
|
-
|
|
53
|
+
this.setLeftover(balances, this.stETH, leftoverAmount);
|
|
54
|
+
break;
|
|
54
55
|
}
|
|
55
56
|
// wstETH is the adapter's target contract
|
|
56
57
|
case "unwrapDiff": {
|
|
57
58
|
const [leftoverAmount] = decoded.args;
|
|
58
|
-
|
|
59
|
+
this.setLeftover(balances, this.targetContract, leftoverAmount);
|
|
60
|
+
break;
|
|
59
61
|
}
|
|
60
62
|
default:
|
|
61
|
-
|
|
63
|
+
super.applyBalanceChanges(balances, decoded);
|
|
62
64
|
}
|
|
63
65
|
}
|
|
64
66
|
}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AddressMap,
|
|
3
|
-
BasePlugin
|
|
4
|
-
} from "../../sdk/index.js";
|
|
1
|
+
import { AddressMap, BasePlugin } from "../../sdk/index.js";
|
|
5
2
|
const MAP_LABEL = "delayedWithdrawal";
|
|
6
3
|
class DelayedWithdrawalPlugin extends BasePlugin {
|
|
7
4
|
#withdrawableAssets;
|
|
@@ -10,11 +7,7 @@ class DelayedWithdrawalPlugin extends BasePlugin {
|
|
|
10
7
|
return this.state;
|
|
11
8
|
}
|
|
12
9
|
this.#withdrawableAssets = new AddressMap(void 0, MAP_LABEL);
|
|
13
|
-
const
|
|
14
|
-
this.sdk.logger?.debug(
|
|
15
|
-
`loading delayed withdrawal plugin with compressor ${compressor.address}`
|
|
16
|
-
);
|
|
17
|
-
const resp = await compressor.getWithdrawableAssetsBatch();
|
|
10
|
+
const resp = await this.sdk.withdrawalCompressor.getWithdrawableAssetsBatch();
|
|
18
11
|
const byCreditManager = /* @__PURE__ */ new Map();
|
|
19
12
|
for (const cfg of resp) {
|
|
20
13
|
const assets = byCreditManager.get(cfg.creditManager) ?? [];
|
|
@@ -4,10 +4,16 @@ import {
|
|
|
4
4
|
} from "../../plugins/adapters/index.js";
|
|
5
5
|
import {
|
|
6
6
|
AssetsMap,
|
|
7
|
-
MAX_UINT256
|
|
8
|
-
MIN_INT96
|
|
7
|
+
MAX_UINT256
|
|
9
8
|
} from "../../sdk/index.js";
|
|
10
9
|
import { applyRWAWrapUnwrap } from "./applyRWAWrapUnwrap.js";
|
|
10
|
+
import {
|
|
11
|
+
ERROR_ADAPTER_CALL_OUTSIDE_BRACKET,
|
|
12
|
+
ERROR_MALFORMED_BRACKET,
|
|
13
|
+
ERROR_NON_ADAPTER_CALL_IN_BRACKET,
|
|
14
|
+
ERROR_UNPREVIEWABLE_ADAPTER_CALL,
|
|
15
|
+
ERROR_UNPREVIEWABLE_RWA_WRAP_UNWRAP
|
|
16
|
+
} from "./types.js";
|
|
11
17
|
function makeInnerOperationsState() {
|
|
12
18
|
return {
|
|
13
19
|
balances: new AssetsMap(),
|
|
@@ -21,41 +27,31 @@ function makeInnerOperationsState() {
|
|
|
21
27
|
function applyInnerOperations(sdk, multicall, state) {
|
|
22
28
|
let inBracket = false;
|
|
23
29
|
let storeSeen = false;
|
|
30
|
+
let error;
|
|
24
31
|
for (const op of multicall) {
|
|
32
|
+
let opError;
|
|
25
33
|
switch (op.operation) {
|
|
26
34
|
case "AddCollateral":
|
|
27
|
-
state
|
|
28
|
-
state.balances.inc(op.token, op.amount);
|
|
35
|
+
applyAddCollateral(state, op);
|
|
29
36
|
break;
|
|
30
|
-
case "WithdrawCollateral":
|
|
31
|
-
|
|
32
|
-
const amount = op.amount === MAX_UINT256 ? running > 0n ? running : 0n : op.amount;
|
|
33
|
-
state.balances.dec(op.token, amount);
|
|
34
|
-
state.collateralWithdrawn.inc(op.token, amount);
|
|
37
|
+
case "WithdrawCollateral":
|
|
38
|
+
applyWithdrawCollateral(state, op);
|
|
35
39
|
break;
|
|
36
|
-
}
|
|
37
40
|
case "IncreaseBorrowedAmount":
|
|
38
|
-
state
|
|
39
|
-
state.totalDebt += op.amount;
|
|
40
|
-
state.balances.inc(op.token, op.amount);
|
|
41
|
+
applyIncreaseDebt(state, op);
|
|
41
42
|
break;
|
|
42
|
-
case "DecreaseBorrowedAmount":
|
|
43
|
-
|
|
44
|
-
state.balances.dec(op.token, repaid);
|
|
45
|
-
state.totalDebt -= repaid;
|
|
46
|
-
if (state.debt > state.totalDebt) {
|
|
47
|
-
state.debt = state.totalDebt;
|
|
48
|
-
}
|
|
43
|
+
case "DecreaseBorrowedAmount":
|
|
44
|
+
applyDecreaseDebt(state, op);
|
|
49
45
|
break;
|
|
50
|
-
}
|
|
51
46
|
case "UpdateQuota":
|
|
52
47
|
state.quotaChanges.push({ token: op.token, balance: op.change });
|
|
53
48
|
break;
|
|
54
49
|
case "StoreExpectedBalances":
|
|
55
50
|
if (storeSeen) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
51
|
+
opError = {
|
|
52
|
+
code: ERROR_MALFORMED_BRACKET,
|
|
53
|
+
message: "duplicate storeExpectedBalances call"
|
|
54
|
+
};
|
|
59
55
|
}
|
|
60
56
|
storeSeen = true;
|
|
61
57
|
inBracket = true;
|
|
@@ -65,32 +61,83 @@ function applyInnerOperations(sdk, multicall, state) {
|
|
|
65
61
|
break;
|
|
66
62
|
case "CompareBalances":
|
|
67
63
|
if (!inBracket) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
64
|
+
opError = {
|
|
65
|
+
code: ERROR_MALFORMED_BRACKET,
|
|
66
|
+
message: "compareBalances without a preceding storeExpectedBalances"
|
|
67
|
+
};
|
|
71
68
|
}
|
|
72
69
|
inBracket = false;
|
|
73
70
|
break;
|
|
74
|
-
case "Execute":
|
|
75
|
-
|
|
76
|
-
if (inBracket) {
|
|
77
|
-
if (!(adapter instanceof AbstractAdapterContract)) {
|
|
78
|
-
throw new Error(
|
|
79
|
-
`call to ${op.adapter} between storeExpectedBalances and compareBalances is not an adapter call`
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
adapter.previewBalanceChanges(state.balances, op.calldata);
|
|
83
|
-
} else if (isRWAShare(sdk, adapter)) {
|
|
84
|
-
applyRWAWrapUnwrap(adapter, op.calldata, state.balances);
|
|
85
|
-
}
|
|
71
|
+
case "Execute":
|
|
72
|
+
opError = applyExecute(sdk, op, inBracket, state.balances);
|
|
86
73
|
break;
|
|
87
|
-
}
|
|
88
74
|
}
|
|
75
|
+
error ??= opError;
|
|
89
76
|
}
|
|
90
77
|
if (inBracket) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
78
|
+
error ??= {
|
|
79
|
+
code: ERROR_MALFORMED_BRACKET,
|
|
80
|
+
message: "storeExpectedBalances without a matching compareBalances"
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
return error;
|
|
84
|
+
}
|
|
85
|
+
function applyAddCollateral(state, op) {
|
|
86
|
+
state.collateralAdded.inc(op.token, op.amount);
|
|
87
|
+
state.balances.inc(op.token, op.amount);
|
|
88
|
+
}
|
|
89
|
+
function applyWithdrawCollateral(state, op) {
|
|
90
|
+
const running = state.balances.getOrZero(op.token);
|
|
91
|
+
const amount = op.amount === MAX_UINT256 ? running > 0n ? running : 0n : op.amount;
|
|
92
|
+
state.balances.dec(op.token, amount);
|
|
93
|
+
state.collateralWithdrawn.inc(op.token, amount);
|
|
94
|
+
}
|
|
95
|
+
function applyIncreaseDebt(state, op) {
|
|
96
|
+
state.debt += op.amount;
|
|
97
|
+
state.totalDebt += op.amount;
|
|
98
|
+
state.balances.inc(op.token, op.amount);
|
|
99
|
+
}
|
|
100
|
+
function applyDecreaseDebt(state, op) {
|
|
101
|
+
const repaid = op.amount > state.totalDebt ? state.totalDebt : op.amount;
|
|
102
|
+
state.balances.dec(op.token, repaid);
|
|
103
|
+
state.totalDebt -= repaid;
|
|
104
|
+
if (state.debt > state.totalDebt) {
|
|
105
|
+
state.debt = state.totalDebt;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
function applyExecute(sdk, op, inBracket, balances) {
|
|
109
|
+
const adapter = sdk.getContract(op.adapter);
|
|
110
|
+
if (!inBracket) {
|
|
111
|
+
if (!isRWAShare(sdk, adapter)) {
|
|
112
|
+
return {
|
|
113
|
+
code: ERROR_ADAPTER_CALL_OUTSIDE_BRACKET,
|
|
114
|
+
message: `call to ${op.adapter} outside of a storeExpectedBalances/compareBalances bracket`
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
try {
|
|
118
|
+
applyRWAWrapUnwrap(adapter, op.calldata, balances);
|
|
119
|
+
return void 0;
|
|
120
|
+
} catch (e) {
|
|
121
|
+
return {
|
|
122
|
+
code: ERROR_UNPREVIEWABLE_RWA_WRAP_UNWRAP,
|
|
123
|
+
message: e instanceof Error ? e.message : String(e)
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (!(adapter instanceof AbstractAdapterContract)) {
|
|
128
|
+
return {
|
|
129
|
+
code: ERROR_NON_ADAPTER_CALL_IN_BRACKET,
|
|
130
|
+
message: `call to ${op.adapter} between storeExpectedBalances and compareBalances is not an adapter call`
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
try {
|
|
134
|
+
adapter.previewBalanceChanges(balances, op.calldata);
|
|
135
|
+
return void 0;
|
|
136
|
+
} catch (e) {
|
|
137
|
+
return {
|
|
138
|
+
code: ERROR_UNPREVIEWABLE_ADAPTER_CALL,
|
|
139
|
+
message: e instanceof Error ? e.message : String(e)
|
|
140
|
+
};
|
|
94
141
|
}
|
|
95
142
|
}
|
|
96
143
|
function isRWAShare(sdk, adapter) {
|
|
@@ -100,23 +147,7 @@ function isRWAShare(sdk, adapter) {
|
|
|
100
147
|
}
|
|
101
148
|
return false;
|
|
102
149
|
}
|
|
103
|
-
function applyQuotaChanges(initialQuotas, changes) {
|
|
104
|
-
const final = initialQuotas.clone();
|
|
105
|
-
for (const { token, balance: change } of changes) {
|
|
106
|
-
if (change === MIN_INT96) {
|
|
107
|
-
final.upsert(token, 0n);
|
|
108
|
-
} else {
|
|
109
|
-
const next = final.getOrZero(token) + change;
|
|
110
|
-
final.upsert(token, next > 0n ? next : 0n);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
return {
|
|
114
|
-
quotas: final.toAssets(0n),
|
|
115
|
-
quotasChange: final.difference(initialQuotas).toAssets()
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
150
|
export {
|
|
119
151
|
applyInnerOperations,
|
|
120
|
-
applyQuotaChanges,
|
|
121
152
|
makeInnerOperationsState
|
|
122
153
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { MIN_INT96 } from "../../sdk/index.js";
|
|
2
|
+
function applyQuotaChanges(initialQuotas, changes) {
|
|
3
|
+
const final = initialQuotas.clone();
|
|
4
|
+
for (const { token, balance: change } of changes) {
|
|
5
|
+
if (change === MIN_INT96) {
|
|
6
|
+
final.upsert(token, 0n);
|
|
7
|
+
} else {
|
|
8
|
+
const next = final.getOrZero(token) + change;
|
|
9
|
+
final.upsert(token, next > 0n ? next : 0n);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return {
|
|
13
|
+
quotas: final.toAssets(0n),
|
|
14
|
+
quotasChange: final.difference(initialQuotas).toAssets()
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
applyQuotaChanges
|
|
19
|
+
};
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
class InvalidTransactionValueError extends Error {
|
|
2
|
-
/** Transaction `msg.value`. */
|
|
3
|
-
value;
|
|
4
|
-
/** Amount of wrapped native token added as collateral. */
|
|
5
|
-
wethCollateral;
|
|
6
|
-
constructor(value, wethCollateral) {
|
|
7
|
-
super(
|
|
8
|
-
`transaction value ${value} exceeds WETH collateral ${wethCollateral}`
|
|
9
|
-
);
|
|
10
|
-
this.name = "InvalidTransactionValueError";
|
|
11
|
-
this.value = value;
|
|
12
|
-
this.wethCollateral = wethCollateral;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
1
|
class UnsupportedOperationError extends Error {
|
|
16
2
|
/** The parsed operation kind (the `operation` discriminant). */
|
|
17
3
|
operation;
|
|
@@ -22,6 +8,5 @@ class UnsupportedOperationError extends Error {
|
|
|
22
8
|
}
|
|
23
9
|
}
|
|
24
10
|
export {
|
|
25
|
-
InvalidTransactionValueError,
|
|
26
11
|
UnsupportedOperationError
|
|
27
12
|
};
|
|
@@ -5,9 +5,12 @@ import {
|
|
|
5
5
|
} from "../../sdk/index.js";
|
|
6
6
|
import {
|
|
7
7
|
applyInnerOperations,
|
|
8
|
-
applyQuotaChanges,
|
|
9
8
|
makeInnerOperationsState
|
|
10
9
|
} from "./applyInnerOperations.js";
|
|
10
|
+
import { applyQuotaChanges } from "./applyQuotaChanges.js";
|
|
11
|
+
import {
|
|
12
|
+
ERROR_UNPRICEABLE_TOKEN
|
|
13
|
+
} from "./types.js";
|
|
11
14
|
import { unwrapNativeCollateral } from "./unwrapNativeCollateral.js";
|
|
12
15
|
async function previewAdjustCreditAccount(input, operation, options) {
|
|
13
16
|
const { sdk, value = 0n } = input;
|
|
@@ -38,22 +41,30 @@ async function previewAdjustCreditAccount(input, operation, options) {
|
|
|
38
41
|
state.balances = initialBalances.clone();
|
|
39
42
|
state.debt = ca.debt;
|
|
40
43
|
state.totalDebt = ca.debt + ca.accruedInterest + ca.accruedFees;
|
|
41
|
-
applyInnerOperations(sdk, operation.multicall, state);
|
|
42
|
-
const collateralAdded = unwrapNativeCollateral(
|
|
44
|
+
let error = applyInnerOperations(sdk, operation.multicall, state);
|
|
45
|
+
const { assets: collateralAdded, error: unwrapError } = unwrapNativeCollateral(
|
|
43
46
|
state.collateralAdded.toAssets(),
|
|
44
47
|
value,
|
|
45
48
|
sdk.addressProvider.getAddress(AP_WETH_TOKEN, NO_VERSION)
|
|
46
49
|
);
|
|
50
|
+
error ??= unwrapError;
|
|
47
51
|
const { quotas, quotasChange } = applyQuotaChanges(
|
|
48
52
|
initialQuotas,
|
|
49
53
|
state.quotaChanges
|
|
50
54
|
);
|
|
51
55
|
const assets = state.balances.toAssets(1n);
|
|
52
56
|
const assetsChange = state.balances.difference(initialBalances).toAssets(1n);
|
|
53
|
-
const totalValue = assets.reduce(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
const totalValue = assets.reduce((acc, { token, balance }) => {
|
|
58
|
+
try {
|
|
59
|
+
return acc + market.priceOracle.convert(token, market.underlying, balance);
|
|
60
|
+
} catch {
|
|
61
|
+
error ??= {
|
|
62
|
+
code: ERROR_UNPRICEABLE_TOKEN,
|
|
63
|
+
message: `cannot price token ${token}`
|
|
64
|
+
};
|
|
65
|
+
return acc;
|
|
66
|
+
}
|
|
67
|
+
}, 0n);
|
|
57
68
|
return {
|
|
58
69
|
operation: "AdjustCreditAccount",
|
|
59
70
|
creditManager: operation.creditManager,
|
|
@@ -66,7 +77,8 @@ async function previewAdjustCreditAccount(input, operation, options) {
|
|
|
66
77
|
quotas,
|
|
67
78
|
quotasChange,
|
|
68
79
|
assets,
|
|
69
|
-
assetsChange
|
|
80
|
+
assetsChange,
|
|
81
|
+
error
|
|
70
82
|
};
|
|
71
83
|
}
|
|
72
84
|
export {
|
|
@@ -21,23 +21,31 @@ async function previewCloseCreditAccount(input, operation, permanent, options) {
|
|
|
21
21
|
const market = sdk.marketRegister.findByCreditManager(
|
|
22
22
|
operation.creditManager
|
|
23
23
|
);
|
|
24
|
-
const { state } = await replayMulticall(sdk, operation, options);
|
|
24
|
+
const { state, error } = await replayMulticall(sdk, operation, options);
|
|
25
25
|
return {
|
|
26
26
|
operation: "CloseCreditAccount",
|
|
27
27
|
permanent,
|
|
28
28
|
creditManager: operation.creditManager,
|
|
29
29
|
creditAccount: operation.creditAccount,
|
|
30
|
-
|
|
30
|
+
// On a malformed multicall the withdrawn amount depends on best-effort
|
|
31
|
+
// replayed balances and may be unreliable
|
|
32
|
+
receivedAmount: state.collateralWithdrawn.getOrZero(market.underlying),
|
|
33
|
+
error
|
|
31
34
|
};
|
|
32
35
|
}
|
|
33
36
|
async function previewRepayCreditAccount(input, operation, permanent, options) {
|
|
34
37
|
const { sdk, value = 0n } = input;
|
|
35
|
-
const {
|
|
36
|
-
|
|
38
|
+
const {
|
|
39
|
+
ca,
|
|
40
|
+
state,
|
|
41
|
+
error: replayError
|
|
42
|
+
} = await replayMulticall(sdk, operation, options);
|
|
43
|
+
const { assets: collateralAdded, error: unwrapError } = unwrapNativeCollateral(
|
|
37
44
|
state.collateralAdded.toAssets(),
|
|
38
45
|
value,
|
|
39
46
|
sdk.addressProvider.getAddress(AP_WETH_TOKEN, NO_VERSION)
|
|
40
47
|
);
|
|
48
|
+
const error = replayError ?? unwrapError;
|
|
41
49
|
const initialTotalDebt = ca.debt + ca.accruedInterest + ca.accruedFees;
|
|
42
50
|
return {
|
|
43
51
|
operation: "RepayCreditAccount",
|
|
@@ -46,7 +54,10 @@ async function previewRepayCreditAccount(input, operation, permanent, options) {
|
|
|
46
54
|
creditAccount: operation.creditAccount,
|
|
47
55
|
collateralAdded,
|
|
48
56
|
debtRepaid: initialTotalDebt - state.totalDebt,
|
|
49
|
-
|
|
57
|
+
// On a malformed multicall the MAX_UINT256 withdrawal sentinel resolves
|
|
58
|
+
// against best-effort replayed balances and may be unreliable
|
|
59
|
+
collateralWithdrawn: state.collateralWithdrawn.toAssets(),
|
|
60
|
+
error
|
|
50
61
|
};
|
|
51
62
|
}
|
|
52
63
|
async function replayMulticall(sdk, operation, options) {
|
|
@@ -68,8 +79,8 @@ async function replayMulticall(sdk, operation, options) {
|
|
|
68
79
|
}
|
|
69
80
|
state.debt = ca.debt;
|
|
70
81
|
state.totalDebt = ca.debt + ca.accruedInterest + ca.accruedFees;
|
|
71
|
-
applyInnerOperations(sdk, operation.multicall, state);
|
|
72
|
-
return { ca, state };
|
|
82
|
+
const error = applyInnerOperations(sdk, operation.multicall, state);
|
|
83
|
+
return { ca, state, error };
|
|
73
84
|
}
|
|
74
85
|
export {
|
|
75
86
|
previewCloseOrRepayCreditAccount
|
|
@@ -6,6 +6,9 @@ import {
|
|
|
6
6
|
applyInnerOperations,
|
|
7
7
|
makeInnerOperationsState
|
|
8
8
|
} from "./applyInnerOperations.js";
|
|
9
|
+
import {
|
|
10
|
+
ERROR_UNPRICEABLE_TOKEN
|
|
11
|
+
} from "./types.js";
|
|
9
12
|
import { unwrapNativeCollateral } from "./unwrapNativeCollateral.js";
|
|
10
13
|
function previewOpenCreditAccount(input, operation) {
|
|
11
14
|
const { sdk, value = 0n } = input;
|
|
@@ -13,15 +16,25 @@ function previewOpenCreditAccount(input, operation) {
|
|
|
13
16
|
operation.creditManager
|
|
14
17
|
);
|
|
15
18
|
const state = makeInnerOperationsState();
|
|
16
|
-
applyInnerOperations(sdk, operation.multicall, state);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
let error = applyInnerOperations(sdk, operation.multicall, state);
|
|
20
|
+
let priceError;
|
|
21
|
+
const collateralValue = state.collateralAdded.sum((token, balance) => {
|
|
22
|
+
try {
|
|
23
|
+
return market.priceOracle.convert(token, market.underlying, balance);
|
|
24
|
+
} catch {
|
|
25
|
+
priceError ??= {
|
|
26
|
+
code: ERROR_UNPRICEABLE_TOKEN,
|
|
27
|
+
message: `cannot price token ${token}`
|
|
28
|
+
};
|
|
29
|
+
return 0n;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
const { assets: collateral, error: unwrapError } = unwrapNativeCollateral(
|
|
21
33
|
state.collateralAdded.toAssets(),
|
|
22
34
|
value,
|
|
23
35
|
sdk.addressProvider.getAddress(AP_WETH_TOKEN, NO_VERSION)
|
|
24
36
|
);
|
|
37
|
+
error ??= unwrapError ?? priceError;
|
|
25
38
|
const assets = state.balances.toAssets(1n);
|
|
26
39
|
return {
|
|
27
40
|
operation: operation.operation,
|
|
@@ -32,7 +45,8 @@ function previewOpenCreditAccount(input, operation) {
|
|
|
32
45
|
debt: state.debt,
|
|
33
46
|
// On opening, initial quotas are zero, so the raw changes are the quotas.
|
|
34
47
|
quotas: state.quotaChanges,
|
|
35
|
-
assets
|
|
48
|
+
assets,
|
|
49
|
+
error
|
|
36
50
|
};
|
|
37
51
|
}
|
|
38
52
|
function inferTargetAsset(multicall, balances) {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const ERROR_MALFORMED_BRACKET = 1001;
|
|
2
|
+
const ERROR_ADAPTER_CALL_OUTSIDE_BRACKET = 1002;
|
|
3
|
+
const ERROR_NON_ADAPTER_CALL_IN_BRACKET = 1003;
|
|
4
|
+
const ERROR_UNPREVIEWABLE_ADAPTER_CALL = 1004;
|
|
5
|
+
const ERROR_UNPREVIEWABLE_RWA_WRAP_UNWRAP = 1005;
|
|
6
|
+
const ERROR_INVALID_TRANSACTION_VALUE = 1006;
|
|
7
|
+
const ERROR_UNPRICEABLE_TOKEN = 2001;
|
|
8
|
+
export {
|
|
9
|
+
ERROR_ADAPTER_CALL_OUTSIDE_BRACKET,
|
|
10
|
+
ERROR_INVALID_TRANSACTION_VALUE,
|
|
11
|
+
ERROR_MALFORMED_BRACKET,
|
|
12
|
+
ERROR_NON_ADAPTER_CALL_IN_BRACKET,
|
|
13
|
+
ERROR_UNPREVIEWABLE_ADAPTER_CALL,
|
|
14
|
+
ERROR_UNPREVIEWABLE_RWA_WRAP_UNWRAP,
|
|
15
|
+
ERROR_UNPRICEABLE_TOKEN
|
|
16
|
+
};
|
|
@@ -1,20 +1,28 @@
|
|
|
1
1
|
import { AssetsMap, NATIVE_ADDRESS } from "../../sdk/index.js";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
ERROR_INVALID_TRANSACTION_VALUE
|
|
4
|
+
} from "./types.js";
|
|
3
5
|
function unwrapNativeCollateral(collateral, nativeAmount, wethToken) {
|
|
4
6
|
if (nativeAmount === 0n) {
|
|
5
|
-
return collateral;
|
|
7
|
+
return { assets: collateral };
|
|
6
8
|
}
|
|
7
9
|
const balances = new AssetsMap(collateral);
|
|
8
10
|
const wethBalance = balances.get(wethToken) ?? 0n;
|
|
9
11
|
if (wethBalance < nativeAmount) {
|
|
10
|
-
|
|
12
|
+
return {
|
|
13
|
+
assets: collateral,
|
|
14
|
+
error: {
|
|
15
|
+
code: ERROR_INVALID_TRANSACTION_VALUE,
|
|
16
|
+
message: `transaction value ${nativeAmount} exceeds WETH collateral ${wethBalance}`
|
|
17
|
+
}
|
|
18
|
+
};
|
|
11
19
|
}
|
|
12
20
|
balances.upsert(
|
|
13
21
|
wethToken,
|
|
14
22
|
wethBalance === nativeAmount ? void 0 : wethBalance - nativeAmount
|
|
15
23
|
);
|
|
16
24
|
balances.inc(NATIVE_ADDRESS, nativeAmount);
|
|
17
|
-
return balances.toAssets();
|
|
25
|
+
return { assets: balances.toAssets() };
|
|
18
26
|
}
|
|
19
27
|
export {
|
|
20
28
|
unwrapNativeCollateral
|
|
@@ -538,13 +538,10 @@ class OnchainSDK extends ChainContractsRegister {
|
|
|
538
538
|
/**
|
|
539
539
|
* Lazily returns a withdrawal compressor contract for the current chain.
|
|
540
540
|
*
|
|
541
|
-
* @
|
|
542
|
-
* version supported on the current chain is used.
|
|
543
|
-
* @throws If no withdrawal compressor of the given version is supported
|
|
544
|
-
* on the current chain.
|
|
541
|
+
* @throws If no withdrawal compressor is supported on the current chain.
|
|
545
542
|
**/
|
|
546
|
-
withdrawalCompressor(
|
|
547
|
-
return createWithdrawalCompressor(this
|
|
543
|
+
get withdrawalCompressor() {
|
|
544
|
+
return createWithdrawalCompressor(this);
|
|
548
545
|
}
|
|
549
546
|
}
|
|
550
547
|
export {
|
|
@@ -782,8 +782,7 @@ class CreditAccountsServiceV310 extends SDKConstruct {
|
|
|
782
782
|
token,
|
|
783
783
|
intent
|
|
784
784
|
}) {
|
|
785
|
-
|
|
786
|
-
return compressor.getWithdrawalRequestResult(
|
|
785
|
+
return this.sdk.withdrawalCompressor.getWithdrawalRequestResult(
|
|
787
786
|
creditAccount,
|
|
788
787
|
token,
|
|
789
788
|
amount,
|
|
@@ -796,8 +795,7 @@ class CreditAccountsServiceV310 extends SDKConstruct {
|
|
|
796
795
|
async getPendingWithdrawals({
|
|
797
796
|
creditAccount
|
|
798
797
|
}) {
|
|
799
|
-
const
|
|
800
|
-
const { claimable, pending } = await compressor.getCurrentWithdrawals(creditAccount);
|
|
798
|
+
const { claimable, pending } = await this.sdk.withdrawalCompressor.getCurrentWithdrawals(creditAccount);
|
|
801
799
|
return {
|
|
802
800
|
claimableNow: claimable,
|
|
803
801
|
pending
|