@gearbox-protocol/sdk 14.11.8 → 14.11.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 (24) hide show
  1. package/dist/cjs/plugins/adapters/abi/actionAbi.js +19 -5
  2. package/dist/cjs/plugins/adapters/abi/conctructorAbi.js +5 -1
  3. package/dist/cjs/plugins/adapters/abi/securitize/iMidasGatewayAdapter.js +354 -0
  4. package/dist/cjs/plugins/adapters/abi/securitize/iSecuritizeRedemptionGatewayAdapter.js +43 -8
  5. package/dist/cjs/plugins/adapters/abi/securitize/index.js +2 -0
  6. package/dist/cjs/plugins/adapters/contracts/MidasGatewayAdapterContract.js +103 -0
  7. package/dist/cjs/plugins/adapters/createAdapter.js +3 -0
  8. package/dist/cjs/plugins/adapters/types.js +1 -0
  9. package/dist/esm/plugins/adapters/abi/actionAbi.js +19 -5
  10. package/dist/esm/plugins/adapters/abi/conctructorAbi.js +5 -1
  11. package/dist/esm/plugins/adapters/abi/securitize/iMidasGatewayAdapter.js +330 -0
  12. package/dist/esm/plugins/adapters/abi/securitize/iSecuritizeRedemptionGatewayAdapter.js +43 -8
  13. package/dist/esm/plugins/adapters/abi/securitize/index.js +1 -0
  14. package/dist/esm/plugins/adapters/contracts/MidasGatewayAdapterContract.js +81 -0
  15. package/dist/esm/plugins/adapters/createAdapter.js +3 -0
  16. package/dist/esm/plugins/adapters/types.js +1 -0
  17. package/dist/types/plugins/adapters/abi/actionAbi.d.ts +1 -1
  18. package/dist/types/plugins/adapters/abi/securitize/iMidasGatewayAdapter.d.ts +555 -0
  19. package/dist/types/plugins/adapters/abi/securitize/iSecuritizeRedemptionGatewayAdapter.d.ts +73 -7
  20. package/dist/types/plugins/adapters/abi/securitize/index.d.ts +1 -0
  21. package/dist/types/plugins/adapters/contracts/MidasGatewayAdapterContract.d.ts +1144 -0
  22. package/dist/types/plugins/adapters/contracts/SecuritizeRedemptionGatewayAdapterContract.d.ts +73 -7
  23. package/dist/types/plugins/adapters/types.d.ts +2 -1
  24. package/package.json +1 -1
