@1inch/fusion-sdk 2.3.7 → 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/fusion-order/whitelist/whitelist.js +1 -1
- package/dist/cjs/fusion-order/whitelist/whitelist.spec.js +18 -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/fusion-order/whitelist/whitelist.js +1 -1
- package/dist/esm/fusion-order/whitelist/whitelist.spec.js +18 -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 +2 -2
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
function _assert_this_initialized(self) {
|
|
2
|
+
if (self === void 0) {
|
|
3
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
4
|
+
}
|
|
5
|
+
return self;
|
|
6
|
+
}
|
|
7
|
+
function _call_super(_this, derived, args) {
|
|
8
|
+
derived = _get_prototype_of(derived);
|
|
9
|
+
return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
|
|
10
|
+
}
|
|
11
|
+
function _class_call_check(instance, Constructor) {
|
|
12
|
+
if (!(instance instanceof Constructor)) {
|
|
13
|
+
throw new TypeError("Cannot call a class as a function");
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function _defineProperties(target, props) {
|
|
17
|
+
for(var i = 0; i < props.length; i++){
|
|
18
|
+
var descriptor = props[i];
|
|
19
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
20
|
+
descriptor.configurable = true;
|
|
21
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
22
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
26
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
27
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
28
|
+
return Constructor;
|
|
29
|
+
}
|
|
30
|
+
function _define_property(obj, key, value) {
|
|
31
|
+
if (key in obj) {
|
|
32
|
+
Object.defineProperty(obj, key, {
|
|
33
|
+
value: value,
|
|
34
|
+
enumerable: true,
|
|
35
|
+
configurable: true,
|
|
36
|
+
writable: true
|
|
37
|
+
});
|
|
38
|
+
} else {
|
|
39
|
+
obj[key] = value;
|
|
40
|
+
}
|
|
41
|
+
return obj;
|
|
42
|
+
}
|
|
43
|
+
function _get_prototype_of(o) {
|
|
44
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
45
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
46
|
+
};
|
|
47
|
+
return _get_prototype_of(o);
|
|
48
|
+
}
|
|
49
|
+
function _inherits(subClass, superClass) {
|
|
50
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
51
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
52
|
+
}
|
|
53
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
54
|
+
constructor: {
|
|
55
|
+
value: subClass,
|
|
56
|
+
writable: true,
|
|
57
|
+
configurable: true
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
61
|
+
}
|
|
62
|
+
function _object_spread(target) {
|
|
63
|
+
for(var i = 1; i < arguments.length; i++){
|
|
64
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
65
|
+
var ownKeys = Object.keys(source);
|
|
66
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
67
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
68
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
ownKeys.forEach(function(key) {
|
|
72
|
+
_define_property(target, key, source[key]);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return target;
|
|
76
|
+
}
|
|
77
|
+
function ownKeys(object, enumerableOnly) {
|
|
78
|
+
var keys = Object.keys(object);
|
|
79
|
+
if (Object.getOwnPropertySymbols) {
|
|
80
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
81
|
+
if (enumerableOnly) {
|
|
82
|
+
symbols = symbols.filter(function(sym) {
|
|
83
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
keys.push.apply(keys, symbols);
|
|
87
|
+
}
|
|
88
|
+
return keys;
|
|
89
|
+
}
|
|
90
|
+
function _object_spread_props(target, source) {
|
|
91
|
+
source = source != null ? source : {};
|
|
92
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
93
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
94
|
+
} else {
|
|
95
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
96
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
return target;
|
|
100
|
+
}
|
|
101
|
+
function _possible_constructor_return(self, call) {
|
|
102
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
103
|
+
return call;
|
|
104
|
+
}
|
|
105
|
+
return _assert_this_initialized(self);
|
|
106
|
+
}
|
|
107
|
+
function _set_prototype_of(o, p) {
|
|
108
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
109
|
+
o.__proto__ = p;
|
|
110
|
+
return o;
|
|
111
|
+
};
|
|
112
|
+
return _set_prototype_of(o, p);
|
|
113
|
+
}
|
|
114
|
+
function _type_of(obj) {
|
|
115
|
+
"@swc/helpers - typeof";
|
|
116
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
117
|
+
}
|
|
118
|
+
function _is_native_reflect_construct() {
|
|
119
|
+
try {
|
|
120
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
121
|
+
} catch (_) {}
|
|
122
|
+
return (_is_native_reflect_construct = function() {
|
|
123
|
+
return !!result;
|
|
124
|
+
})();
|
|
125
|
+
}
|
|
126
|
+
import { CHAIN_TO_WRAPPER } from './constants.js';
|
|
127
|
+
import { FusionOrder } from './fusion-order.js';
|
|
128
|
+
/**
|
|
129
|
+
* Fusion order from native currency
|
|
130
|
+
*
|
|
131
|
+
* Note, that such order should be submitted onchain through `ETHOrders.depositForOrder` AND offchain through submit to relayer
|
|
132
|
+
*
|
|
133
|
+
* @see ETHOrders.depositForOrder https://github.com/1inch/limit-order-protocol/blob/c100474444cd71cf7989cd8a63f375e72656b8b4/contracts/extensions/ETHOrders.sol#L89
|
|
134
|
+
*/ export var FusionOrderFromNative = /*#__PURE__*/ function(FusionOrder) {
|
|
135
|
+
"use strict";
|
|
136
|
+
_inherits(FusionOrderFromNative, FusionOrder);
|
|
137
|
+
function FusionOrderFromNative(realMaker, /**
|
|
138
|
+
* Fusion extension address
|
|
139
|
+
* @see https://github.com/1inch/limit-order-settlement
|
|
140
|
+
*/ settlementExtensionContract, orderInfo, auctionDetails, whitelist, surplusParams, extra, extension) {
|
|
141
|
+
_class_call_check(this, FusionOrderFromNative);
|
|
142
|
+
var _this;
|
|
143
|
+
_this = _call_super(this, FusionOrderFromNative, [
|
|
144
|
+
settlementExtensionContract,
|
|
145
|
+
orderInfo,
|
|
146
|
+
auctionDetails,
|
|
147
|
+
whitelist,
|
|
148
|
+
surplusParams,
|
|
149
|
+
extra,
|
|
150
|
+
extension
|
|
151
|
+
]), _define_property(_this, "realMaker", void 0), _this.realMaker = realMaker;
|
|
152
|
+
return _this;
|
|
153
|
+
}
|
|
154
|
+
_create_class(FusionOrderFromNative, null, [
|
|
155
|
+
{
|
|
156
|
+
key: "fromNative",
|
|
157
|
+
value: /**
|
|
158
|
+
* Create new order from native asset
|
|
159
|
+
*/ function fromNative(chainId, ethOrdersExtension, /**
|
|
160
|
+
* Fusion extension address
|
|
161
|
+
* @see https://github.com/1inch/limit-order-settlement
|
|
162
|
+
*/ settlementExtension, orderInfo, details, extra) {
|
|
163
|
+
var _orderInfo = _object_spread_props(_object_spread({}, orderInfo), {
|
|
164
|
+
makerAsset: CHAIN_TO_WRAPPER[chainId],
|
|
165
|
+
receiver: orderInfo.receiver || orderInfo.maker,
|
|
166
|
+
maker: ethOrdersExtension
|
|
167
|
+
});
|
|
168
|
+
return new FusionOrderFromNative(orderInfo.maker, settlementExtension, _orderInfo, details.auction, details.whitelist, details.surplus, extra);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
]);
|
|
172
|
+
return FusionOrderFromNative;
|
|
173
|
+
}(FusionOrder);
|
|
@@ -85,18 +85,7 @@ export var FusionOrder = /*#__PURE__*/ function() {
|
|
|
85
85
|
* Fusion extension address
|
|
86
86
|
* @see https://github.com/1inch/limit-order-settlement
|
|
87
87
|
*/ settlementExtensionContract, orderInfo, auctionDetails, whitelist) {
|
|
88
|
-
var surplusParams = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : SurplusParams.NO_FEE, extra = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] :
|
|
89
|
-
* Required if `allowPartialFills` or `allowMultipleFills` is false
|
|
90
|
-
*/ /**
|
|
91
|
-
* 0x prefixed without the token address
|
|
92
|
-
*/ /**
|
|
93
|
-
* Default is true
|
|
94
|
-
*/ /**
|
|
95
|
-
* Default is true
|
|
96
|
-
*/ /**
|
|
97
|
-
* Order will expire in `orderExpirationDelay` after auction ends
|
|
98
|
-
* Default 12s
|
|
99
|
-
*/ FusionOrder.defaultExtra, extension = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : new FusionExtension(settlementExtensionContract, auctionDetails, whitelist, surplusParams, {
|
|
88
|
+
var surplusParams = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : SurplusParams.NO_FEE, extra = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : FusionOrder.defaultExtra, extension = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : new FusionExtension(settlementExtensionContract, auctionDetails, whitelist, surplusParams, {
|
|
100
89
|
makerPermit: extra.permit ? new Interaction(orderInfo.makerAsset, extra.permit) : undefined,
|
|
101
90
|
customReceiver: orderInfo.receiver,
|
|
102
91
|
fees: extra === null || extra === void 0 ? void 0 : extra.fees
|
|
@@ -136,6 +125,9 @@ export var FusionOrder = /*#__PURE__*/ function() {
|
|
|
136
125
|
var builtExtension = extension.build();
|
|
137
126
|
var salt = LimitOrder.buildSalt(builtExtension, orderInfo.salt);
|
|
138
127
|
var saltWithInjectedTrackCode = orderInfo.salt ? salt : injectTrackCode(salt, extra.source);
|
|
128
|
+
if (orderInfo.makerAsset.isNative()) {
|
|
129
|
+
throw new Error('use FusionOrder.fromNative to create order from native asset');
|
|
130
|
+
}
|
|
139
131
|
this.inner = new LimitOrder(_object_spread_props(_object_spread({}, orderInfo), {
|
|
140
132
|
receiver: receiver,
|
|
141
133
|
salt: saltWithInjectedTrackCode
|
|
@@ -444,17 +436,7 @@ export var FusionOrder = /*#__PURE__*/ function() {
|
|
|
444
436
|
value: function _new(/**
|
|
445
437
|
* Fusion extension address
|
|
446
438
|
* @see https://github.com/1inch/limit-order-settlement
|
|
447
|
-
*/ settlementExtension, orderInfo, details, extra)
|
|
448
|
-
* Required if `allowPartialFills` or `allowMultipleFills` is false
|
|
449
|
-
* Max size is 40bit
|
|
450
|
-
*/ /**
|
|
451
|
-
* Default is true
|
|
452
|
-
*/ /**
|
|
453
|
-
* Default is true
|
|
454
|
-
*/ /**
|
|
455
|
-
* Order will expire in `orderExpirationDelay` after auction ends
|
|
456
|
-
* Default 12s
|
|
457
|
-
*/ {
|
|
439
|
+
*/ settlementExtension, orderInfo, details, extra) {
|
|
458
440
|
return new FusionOrder(settlementExtension, orderInfo, details.auction, details.whitelist, details.surplus, extra);
|
|
459
441
|
}
|
|
460
442
|
},
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export * from './fusion-order.js';
|
|
2
|
+
export * from './fusion-order-from-native.js';
|
|
2
3
|
export * from './auction-details/index.js';
|
|
3
4
|
export * from './whitelist/index.js';
|
|
4
5
|
export * from './fusion-extension.js';
|
|
5
6
|
export * from './fees/index.js';
|
|
6
7
|
export { CHAIN_TO_WRAPPER } from './constants.js';
|
|
7
8
|
export * from './surplus-params.js';
|
|
9
|
+
export * from './cancellation-auction.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Required if `allowPartialFills` or `allowMultipleFills` is false
|
|
3
|
+
* Max size is 40bit
|
|
4
|
+
*/ /**
|
|
5
|
+
* Default is true
|
|
6
|
+
*/ /**
|
|
7
|
+
* Default is true
|
|
8
|
+
*/ /**
|
|
9
|
+
* Order will expire in `orderExpirationDelay` after auction ends
|
|
10
|
+
* Default 12s
|
|
11
|
+
*/ export { };
|
|
@@ -125,7 +125,7 @@ export var Whitelist = /*#__PURE__*/ function() {
|
|
|
125
125
|
{
|
|
126
126
|
key: "isWhitelisted",
|
|
127
127
|
value: function isWhitelisted(address) {
|
|
128
|
-
var half = address.
|
|
128
|
+
var half = address.toString().slice(-20);
|
|
129
129
|
return this.whitelist.some(function(w) {
|
|
130
130
|
return w.addressHalf === half;
|
|
131
131
|
});
|
|
@@ -61,4 +61,22 @@ describe('Whitelist', function() {
|
|
|
61
61
|
expect(data.canExecuteAt(Address.fromBigInt(3n), start + 9n)).toEqual(false);
|
|
62
62
|
expect(data.canExecuteAt(Address.fromBigInt(2n), start + 50n)).toEqual(false);
|
|
63
63
|
});
|
|
64
|
+
it('should correctly identify whitelisted addresses with address half reconstruction', function() {
|
|
65
|
+
var start = 1708117482n;
|
|
66
|
+
var testAddress = new Address('0x1234567890abcdef1234567890abcdef12345678');
|
|
67
|
+
var whitelist = Whitelist.new(start, [
|
|
68
|
+
{
|
|
69
|
+
address: testAddress,
|
|
70
|
+
allowFrom: start + 10n
|
|
71
|
+
}
|
|
72
|
+
]);
|
|
73
|
+
// Get the address half from the whitelist
|
|
74
|
+
var addressHalf = whitelist.whitelist[0].addressHalf;
|
|
75
|
+
expect(addressHalf).toBe('1234567890abcdef1234567890abcdef12345678'.slice(-20));
|
|
76
|
+
// Create a new address by duplicating the address half (like in the user's scenario)
|
|
77
|
+
var reconstructedAddress = new Address(addressHalf + addressHalf);
|
|
78
|
+
expect(whitelist.isWhitelisted(reconstructedAddress)).toBe(true);
|
|
79
|
+
expect(reconstructedAddress.toString().slice(-20)).toBe(addressHalf);
|
|
80
|
+
expect(reconstructedAddress.lastHalf()).toBe('0x' + addressHalf);
|
|
81
|
+
});
|
|
64
82
|
});
|
package/dist/esm/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@1inch/fusion-sdk","version":"2.3.
|
|
1
|
+
{"name":"@1inch/fusion-sdk","version":"2.3.9-rc.0","type":"module"}
|
package/dist/esm/sdk/sdk.js
CHANGED
|
@@ -59,6 +59,13 @@ function _define_property(obj, key, value) {
|
|
|
59
59
|
}
|
|
60
60
|
return obj;
|
|
61
61
|
}
|
|
62
|
+
function _instanceof(left, right) {
|
|
63
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
64
|
+
return !!right[Symbol.hasInstance](left);
|
|
65
|
+
} else {
|
|
66
|
+
return left instanceof right;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
62
69
|
function _ts_generator(thisArg, body) {
|
|
63
70
|
var f, y, t, g, _ = {
|
|
64
71
|
label: 0,
|
|
@@ -158,6 +165,7 @@ import { Address, MakerTraits } from '@1inch/limit-order-sdk';
|
|
|
158
165
|
import { encodeCancelOrder } from './encoders/index.js';
|
|
159
166
|
import { FusionApi, QuoterRequest, RelayerRequest, QuoterCustomPresetRequest } from '../api/index.js';
|
|
160
167
|
import { ActiveOrdersRequest, OrdersByMakerRequest, OrderStatusRequest } from '../api/orders/index.js';
|
|
168
|
+
import { FusionOrderFromNative } from '../fusion-order/index.js';
|
|
161
169
|
export var FusionSDK = /*#__PURE__*/ function() {
|
|
162
170
|
"use strict";
|
|
163
171
|
function FusionSDK(config) {
|
|
@@ -331,23 +339,25 @@ export var FusionSDK = /*#__PURE__*/ function() {
|
|
|
331
339
|
},
|
|
332
340
|
{
|
|
333
341
|
key: "submitOrder",
|
|
334
|
-
value:
|
|
342
|
+
value: /**
|
|
343
|
+
* Submit order to relayer
|
|
344
|
+
*
|
|
345
|
+
* Note, that orders from native assets must be submitted onchain as well
|
|
346
|
+
* @see EthOrdersExtension.depositForOrder
|
|
347
|
+
*/ function submitOrder(order, quoteId) {
|
|
335
348
|
var _this = this;
|
|
336
349
|
return _async_to_generator(function() {
|
|
337
|
-
var
|
|
350
|
+
var signature, orderStruct, relayerRequest;
|
|
338
351
|
return _ts_generator(this, function(_state) {
|
|
339
352
|
switch(_state.label){
|
|
340
353
|
case 0:
|
|
341
|
-
if (!_this.config.blockchainProvider) {
|
|
342
|
-
throw new Error('blockchainProvider has not set to config');
|
|
343
|
-
}
|
|
344
|
-
orderStruct = order.build();
|
|
345
354
|
return [
|
|
346
355
|
4,
|
|
347
|
-
_this.
|
|
356
|
+
_this.signOrder(order)
|
|
348
357
|
];
|
|
349
358
|
case 1:
|
|
350
359
|
signature = _state.sent();
|
|
360
|
+
orderStruct = order.build();
|
|
351
361
|
relayerRequest = RelayerRequest.new({
|
|
352
362
|
order: orderStruct,
|
|
353
363
|
signature: signature,
|
|
@@ -437,6 +447,12 @@ export var FusionSDK = /*#__PURE__*/ function() {
|
|
|
437
447
|
return _async_to_generator(function() {
|
|
438
448
|
var orderStruct, data;
|
|
439
449
|
return _ts_generator(this, function(_state) {
|
|
450
|
+
if (_instanceof(order, FusionOrderFromNative)) {
|
|
451
|
+
return [
|
|
452
|
+
2,
|
|
453
|
+
order.realMaker.toString()
|
|
454
|
+
];
|
|
455
|
+
}
|
|
440
456
|
if (!_this.config.blockchainProvider) {
|
|
441
457
|
throw new Error('blockchainProvider has not set to config');
|
|
442
458
|
}
|
|
@@ -488,4 +504,5 @@ export var FusionSDK = /*#__PURE__*/ function() {
|
|
|
488
504
|
}
|
|
489
505
|
]);
|
|
490
506
|
return FusionSDK;
|
|
491
|
-
}
|
|
507
|
+
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
508
|
+
();
|
|
@@ -2,11 +2,12 @@ import { Address } from '@1inch/limit-order-sdk';
|
|
|
2
2
|
import { FusionOrderParamsData, IntegratorFeeParams, ResolverFeePreset } from './types.js';
|
|
3
3
|
import { Cost, PresetEnum, QuoterResponse } from '../types.js';
|
|
4
4
|
import { Preset } from '../preset.js';
|
|
5
|
-
import { FusionOrder } from '../../../fusion-order/index.js';
|
|
5
|
+
import { FusionOrder, FusionOrderFromNative } from '../../../fusion-order/index.js';
|
|
6
6
|
import { QuoterRequest } from '../quoter.request.js';
|
|
7
7
|
export declare class Quote {
|
|
8
8
|
private readonly params;
|
|
9
9
|
readonly settlementAddress: Address;
|
|
10
|
+
readonly ethOrdersAddress?: Address;
|
|
10
11
|
readonly fromTokenAmount: bigint;
|
|
11
12
|
readonly presets: {
|
|
12
13
|
[PresetEnum.fast]: Preset;
|
|
@@ -26,7 +27,8 @@ export declare class Quote {
|
|
|
26
27
|
readonly surplusFee?: number;
|
|
27
28
|
readonly integratorFeeParams?: IntegratorFeeParams;
|
|
28
29
|
constructor(params: QuoterRequest, response: QuoterResponse);
|
|
29
|
-
createFusionOrder(paramsData: Omit<FusionOrderParamsData, 'permit' | 'isPermit2'>): FusionOrder;
|
|
30
|
+
createFusionOrder(paramsData: Omit<FusionOrderParamsData, 'permit' | 'isPermit2'>): FusionOrder | FusionOrderFromNative;
|
|
30
31
|
getPreset(type?: PresetEnum): Preset;
|
|
31
32
|
private getWhitelist;
|
|
33
|
+
private _createOrder;
|
|
32
34
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Address, LimitOrderV4Struct } from '@1inch/limit-order-sdk';
|
|
2
|
+
import { CallInfo } from './types.js';
|
|
3
|
+
import { FusionOrder, CancellationAuction } from '../fusion-order/index.js';
|
|
4
|
+
export declare class EthOrdersExtension {
|
|
5
|
+
address: Address;
|
|
6
|
+
private readonly iface;
|
|
7
|
+
constructor(address: Address);
|
|
8
|
+
deposit(order: FusionOrder, cancellationAuction?: CancellationAuction): CallInfo;
|
|
9
|
+
cancelOrder(orderHash: string): CallInfo;
|
|
10
|
+
cancelExpiredOrderByResolver(maker: Address, orderInfo: LimitOrderV4Struct): CallInfo;
|
|
11
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Address, OrderInfoData } from '@1inch/limit-order-sdk';
|
|
2
|
+
import { FusionOrder } from './fusion-order.js';
|
|
3
|
+
import { Details, Extra } from './types.js';
|
|
4
|
+
import { FusionExtension } from './fusion-extension.js';
|
|
5
|
+
import { SurplusParams } from './surplus-params.js';
|
|
6
|
+
import { Whitelist } from './whitelist/whitelist.js';
|
|
7
|
+
import { AuctionDetails } from './auction-details/auction-details.js';
|
|
8
|
+
import { NetworkEnum } from '../constants.js';
|
|
9
|
+
export declare class FusionOrderFromNative extends FusionOrder {
|
|
10
|
+
readonly realMaker: Address;
|
|
11
|
+
constructor(realMaker: Address, settlementExtensionContract: Address, orderInfo: OrderInfoData, auctionDetails: AuctionDetails, whitelist: Whitelist, surplusParams?: SurplusParams, extra?: Extra, extension?: FusionExtension);
|
|
12
|
+
static fromNative(chainId: NetworkEnum, ethOrdersExtension: Address, settlementExtension: Address, orderInfo: Omit<OrderInfoData, 'makerAsset'>, details: Details, extra?: Extra): FusionOrderFromNative;
|
|
13
|
+
}
|
|
@@ -3,7 +3,7 @@ import { FusionExtension } from './fusion-extension.js';
|
|
|
3
3
|
import { AuctionDetails } from './auction-details/index.js';
|
|
4
4
|
import { Whitelist } from './whitelist/whitelist.js';
|
|
5
5
|
import { SurplusParams } from './surplus-params.js';
|
|
6
|
-
import {
|
|
6
|
+
import type { Details, Extra } from './types.js';
|
|
7
7
|
import { AuctionCalculator } from '../amount-calculator/auction-calculator/index.js';
|
|
8
8
|
import { AmountCalculator } from '../amount-calculator/amount-calculator.js';
|
|
9
9
|
export declare class FusionOrder {
|
|
@@ -11,17 +11,7 @@ export declare class FusionOrder {
|
|
|
11
11
|
private static defaultExtra;
|
|
12
12
|
readonly fusionExtension: FusionExtension;
|
|
13
13
|
private inner;
|
|
14
|
-
protected constructor(settlementExtensionContract: Address, orderInfo: OrderInfoData, auctionDetails: AuctionDetails, whitelist: Whitelist, surplusParams?: SurplusParams, extra?:
|
|
15
|
-
unwrapWETH?: boolean;
|
|
16
|
-
nonce?: bigint;
|
|
17
|
-
permit?: string;
|
|
18
|
-
allowPartialFills?: boolean;
|
|
19
|
-
allowMultipleFills?: boolean;
|
|
20
|
-
orderExpirationDelay?: bigint;
|
|
21
|
-
enablePermit2?: boolean;
|
|
22
|
-
source?: string;
|
|
23
|
-
fees?: Fees;
|
|
24
|
-
}, extension?: FusionExtension);
|
|
14
|
+
protected constructor(settlementExtensionContract: Address, orderInfo: OrderInfoData, auctionDetails: AuctionDetails, whitelist: Whitelist, surplusParams?: SurplusParams, extra?: Extra, extension?: FusionExtension);
|
|
25
15
|
get extension(): Extension;
|
|
26
16
|
get maker(): Address;
|
|
27
17
|
get takerAsset(): Address;
|
|
@@ -38,21 +28,7 @@ export declare class FusionOrder {
|
|
|
38
28
|
get multipleFillsAllowed(): boolean;
|
|
39
29
|
get nonce(): bigint;
|
|
40
30
|
get salt(): bigint;
|
|
41
|
-
static new(settlementExtension: Address, orderInfo: OrderInfoData, details:
|
|
42
|
-
auction: AuctionDetails;
|
|
43
|
-
whitelist: Whitelist;
|
|
44
|
-
surplus?: SurplusParams;
|
|
45
|
-
}, extra?: {
|
|
46
|
-
unwrapWETH?: boolean;
|
|
47
|
-
nonce?: bigint;
|
|
48
|
-
permit?: string;
|
|
49
|
-
allowPartialFills?: boolean;
|
|
50
|
-
allowMultipleFills?: boolean;
|
|
51
|
-
orderExpirationDelay?: bigint;
|
|
52
|
-
enablePermit2?: boolean;
|
|
53
|
-
source?: string;
|
|
54
|
-
fees?: Fees;
|
|
55
|
-
}): FusionOrder;
|
|
31
|
+
static new(settlementExtension: Address, orderInfo: OrderInfoData, details: Details, extra?: Extra): FusionOrder;
|
|
56
32
|
static fromDataAndExtension(order: LimitOrderV4Struct, extension: Extension): FusionOrder;
|
|
57
33
|
build(): LimitOrderV4Struct;
|
|
58
34
|
getOrderHash(chainId: number): string;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export * from './fusion-order.js';
|
|
2
|
+
export * from './fusion-order-from-native.js';
|
|
2
3
|
export * from './auction-details/index.js';
|
|
3
4
|
export * from './whitelist/index.js';
|
|
4
5
|
export * from './fusion-extension.js';
|
|
5
6
|
export * from './fees/index.js';
|
|
6
7
|
export { CHAIN_TO_WRAPPER } from './constants.js';
|
|
7
8
|
export * from './surplus-params.js';
|
|
9
|
+
export * from './cancellation-auction.js';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AuctionDetails } from './auction-details/auction-details.js';
|
|
2
|
+
import { Fees } from './fees/index.js';
|
|
3
|
+
import { SurplusParams } from './surplus-params.js';
|
|
4
|
+
import { Whitelist } from './whitelist/whitelist.js';
|
|
5
|
+
export type Extra = {
|
|
6
|
+
unwrapWETH?: boolean;
|
|
7
|
+
nonce?: bigint;
|
|
8
|
+
permit?: string;
|
|
9
|
+
allowPartialFills?: boolean;
|
|
10
|
+
allowMultipleFills?: boolean;
|
|
11
|
+
orderExpirationDelay?: bigint;
|
|
12
|
+
enablePermit2?: boolean;
|
|
13
|
+
source?: string;
|
|
14
|
+
fees?: Fees;
|
|
15
|
+
};
|
|
16
|
+
export type Details = {
|
|
17
|
+
auction: AuctionDetails;
|
|
18
|
+
whitelist: Whitelist;
|
|
19
|
+
surplus?: SurplusParams;
|
|
20
|
+
};
|