@1inch/fusion-sdk 2.3.9-rc.0 → 2.3.9-rc.2

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 (47) hide show
  1. package/dist/cjs/abi/NativeOrderFactory.abi.json +217 -0
  2. package/dist/cjs/abi/NativeOrderImpl.abi.json +281 -0
  3. package/dist/cjs/api/quoter/quote/quote.js +5 -4
  4. package/dist/cjs/api/quoter/types.js +0 -2
  5. package/dist/cjs/contracts/index.js +20 -0
  6. package/dist/cjs/contracts/native-order-factory.js +115 -0
  7. package/dist/cjs/contracts/native-order-impl.js +129 -0
  8. package/dist/cjs/contracts/proxy-factory.js +87 -0
  9. package/dist/cjs/fusion-order/fusion-order.js +66 -2
  10. package/dist/cjs/fusion-order/fusion-order.spec.js +73 -0
  11. package/dist/cjs/fusion-order/index.js +0 -1
  12. package/dist/cjs/index.js +1 -0
  13. package/dist/cjs/sdk/sdk.js +76 -38
  14. package/dist/esm/abi/NativeOrderFactory.abi.json +217 -0
  15. package/dist/esm/abi/NativeOrderImpl.abi.json +281 -0
  16. package/dist/esm/api/quoter/quote/quote.js +6 -5
  17. package/dist/esm/api/quoter/types.js +0 -2
  18. package/dist/esm/contracts/index.js +3 -0
  19. package/dist/esm/contracts/native-order-factory.js +100 -0
  20. package/dist/esm/contracts/native-order-impl.js +114 -0
  21. package/dist/esm/contracts/proxy-factory.js +72 -0
  22. package/dist/esm/fusion-order/fusion-order.js +64 -0
  23. package/dist/esm/fusion-order/fusion-order.spec.js +73 -0
  24. package/dist/esm/fusion-order/index.js +0 -1
  25. package/dist/esm/index.js +1 -0
  26. package/dist/esm/package.json +1 -1
  27. package/dist/esm/sdk/sdk.js +76 -38
  28. package/dist/types/src/api/quoter/quote/quote.d.ts +4 -3
  29. package/dist/types/src/api/quoter/types.d.ts +2 -1
  30. package/dist/types/src/contracts/index.d.ts +3 -0
  31. package/dist/types/src/contracts/native-order-factory.d.ts +9 -0
  32. package/dist/types/src/contracts/native-order-impl.d.ts +9 -0
  33. package/dist/types/src/contracts/proxy-factory.d.ts +8 -0
  34. package/dist/types/src/fusion-order/fusion-order.d.ts +6 -0
  35. package/dist/types/src/fusion-order/index.d.ts +0 -1
  36. package/dist/types/src/index.d.ts +1 -0
  37. package/dist/types/src/sdk/sdk.d.ts +4 -0
  38. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  39. package/package.json +1 -1
  40. package/dist/cjs/abi/ETHOrders.abi.json +0 -431
  41. package/dist/cjs/contracts/eth-orders.extension.js +0 -105
  42. package/dist/cjs/fusion-order/fusion-order-from-native.js +0 -183
  43. package/dist/esm/abi/ETHOrders.abi.json +0 -431
  44. package/dist/esm/contracts/eth-orders.extension.js +0 -90
  45. package/dist/esm/fusion-order/fusion-order-from-native.js +0 -173
  46. package/dist/types/src/contracts/eth-orders.extension.d.ts +0 -11
  47. package/dist/types/src/fusion-order/fusion-order-from-native.d.ts +0 -13