@@ -69,6 +69,12 @@ const adapterActionSignatures = {
69
69
  [import_types.AdapterType.MIDAS_REDEMPTION_VAULT]: {
70
70
  310: "function setTokenAllowedStatusBatch((address,address,bool)[])"
71
71
  },
72
+ [import_types.AdapterType.MIDAS_GATEWAY]: {
73
+ 311: [
74
+ "function setInputTokenAllowedStatusBatch(address[],bool[])",
75
+ "function setOutputTokenAllowedStatusBatch((address,address,bool)[])"
76
+ ]
77
+ },
72
78
  [import_types.AdapterType.PENDLE_ROUTER]: {
73
79
  310: "function setPairStatusBatch((address,address,address,uint8)[])",
74
80
  311: "function setPairStatusBatch((address,address,address,uint8,uint8)[])"
@@ -96,7 +102,7 @@ const adapterActionAbi = Object.fromEntries(
96
102
  Object.fromEntries(
97
103
  Object.entries(versionedSignature).map(([version, signature]) => [
98
104
  version,
99
- (0, import_viem.parseAbi)([signature])
105
+ (0, import_viem.parseAbi)(Array.isArray(signature) ? signature : [signature])
100
106
  ])
101
107
  )
102
108
  ]
@@ -104,10 +110,18 @@ const adapterActionAbi = Object.fromEntries(
104
110
  );
105
111
  const adapterActionSelectors = Object.fromEntries(
106
112
  Object.entries(adapterActionSignatures).flatMap(
107
- ([adapterType, versionedSignature]) => Object.entries(versionedSignature).map(([version, signature]) => [
108
- (0, import_viem.toFunctionSelector)(signature),
109
- { version: +version, signature, adapterType }
110
- ])
113
+ ([adapterType, versionedSignature]) => Object.entries(versionedSignature).map(([version, signature]) => {
114
+ if (Array.isArray(signature)) {
115
+ return signature.map((s) => [
116
+ (0, import_viem.toFunctionSelector)(s),
117
+ { version: +version, signature: s, adapterType }
118
+ ]);
119
+ }
120
+ return [
121
+ (0, import_viem.toFunctionSelector)(signature),
122
+ { version: +version, signature, adapterType }
123
+ ];
124
+ })
111
125
  )
112
126
  );
113
127
  // Annotate the CommonJS export names for ESM import in node:
@@ -183,7 +183,8 @@ const adapterConstructorAbi = {
183
183
  310: import_conctructorAbiPatterns.PHANTOM_TOKEN_ADAPTER_ABI
184
184
  },
185
185
  [import_types.AdapterType.SECURITIZE_REDEMPTION]: {
186
- 310: import_conctructorAbiPatterns.PHANTOM_TOKEN_ADAPTER_ABI
186
+ 310: import_conctructorAbiPatterns.PHANTOM_TOKEN_ADAPTER_ABI,
187
+ 311: import_conctructorAbiPatterns.PHANTOM_TOKEN_ADAPTER_ABI
187
188
  },
188
189
  // other patterns
189
190
  [import_types.AdapterType.STAKING_REWARDS]: {
@@ -193,6 +194,9 @@ const adapterConstructorAbi = {
193
194
  },
194
195
  [import_types.AdapterType.MIDAS_ISSUANCE_VAULT]: {
195
196
  310: import_conctructorAbiPatterns.REFERER_ID_ADAPTER_ABI
197
+ },
198
+ [import_types.AdapterType.MIDAS_GATEWAY]: {
199
+ 311: import_conctructorAbiPatterns.REFERER_ID_ADAPTER_ABI
196
200
  }
197
201
  };
198
202
  // Annotate the CommonJS export names for ESM import in node:
@@ -0,0 +1,354 @@
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 iMidasGatewayAdapter_exports = {};
20
+ __export(iMidasGatewayAdapter_exports, {
21
+ iMidasGatewayAdapterAbi: () => iMidasGatewayAdapterAbi
22
+ });
23
+ module.exports = __toCommonJS(iMidasGatewayAdapter_exports);
24
+ const iMidasGatewayAdapterAbi = [
25
+ {
26
+ type: "function",
27
+ name: "acl",
28
+ inputs: [],
29
+ outputs: [{ name: "", type: "address", internalType: "address" }],
30
+ stateMutability: "view"
31
+ },
32
+ {
33
+ type: "function",
34
+ name: "allowedInputTokens",
35
+ inputs: [],
36
+ outputs: [{ name: "", type: "address[]", internalType: "address[]" }],
37
+ stateMutability: "view"
38
+ },
39
+ {
40
+ type: "function",
41
+ name: "allowedOutputTokens",
42
+ inputs: [],
43
+ outputs: [{ name: "", type: "address[]", internalType: "address[]" }],
44
+ stateMutability: "view"
45
+ },
46
+ {
47
+ type: "function",
48
+ name: "allowedPhantomTokens",
49
+ inputs: [],
50
+ outputs: [{ name: "", type: "address[]", internalType: "address[]" }],
51
+ stateMutability: "view"
52
+ },
53
+ {
54
+ type: "function",
55
+ name: "contractType",
56
+ inputs: [],
57
+ outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
58
+ stateMutability: "view"
59
+ },
60
+ {
61
+ type: "function",
62
+ name: "creditManager",
63
+ inputs: [],
64
+ outputs: [{ name: "", type: "address", internalType: "address" }],
65
+ stateMutability: "view"
66
+ },
67
+ {
68
+ type: "function",
69
+ name: "depositInstant",
70
+ inputs: [
71
+ { name: "tokenIn", type: "address", internalType: "address" },
72
+ { name: "amountToken", type: "uint256", internalType: "uint256" },
73
+ { name: "minReceiveAmount", type: "uint256", internalType: "uint256" },
74
+ { name: "", type: "bytes32", internalType: "bytes32" }
75
+ ],
76
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
77
+ stateMutability: "nonpayable"
78
+ },
79
+ {
80
+ type: "function",
81
+ name: "depositInstantDiff",
82
+ inputs: [
83
+ { name: "tokenIn", type: "address", internalType: "address" },
84
+ { name: "leftoverAmount", type: "uint256", internalType: "uint256" },
85
+ { name: "rateMinRAY", type: "uint256", internalType: "uint256" }
86
+ ],
87
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
88
+ stateMutability: "nonpayable"
89
+ },
90
+ {
91
+ type: "function",
92
+ name: "depositPhantomToken",
93
+ inputs: [
94
+ { name: "", type: "address", internalType: "address" },
95
+ { name: "", type: "uint256", internalType: "uint256" }
96
+ ],
97
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
98
+ stateMutability: "view"
99
+ },
100
+ {
101
+ type: "function",
102
+ name: "gateway",
103
+ inputs: [],
104
+ outputs: [{ name: "", type: "address", internalType: "address" }],
105
+ stateMutability: "view"
106
+ },
107
+ {
108
+ type: "function",
109
+ name: "isInputTokenAllowed",
110
+ inputs: [{ name: "token", type: "address", internalType: "address" }],
111
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
112
+ stateMutability: "view"
113
+ },
114
+ {
115
+ type: "function",
116
+ name: "isOutputTokenAllowed",
117
+ inputs: [{ name: "token", type: "address", internalType: "address" }],
118
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
119
+ stateMutability: "view"
120
+ },
121
+ {
122
+ type: "function",
123
+ name: "mToken",
124
+ inputs: [],
125
+ outputs: [{ name: "", type: "address", internalType: "address" }],
126
+ stateMutability: "view"
127
+ },
128
+ {
129
+ type: "function",
130
+ name: "outputTokenToPhantomToken",
131
+ inputs: [{ name: "", type: "address", internalType: "address" }],
132
+ outputs: [{ name: "", type: "address", internalType: "address" }],
133
+ stateMutability: "view"
134
+ },
135
+ {
136
+ type: "function",
137
+ name: "phantomTokenToOutputToken",
138
+ inputs: [{ name: "", type: "address", internalType: "address" }],
139
+ outputs: [{ name: "", type: "address", internalType: "address" }],
140
+ stateMutability: "view"
141
+ },
142
+ {
143
+ type: "function",
144
+ name: "redeemInstant",
145
+ inputs: [
146
+ { name: "tokenOut", type: "address", internalType: "address" },
147
+ { name: "amountMTokenIn", type: "uint256", internalType: "uint256" },
148
+ { name: "minReceiveAmount", type: "uint256", internalType: "uint256" }
149
+ ],
150
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
151
+ stateMutability: "nonpayable"
152
+ },
153
+ {
154
+ type: "function",
155
+ name: "redeemInstantDiff",
156
+ inputs: [
157
+ { name: "tokenOut", type: "address", internalType: "address" },
158
+ { name: "leftoverAmount", type: "uint256", internalType: "uint256" },
159
+ { name: "rateMinRAY", type: "uint256", internalType: "uint256" }
160
+ ],
161
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
162
+ stateMutability: "nonpayable"
163
+ },
164
+ {
165
+ type: "function",
166
+ name: "redeemRequest",
167
+ inputs: [
168
+ { name: "tokenOut", type: "address", internalType: "address" },
169
+ { name: "amountMTokenIn", type: "uint256", internalType: "uint256" },
170
+ { name: "extraData", type: "bytes", internalType: "bytes" }
171
+ ],
172
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
173
+ stateMutability: "nonpayable"
174
+ },
175
+ {
176
+ type: "function",
177
+ name: "redeemRequest",
178
+ inputs: [
179
+ { name: "tokenOut", type: "address", internalType: "address" },
180
+ { name: "amountMTokenIn", type: "uint256", internalType: "uint256" }
181
+ ],
182
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
183
+ stateMutability: "nonpayable"
184
+ },
185
+ {
186
+ type: "function",
187
+ name: "redeemRequestDiff",
188
+ inputs: [
189
+ { name: "tokenOut", type: "address", internalType: "address" },
190
+ { name: "leftoverAmount", type: "uint256", internalType: "uint256" }
191
+ ],
192
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
193
+ stateMutability: "nonpayable"
194
+ },
195
+ {
196
+ type: "function",
197
+ name: "redeemRequestDiff",
198
+ inputs: [
199
+ { name: "tokenOut", type: "address", internalType: "address" },
200
+ { name: "leftoverAmount", type: "uint256", internalType: "uint256" },
201
+ { name: "extraData", type: "bytes", internalType: "bytes" }
202
+ ],
203
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
204
+ stateMutability: "nonpayable"
205
+ },
206
+ {
207
+ type: "function",
208
+ name: "referrerId",
209
+ inputs: [],
210
+ outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
211
+ stateMutability: "view"
212
+ },
213
+ {
214
+ type: "function",
215
+ name: "serialize",
216
+ inputs: [],
217
+ outputs: [{ name: "serializedData", type: "bytes", internalType: "bytes" }],
218
+ stateMutability: "view"
219
+ },
220
+ {
221
+ type: "function",
222
+ name: "setInputTokenAllowedStatusBatch",
223
+ inputs: [
224
+ { name: "tokens", type: "address[]", internalType: "address[]" },
225
+ { name: "allowed", type: "bool[]", internalType: "bool[]" }
226
+ ],
227
+ outputs: [],
228
+ stateMutability: "nonpayable"
229
+ },
230
+ {
231
+ type: "function",
232
+ name: "setOutputTokenAllowedStatusBatch",
233
+ inputs: [
234
+ {
235
+ name: "configs",
236
+ type: "tuple[]",
237
+ internalType: "struct IMidasGatewayAdapter.MidasAllowedTokenStatus[]",
238
+ components: [
239
+ { name: "token", type: "address", internalType: "address" },
240
+ { name: "phantomToken", type: "address", internalType: "address" },
241
+ { name: "allowed", type: "bool", internalType: "bool" }
242
+ ]
243
+ }
244
+ ],
245
+ outputs: [],
246
+ stateMutability: "nonpayable"
247
+ },
248
+ {
249
+ type: "function",
250
+ name: "targetContract",
251
+ inputs: [],
252
+ outputs: [{ name: "", type: "address", internalType: "address" }],
253
+ stateMutability: "view"
254
+ },
255
+ {
256
+ type: "function",
257
+ name: "transferRedeemer",
258
+ inputs: [
259
+ { name: "redeemer", type: "address", internalType: "address" },
260
+ { name: "newAccount", type: "address", internalType: "address" }
261
+ ],
262
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
263
+ stateMutability: "nonpayable"
264
+ },
265
+ {
266
+ type: "function",
267
+ name: "version",
268
+ inputs: [],
269
+ outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
270
+ stateMutability: "view"
271
+ },
272
+ {
273
+ type: "function",
274
+ name: "withdraw",
275
+ inputs: [
276
+ { name: "tokenOut", type: "address", internalType: "address" },
277
+ { name: "amount", type: "uint256", internalType: "uint256" }
278
+ ],
279
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
280
+ stateMutability: "nonpayable"
281
+ },
282
+ {
283
+ type: "function",
284
+ name: "withdrawFromRedeemer",
285
+ inputs: [
286
+ { name: "redeemer", type: "address", internalType: "address" },
287
+ { name: "tokenOut", type: "address", internalType: "address" },
288
+ { name: "amount", type: "uint256", internalType: "uint256" }
289
+ ],
290
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
291
+ stateMutability: "nonpayable"
292
+ },
293
+ {
294
+ type: "function",
295
+ name: "withdrawPhantomToken",
296
+ inputs: [
297
+ { name: "token", type: "address", internalType: "address" },
298
+ { name: "amount", type: "uint256", internalType: "uint256" }
299
+ ],
300
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
301
+ stateMutability: "nonpayable"
302
+ },
303
+ {
304
+ type: "event",
305
+ name: "SetInputTokenAllowedStatus",
306
+ inputs: [
307
+ {
308
+ name: "token",
309
+ type: "address",
310
+ indexed: true,
311
+ internalType: "address"
312
+ },
313
+ { name: "allowed", type: "bool", indexed: false, internalType: "bool" }
314
+ ],
315
+ anonymous: false
316
+ },
317
+ {
318
+ type: "event",
319
+ name: "SetOutputTokenAllowedStatus",
320
+ inputs: [
321
+ {
322
+ name: "token",
323
+ type: "address",
324
+ indexed: true,
325
+ internalType: "address"
326
+ },
327
+ {
328
+ name: "phantomToken",
329
+ type: "address",
330
+ indexed: true,
331
+ internalType: "address"
332
+ },
333
+ { name: "allowed", type: "bool", indexed: false, internalType: "bool" }
334
+ ],
335
+ anonymous: false
336
+ },
337
+ {
338
+ type: "error",
339
+ name: "AddressIsNotContractException",
340
+ inputs: [{ name: "", type: "address", internalType: "address" }]
341
+ },
342
+ { type: "error", name: "CallerNotConfiguratorException", inputs: [] },
343
+ { type: "error", name: "CallerNotCreditFacadeException", inputs: [] },
344
+ { type: "error", name: "IncorrectArrayLengthException", inputs: [] },
345
+ { type: "error", name: "IncorrectStakedPhantomTokenException", inputs: [] },
346
+ { type: "error", name: "NotImplementedException", inputs: [] },
347
+ { type: "error", name: "PhantomTokenTokenOutMismatchException", inputs: [] },
348
+ { type: "error", name: "TokenNotAllowedException", inputs: [] },
349
+ { type: "error", name: "ZeroAddressException", inputs: [] }
350
+ ];
351
+ // Annotate the CommonJS export names for ESM import in node:
352
+ 0 && (module.exports = {
353
+ iMidasGatewayAdapterAbi
354
+ });
@@ -22,6 +22,13 @@ __export(iSecuritizeRedemptionGatewayAdapter_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(iSecuritizeRedemptionGatewayAdapter_exports);
24
24
  const iSecuritizeRedemptionGatewayAdapterAbi = [
25
+ {
26
+ type: "function",
27
+ name: "acl",
28
+ inputs: [],
29
+ outputs: [{ name: "", type: "address", internalType: "address" }],
30
+ stateMutability: "view"
31
+ },
25
32
  {
26
33
  type: "function",
27
34
  name: "claim",
@@ -49,11 +56,11 @@ const iSecuritizeRedemptionGatewayAdapterAbi = [
49
56
  type: "function",
50
57
  name: "depositPhantomToken",
51
58
  inputs: [
52
- { name: "token", type: "address", internalType: "address" },
53
- { name: "amount", type: "uint256", internalType: "uint256" }
59
+ { name: "", type: "address", internalType: "address" },
60
+ { name: "", type: "uint256", internalType: "uint256" }
54
61
  ],
55
62
  outputs: [{ name: "", type: "bool", internalType: "bool" }],
56
- stateMutability: "nonpayable"
63
+ stateMutability: "view"
57
64
  },
58
65
  {
59
66
  type: "function",
@@ -71,6 +78,26 @@ const iSecuritizeRedemptionGatewayAdapterAbi = [
71
78
  outputs: [{ name: "", type: "bool", internalType: "bool" }],
72
79
  stateMutability: "nonpayable"
73
80
  },
81
+ {
82
+ type: "function",
83
+ name: "redeem",
84
+ inputs: [
85
+ { name: "dsTokenAmount", type: "uint256", internalType: "uint256" },
86
+ { name: "extraData", type: "bytes", internalType: "bytes" }
87
+ ],
88
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
89
+ stateMutability: "nonpayable"
90
+ },
91
+ {
92
+ type: "function",
93
+ name: "redeemDiff",
94
+ inputs: [
95
+ { name: "leftoverAmount", type: "uint256", internalType: "uint256" },
96
+ { name: "extraData", type: "bytes", internalType: "bytes" }
97
+ ],
98
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
99
+ stateMutability: "nonpayable"
100
+ },
74
101
  {
75
102
  type: "function",
76
103
  name: "redeemDiff",
@@ -129,14 +156,22 @@ const iSecuritizeRedemptionGatewayAdapterAbi = [
129
156
  type: "function",
130
157
  name: "withdrawPhantomToken",
131
158
  inputs: [
132
- { name: "token", type: "address", internalType: "address" },
133
- { name: "amount", type: "uint256", internalType: "uint256" }
159
+ { name: "", type: "address", internalType: "address" },
160
+ { name: "", type: "uint256", internalType: "uint256" }
134
161
  ],
135
- outputs: [{ name: "useSafePrices", type: "bool", internalType: "bool" }],
136
- stateMutability: "nonpayable"
162
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
163
+ stateMutability: "view"
164
+ },
165
+ {
166
+ type: "error",
167
+ name: "AddressIsNotContractException",
168
+ inputs: [{ name: "", type: "address", internalType: "address" }]
137
169
  },
170
+ { type: "error", name: "CallerNotCreditFacadeException", inputs: [] },
138
171
  { type: "error", name: "IncorrectStakedPhantomTokenException", inputs: [] },
139
- { type: "error", name: "InvalidRedemptionGatewayException", inputs: [] }
172
+ { type: "error", name: "InvalidRedemptionGatewayException", inputs: [] },
173
+ { type: "error", name: "NotImplementedException", inputs: [] },
174
+ { type: "error", name: "ZeroAddressException", inputs: [] }
140
175
  ];
141
176
  // Annotate the CommonJS export names for ESM import in node:
142
177
  0 && (module.exports = {
@@ -16,6 +16,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
16
16
  var securitize_exports = {};
17
17
  module.exports = __toCommonJS(securitize_exports);
18
18
  __reExport(securitize_exports, require("./iBaseOnRamp.js"), module.exports);
19
+ __reExport(securitize_exports, require("./iMidasGatewayAdapter.js"), module.exports);
19
20
  __reExport(securitize_exports, require("./iSecuritizeOnRamp.js"), module.exports);
20
21
  __reExport(securitize_exports, require("./iSecuritizeOnRampAdapter.js"), module.exports);
21
22
  __reExport(securitize_exports, require("./iSecuritizeRedemptionGateway.js"), module.exports);
@@ -23,6 +24,7 @@ __reExport(securitize_exports, require("./iSecuritizeRedemptionGatewayAdapter.js
23
24
  // Annotate the CommonJS export names for ESM import in node:
24
25
  0 && (module.exports = {
25
26
  ...require("./iBaseOnRamp.js"),
27
+ ...require("./iMidasGatewayAdapter.js"),
26
28
  ...require("./iSecuritizeOnRamp.js"),
27
29
  ...require("./iSecuritizeOnRampAdapter.js"),
28
30
  ...require("./iSecuritizeRedemptionGateway.js"),
@@ -0,0 +1,103 @@
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_abi = require("../abi/index.js");
27
+ var import_AbstractAdapter = require("./AbstractAdapter.js");
28
+ const abi = import_abi.iMidasGatewayAdapterAbi;
29
+ const protocolAbi = import_abi.iMidasGatewayAdapterAbi;
30
+ class MidasGatewayAdapterContract extends import_AbstractAdapter.AbstractAdapterContract {
31
+ #gateway;
32
+ #mToken;
33
+ #referralId;
34
+ #allowedInputTokens;
35
+ #allowedTokens;
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: "referralId" },
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.#referralId = decoded[4];
55
+ this.#allowedInputTokens = decoded[5].map((token) => token);
56
+ this.#allowedTokens = 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 allowedTokens() {
71
+ if (!this.#allowedTokens)
72
+ throw new import_sdk.MissingSerializedParamsError("allowedTokens");
73
+ return this.#allowedTokens;
74
+ }
75
+ get referralId() {
76
+ if (!this.#referralId) throw new import_sdk.MissingSerializedParamsError("referralId");
77
+ return this.#referralId;
78
+ }
79
+ get allowedInputTokens() {
80
+ if (!this.#allowedInputTokens)
81
+ throw new import_sdk.MissingSerializedParamsError("allowedInputTokens");
82
+ return this.#allowedInputTokens;
83
+ }
84
+ stateHuman(raw) {
85
+ return {
86
+ ...super.stateHuman(raw),
87
+ gateway: this.#gateway ? this.labelAddress(this.#gateway) : void 0,
88
+ mToken: this.#mToken ? this.labelAddress(this.#mToken) : void 0,
89
+ referralId: this.#referralId,
90
+ allowedInputTokens: this.#allowedInputTokens?.map(
91
+ (token) => this.labelAddress(token)
92
+ ),
93
+ allowedTokens: this.#allowedTokens?.map((t) => ({
94
+ token: this.labelAddress(t.token),
95
+ phantomToken: this.labelAddress(t.phantomToken)
96
+ }))
97
+ };
98
+ }
99
+ }
100
+ // Annotate the CommonJS export names for ESM import in node:
101
+ 0 && (module.exports = {
102
+ MidasGatewayAdapterContract
103
+ });
@@ -24,6 +24,7 @@ module.exports = __toCommonJS(createAdapter_exports);
24
24
  var import_viem = require("viem");
25
25
  var import_sdk = require("../../sdk/index.js");
26
26
  var import_contracts = require("./contracts/index.js");
27
+ var import_MidasGatewayAdapterContract = require("./contracts/MidasGatewayAdapterContract.js");
27
28
  var import_SecuritizeOnRampAdapterContract = require("./contracts/SecuritizeOnRampAdapterContract.js");
28
29
  var import_SecuritizeRedemptionGatewayAdapterContract = require("./contracts/SecuritizeRedemptionGatewayAdapterContract.js");
29
30
  var import_SecuritizeSwapAdapterContract = require("./contracts/SecuritizeSwapAdapterContract.js");
@@ -92,6 +93,8 @@ function createAdapter(options, data, strict) {
92
93
  return new import_contracts.MidasIssuanceVaultAdapterContract(options, data);
93
94
  case "ADAPTER::MIDAS_REDEMPTION_VAULT":
94
95
  return new import_contracts.MidasRedemptionVaultAdapterContract(options, data);
96
+ case "ADAPTER::MIDAS_GATEWAY":
97
+ return new import_MidasGatewayAdapterContract.MidasGatewayAdapterContract(options, data);
95
98
  case "ADAPTER::PENDLE_ROUTER":
96
99
  return new import_contracts.PendleRouterAdapterContract(options, data);
97
100
  case "ADAPTER::SECURITIZE_ONRAMP":
@@ -57,6 +57,7 @@ var AdapterType = /* @__PURE__ */ ((AdapterType2) => {
57
57
  AdapterType2["MELLOW_REDEEM_QUEUE"] = "MELLOW_REDEEM_QUEUE";
58
58
  AdapterType2["MIDAS_ISSUANCE_VAULT"] = "MIDAS_ISSUANCE_VAULT";
59
59
  AdapterType2["MIDAS_REDEMPTION_VAULT"] = "MIDAS_REDEMPTION_VAULT";
60
+ AdapterType2["MIDAS_GATEWAY"] = "MIDAS_GATEWAY";
60
61
  AdapterType2["PENDLE_ROUTER"] = "PENDLE_ROUTER";
61
62
  AdapterType2["SECURITIZE_ONRAMP"] = "SECURITIZE_ONRAMP";
62
63
  AdapterType2["SECURITIZE_REDEMPTION"] = "SECURITIZE_REDEMPTION";