@1inch/fusion-sdk 2.3.8 → 2.3.9-rc.0
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/ETHOrders.abi.json +431 -0
- package/dist/cjs/api/quoter/quote/quote.js +28 -4
- package/dist/cjs/api/quoter/types.js +2 -0
- package/dist/cjs/contracts/eth-orders.extension.js +105 -0
- package/dist/cjs/contracts/types.js +4 -0
- package/dist/cjs/fusion-order/cancellation-auction.js +81 -0
- package/dist/cjs/fusion-order/fusion-order-from-native.js +183 -0
- package/dist/cjs/fusion-order/fusion-order.js +5 -23
- package/dist/cjs/fusion-order/index.js +2 -0
- package/dist/cjs/fusion-order/types.js +4 -0
- package/dist/cjs/sdk/sdk.js +25 -8
- package/dist/esm/abi/ETHOrders.abi.json +431 -0
- package/dist/esm/api/quoter/quote/quote.js +24 -5
- package/dist/esm/api/quoter/types.js +2 -0
- package/dist/esm/contracts/eth-orders.extension.js +90 -0
- package/dist/esm/contracts/types.js +1 -0
- package/dist/esm/fusion-order/cancellation-auction.js +66 -0
- package/dist/esm/fusion-order/fusion-order-from-native.js +173 -0
- package/dist/esm/fusion-order/fusion-order.js +5 -23
- package/dist/esm/fusion-order/index.js +2 -0
- package/dist/esm/fusion-order/types.js +11 -0
- package/dist/esm/package.json +1 -1
- package/dist/esm/sdk/sdk.js +25 -8
- package/dist/types/src/api/quoter/quote/quote.d.ts +4 -2
- package/dist/types/src/api/quoter/types.d.ts +1 -0
- package/dist/types/src/contracts/eth-orders.extension.d.ts +11 -0
- package/dist/types/src/contracts/types.d.ts +6 -0
- package/dist/types/src/fusion-order/cancellation-auction.d.ts +7 -0
- package/dist/types/src/fusion-order/fusion-order-from-native.d.ts +13 -0
- package/dist/types/src/fusion-order/fusion-order.d.ts +3 -27
- package/dist/types/src/fusion-order/index.d.ts +2 -0
- package/dist/types/src/fusion-order/types.d.ts +20 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"type": "constructor",
|
|
4
|
+
"inputs": [
|
|
5
|
+
{
|
|
6
|
+
"name": "weth",
|
|
7
|
+
"type": "address",
|
|
8
|
+
"internalType": "contract IWETH"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"name": "limitOrderProtocol",
|
|
12
|
+
"type": "address",
|
|
13
|
+
"internalType": "address"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"name": "accessToken",
|
|
17
|
+
"type": "address",
|
|
18
|
+
"internalType": "contract IERC20"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"stateMutability": "nonpayable"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"type": "receive",
|
|
25
|
+
"stateMutability": "payable"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"type": "function",
|
|
29
|
+
"name": "cancelOrder",
|
|
30
|
+
"inputs": [
|
|
31
|
+
{
|
|
32
|
+
"name": "makerTraits",
|
|
33
|
+
"type": "uint256",
|
|
34
|
+
"internalType": "MakerTraits"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "orderHash",
|
|
38
|
+
"type": "bytes32",
|
|
39
|
+
"internalType": "bytes32"
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"outputs": [],
|
|
43
|
+
"stateMutability": "nonpayable"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"type": "function",
|
|
47
|
+
"name": "cancelOrderByResolver",
|
|
48
|
+
"inputs": [
|
|
49
|
+
{
|
|
50
|
+
"name": "makerTraits",
|
|
51
|
+
"type": "uint256",
|
|
52
|
+
"internalType": "MakerTraits"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "orderHash",
|
|
56
|
+
"type": "bytes32",
|
|
57
|
+
"internalType": "bytes32"
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
"outputs": [],
|
|
61
|
+
"stateMutability": "nonpayable"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"type": "function",
|
|
65
|
+
"name": "ethOrderDeposit",
|
|
66
|
+
"inputs": [
|
|
67
|
+
{
|
|
68
|
+
"name": "order",
|
|
69
|
+
"type": "tuple",
|
|
70
|
+
"internalType": "struct IOrderMixin.Order",
|
|
71
|
+
"components": [
|
|
72
|
+
{
|
|
73
|
+
"name": "salt",
|
|
74
|
+
"type": "uint256",
|
|
75
|
+
"internalType": "uint256"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"name": "maker",
|
|
79
|
+
"type": "uint256",
|
|
80
|
+
"internalType": "Address"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"name": "receiver",
|
|
84
|
+
"type": "uint256",
|
|
85
|
+
"internalType": "Address"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"name": "makerAsset",
|
|
89
|
+
"type": "uint256",
|
|
90
|
+
"internalType": "Address"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"name": "takerAsset",
|
|
94
|
+
"type": "uint256",
|
|
95
|
+
"internalType": "Address"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"name": "makingAmount",
|
|
99
|
+
"type": "uint256",
|
|
100
|
+
"internalType": "uint256"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"name": "takingAmount",
|
|
104
|
+
"type": "uint256",
|
|
105
|
+
"internalType": "uint256"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"name": "makerTraits",
|
|
109
|
+
"type": "uint256",
|
|
110
|
+
"internalType": "MakerTraits"
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"name": "extension",
|
|
116
|
+
"type": "bytes",
|
|
117
|
+
"internalType": "bytes"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"name": "maximumPremium",
|
|
121
|
+
"type": "uint16",
|
|
122
|
+
"internalType": "uint16"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"name": "auctionDuration",
|
|
126
|
+
"type": "uint32",
|
|
127
|
+
"internalType": "uint32"
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
"outputs": [
|
|
131
|
+
{
|
|
132
|
+
"name": "orderHash",
|
|
133
|
+
"type": "bytes32",
|
|
134
|
+
"internalType": "bytes32"
|
|
135
|
+
}
|
|
136
|
+
],
|
|
137
|
+
"stateMutability": "payable"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"type": "function",
|
|
141
|
+
"name": "ethOrdersBatch",
|
|
142
|
+
"inputs": [
|
|
143
|
+
{
|
|
144
|
+
"name": "orderHashes",
|
|
145
|
+
"type": "bytes32[]",
|
|
146
|
+
"internalType": "bytes32[]"
|
|
147
|
+
}
|
|
148
|
+
],
|
|
149
|
+
"outputs": [
|
|
150
|
+
{
|
|
151
|
+
"name": "ethOrders",
|
|
152
|
+
"type": "tuple[]",
|
|
153
|
+
"internalType": "struct ETHOrders.ETHOrder[]",
|
|
154
|
+
"components": [
|
|
155
|
+
{
|
|
156
|
+
"name": "maker",
|
|
157
|
+
"type": "address",
|
|
158
|
+
"internalType": "address"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"name": "balance",
|
|
162
|
+
"type": "uint96",
|
|
163
|
+
"internalType": "uint96"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"name": "maximumPremium",
|
|
167
|
+
"type": "uint16",
|
|
168
|
+
"internalType": "uint16"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"name": "auctionDuration",
|
|
172
|
+
"type": "uint32",
|
|
173
|
+
"internalType": "uint32"
|
|
174
|
+
}
|
|
175
|
+
]
|
|
176
|
+
}
|
|
177
|
+
],
|
|
178
|
+
"stateMutability": "view"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"type": "function",
|
|
182
|
+
"name": "isValidSignature",
|
|
183
|
+
"inputs": [
|
|
184
|
+
{
|
|
185
|
+
"name": "orderHash",
|
|
186
|
+
"type": "bytes32",
|
|
187
|
+
"internalType": "bytes32"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"name": "signature",
|
|
191
|
+
"type": "bytes",
|
|
192
|
+
"internalType": "bytes"
|
|
193
|
+
}
|
|
194
|
+
],
|
|
195
|
+
"outputs": [
|
|
196
|
+
{
|
|
197
|
+
"name": "",
|
|
198
|
+
"type": "bytes4",
|
|
199
|
+
"internalType": "bytes4"
|
|
200
|
+
}
|
|
201
|
+
],
|
|
202
|
+
"stateMutability": "view"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"type": "function",
|
|
206
|
+
"name": "ordersMakersBalances",
|
|
207
|
+
"inputs": [
|
|
208
|
+
{
|
|
209
|
+
"name": "orderHash",
|
|
210
|
+
"type": "bytes32",
|
|
211
|
+
"internalType": "bytes32"
|
|
212
|
+
}
|
|
213
|
+
],
|
|
214
|
+
"outputs": [
|
|
215
|
+
{
|
|
216
|
+
"name": "maker",
|
|
217
|
+
"type": "address",
|
|
218
|
+
"internalType": "address"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"name": "balance",
|
|
222
|
+
"type": "uint96",
|
|
223
|
+
"internalType": "uint96"
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"name": "maximumPremium",
|
|
227
|
+
"type": "uint16",
|
|
228
|
+
"internalType": "uint16"
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"name": "auctionDuration",
|
|
232
|
+
"type": "uint32",
|
|
233
|
+
"internalType": "uint32"
|
|
234
|
+
}
|
|
235
|
+
],
|
|
236
|
+
"stateMutability": "view"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"type": "function",
|
|
240
|
+
"name": "postInteraction",
|
|
241
|
+
"inputs": [
|
|
242
|
+
{
|
|
243
|
+
"name": "",
|
|
244
|
+
"type": "tuple",
|
|
245
|
+
"internalType": "struct IOrderMixin.Order",
|
|
246
|
+
"components": [
|
|
247
|
+
{
|
|
248
|
+
"name": "salt",
|
|
249
|
+
"type": "uint256",
|
|
250
|
+
"internalType": "uint256"
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"name": "maker",
|
|
254
|
+
"type": "uint256",
|
|
255
|
+
"internalType": "Address"
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
"name": "receiver",
|
|
259
|
+
"type": "uint256",
|
|
260
|
+
"internalType": "Address"
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
"name": "makerAsset",
|
|
264
|
+
"type": "uint256",
|
|
265
|
+
"internalType": "Address"
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
"name": "takerAsset",
|
|
269
|
+
"type": "uint256",
|
|
270
|
+
"internalType": "Address"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"name": "makingAmount",
|
|
274
|
+
"type": "uint256",
|
|
275
|
+
"internalType": "uint256"
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
"name": "takingAmount",
|
|
279
|
+
"type": "uint256",
|
|
280
|
+
"internalType": "uint256"
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
"name": "makerTraits",
|
|
284
|
+
"type": "uint256",
|
|
285
|
+
"internalType": "MakerTraits"
|
|
286
|
+
}
|
|
287
|
+
]
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
"name": "",
|
|
291
|
+
"type": "bytes",
|
|
292
|
+
"internalType": "bytes"
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
"name": "orderHash",
|
|
296
|
+
"type": "bytes32",
|
|
297
|
+
"internalType": "bytes32"
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
"name": "",
|
|
301
|
+
"type": "address",
|
|
302
|
+
"internalType": "address"
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
"name": "makingAmount",
|
|
306
|
+
"type": "uint256",
|
|
307
|
+
"internalType": "uint256"
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
"name": "",
|
|
311
|
+
"type": "uint256",
|
|
312
|
+
"internalType": "uint256"
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
"name": "",
|
|
316
|
+
"type": "uint256",
|
|
317
|
+
"internalType": "uint256"
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
"name": "",
|
|
321
|
+
"type": "bytes",
|
|
322
|
+
"internalType": "bytes"
|
|
323
|
+
}
|
|
324
|
+
],
|
|
325
|
+
"outputs": [],
|
|
326
|
+
"stateMutability": "nonpayable"
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
"type": "event",
|
|
330
|
+
"name": "ETHDeposited",
|
|
331
|
+
"inputs": [
|
|
332
|
+
{
|
|
333
|
+
"name": "orderHash",
|
|
334
|
+
"type": "bytes32",
|
|
335
|
+
"indexed": false,
|
|
336
|
+
"internalType": "bytes32"
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
"name": "amount",
|
|
340
|
+
"type": "uint256",
|
|
341
|
+
"indexed": false,
|
|
342
|
+
"internalType": "uint256"
|
|
343
|
+
}
|
|
344
|
+
],
|
|
345
|
+
"anonymous": false
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
"type": "event",
|
|
349
|
+
"name": "ETHOrderCancelled",
|
|
350
|
+
"inputs": [
|
|
351
|
+
{
|
|
352
|
+
"name": "orderHash",
|
|
353
|
+
"type": "bytes32",
|
|
354
|
+
"indexed": false,
|
|
355
|
+
"internalType": "bytes32"
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
"name": "amount",
|
|
359
|
+
"type": "uint256",
|
|
360
|
+
"indexed": false,
|
|
361
|
+
"internalType": "uint256"
|
|
362
|
+
}
|
|
363
|
+
],
|
|
364
|
+
"anonymous": false
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
"type": "event",
|
|
368
|
+
"name": "ETHOrderCancelledByThirdParty",
|
|
369
|
+
"inputs": [
|
|
370
|
+
{
|
|
371
|
+
"name": "orderHash",
|
|
372
|
+
"type": "bytes32",
|
|
373
|
+
"indexed": false,
|
|
374
|
+
"internalType": "bytes32"
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
"name": "amount",
|
|
378
|
+
"type": "uint256",
|
|
379
|
+
"indexed": false,
|
|
380
|
+
"internalType": "uint256"
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
"name": "reward",
|
|
384
|
+
"type": "uint256",
|
|
385
|
+
"indexed": false,
|
|
386
|
+
"internalType": "uint256"
|
|
387
|
+
}
|
|
388
|
+
],
|
|
389
|
+
"anonymous": false
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
"type": "error",
|
|
393
|
+
"name": "AccessDenied",
|
|
394
|
+
"inputs": []
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
"type": "error",
|
|
398
|
+
"name": "CancelOrderByResolverIsForbidden",
|
|
399
|
+
"inputs": []
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
"type": "error",
|
|
403
|
+
"name": "EthDepositRejected",
|
|
404
|
+
"inputs": []
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
"type": "error",
|
|
408
|
+
"name": "ExistingOrder",
|
|
409
|
+
"inputs": []
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
"type": "error",
|
|
413
|
+
"name": "InvalidOrder",
|
|
414
|
+
"inputs": []
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
"type": "error",
|
|
418
|
+
"name": "NotEnoughBalance",
|
|
419
|
+
"inputs": []
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
"type": "error",
|
|
423
|
+
"name": "OrderNotExpired",
|
|
424
|
+
"inputs": []
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
"type": "error",
|
|
428
|
+
"name": "RewardIsTooBig",
|
|
429
|
+
"inputs": []
|
|
430
|
+
}
|
|
431
|
+
]
|
|
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "Quote", {
|
|
|
10
10
|
});
|
|
11
11
|
var _limitordersdk = require("@1inch/limit-order-sdk");
|
|
12
12
|
var _byteutils = require("@1inch/byte-utils");
|
|
13
|
+
var _assert = /*#__PURE__*/ _interop_require_default(require("assert"));
|
|
13
14
|
var _orderparams = require("./order-params.js");
|
|
14
15
|
var _types = require("../types.js");
|
|
15
16
|
var _preset = require("../preset.js");
|
|
@@ -48,6 +49,11 @@ function _define_property(obj, key, value) {
|
|
|
48
49
|
}
|
|
49
50
|
return obj;
|
|
50
51
|
}
|
|
52
|
+
function _interop_require_default(obj) {
|
|
53
|
+
return obj && obj.__esModule ? obj : {
|
|
54
|
+
default: obj
|
|
55
|
+
};
|
|
56
|
+
}
|
|
51
57
|
var Quote = /*#__PURE__*/ function() {
|
|
52
58
|
"use strict";
|
|
53
59
|
function Quote(params, response) {
|
|
@@ -57,6 +63,10 @@ var Quote = /*#__PURE__*/ function() {
|
|
|
57
63
|
* Fusion extension address
|
|
58
64
|
* @see https://github.com/1inch/limit-order-settlement
|
|
59
65
|
*/ _define_property(this, "settlementAddress", void 0);
|
|
66
|
+
/**
|
|
67
|
+
* Native asset extension address
|
|
68
|
+
* @see https://github.com/1inch/limit-order-settlement todo: update link
|
|
69
|
+
*/ _define_property(this, "ethOrdersAddress", void 0);
|
|
60
70
|
_define_property(this, "fromTokenAmount", void 0);
|
|
61
71
|
_define_property(this, "presets", void 0);
|
|
62
72
|
_define_property(this, "recommendedPreset", void 0);
|
|
@@ -85,6 +95,7 @@ var Quote = /*#__PURE__*/ function() {
|
|
|
85
95
|
this.recommendedPreset = response.recommended_preset;
|
|
86
96
|
this.slippage = response.autoK;
|
|
87
97
|
this.settlementAddress = new _limitordersdk.Address(response.settlementAddress);
|
|
98
|
+
this.ethOrdersAddress = response.ethOrdersAddress ? new _limitordersdk.Address(response.ethOrdersAddress) : undefined;
|
|
88
99
|
this.resolverFeePreset = {
|
|
89
100
|
receiver: new _limitordersdk.Address(response.fee.receiver),
|
|
90
101
|
whitelistDiscountPercent: _limitordersdk.Bps.fromPercent(response.fee.whitelistDiscountPercent),
|
|
@@ -119,18 +130,20 @@ var Quote = /*#__PURE__*/ function() {
|
|
|
119
130
|
var _params_nonce;
|
|
120
131
|
var nonce = isNonceRequired ? (_params_nonce = params.nonce) !== null && _params_nonce !== void 0 ? _params_nonce : (0, _limitordersdk.randBigInt)(_byteutils.UINT_40_MAX) : params.nonce;
|
|
121
132
|
var takerAsset = this.params.toTokenAddress.isNative() ? _constants.CHAIN_TO_WRAPPER[paramsData.network] : this.params.toTokenAddress;
|
|
122
|
-
|
|
133
|
+
var orderInfo = {
|
|
123
134
|
makerAsset: this.params.fromTokenAddress,
|
|
124
135
|
takerAsset: takerAsset,
|
|
125
136
|
makingAmount: this.fromTokenAmount,
|
|
126
137
|
takingAmount: preset.auctionEndAmount,
|
|
127
138
|
maker: this.params.walletAddress,
|
|
128
139
|
receiver: params.receiver
|
|
129
|
-
}
|
|
140
|
+
};
|
|
141
|
+
var details = {
|
|
130
142
|
auction: auctionDetails,
|
|
131
143
|
whitelist: this.getWhitelist(auctionDetails.startTime, preset.exclusiveResolver),
|
|
132
144
|
surplus: new _index.SurplusParams(this.marketReturn, _limitordersdk.Bps.fromPercent(this.surplusFee || 0))
|
|
133
|
-
}
|
|
145
|
+
};
|
|
146
|
+
var extra = {
|
|
134
147
|
nonce: nonce,
|
|
135
148
|
unwrapWETH: this.params.toTokenAddress.isNative(),
|
|
136
149
|
permit: params.permit,
|
|
@@ -140,7 +153,8 @@ var Quote = /*#__PURE__*/ function() {
|
|
|
140
153
|
source: this.params.source,
|
|
141
154
|
enablePermit2: params.isPermit2,
|
|
142
155
|
fees: buildFees(this.resolverFeePreset, this.params.integratorFee || this.integratorFeeParams, this.surplusFee)
|
|
143
|
-
}
|
|
156
|
+
};
|
|
157
|
+
return this._createOrder(paramsData.network, this.settlementAddress, orderInfo, details, extra);
|
|
144
158
|
}
|
|
145
159
|
},
|
|
146
160
|
{
|
|
@@ -169,6 +183,16 @@ var Quote = /*#__PURE__*/ function() {
|
|
|
169
183
|
};
|
|
170
184
|
}));
|
|
171
185
|
}
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
key: "_createOrder",
|
|
189
|
+
value: function _createOrder(chainId, settlementExtension, orderInfo, details, extra) {
|
|
190
|
+
if (this.params.fromTokenAddress.isNative()) {
|
|
191
|
+
(0, _assert.default)(this.ethOrdersAddress, 'expected ethOrdersAddress to be set for order from native asset');
|
|
192
|
+
return _index.FusionOrderFromNative.fromNative(chainId, this.ethOrdersAddress, settlementExtension, orderInfo, details, extra);
|
|
193
|
+
}
|
|
194
|
+
return _index.FusionOrder.new(settlementExtension, orderInfo, details, extra);
|
|
195
|
+
}
|
|
172
196
|
}
|
|
173
197
|
]);
|
|
174
198
|
return Quote;
|
|
@@ -14,6 +14,8 @@ Object.defineProperty(exports, "PresetEnum", {
|
|
|
14
14
|
* Optional slippage value in percent (e.g., 1 for 1%, max 50)
|
|
15
15
|
* Must be between 1 and 50 inclusive
|
|
16
16
|
*/ /**
|
|
17
|
+
* Present if src token is native
|
|
18
|
+
*/ /**
|
|
17
19
|
* In bps
|
|
18
20
|
*/ /**
|
|
19
21
|
* Percentage of the integrator fee that will be shared with the integrator.
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "EthOrdersExtension", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return EthOrdersExtension;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _ethers = require("ethers");
|
|
12
|
+
var _assert = /*#__PURE__*/ _interop_require_default(require("assert"));
|
|
13
|
+
var _index = require("../fusion-order/index.js");
|
|
14
|
+
var _ETHOrdersabijson = /*#__PURE__*/ _interop_require_default(require("../abi/ETHOrders.abi.json"));
|
|
15
|
+
function _class_call_check(instance, Constructor) {
|
|
16
|
+
if (!(instance instanceof Constructor)) {
|
|
17
|
+
throw new TypeError("Cannot call a class as a function");
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function _defineProperties(target, props) {
|
|
21
|
+
for(var i = 0; i < props.length; i++){
|
|
22
|
+
var descriptor = props[i];
|
|
23
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
24
|
+
descriptor.configurable = true;
|
|
25
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
26
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
30
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
31
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
32
|
+
return Constructor;
|
|
33
|
+
}
|
|
34
|
+
function _define_property(obj, key, value) {
|
|
35
|
+
if (key in obj) {
|
|
36
|
+
Object.defineProperty(obj, key, {
|
|
37
|
+
value: value,
|
|
38
|
+
enumerable: true,
|
|
39
|
+
configurable: true,
|
|
40
|
+
writable: true
|
|
41
|
+
});
|
|
42
|
+
} else {
|
|
43
|
+
obj[key] = value;
|
|
44
|
+
}
|
|
45
|
+
return obj;
|
|
46
|
+
}
|
|
47
|
+
function _interop_require_default(obj) {
|
|
48
|
+
return obj && obj.__esModule ? obj : {
|
|
49
|
+
default: obj
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
var EthOrdersExtension = /*#__PURE__*/ function() {
|
|
53
|
+
"use strict";
|
|
54
|
+
function EthOrdersExtension(address) {
|
|
55
|
+
_class_call_check(this, EthOrdersExtension);
|
|
56
|
+
_define_property(this, "address", void 0);
|
|
57
|
+
_define_property(this, "iface", void 0);
|
|
58
|
+
this.address = address;
|
|
59
|
+
this.iface = new _ethers.Interface(_ETHOrdersabijson.default);
|
|
60
|
+
}
|
|
61
|
+
_create_class(EthOrdersExtension, [
|
|
62
|
+
{
|
|
63
|
+
key: "deposit",
|
|
64
|
+
value: function deposit(order) {
|
|
65
|
+
var cancellationAuction = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : _index.CancellationAuction.ZERO;
|
|
66
|
+
(0, _assert.default)(order.maker.equal(this.address), 'maker must be extension address, use FusionOrder.fromNative to create correct order');
|
|
67
|
+
return {
|
|
68
|
+
to: this.address,
|
|
69
|
+
value: order.makingAmount,
|
|
70
|
+
data: this.iface.encodeFunctionData('deposit', [
|
|
71
|
+
order.build(),
|
|
72
|
+
order.extension.encode(),
|
|
73
|
+
cancellationAuction.build()
|
|
74
|
+
])
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
key: "cancelOrder",
|
|
80
|
+
value: function cancelOrder(orderHash) {
|
|
81
|
+
return {
|
|
82
|
+
to: this.address,
|
|
83
|
+
value: 0n,
|
|
84
|
+
data: this.iface.encodeFunctionData('cancelOrder', [
|
|
85
|
+
orderHash
|
|
86
|
+
])
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
key: "cancelExpiredOrderByResolver",
|
|
92
|
+
value: function cancelExpiredOrderByResolver(maker, orderInfo) {
|
|
93
|
+
return {
|
|
94
|
+
value: 0n,
|
|
95
|
+
data: this.iface.encodeFunctionData('cancelExpiredOrderByResolver', [
|
|
96
|
+
maker.toString(),
|
|
97
|
+
orderInfo
|
|
98
|
+
]),
|
|
99
|
+
to: this.address
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
]);
|
|
104
|
+
return EthOrdersExtension;
|
|
105
|
+
}();
|