@@ -1,183 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "FusionOrderFromNative", {
6
- enumerable: true,
7
- get: function() {
8
- return FusionOrderFromNative;
9
- }
10
- });
11
- var _constants = require("./constants.js");
12
- var _fusionorder = require("./fusion-order.js");
13
- function _assert_this_initialized(self) {
14
- if (self === void 0) {
15
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
16
- }
17
- return self;
18
- }
19
- function _call_super(_this, derived, args) {
20
- derived = _get_prototype_of(derived);
21
- return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
22
- }
23
- function _class_call_check(instance, Constructor) {
24
- if (!(instance instanceof Constructor)) {
25
- throw new TypeError("Cannot call a class as a function");
26
- }
27
- }
28
- function _defineProperties(target, props) {
29
- for(var i = 0; i < props.length; i++){
30
- var descriptor = props[i];
31
- descriptor.enumerable = descriptor.enumerable || false;
32
- descriptor.configurable = true;
33
- if ("value" in descriptor) descriptor.writable = true;
34
- Object.defineProperty(target, descriptor.key, descriptor);
35
- }
36
- }
37
- function _create_class(Constructor, protoProps, staticProps) {
38
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
39
- if (staticProps) _defineProperties(Constructor, staticProps);
40
- return Constructor;
41
- }
42
- function _define_property(obj, key, value) {
43
- if (key in obj) {
44
- Object.defineProperty(obj, key, {
45
- value: value,
46
- enumerable: true,
47
- configurable: true,
48
- writable: true
49
- });
50
- } else {
51
- obj[key] = value;
52
- }
53
- return obj;
54
- }
55
- function _get_prototype_of(o) {
56
- _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
57
- return o.__proto__ || Object.getPrototypeOf(o);
58
- };
59
- return _get_prototype_of(o);
60
- }
61
- function _inherits(subClass, superClass) {
62
- if (typeof superClass !== "function" && superClass !== null) {
63
- throw new TypeError("Super expression must either be null or a function");
64
- }
65
- subClass.prototype = Object.create(superClass && superClass.prototype, {
66
- constructor: {
67
- value: subClass,
68
- writable: true,
69
- configurable: true
70
- }
71
- });
72
- if (superClass) _set_prototype_of(subClass, superClass);
73
- }
74
- function _object_spread(target) {
75
- for(var i = 1; i < arguments.length; i++){
76
- var source = arguments[i] != null ? arguments[i] : {};
77
- var ownKeys = Object.keys(source);
78
- if (typeof Object.getOwnPropertySymbols === "function") {
79
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
80
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
81
- }));
82
- }
83
- ownKeys.forEach(function(key) {
84
- _define_property(target, key, source[key]);
85
- });
86
- }
87
- return target;
88
- }
89
- function ownKeys(object, enumerableOnly) {
90
- var keys = Object.keys(object);
91
- if (Object.getOwnPropertySymbols) {
92
- var symbols = Object.getOwnPropertySymbols(object);
93
- if (enumerableOnly) {
94
- symbols = symbols.filter(function(sym) {
95
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
96
- });
97
- }
98
- keys.push.apply(keys, symbols);
99
- }
100
- return keys;
101
- }
102
- function _object_spread_props(target, source) {
103
- source = source != null ? source : {};
104
- if (Object.getOwnPropertyDescriptors) {
105
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
106
- } else {
107
- ownKeys(Object(source)).forEach(function(key) {
108
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
109
- });
110
- }
111
- return target;
112
- }
113
- function _possible_constructor_return(self, call) {
114
- if (call && (_type_of(call) === "object" || typeof call === "function")) {
115
- return call;
116
- }
117
- return _assert_this_initialized(self);
118
- }
119
- function _set_prototype_of(o, p) {
120
- _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
121
- o.__proto__ = p;
122
- return o;
123
- };
124
- return _set_prototype_of(o, p);
125
- }
126
- function _type_of(obj) {
127
- "@swc/helpers - typeof";
128
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
129
- }
130
- function _is_native_reflect_construct() {
131
- try {
132
- var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
133
- } catch (_) {}
134
- return (_is_native_reflect_construct = function() {
135
- return !!result;
136
- })();
137
- }
138
- /**
139
- * Fusion order from native currency
140
- *
141
- * Note, that such order should be submitted onchain through `ETHOrders.depositForOrder` AND offchain through submit to relayer
142
- *
143
- * @see ETHOrders.depositForOrder https://github.com/1inch/limit-order-protocol/blob/c100474444cd71cf7989cd8a63f375e72656b8b4/contracts/extensions/ETHOrders.sol#L89
144
- */ var FusionOrderFromNative = /*#__PURE__*/ function(FusionOrder) {
145
- "use strict";
146
- _inherits(FusionOrderFromNative, FusionOrder);
147
- function FusionOrderFromNative(realMaker, /**
148
- * Fusion extension address
149
- * @see https://github.com/1inch/limit-order-settlement
150
- */ settlementExtensionContract, orderInfo, auctionDetails, whitelist, surplusParams, extra, extension) {
151
- _class_call_check(this, FusionOrderFromNative);
152
- var _this;
153
- _this = _call_super(this, FusionOrderFromNative, [
154
- settlementExtensionContract,
155
- orderInfo,
156
- auctionDetails,
157
- whitelist,
158
- surplusParams,
159
- extra,
160
- extension
161
- ]), _define_property(_this, "realMaker", void 0), _this.realMaker = realMaker;
162
- return _this;
163
- }
164
- _create_class(FusionOrderFromNative, null, [
165
- {
166
- key: "fromNative",
167
- value: /**
168
- * Create new order from native asset
169
- */ function fromNative(chainId, ethOrdersExtension, /**
170
- * Fusion extension address
171
- * @see https://github.com/1inch/limit-order-settlement
172
- */ settlementExtension, orderInfo, details, extra) {
173
- var _orderInfo = _object_spread_props(_object_spread({}, orderInfo), {
174
- makerAsset: _constants.CHAIN_TO_WRAPPER[chainId],
175
- receiver: orderInfo.receiver || orderInfo.maker,
176
- maker: ethOrdersExtension
177
- });
178
- return new FusionOrderFromNative(orderInfo.maker, settlementExtension, _orderInfo, details.auction, details.whitelist, details.surplus, extra);
179
- }
180
- }
181
- ]);
182
- return FusionOrderFromNative;
183
- }(_fusionorder.FusionOrder);
@@ -1,431 +0,0 @@
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
- ]
@@ -1,90 +0,0 @@
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
- import { Interface } from 'ethers';
34
- import assert from 'assert';
35
- import { CancellationAuction } from '../fusion-order/index.js';
36
- import ABI from '../abi/ETHOrders.abi.json';
37
- export var EthOrdersExtension = /*#__PURE__*/ function() {
38
- "use strict";
39
- function EthOrdersExtension(address) {
40
- _class_call_check(this, EthOrdersExtension);
41
- _define_property(this, "address", void 0);
42
- _define_property(this, "iface", void 0);
43
- this.address = address;
44
- this.iface = new Interface(ABI);
45
- }
46
- _create_class(EthOrdersExtension, [
47
- {
48
- key: "deposit",
49
- value: function deposit(order) {
50
- var cancellationAuction = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : CancellationAuction.ZERO;
51
- assert(order.maker.equal(this.address), 'maker must be extension address, use FusionOrder.fromNative to create correct order');
52
- return {
53
- to: this.address,
54
- value: order.makingAmount,
55
- data: this.iface.encodeFunctionData('deposit', [
56
- order.build(),
57
- order.extension.encode(),
58
- cancellationAuction.build()
59
- ])
60
- };
61
- }
62
- },
63
- {
64
- key: "cancelOrder",
65
- value: function cancelOrder(orderHash) {
66
- return {
67
- to: this.address,
68
- value: 0n,
69
- data: this.iface.encodeFunctionData('cancelOrder', [
70
- orderHash
71
- ])
72
- };
73
- }
74
- },
75
- {
76
- key: "cancelExpiredOrderByResolver",
77
- value: function cancelExpiredOrderByResolver(maker, orderInfo) {
78
- return {
79
- value: 0n,
80
- data: this.iface.encodeFunctionData('cancelExpiredOrderByResolver', [
81
- maker.toString(),
82
- orderInfo
83
- ]),
84
- to: this.address
85
- };
86
- }
87
- }
88
- ]);
89
- return EthOrdersExtension;
90
- }();