@1inch/fusion-sdk 2.3.9-rc.0 → 2.3.9-rc.10
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/NativeOrderFactory.abi.json +217 -0
- package/dist/cjs/abi/{ETHOrders.abi.json → NativeOrderImpl.abi.json} +110 -255
- package/dist/cjs/api/quoter/quote/quote.js +6 -4
- package/dist/cjs/api/quoter/quoter.request.js +0 -3
- package/dist/cjs/api/quoter/quoter.request.spec.js +0 -15
- package/dist/cjs/api/quoter/types.js +0 -2
- package/dist/cjs/contracts/index.js +21 -0
- package/dist/cjs/contracts/native-order-factory.js +115 -0
- package/dist/cjs/contracts/native-order-impl.js +130 -0
- package/dist/cjs/contracts/proxy-factory.js +87 -0
- package/dist/cjs/fusion-order/fusion-order.js +81 -5
- package/dist/cjs/fusion-order/fusion-order.spec.js +106 -0
- package/dist/cjs/fusion-order/index.js +0 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/sdk/sdk.js +79 -40
- package/dist/esm/abi/NativeOrderFactory.abi.json +217 -0
- package/dist/esm/abi/{ETHOrders.abi.json → NativeOrderImpl.abi.json} +110 -255
- package/dist/esm/api/quoter/quote/quote.js +7 -5
- package/dist/esm/api/quoter/quoter.request.js +0 -3
- package/dist/esm/api/quoter/quoter.request.spec.js +0 -15
- package/dist/esm/api/quoter/types.js +0 -2
- package/dist/esm/contracts/index.js +4 -0
- package/dist/esm/contracts/native-order-factory.js +100 -0
- package/dist/esm/contracts/native-order-impl.js +115 -0
- package/dist/esm/contracts/proxy-factory.js +72 -0
- package/dist/esm/fusion-order/fusion-order.js +79 -3
- package/dist/esm/fusion-order/fusion-order.spec.js +106 -0
- package/dist/esm/fusion-order/index.js +0 -1
- package/dist/esm/fusion-order/types.js +4 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/package.json +1 -1
- package/dist/esm/sdk/sdk.js +79 -40
- package/dist/types/src/api/quoter/quote/quote.d.ts +4 -3
- package/dist/types/src/api/quoter/types.d.ts +2 -1
- package/dist/types/src/contracts/index.d.ts +4 -0
- package/dist/types/src/contracts/native-order-factory.d.ts +9 -0
- package/dist/types/src/contracts/native-order-impl.d.ts +9 -0
- package/dist/types/src/contracts/proxy-factory.d.ts +8 -0
- package/dist/types/src/fusion-order/fusion-order.d.ts +6 -0
- package/dist/types/src/fusion-order/index.d.ts +0 -1
- package/dist/types/src/fusion-order/types.d.ts +1 -0
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/sdk/sdk.d.ts +4 -0
- package/dist/types/src/sdk/types.d.ts +2 -1
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/dist/cjs/contracts/eth-orders.extension.js +0 -105
- package/dist/cjs/fusion-order/fusion-order-from-native.js +0 -183
- package/dist/esm/contracts/eth-orders.extension.js +0 -90
- package/dist/esm/fusion-order/fusion-order-from-native.js +0 -173
- package/dist/types/src/contracts/eth-orders.extension.d.ts +0 -11
- package/dist/types/src/fusion-order/fusion-order-from-native.d.ts +0 -13
|
@@ -7,6 +7,11 @@
|
|
|
7
7
|
"type": "address",
|
|
8
8
|
"internalType": "contract IWETH"
|
|
9
9
|
},
|
|
10
|
+
{
|
|
11
|
+
"name": "nativeOrderFactory",
|
|
12
|
+
"type": "address",
|
|
13
|
+
"internalType": "address"
|
|
14
|
+
},
|
|
10
15
|
{
|
|
11
16
|
"name": "limitOrderProtocol",
|
|
12
17
|
"type": "address",
|
|
@@ -20,52 +25,13 @@
|
|
|
20
25
|
],
|
|
21
26
|
"stateMutability": "nonpayable"
|
|
22
27
|
},
|
|
23
|
-
{
|
|
24
|
-
"type": "receive",
|
|
25
|
-
"stateMutability": "payable"
|
|
26
|
-
},
|
|
28
|
+
{"type": "receive", "stateMutability": "payable"},
|
|
27
29
|
{
|
|
28
30
|
"type": "function",
|
|
29
|
-
"name": "
|
|
31
|
+
"name": "cancelExpiredOrderByResolver",
|
|
30
32
|
"inputs": [
|
|
31
33
|
{
|
|
32
|
-
"name": "
|
|
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",
|
|
34
|
+
"name": "makerOrder",
|
|
69
35
|
"type": "tuple",
|
|
70
36
|
"internalType": "struct IOrderMixin.Order",
|
|
71
37
|
"components": [
|
|
@@ -112,135 +78,20 @@
|
|
|
112
78
|
]
|
|
113
79
|
},
|
|
114
80
|
{
|
|
115
|
-
"name": "
|
|
116
|
-
"type": "
|
|
117
|
-
"internalType": "
|
|
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"
|
|
81
|
+
"name": "rewardLimit",
|
|
82
|
+
"type": "uint256",
|
|
83
|
+
"internalType": "uint256"
|
|
234
84
|
}
|
|
235
85
|
],
|
|
236
|
-
"
|
|
86
|
+
"outputs": [],
|
|
87
|
+
"stateMutability": "nonpayable"
|
|
237
88
|
},
|
|
238
89
|
{
|
|
239
90
|
"type": "function",
|
|
240
|
-
"name": "
|
|
91
|
+
"name": "cancelOrder",
|
|
241
92
|
"inputs": [
|
|
242
93
|
{
|
|
243
|
-
"name": "",
|
|
94
|
+
"name": "makerOrder",
|
|
244
95
|
"type": "tuple",
|
|
245
96
|
"internalType": "struct IOrderMixin.Order",
|
|
246
97
|
"components": [
|
|
@@ -285,102 +136,78 @@
|
|
|
285
136
|
"internalType": "MakerTraits"
|
|
286
137
|
}
|
|
287
138
|
]
|
|
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
139
|
}
|
|
324
140
|
],
|
|
325
141
|
"outputs": [],
|
|
326
142
|
"stateMutability": "nonpayable"
|
|
327
143
|
},
|
|
328
144
|
{
|
|
329
|
-
"type": "
|
|
330
|
-
"name": "
|
|
145
|
+
"type": "function",
|
|
146
|
+
"name": "decimals",
|
|
147
|
+
"inputs": [],
|
|
148
|
+
"outputs": [{"name": "", "type": "uint8", "internalType": "uint8"}],
|
|
149
|
+
"stateMutability": "pure"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"type": "function",
|
|
153
|
+
"name": "depositAndApprove",
|
|
154
|
+
"inputs": [],
|
|
155
|
+
"outputs": [],
|
|
156
|
+
"stateMutability": "payable"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"type": "function",
|
|
160
|
+
"name": "isValidSignature",
|
|
331
161
|
"inputs": [
|
|
332
|
-
{
|
|
333
|
-
|
|
334
|
-
"type": "bytes32",
|
|
335
|
-
"indexed": false,
|
|
336
|
-
"internalType": "bytes32"
|
|
337
|
-
},
|
|
338
|
-
{
|
|
339
|
-
"name": "amount",
|
|
340
|
-
"type": "uint256",
|
|
341
|
-
"indexed": false,
|
|
342
|
-
"internalType": "uint256"
|
|
343
|
-
}
|
|
162
|
+
{"name": "hash", "type": "bytes32", "internalType": "bytes32"},
|
|
163
|
+
{"name": "signature", "type": "bytes", "internalType": "bytes"}
|
|
344
164
|
],
|
|
345
|
-
"
|
|
165
|
+
"outputs": [{"name": "", "type": "bytes4", "internalType": "bytes4"}],
|
|
166
|
+
"stateMutability": "view"
|
|
346
167
|
},
|
|
347
168
|
{
|
|
348
|
-
"type": "
|
|
349
|
-
"name": "
|
|
169
|
+
"type": "function",
|
|
170
|
+
"name": "name",
|
|
171
|
+
"inputs": [],
|
|
172
|
+
"outputs": [{"name": "", "type": "string", "internalType": "string"}],
|
|
173
|
+
"stateMutability": "pure"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"type": "function",
|
|
177
|
+
"name": "rescueFunds",
|
|
350
178
|
"inputs": [
|
|
351
|
-
{
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
"indexed": false,
|
|
355
|
-
"internalType": "bytes32"
|
|
356
|
-
},
|
|
357
|
-
{
|
|
358
|
-
"name": "amount",
|
|
359
|
-
"type": "uint256",
|
|
360
|
-
"indexed": false,
|
|
361
|
-
"internalType": "uint256"
|
|
362
|
-
}
|
|
179
|
+
{"name": "token", "type": "address", "internalType": "address"},
|
|
180
|
+
{"name": "to", "type": "address", "internalType": "address"},
|
|
181
|
+
{"name": "amount", "type": "uint256", "internalType": "uint256"}
|
|
363
182
|
],
|
|
364
|
-
"
|
|
183
|
+
"outputs": [],
|
|
184
|
+
"stateMutability": "nonpayable"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"type": "function",
|
|
188
|
+
"name": "symbol",
|
|
189
|
+
"inputs": [],
|
|
190
|
+
"outputs": [{"name": "", "type": "string", "internalType": "string"}],
|
|
191
|
+
"stateMutability": "pure"
|
|
365
192
|
},
|
|
366
193
|
{
|
|
367
194
|
"type": "event",
|
|
368
|
-
"name": "
|
|
195
|
+
"name": "NativeOrderCancelled",
|
|
369
196
|
"inputs": [
|
|
370
197
|
{
|
|
371
|
-
"name": "
|
|
198
|
+
"name": "makerOrderHash",
|
|
372
199
|
"type": "bytes32",
|
|
373
200
|
"indexed": false,
|
|
374
201
|
"internalType": "bytes32"
|
|
375
202
|
},
|
|
376
203
|
{
|
|
377
|
-
"name": "
|
|
204
|
+
"name": "balance",
|
|
378
205
|
"type": "uint256",
|
|
379
206
|
"indexed": false,
|
|
380
207
|
"internalType": "uint256"
|
|
381
208
|
},
|
|
382
209
|
{
|
|
383
|
-
"name": "
|
|
210
|
+
"name": "resolverReward",
|
|
384
211
|
"type": "uint256",
|
|
385
212
|
"indexed": false,
|
|
386
213
|
"internalType": "uint256"
|
|
@@ -388,44 +215,72 @@
|
|
|
388
215
|
],
|
|
389
216
|
"anonymous": false
|
|
390
217
|
},
|
|
218
|
+
{"type": "error", "name": "CanNotCancelForZeroBalance", "inputs": []},
|
|
219
|
+
{"type": "error", "name": "EthDepositRejected", "inputs": []},
|
|
220
|
+
{"type": "error", "name": "ForceApproveFailed", "inputs": []},
|
|
391
221
|
{
|
|
392
222
|
"type": "error",
|
|
393
|
-
"name": "
|
|
394
|
-
"inputs": [
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
"name": "CancelOrderByResolverIsForbidden",
|
|
399
|
-
"inputs": []
|
|
223
|
+
"name": "OnlyFactoryViolation",
|
|
224
|
+
"inputs": [
|
|
225
|
+
{"name": "sender", "type": "address", "internalType": "address"},
|
|
226
|
+
{"name": "factory", "type": "address", "internalType": "address"}
|
|
227
|
+
]
|
|
400
228
|
},
|
|
401
229
|
{
|
|
402
230
|
"type": "error",
|
|
403
|
-
"name": "
|
|
404
|
-
"inputs": [
|
|
231
|
+
"name": "OnlyLimitOrderProtocolViolation",
|
|
232
|
+
"inputs": [
|
|
233
|
+
{"name": "sender", "type": "address", "internalType": "address"},
|
|
234
|
+
{
|
|
235
|
+
"name": "limitOrderProtocol",
|
|
236
|
+
"type": "address",
|
|
237
|
+
"internalType": "address"
|
|
238
|
+
}
|
|
239
|
+
]
|
|
405
240
|
},
|
|
406
241
|
{
|
|
407
242
|
"type": "error",
|
|
408
|
-
"name": "
|
|
409
|
-
"inputs": [
|
|
243
|
+
"name": "OrderIsIncorrect",
|
|
244
|
+
"inputs": [
|
|
245
|
+
{"name": "expected", "type": "address", "internalType": "address"},
|
|
246
|
+
{"name": "actual", "type": "address", "internalType": "address"}
|
|
247
|
+
]
|
|
410
248
|
},
|
|
411
249
|
{
|
|
412
250
|
"type": "error",
|
|
413
|
-
"name": "
|
|
414
|
-
"inputs": [
|
|
251
|
+
"name": "OrderShouldBeExpired",
|
|
252
|
+
"inputs": [
|
|
253
|
+
{
|
|
254
|
+
"name": "currentTime",
|
|
255
|
+
"type": "uint256",
|
|
256
|
+
"internalType": "uint256"
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
"name": "expirationTime",
|
|
260
|
+
"type": "uint256",
|
|
261
|
+
"internalType": "uint256"
|
|
262
|
+
}
|
|
263
|
+
]
|
|
415
264
|
},
|
|
416
265
|
{
|
|
417
266
|
"type": "error",
|
|
418
|
-
"name": "
|
|
419
|
-
"inputs": [
|
|
267
|
+
"name": "RescueFundsTooMuch",
|
|
268
|
+
"inputs": [
|
|
269
|
+
{"name": "requested", "type": "uint256", "internalType": "uint256"},
|
|
270
|
+
{"name": "available", "type": "uint256", "internalType": "uint256"}
|
|
271
|
+
]
|
|
420
272
|
},
|
|
421
273
|
{
|
|
422
274
|
"type": "error",
|
|
423
|
-
"name": "
|
|
424
|
-
"inputs": [
|
|
275
|
+
"name": "ResolverAccessTokenMissing",
|
|
276
|
+
"inputs": [
|
|
277
|
+
{"name": "resolver", "type": "address", "internalType": "address"},
|
|
278
|
+
{
|
|
279
|
+
"name": "accessToken",
|
|
280
|
+
"type": "address",
|
|
281
|
+
"internalType": "address"
|
|
282
|
+
}
|
|
283
|
+
]
|
|
425
284
|
},
|
|
426
|
-
{
|
|
427
|
-
"type": "error",
|
|
428
|
-
"name": "RewardIsTooBig",
|
|
429
|
-
"inputs": []
|
|
430
|
-
}
|
|
285
|
+
{"type": "error", "name": "SafeTransferFailed", "inputs": []}
|
|
431
286
|
]
|
|
@@ -36,9 +36,10 @@ import assert from 'assert';
|
|
|
36
36
|
import { FusionOrderParams } from './order-params.js';
|
|
37
37
|
import { PresetEnum } from '../types.js';
|
|
38
38
|
import { Preset } from '../preset.js';
|
|
39
|
-
import { FusionOrder,
|
|
39
|
+
import { FusionOrder, SurplusParams, Whitelist } from '../../../fusion-order/index.js';
|
|
40
40
|
import { CHAIN_TO_WRAPPER } from '../../../fusion-order/constants.js';
|
|
41
41
|
import { Fees, ResolverFee, IntegratorFee } from '../../../fusion-order/fees/index.js';
|
|
42
|
+
import { ProxyFactory } from '../../../index.js';
|
|
42
43
|
export var Quote = /*#__PURE__*/ function() {
|
|
43
44
|
"use strict";
|
|
44
45
|
function Quote(params, response) {
|
|
@@ -51,7 +52,7 @@ export var Quote = /*#__PURE__*/ function() {
|
|
|
51
52
|
/**
|
|
52
53
|
* Native asset extension address
|
|
53
54
|
* @see https://github.com/1inch/limit-order-settlement todo: update link
|
|
54
|
-
*/ _define_property(this, "
|
|
55
|
+
*/ _define_property(this, "nativeOrderFactory", void 0);
|
|
55
56
|
_define_property(this, "fromTokenAmount", void 0);
|
|
56
57
|
_define_property(this, "presets", void 0);
|
|
57
58
|
_define_property(this, "recommendedPreset", void 0);
|
|
@@ -80,7 +81,7 @@ export var Quote = /*#__PURE__*/ function() {
|
|
|
80
81
|
this.recommendedPreset = response.recommended_preset;
|
|
81
82
|
this.slippage = response.autoK;
|
|
82
83
|
this.settlementAddress = new Address(response.settlementAddress);
|
|
83
|
-
this.
|
|
84
|
+
this.nativeOrderFactory = response.nativeOrderFactoryAddress && response.nativeOrderImplAddress ? new ProxyFactory(new Address(response.nativeOrderFactoryAddress), new Address(response.nativeOrderImplAddress)) : undefined;
|
|
84
85
|
this.resolverFeePreset = {
|
|
85
86
|
receiver: new Address(response.fee.receiver),
|
|
86
87
|
whitelistDiscountPercent: Bps.fromPercent(response.fee.whitelistDiscountPercent),
|
|
@@ -103,6 +104,7 @@ export var Quote = /*#__PURE__*/ function() {
|
|
|
103
104
|
permit: this.params.permit,
|
|
104
105
|
isPermit2: this.params.isPermit2,
|
|
105
106
|
nonce: paramsData === null || paramsData === void 0 ? void 0 : paramsData.nonce,
|
|
107
|
+
delayAuctionStartTimeBy: paramsData === null || paramsData === void 0 ? void 0 : paramsData.delayAuctionStartTimeBy,
|
|
106
108
|
network: paramsData.network
|
|
107
109
|
});
|
|
108
110
|
var preset = this.getPreset(params.preset);
|
|
@@ -173,8 +175,8 @@ export var Quote = /*#__PURE__*/ function() {
|
|
|
173
175
|
key: "_createOrder",
|
|
174
176
|
value: function _createOrder(chainId, settlementExtension, orderInfo, details, extra) {
|
|
175
177
|
if (this.params.fromTokenAddress.isNative()) {
|
|
176
|
-
assert(this.
|
|
177
|
-
return
|
|
178
|
+
assert(this.nativeOrderFactory, 'expected nativeOrderFactory to be set for order from native asset');
|
|
179
|
+
return FusionOrder.fromNative(chainId, this.nativeOrderFactory, settlementExtension, orderInfo, details, extra);
|
|
178
180
|
}
|
|
179
181
|
return FusionOrder.new(settlementExtension, orderInfo, details, extra);
|
|
180
182
|
}
|
|
@@ -57,9 +57,6 @@ export var QuoterRequest = /*#__PURE__*/ function() {
|
|
|
57
57
|
var _params_isPermit2;
|
|
58
58
|
this.isPermit2 = (_params_isPermit2 = params.isPermit2) !== null && _params_isPermit2 !== void 0 ? _params_isPermit2 : false;
|
|
59
59
|
this.slippage = params.slippage;
|
|
60
|
-
if (this.fromTokenAddress.isNative()) {
|
|
61
|
-
throw new Error("cannot swap ".concat(Address.NATIVE_CURRENCY, ": wrap native currency to it's wrapper fist"));
|
|
62
|
-
}
|
|
63
60
|
if (this.fromTokenAddress.isZero() || this.toTokenAddress.isZero()) {
|
|
64
61
|
throw new Error("replace ".concat(Address.ZERO_ADDRESS, " with ").concat(Address.NATIVE_CURRENCY));
|
|
65
62
|
}
|
|
@@ -1,21 +1,6 @@
|
|
|
1
1
|
import { Address, Bps } from '@1inch/limit-order-sdk';
|
|
2
2
|
import { QuoterRequest } from './quoter.request.js';
|
|
3
3
|
describe(__filename, function() {
|
|
4
|
-
it('should return error if native currency', function() {
|
|
5
|
-
expect(function() {
|
|
6
|
-
return QuoterRequest.new({
|
|
7
|
-
fromTokenAddress: Address.NATIVE_CURRENCY.toString(),
|
|
8
|
-
toTokenAddress: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
9
|
-
amount: '1000000000000000000000',
|
|
10
|
-
walletAddress: '0x00000000219ab540356cbb839cbe05303d7705fa',
|
|
11
|
-
integratorFee: {
|
|
12
|
-
share: Bps.fromPercent(50),
|
|
13
|
-
receiver: Address.fromBigInt(10n),
|
|
14
|
-
value: new Bps(1n)
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
}).toThrow(/wrap native currency/);
|
|
18
|
-
});
|
|
19
4
|
it('returns error fromTokenAddress or toTokenAddress equals ZERO_ADDRESS', function() {
|
|
20
5
|
expect(function() {
|
|
21
6
|
return QuoterRequest.new({
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
function _class_call_check(instance, Constructor) {
|
|
2
|
+
if (!(instance instanceof Constructor)) {
|
|
3
|
+
throw new TypeError("Cannot call a class as a function");
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
function _defineProperties(target, props) {
|
|
7
|
+
for(var i = 0; i < props.length; i++){
|
|
8
|
+
var descriptor = props[i];
|
|
9
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
10
|
+
descriptor.configurable = true;
|
|
11
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
12
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
16
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
17
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
18
|
+
return Constructor;
|
|
19
|
+
}
|
|
20
|
+
function _define_property(obj, key, value) {
|
|
21
|
+
if (key in obj) {
|
|
22
|
+
Object.defineProperty(obj, key, {
|
|
23
|
+
value: value,
|
|
24
|
+
enumerable: true,
|
|
25
|
+
configurable: true,
|
|
26
|
+
writable: true
|
|
27
|
+
});
|
|
28
|
+
} else {
|
|
29
|
+
obj[key] = value;
|
|
30
|
+
}
|
|
31
|
+
return obj;
|
|
32
|
+
}
|
|
33
|
+
function _object_spread(target) {
|
|
34
|
+
for(var i = 1; i < arguments.length; i++){
|
|
35
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
36
|
+
var ownKeys = Object.keys(source);
|
|
37
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
38
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
39
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
ownKeys.forEach(function(key) {
|
|
43
|
+
_define_property(target, key, source[key]);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return target;
|
|
47
|
+
}
|
|
48
|
+
function ownKeys(object, enumerableOnly) {
|
|
49
|
+
var keys = Object.keys(object);
|
|
50
|
+
if (Object.getOwnPropertySymbols) {
|
|
51
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
52
|
+
if (enumerableOnly) {
|
|
53
|
+
symbols = symbols.filter(function(sym) {
|
|
54
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
keys.push.apply(keys, symbols);
|
|
58
|
+
}
|
|
59
|
+
return keys;
|
|
60
|
+
}
|
|
61
|
+
function _object_spread_props(target, source) {
|
|
62
|
+
source = source != null ? source : {};
|
|
63
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
64
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
65
|
+
} else {
|
|
66
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
67
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return target;
|
|
71
|
+
}
|
|
72
|
+
import { Interface } from 'ethers';
|
|
73
|
+
import ABI from '../abi/NativeOrderFactory.abi.json';
|
|
74
|
+
export var NativeOrdersFactory = /*#__PURE__*/ function() {
|
|
75
|
+
"use strict";
|
|
76
|
+
function NativeOrdersFactory(address) {
|
|
77
|
+
_class_call_check(this, NativeOrdersFactory);
|
|
78
|
+
_define_property(this, "address", void 0);
|
|
79
|
+
_define_property(this, "iface", void 0);
|
|
80
|
+
this.address = address;
|
|
81
|
+
this.iface = new Interface(ABI);
|
|
82
|
+
}
|
|
83
|
+
_create_class(NativeOrdersFactory, [
|
|
84
|
+
{
|
|
85
|
+
key: "create",
|
|
86
|
+
value: function create(maker, order) {
|
|
87
|
+
return {
|
|
88
|
+
to: this.address,
|
|
89
|
+
value: order.makingAmount,
|
|
90
|
+
data: this.iface.encodeFunctionData('create', [
|
|
91
|
+
_object_spread_props(_object_spread({}, order.build()), {
|
|
92
|
+
maker: maker.toString()
|
|
93
|
+
})
|
|
94
|
+
])
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
]);
|
|
99
|
+
return NativeOrdersFactory;
|
|
100
|
+
}();
|