@gearbox-protocol/sdk 14.12.0-next.17 → 14.12.0-next.19
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/{IWithdrawalCompressorV312.js → IWithdrawalCompressorV313.js} +49 -6
- package/dist/cjs/abi/compressors/subcompressors/withdrawal/mellowWithdrawalSubcompressor.js +45 -1
- package/dist/cjs/abi/compressors/subcompressors/withdrawal/midasWithdrawalSubcompressor.js +45 -1
- package/dist/cjs/abi/compressors/subcompressors/withdrawal/securitizeRedemptionSubcompressor.js +45 -1
- package/dist/cjs/abi/compressors/withdrawalCompressor.js +45 -1
- package/dist/cjs/dev/index.js +3 -1
- package/dist/cjs/dev/withdrawalAbi.js +2105 -0
- package/dist/cjs/dev/withdrawalUtils.js +271 -0
- package/dist/cjs/permissionless/bindings/factory/rate-keeper-factory.js +35 -0
- package/dist/cjs/permissionless/bindings/market-configurator.js +11 -0
- package/dist/cjs/plugins/adapters/abi/adapters/iMidasGatewayAdapterV311.js +1015 -0
- package/dist/cjs/plugins/adapters/abi/adapters/{iMidasIssuanceVaultAdapter.js → iMidasIssuanceVaultAdapterV310.js} +6 -6
- package/dist/cjs/plugins/adapters/abi/adapters/{iMidasRedemptionVault.js → iMidasRedemptionVaultAdapterV310.js} +9 -9
- package/dist/cjs/plugins/adapters/abi/adapters/index.js +6 -4
- package/dist/cjs/plugins/adapters/abi/conctructorAbi.js +3 -0
- package/dist/cjs/plugins/adapters/abi/targetContractAbi.js +3 -3
- package/dist/cjs/plugins/adapters/contracts/MidasGatewayAdapterContract.js +121 -0
- package/dist/cjs/plugins/adapters/contracts/MidasIssuanceVaultAdapterContract.js +2 -2
- package/dist/cjs/plugins/adapters/contracts/MidasRedemptionVaultAdapterContract.js +2 -2
- package/dist/cjs/plugins/adapters/contracts/index.js +2 -0
- package/dist/cjs/plugins/adapters/createAdapter.js +2 -0
- package/dist/cjs/plugins/adapters/types.js +1 -0
- package/dist/cjs/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.js +20 -37
- package/dist/cjs/sdk/OnchainSDK.js +11 -0
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +9 -55
- package/dist/cjs/sdk/accounts/index.js +3 -1
- package/dist/cjs/sdk/accounts/withdrawal-compressor/AbstractWithdrawalCompressorContract.js +224 -0
- package/dist/cjs/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +40 -0
- package/dist/cjs/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +40 -0
- package/dist/cjs/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +40 -0
- package/dist/cjs/sdk/accounts/withdrawal-compressor/addresses.js +52 -0
- package/dist/cjs/sdk/accounts/withdrawal-compressor/createWithdrawalCompressor.js +53 -0
- package/dist/cjs/sdk/accounts/withdrawal-compressor/index.js +36 -0
- package/dist/cjs/sdk/accounts/withdrawal-compressor/intent.js +172 -0
- package/dist/cjs/sdk/accounts/withdrawal-compressor/types.js +16 -0
- package/dist/esm/abi/{IWithdrawalCompressorV312.js → IWithdrawalCompressorV313.js} +45 -2
- package/dist/esm/abi/compressors/subcompressors/withdrawal/mellowWithdrawalSubcompressor.js +45 -1
- package/dist/esm/abi/compressors/subcompressors/withdrawal/midasWithdrawalSubcompressor.js +45 -1
- package/dist/esm/abi/compressors/subcompressors/withdrawal/securitizeRedemptionSubcompressor.js +45 -1
- package/dist/esm/abi/compressors/withdrawalCompressor.js +45 -1
- package/dist/esm/dev/index.js +1 -0
- package/dist/esm/dev/withdrawalAbi.js +2074 -0
- package/dist/esm/dev/withdrawalUtils.js +259 -0
- package/dist/esm/permissionless/bindings/factory/rate-keeper-factory.js +11 -0
- package/dist/esm/permissionless/bindings/market-configurator.js +11 -0
- package/dist/esm/plugins/adapters/abi/adapters/iMidasGatewayAdapterV311.js +990 -0
- package/dist/esm/plugins/adapters/abi/adapters/{iMidasIssuanceVaultAdapter.js → iMidasIssuanceVaultAdapterV310.js} +2 -2
- package/dist/esm/plugins/adapters/abi/adapters/{iMidasRedemptionVault.js → iMidasRedemptionVaultAdapterV310.js} +4 -4
- package/dist/esm/plugins/adapters/abi/adapters/index.js +3 -2
- package/dist/esm/plugins/adapters/abi/conctructorAbi.js +3 -0
- package/dist/esm/plugins/adapters/abi/targetContractAbi.js +2 -2
- package/dist/esm/plugins/adapters/contracts/MidasGatewayAdapterContract.js +104 -0
- package/dist/esm/plugins/adapters/contracts/MidasIssuanceVaultAdapterContract.js +4 -4
- package/dist/esm/plugins/adapters/contracts/MidasRedemptionVaultAdapterContract.js +4 -4
- package/dist/esm/plugins/adapters/contracts/index.js +1 -0
- package/dist/esm/plugins/adapters/createAdapter.js +3 -0
- package/dist/esm/plugins/adapters/types.js +1 -0
- package/dist/esm/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.js +21 -39
- package/dist/esm/sdk/OnchainSDK.js +13 -1
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +8 -53
- package/dist/esm/sdk/accounts/index.js +1 -0
- package/dist/esm/sdk/accounts/withdrawal-compressor/AbstractWithdrawalCompressorContract.js +200 -0
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +16 -0
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +16 -0
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +16 -0
- package/dist/esm/sdk/accounts/withdrawal-compressor/addresses.js +28 -0
- package/dist/esm/sdk/accounts/withdrawal-compressor/createWithdrawalCompressor.js +29 -0
- package/dist/esm/sdk/accounts/withdrawal-compressor/index.js +8 -0
- package/dist/esm/sdk/accounts/withdrawal-compressor/intent.js +137 -0
- package/dist/esm/sdk/accounts/withdrawal-compressor/types.js +0 -0
- package/dist/types/abi/{IWithdrawalCompressorV312.d.ts → IWithdrawalCompressorV313.d.ts} +74 -1
- package/dist/types/abi/compressors/subcompressors/withdrawal/mellowWithdrawalSubcompressor.d.ts +77 -0
- package/dist/types/abi/compressors/subcompressors/withdrawal/midasWithdrawalSubcompressor.d.ts +77 -0
- package/dist/types/abi/compressors/subcompressors/withdrawal/securitizeRedemptionSubcompressor.d.ts +77 -0
- package/dist/types/abi/compressors/withdrawalCompressor.d.ts +77 -0
- package/dist/types/dev/index.d.ts +1 -0
- package/dist/types/dev/withdrawalAbi.d.ts +1584 -0
- package/dist/types/dev/withdrawalUtils.d.ts +19 -0
- package/dist/types/permissionless/bindings/compressors/withdrawal-compressor.d.ts +77 -0
- package/dist/types/permissionless/bindings/factory/rate-keeper-factory.d.ts +179 -0
- package/dist/types/permissionless/bindings/market-configurator.d.ts +2 -0
- package/dist/types/plugins/adapters/abi/adapters/iMidasGatewayAdapterV311.d.ts +754 -0
- package/dist/types/plugins/adapters/abi/adapters/{iMidasIssuanceVaultAdapter.d.ts → iMidasIssuanceVaultAdapterV310.d.ts} +1 -1
- package/dist/types/plugins/adapters/abi/adapters/{iMidasRedemptionVault.d.ts → iMidasRedemptionVaultAdapterV310.d.ts} +2 -2
- package/dist/types/plugins/adapters/abi/adapters/index.d.ts +3 -2
- package/dist/types/plugins/adapters/abi/targetContractAbi.d.ts +1 -1
- package/dist/types/plugins/adapters/contracts/MidasGatewayAdapterContract.d.ts +790 -0
- package/dist/types/plugins/adapters/contracts/index.d.ts +1 -0
- package/dist/types/plugins/adapters/types.d.ts +2 -1
- package/dist/types/plugins/delayed-withdrawal/types.d.ts +4 -17
- package/dist/types/sdk/OnchainSDK.d.ts +10 -1
- package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +3 -11
- package/dist/types/sdk/accounts/index.d.ts +1 -0
- package/dist/types/sdk/accounts/types.d.ts +4 -18
- package/dist/types/sdk/accounts/withdrawal-compressor/AbstractWithdrawalCompressorContract.d.ts +35 -0
- package/dist/types/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.d.ts +334 -0
- package/dist/types/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.d.ts +338 -0
- package/dist/types/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.d.ts +300 -0
- package/dist/types/sdk/accounts/withdrawal-compressor/addresses.d.ts +21 -0
- package/dist/types/sdk/accounts/withdrawal-compressor/createWithdrawalCompressor.d.ts +11 -0
- package/dist/types/sdk/accounts/withdrawal-compressor/index.d.ts +8 -0
- package/dist/types/sdk/accounts/withdrawal-compressor/intent.d.ts +106 -0
- package/dist/types/sdk/accounts/withdrawal-compressor/types.d.ts +122 -0
- package/package.json +1 -1
|
@@ -16,12 +16,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
21
|
-
|
|
19
|
+
var iMidasIssuanceVaultAdapterV310_exports = {};
|
|
20
|
+
__export(iMidasIssuanceVaultAdapterV310_exports, {
|
|
21
|
+
iMidasIssuanceVaultAdapterV310Abi: () => iMidasIssuanceVaultAdapterV310Abi
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
24
|
-
const
|
|
23
|
+
module.exports = __toCommonJS(iMidasIssuanceVaultAdapterV310_exports);
|
|
24
|
+
const iMidasIssuanceVaultAdapterV310Abi = [
|
|
25
25
|
{
|
|
26
26
|
type: "function",
|
|
27
27
|
inputs: [],
|
|
@@ -258,5 +258,5 @@ const iMidasIssuanceVaultAdapterAbi = [
|
|
|
258
258
|
];
|
|
259
259
|
// Annotate the CommonJS export names for ESM import in node:
|
|
260
260
|
0 && (module.exports = {
|
|
261
|
-
|
|
261
|
+
iMidasIssuanceVaultAdapterV310Abi
|
|
262
262
|
});
|
|
@@ -16,13 +16,13 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
var iMidasRedemptionVaultAdapterV310_exports = {};
|
|
20
|
+
__export(iMidasRedemptionVaultAdapterV310_exports, {
|
|
21
|
+
iMidasRedemptionVaultAdapterV310Abi: () => iMidasRedemptionVaultAdapterV310Abi,
|
|
22
|
+
iMidasRedemptionVaultGatewayV310Abi: () => iMidasRedemptionVaultGatewayV310Abi
|
|
23
23
|
});
|
|
24
|
-
module.exports = __toCommonJS(
|
|
25
|
-
const
|
|
24
|
+
module.exports = __toCommonJS(iMidasRedemptionVaultAdapterV310_exports);
|
|
25
|
+
const iMidasRedemptionVaultAdapterV310Abi = [
|
|
26
26
|
{
|
|
27
27
|
type: "function",
|
|
28
28
|
inputs: [],
|
|
@@ -385,7 +385,7 @@ const iMidasRedemptionVaultAdapterAbi = [
|
|
|
385
385
|
name: "TokenNotAllowedException"
|
|
386
386
|
}
|
|
387
387
|
];
|
|
388
|
-
const
|
|
388
|
+
const iMidasRedemptionVaultGatewayV310Abi = [
|
|
389
389
|
{
|
|
390
390
|
type: "function",
|
|
391
391
|
inputs: [],
|
|
@@ -617,6 +617,6 @@ const iMidasRedemptionVaultGatewayAbi = [
|
|
|
617
617
|
];
|
|
618
618
|
// Annotate the CommonJS export names for ESM import in node:
|
|
619
619
|
0 && (module.exports = {
|
|
620
|
-
|
|
621
|
-
|
|
620
|
+
iMidasRedemptionVaultAdapterV310Abi,
|
|
621
|
+
iMidasRedemptionVaultGatewayV310Abi
|
|
622
622
|
});
|
|
@@ -35,8 +35,9 @@ __reExport(adapters_exports, require("./iLidoV1Adapter.js"), module.exports);
|
|
|
35
35
|
__reExport(adapters_exports, require("./iMellow4626VaultAdapter.js"), module.exports);
|
|
36
36
|
__reExport(adapters_exports, require("./iMellowClaimerAdapter.js"), module.exports);
|
|
37
37
|
__reExport(adapters_exports, require("./iMellowWrapperAdapter.js"), module.exports);
|
|
38
|
-
__reExport(adapters_exports, require("./
|
|
39
|
-
__reExport(adapters_exports, require("./
|
|
38
|
+
__reExport(adapters_exports, require("./iMidasGatewayAdapterV311.js"), module.exports);
|
|
39
|
+
__reExport(adapters_exports, require("./iMidasIssuanceVaultAdapterV310.js"), module.exports);
|
|
40
|
+
__reExport(adapters_exports, require("./iMidasRedemptionVaultAdapterV310.js"), module.exports);
|
|
40
41
|
__reExport(adapters_exports, require("./iPendleRouterAdapter.js"), module.exports);
|
|
41
42
|
__reExport(adapters_exports, require("./iStakingRewardsAdapter.js"), module.exports);
|
|
42
43
|
__reExport(adapters_exports, require("./iTraderJoeRouterAdapter.js"), module.exports);
|
|
@@ -69,8 +70,9 @@ __reExport(adapters_exports, require("./mellowDvvAdapter.js"), module.exports);
|
|
|
69
70
|
...require("./iMellow4626VaultAdapter.js"),
|
|
70
71
|
...require("./iMellowClaimerAdapter.js"),
|
|
71
72
|
...require("./iMellowWrapperAdapter.js"),
|
|
72
|
-
...require("./
|
|
73
|
-
...require("./
|
|
73
|
+
...require("./iMidasGatewayAdapterV311.js"),
|
|
74
|
+
...require("./iMidasIssuanceVaultAdapterV310.js"),
|
|
75
|
+
...require("./iMidasRedemptionVaultAdapterV310.js"),
|
|
74
76
|
...require("./iPendleRouterAdapter.js"),
|
|
75
77
|
...require("./iStakingRewardsAdapter.js"),
|
|
76
78
|
...require("./iTraderJoeRouterAdapter.js"),
|
|
@@ -152,6 +152,9 @@ const adapterConstructorAbi = {
|
|
|
152
152
|
},
|
|
153
153
|
[import_types.AdapterType.MIDAS_ISSUANCE_VAULT]: {
|
|
154
154
|
310: import_conctructorAbiPatterns.REFERER_ID_ADAPTER_ABI
|
|
155
|
+
},
|
|
156
|
+
[import_types.AdapterType.MIDAS_GATEWAY]: {
|
|
157
|
+
311: import_conctructorAbiPatterns.REFERER_ID_ADAPTER_ABI
|
|
155
158
|
}
|
|
156
159
|
};
|
|
157
160
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -37,7 +37,7 @@ __export(targetContractAbi_exports, {
|
|
|
37
37
|
iKelpLRTWithdrawalManagerGatewayAbi: () => iKelpLRTWithdrawalManagerGatewayAbi,
|
|
38
38
|
iMellowClaimerAbi: () => iMellowClaimerAbi,
|
|
39
39
|
iMellowWrapperAbi: () => iMellowWrapperAbi,
|
|
40
|
-
|
|
40
|
+
iMidasIssuanceVaultV310Abi: () => iMidasIssuanceVaultV310Abi,
|
|
41
41
|
iPendleRouterAbi: () => iPendleRouterAbi,
|
|
42
42
|
iStakingRewardsAbi: () => iStakingRewardsAbi,
|
|
43
43
|
iTraderJoeRouterAbi: () => iTraderJoeRouterAbi,
|
|
@@ -3325,7 +3325,7 @@ const iMellowWrapperAbi = [
|
|
|
3325
3325
|
stateMutability: "nonpayable"
|
|
3326
3326
|
}
|
|
3327
3327
|
];
|
|
3328
|
-
const
|
|
3328
|
+
const iMidasIssuanceVaultV310Abi = [
|
|
3329
3329
|
{
|
|
3330
3330
|
type: "function",
|
|
3331
3331
|
name: "depositInstant",
|
|
@@ -4863,7 +4863,7 @@ const iwstETHAbi = [
|
|
|
4863
4863
|
iKelpLRTWithdrawalManagerGatewayAbi,
|
|
4864
4864
|
iMellowClaimerAbi,
|
|
4865
4865
|
iMellowWrapperAbi,
|
|
4866
|
-
|
|
4866
|
+
iMidasIssuanceVaultV310Abi,
|
|
4867
4867
|
iPendleRouterAbi,
|
|
4868
4868
|
iStakingRewardsAbi,
|
|
4869
4869
|
iTraderJoeRouterAbi,
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var MidasGatewayAdapterContract_exports = {};
|
|
20
|
+
__export(MidasGatewayAdapterContract_exports, {
|
|
21
|
+
MidasGatewayAdapterContract: () => MidasGatewayAdapterContract
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(MidasGatewayAdapterContract_exports);
|
|
24
|
+
var import_viem = require("viem");
|
|
25
|
+
var import_sdk = require("../../../sdk/index.js");
|
|
26
|
+
var import_adapters = require("../abi/adapters/index.js");
|
|
27
|
+
var import_AbstractAdapter = require("./AbstractAdapter.js");
|
|
28
|
+
const abi = import_adapters.iMidasGatewayAdapterV311Abi;
|
|
29
|
+
const protocolAbi = import_adapters.iMidasGatewayV311Abi;
|
|
30
|
+
class MidasGatewayAdapterContract extends import_AbstractAdapter.AbstractAdapterContract {
|
|
31
|
+
#gateway;
|
|
32
|
+
#mToken;
|
|
33
|
+
#referrerId;
|
|
34
|
+
#allowedInputTokens;
|
|
35
|
+
#allowedOutputTokens;
|
|
36
|
+
constructor(options, args) {
|
|
37
|
+
super(options, { ...args, abi, protocolAbi });
|
|
38
|
+
if (args.baseParams.serializedParams) {
|
|
39
|
+
const decoded = (0, import_viem.decodeAbiParameters)(
|
|
40
|
+
[
|
|
41
|
+
{ type: "address", name: "creditManager" },
|
|
42
|
+
{ type: "address", name: "targetContract" },
|
|
43
|
+
{ type: "address", name: "gateway" },
|
|
44
|
+
{ type: "address", name: "mToken" },
|
|
45
|
+
{ type: "bytes32", name: "referrerId" },
|
|
46
|
+
{ type: "address[]", name: "allowedInputTokens" },
|
|
47
|
+
{ type: "address[]", name: "allowedOutputTokens" },
|
|
48
|
+
{ type: "address[]", name: "allowedPhantomTokens" }
|
|
49
|
+
],
|
|
50
|
+
args.baseParams.serializedParams
|
|
51
|
+
);
|
|
52
|
+
this.#gateway = decoded[2];
|
|
53
|
+
this.#mToken = decoded[3];
|
|
54
|
+
this.#referrerId = decoded[4];
|
|
55
|
+
this.#allowedInputTokens = [...decoded[5]];
|
|
56
|
+
this.#allowedOutputTokens = decoded[6].map((token, index) => ({
|
|
57
|
+
token,
|
|
58
|
+
phantomToken: decoded[7][index]
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
get gateway() {
|
|
63
|
+
if (!this.#gateway) throw new import_sdk.MissingSerializedParamsError("gateway");
|
|
64
|
+
return this.#gateway;
|
|
65
|
+
}
|
|
66
|
+
get mToken() {
|
|
67
|
+
if (!this.#mToken) throw new import_sdk.MissingSerializedParamsError("mToken");
|
|
68
|
+
return this.#mToken;
|
|
69
|
+
}
|
|
70
|
+
get referrerId() {
|
|
71
|
+
if (this.#referrerId === void 0)
|
|
72
|
+
throw new import_sdk.MissingSerializedParamsError("referrerId");
|
|
73
|
+
return this.#referrerId;
|
|
74
|
+
}
|
|
75
|
+
get allowedInputTokens() {
|
|
76
|
+
if (!this.#allowedInputTokens)
|
|
77
|
+
throw new import_sdk.MissingSerializedParamsError("allowedInputTokens");
|
|
78
|
+
return this.#allowedInputTokens;
|
|
79
|
+
}
|
|
80
|
+
get allowedOutputTokens() {
|
|
81
|
+
if (!this.#allowedOutputTokens)
|
|
82
|
+
throw new import_sdk.MissingSerializedParamsError("allowedOutputTokens");
|
|
83
|
+
return this.#allowedOutputTokens;
|
|
84
|
+
}
|
|
85
|
+
stateHuman(raw) {
|
|
86
|
+
return {
|
|
87
|
+
...super.stateHuman(raw),
|
|
88
|
+
gateway: this.#gateway ? this.labelAddress(this.#gateway) : void 0,
|
|
89
|
+
mToken: this.#mToken ? this.labelAddress(this.#mToken) : void 0,
|
|
90
|
+
referrerId: this.#referrerId,
|
|
91
|
+
allowedInputTokens: this.#allowedInputTokens?.map(
|
|
92
|
+
(t) => this.labelAddress(t)
|
|
93
|
+
),
|
|
94
|
+
allowedOutputTokens: this.#allowedOutputTokens?.map((t) => ({
|
|
95
|
+
token: this.labelAddress(t.token),
|
|
96
|
+
phantomToken: this.labelAddress(t.phantomToken)
|
|
97
|
+
}))
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
decodeDiffLeftovers(decoded, balances) {
|
|
101
|
+
switch (decoded.functionName) {
|
|
102
|
+
case "depositInstantDiff": {
|
|
103
|
+
const [tokenIn, leftoverAmount] = decoded.args;
|
|
104
|
+
return [{ tokenIn, leftoverAmount }];
|
|
105
|
+
}
|
|
106
|
+
// redemptions spend the mToken down to the leftover, tokenOut arg is
|
|
107
|
+
// the received token
|
|
108
|
+
case "redeemInstantDiff":
|
|
109
|
+
case "redeemRequestDiff": {
|
|
110
|
+
const [, leftoverAmount] = decoded.args;
|
|
111
|
+
return [{ tokenIn: this.mToken, leftoverAmount }];
|
|
112
|
+
}
|
|
113
|
+
default:
|
|
114
|
+
return super.decodeDiffLeftovers(decoded, balances);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
119
|
+
0 && (module.exports = {
|
|
120
|
+
MidasGatewayAdapterContract
|
|
121
|
+
});
|
|
@@ -26,8 +26,8 @@ var import_sdk = require("../../../sdk/index.js");
|
|
|
26
26
|
var import_adapters = require("../abi/adapters/index.js");
|
|
27
27
|
var import_targetContractAbi = require("../abi/targetContractAbi.js");
|
|
28
28
|
var import_AbstractAdapter = require("./AbstractAdapter.js");
|
|
29
|
-
const abi = import_adapters.
|
|
30
|
-
const protocolAbi = import_targetContractAbi.
|
|
29
|
+
const abi = import_adapters.iMidasIssuanceVaultAdapterV310Abi;
|
|
30
|
+
const protocolAbi = import_targetContractAbi.iMidasIssuanceVaultV310Abi;
|
|
31
31
|
class MidasIssuanceVaultAdapterContract extends import_AbstractAdapter.AbstractAdapterContract {
|
|
32
32
|
#mToken;
|
|
33
33
|
#referrerId;
|
|
@@ -25,8 +25,8 @@ var import_viem = require("viem");
|
|
|
25
25
|
var import_sdk = require("../../../sdk/index.js");
|
|
26
26
|
var import_adapters = require("../abi/adapters/index.js");
|
|
27
27
|
var import_AbstractAdapter = require("./AbstractAdapter.js");
|
|
28
|
-
const abi = import_adapters.
|
|
29
|
-
const protocolAbi = import_adapters.
|
|
28
|
+
const abi = import_adapters.iMidasRedemptionVaultAdapterV310Abi;
|
|
29
|
+
const protocolAbi = import_adapters.iMidasRedemptionVaultGatewayV310Abi;
|
|
30
30
|
class MidasRedemptionVaultAdapterContract extends import_AbstractAdapter.AbstractAdapterContract {
|
|
31
31
|
#gateway;
|
|
32
32
|
#mToken;
|
|
@@ -40,6 +40,7 @@ __reExport(contracts_exports, require("./MellowClaimerAdapterContract.js"), modu
|
|
|
40
40
|
__reExport(contracts_exports, require("./MellowDVVAdapterContract.js"), module.exports);
|
|
41
41
|
__reExport(contracts_exports, require("./MellowERC4626VaultAdapterContract.js"), module.exports);
|
|
42
42
|
__reExport(contracts_exports, require("./MellowWrapperAdapterContract.js"), module.exports);
|
|
43
|
+
__reExport(contracts_exports, require("./MidasGatewayAdapterContract.js"), module.exports);
|
|
43
44
|
__reExport(contracts_exports, require("./MidasIssuanceVaultAdapterContract.js"), module.exports);
|
|
44
45
|
__reExport(contracts_exports, require("./MidasRedemptionVaultAdapterContract.js"), module.exports);
|
|
45
46
|
__reExport(contracts_exports, require("./PendleRouterAdapterContract.js"), module.exports);
|
|
@@ -80,6 +81,7 @@ __reExport(contracts_exports, require("./WstETHV1AdapterContract.js"), module.ex
|
|
|
80
81
|
...require("./MellowDVVAdapterContract.js"),
|
|
81
82
|
...require("./MellowERC4626VaultAdapterContract.js"),
|
|
82
83
|
...require("./MellowWrapperAdapterContract.js"),
|
|
84
|
+
...require("./MidasGatewayAdapterContract.js"),
|
|
83
85
|
...require("./MidasIssuanceVaultAdapterContract.js"),
|
|
84
86
|
...require("./MidasRedemptionVaultAdapterContract.js"),
|
|
85
87
|
...require("./PendleRouterAdapterContract.js"),
|
|
@@ -81,6 +81,8 @@ function createAdapter(options, data, strict) {
|
|
|
81
81
|
return new import_contracts.MellowERC4626VaultAdapterContract(options, data);
|
|
82
82
|
case "ADAPTER::MELLOW_WRAPPER":
|
|
83
83
|
return new import_contracts.MellowWrapperAdapterContract(options, data);
|
|
84
|
+
case "ADAPTER::MIDAS_GATEWAY":
|
|
85
|
+
return new import_contracts.MidasGatewayAdapterContract(options, data);
|
|
84
86
|
case "ADAPTER::MIDAS_ISSUANCE_VAULT":
|
|
85
87
|
return new import_contracts.MidasIssuanceVaultAdapterContract(options, data);
|
|
86
88
|
case "ADAPTER::MIDAS_REDEMPTION_VAULT":
|
|
@@ -47,6 +47,7 @@ var AdapterType = /* @__PURE__ */ ((AdapterType2) => {
|
|
|
47
47
|
AdapterType2["MELLOW_DVV"] = "MELLOW_DVV";
|
|
48
48
|
AdapterType2["MELLOW_ERC4626_VAULT"] = "MELLOW_ERC4626_VAULT";
|
|
49
49
|
AdapterType2["MELLOW_WRAPPER"] = "MELLOW_WRAPPER";
|
|
50
|
+
AdapterType2["MIDAS_GATEWAY"] = "MIDAS_GATEWAY";
|
|
50
51
|
AdapterType2["MIDAS_ISSUANCE_VAULT"] = "MIDAS_ISSUANCE_VAULT";
|
|
51
52
|
AdapterType2["MIDAS_REDEMPTION_VAULT"] = "MIDAS_REDEMPTION_VAULT";
|
|
52
53
|
AdapterType2["PENDLE_ROUTER"] = "PENDLE_ROUTER";
|
|
@@ -21,8 +21,6 @@ __export(DelayedWithdrawalPlugin_exports, {
|
|
|
21
21
|
DelayedWithdrawalPlugin: () => DelayedWithdrawalPlugin
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(DelayedWithdrawalPlugin_exports);
|
|
24
|
-
var import_IWithdrawalCompressorV310 = require("../../abi/IWithdrawalCompressorV310.js");
|
|
25
|
-
var import_IWithdrawalCompressorV311 = require("../../abi/IWithdrawalCompressorV311.js");
|
|
26
24
|
var import_sdk = require("../../sdk/index.js");
|
|
27
25
|
const MAP_LABEL = "delayedWithdrawal";
|
|
28
26
|
class DelayedWithdrawalPlugin extends import_sdk.BasePlugin {
|
|
@@ -31,44 +29,29 @@ class DelayedWithdrawalPlugin extends import_sdk.BasePlugin {
|
|
|
31
29
|
if (!force && this.loaded) {
|
|
32
30
|
return this.state;
|
|
33
31
|
}
|
|
34
|
-
|
|
32
|
+
this.#withdrawableAssets = new import_sdk.AddressMap(void 0, MAP_LABEL);
|
|
33
|
+
const compressor = this.sdk.withdrawalCompressor();
|
|
35
34
|
this.sdk.logger?.debug(
|
|
36
|
-
`loading delayed withdrawal plugin with compressor ${compressor}`
|
|
35
|
+
`loading delayed withdrawal plugin with compressor ${compressor.address}`
|
|
37
36
|
);
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
37
|
+
const resp = await compressor.getWithdrawableAssetsBatch();
|
|
38
|
+
const byCreditManager = /* @__PURE__ */ new Map();
|
|
39
|
+
for (const cfg of resp) {
|
|
40
|
+
const assets = byCreditManager.get(cfg.creditManager) ?? [];
|
|
41
|
+
assets.push({
|
|
42
|
+
...cfg,
|
|
43
|
+
disabled: isConfigToOmit({
|
|
44
|
+
creditManager: cfg.creditManager,
|
|
45
|
+
token: cfg.token,
|
|
46
|
+
withdrawalPhantomToken: cfg.withdrawalPhantomToken,
|
|
47
|
+
underlying: cfg.underlying
|
|
46
48
|
})
|
|
47
|
-
)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const cm = creditManagers[index];
|
|
54
|
-
if (r.status === "success" && r.result?.length > 0) {
|
|
55
|
-
const configsToShow = r.result;
|
|
56
|
-
this.#withdrawableAssets?.upsert(
|
|
57
|
-
cm.creditManager.address,
|
|
58
|
-
configsToShow.map((cfg) => ({
|
|
59
|
-
...cfg,
|
|
60
|
-
creditManager: cm.creditManager.address,
|
|
61
|
-
disabled: isConfigToOmit({
|
|
62
|
-
creditManager: cm.creditManager.address,
|
|
63
|
-
token: cfg.token,
|
|
64
|
-
withdrawalPhantomToken: cfg.withdrawalPhantomToken,
|
|
65
|
-
underlying: cfg.underlying
|
|
66
|
-
})
|
|
67
|
-
}))
|
|
68
|
-
);
|
|
69
|
-
} else {
|
|
70
|
-
}
|
|
71
|
-
});
|
|
49
|
+
});
|
|
50
|
+
byCreditManager.set(cfg.creditManager, assets);
|
|
51
|
+
}
|
|
52
|
+
for (const [creditManager, assets] of byCreditManager) {
|
|
53
|
+
this.#withdrawableAssets.upsert(creditManager, assets);
|
|
54
|
+
}
|
|
72
55
|
return this.state;
|
|
73
56
|
}
|
|
74
57
|
get loaded() {
|
|
@@ -535,6 +535,17 @@ class OnchainSDK extends import_base.ChainContractsRegister {
|
|
|
535
535
|
const [routerAddr, routerV] = routerEntry;
|
|
536
536
|
return (0, import_router.createRouter)(this, routerAddr, routerV);
|
|
537
537
|
}
|
|
538
|
+
/**
|
|
539
|
+
* Lazily returns a withdrawal compressor contract for the current chain.
|
|
540
|
+
*
|
|
541
|
+
* @param version - Desired compressor version; when omitted, the latest
|
|
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.
|
|
545
|
+
**/
|
|
546
|
+
withdrawalCompressor(version) {
|
|
547
|
+
return (0, import_accounts.createWithdrawalCompressor)(this, version);
|
|
548
|
+
}
|
|
538
549
|
}
|
|
539
550
|
// Annotate the CommonJS export names for ESM import in node:
|
|
540
551
|
0 && (module.exports = {
|
|
@@ -18,8 +18,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var CreditAccountsServiceV310_exports = {};
|
|
20
20
|
__export(CreditAccountsServiceV310_exports, {
|
|
21
|
-
CreditAccountsServiceV310: () => CreditAccountsServiceV310
|
|
22
|
-
getWithdrawalCompressorAddress: () => getWithdrawalCompressorAddress
|
|
21
|
+
CreditAccountsServiceV310: () => CreditAccountsServiceV310
|
|
23
22
|
});
|
|
24
23
|
module.exports = __toCommonJS(CreditAccountsServiceV310_exports);
|
|
25
24
|
var import_viem = require("viem");
|
|
@@ -27,31 +26,15 @@ var import_generated = require("../../abi/310/generated.js");
|
|
|
27
26
|
var import_creditAccountCompressor = require("../../abi/compressors/creditAccountCompressor.js");
|
|
28
27
|
var import_peripheryCompressor = require("../../abi/compressors/peripheryCompressor.js");
|
|
29
28
|
var import_rewardsCompressor = require("../../abi/compressors/rewardsCompressor.js");
|
|
30
|
-
var import_IWithdrawalCompressorV310 = require("../../abi/IWithdrawalCompressorV310.js");
|
|
31
|
-
var import_IWithdrawalCompressorV311 = require("../../abi/IWithdrawalCompressorV311.js");
|
|
32
29
|
var import_iBaseRewardPool = require("../../abi/iBaseRewardPool.js");
|
|
33
30
|
var import_ierc4626Adapter = require("../../abi/ierc4626Adapter.js");
|
|
34
31
|
var import_iRWAFactory = require("../../abi/rwa/iRWAFactory.js");
|
|
35
32
|
var import_base = require("../base/index.js");
|
|
36
|
-
var import_chains = require("../chain/chains.js");
|
|
37
33
|
var import_constants = require("../constants/index.js");
|
|
38
34
|
var import_market = require("../market/index.js");
|
|
39
35
|
var import_utils = require("../utils/index.js");
|
|
40
36
|
var import_viem2 = require("../utils/viem/index.js");
|
|
41
37
|
var import_multicall_utils = require("./multicall-utils.js");
|
|
42
|
-
const COMPRESSORS = {
|
|
43
|
-
[import_chains.chains.Mainnet.id]: {
|
|
44
|
-
address: "0x36F3d0Bb73CBC2E94fE24dF0f26a689409cF9023",
|
|
45
|
-
version: 310
|
|
46
|
-
},
|
|
47
|
-
[import_chains.chains.Monad.id]: {
|
|
48
|
-
address: "0x36F3d0Bb73CBC2E94fE24dF0f26a689409cF9023",
|
|
49
|
-
version: 310
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
function getWithdrawalCompressorAddress(chainId) {
|
|
53
|
-
return COMPRESSORS[chainId];
|
|
54
|
-
}
|
|
55
38
|
class CreditAccountsServiceV310 extends import_base.SDKConstruct {
|
|
56
39
|
#compressor;
|
|
57
40
|
#batchSize;
|
|
@@ -802,22 +785,8 @@ class CreditAccountsServiceV310 extends import_base.SDKConstruct {
|
|
|
802
785
|
amount,
|
|
803
786
|
token
|
|
804
787
|
}) {
|
|
805
|
-
const compressor =
|
|
806
|
-
|
|
807
|
-
throw new Error(
|
|
808
|
-
`No compressor for current chain ${this.sdk.networkType}`
|
|
809
|
-
);
|
|
810
|
-
const contract = (0, import_viem.getContract)({
|
|
811
|
-
address: compressor.address,
|
|
812
|
-
abi: compressor.version === 310 ? import_IWithdrawalCompressorV310.iWithdrawalCompressorV310Abi : import_IWithdrawalCompressorV311.iWithdrawalCompressorV311Abi,
|
|
813
|
-
client: this.client
|
|
814
|
-
});
|
|
815
|
-
const resp = await contract.read.getWithdrawalRequestResult([
|
|
816
|
-
creditAccount,
|
|
817
|
-
token,
|
|
818
|
-
amount
|
|
819
|
-
]);
|
|
820
|
-
return resp;
|
|
788
|
+
const compressor = this.sdk.withdrawalCompressor();
|
|
789
|
+
return compressor.getWithdrawalRequestResult(creditAccount, token, amount);
|
|
821
790
|
}
|
|
822
791
|
/**
|
|
823
792
|
* {@inheritDoc ICreditAccountsService.getPendingWithdrawals}
|
|
@@ -825,26 +794,12 @@ class CreditAccountsServiceV310 extends import_base.SDKConstruct {
|
|
|
825
794
|
async getPendingWithdrawals({
|
|
826
795
|
creditAccount
|
|
827
796
|
}) {
|
|
828
|
-
const compressor =
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
const contract = (0, import_viem.getContract)({
|
|
834
|
-
address: compressor.address,
|
|
835
|
-
abi: compressor.version === 310 ? import_IWithdrawalCompressorV310.iWithdrawalCompressorV310Abi : import_IWithdrawalCompressorV311.iWithdrawalCompressorV311Abi,
|
|
836
|
-
client: this.client
|
|
837
|
-
});
|
|
838
|
-
const resp = await contract.read.getCurrentWithdrawals([creditAccount]);
|
|
839
|
-
const claimableNow = resp?.[0] || [];
|
|
840
|
-
const pendingResult = [...resp?.[1] || []].sort(
|
|
841
|
-
(a, b) => a.claimableAt < b.claimableAt ? -1 : 1
|
|
842
|
-
);
|
|
843
|
-
const respResult = {
|
|
844
|
-
claimableNow: [...claimableNow],
|
|
845
|
-
pending: pendingResult
|
|
797
|
+
const compressor = this.sdk.withdrawalCompressor();
|
|
798
|
+
const { claimable, pending } = await compressor.getCurrentWithdrawals(creditAccount);
|
|
799
|
+
return {
|
|
800
|
+
claimableNow: claimable,
|
|
801
|
+
pending
|
|
846
802
|
};
|
|
847
|
-
return respResult;
|
|
848
803
|
}
|
|
849
804
|
/**
|
|
850
805
|
* {@inheritDoc ICreditAccountsService.startDelayedWithdrawal}
|
|
@@ -1879,6 +1834,5 @@ class CreditAccountsServiceV310 extends import_base.SDKConstruct {
|
|
|
1879
1834
|
}
|
|
1880
1835
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1881
1836
|
0 && (module.exports = {
|
|
1882
|
-
CreditAccountsServiceV310
|
|
1883
|
-
getWithdrawalCompressorAddress
|
|
1837
|
+
CreditAccountsServiceV310
|
|
1884
1838
|
});
|
|
@@ -17,8 +17,10 @@ var accounts_exports = {};
|
|
|
17
17
|
module.exports = __toCommonJS(accounts_exports);
|
|
18
18
|
__reExport(accounts_exports, require("./CreditAccountsServiceV310.js"), module.exports);
|
|
19
19
|
__reExport(accounts_exports, require("./types.js"), module.exports);
|
|
20
|
+
__reExport(accounts_exports, require("./withdrawal-compressor/index.js"), module.exports);
|
|
20
21
|
// Annotate the CommonJS export names for ESM import in node:
|
|
21
22
|
0 && (module.exports = {
|
|
22
23
|
...require("./CreditAccountsServiceV310.js"),
|
|
23
|
-
...require("./types.js")
|
|
24
|
+
...require("./types.js"),
|
|
25
|
+
...require("./withdrawal-compressor/index.js")
|
|
24
26
|
});
|