@1inch/fusion-sdk 2.3.9-rc.9 → 2.4.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/README.md +101 -0
- package/dist/cjs/api/quoter/quote/quote.js +2 -2
- package/dist/cjs/fusion-order/fusion-order.js +10 -31
- package/dist/cjs/fusion-order/fusion-order.spec.js +3 -4
- package/dist/cjs/index.js +9 -1
- package/dist/esm/api/quoter/quote/quote.js +2 -2
- package/dist/esm/fusion-order/fusion-order.js +8 -29
- package/dist/esm/fusion-order/fusion-order.spec.js +1 -2
- package/dist/esm/index.js +1 -2
- package/dist/esm/package.json +1 -1
- package/dist/types/src/api/quoter/quote/quote.d.ts +1 -2
- package/dist/types/src/fusion-order/fusion-order.d.ts +2 -3
- package/dist/types/src/index.d.ts +1 -2
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/dist/cjs/abi/NativeOrderFactory.abi.json +0 -217
- package/dist/cjs/abi/NativeOrderImpl.abi.json +0 -286
- package/dist/cjs/contracts/index.js +0 -21
- package/dist/cjs/contracts/native-order-factory.js +0 -115
- package/dist/cjs/contracts/native-order-impl.js +0 -130
- package/dist/cjs/contracts/proxy-factory.js +0 -87
- package/dist/cjs/contracts/types.js +0 -4
- package/dist/esm/abi/NativeOrderFactory.abi.json +0 -217
- package/dist/esm/abi/NativeOrderImpl.abi.json +0 -286
- package/dist/esm/contracts/index.js +0 -4
- package/dist/esm/contracts/native-order-factory.js +0 -100
- package/dist/esm/contracts/native-order-impl.js +0 -115
- package/dist/esm/contracts/proxy-factory.js +0 -72
- package/dist/esm/contracts/types.js +0 -1
- package/dist/types/src/contracts/index.d.ts +0 -4
- package/dist/types/src/contracts/native-order-factory.d.ts +0 -9
- package/dist/types/src/contracts/native-order-impl.d.ts +0 -9
- package/dist/types/src/contracts/proxy-factory.d.ts +0 -8
- package/dist/types/src/contracts/types.d.ts +0 -6
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "NativeOrdersImpl", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return NativeOrdersImpl;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
var _ethers = require("ethers");
|
|
12
|
-
var _NativeOrderImplabijson = /*#__PURE__*/ _interop_require_default(require("../abi/NativeOrderImpl.abi.json"));
|
|
13
|
-
function _class_call_check(instance, Constructor) {
|
|
14
|
-
if (!(instance instanceof Constructor)) {
|
|
15
|
-
throw new TypeError("Cannot call a class as a function");
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
function _defineProperties(target, props) {
|
|
19
|
-
for(var i = 0; i < props.length; i++){
|
|
20
|
-
var descriptor = props[i];
|
|
21
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
22
|
-
descriptor.configurable = true;
|
|
23
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
24
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
function _create_class(Constructor, protoProps, staticProps) {
|
|
28
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
29
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
30
|
-
return Constructor;
|
|
31
|
-
}
|
|
32
|
-
function _define_property(obj, key, value) {
|
|
33
|
-
if (key in obj) {
|
|
34
|
-
Object.defineProperty(obj, key, {
|
|
35
|
-
value: value,
|
|
36
|
-
enumerable: true,
|
|
37
|
-
configurable: true,
|
|
38
|
-
writable: true
|
|
39
|
-
});
|
|
40
|
-
} else {
|
|
41
|
-
obj[key] = value;
|
|
42
|
-
}
|
|
43
|
-
return obj;
|
|
44
|
-
}
|
|
45
|
-
function _interop_require_default(obj) {
|
|
46
|
-
return obj && obj.__esModule ? obj : {
|
|
47
|
-
default: obj
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
function _object_spread(target) {
|
|
51
|
-
for(var i = 1; i < arguments.length; i++){
|
|
52
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
53
|
-
var ownKeys = Object.keys(source);
|
|
54
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
55
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
56
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
57
|
-
}));
|
|
58
|
-
}
|
|
59
|
-
ownKeys.forEach(function(key) {
|
|
60
|
-
_define_property(target, key, source[key]);
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
return target;
|
|
64
|
-
}
|
|
65
|
-
function ownKeys(object, enumerableOnly) {
|
|
66
|
-
var keys = Object.keys(object);
|
|
67
|
-
if (Object.getOwnPropertySymbols) {
|
|
68
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
69
|
-
if (enumerableOnly) {
|
|
70
|
-
symbols = symbols.filter(function(sym) {
|
|
71
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
keys.push.apply(keys, symbols);
|
|
75
|
-
}
|
|
76
|
-
return keys;
|
|
77
|
-
}
|
|
78
|
-
function _object_spread_props(target, source) {
|
|
79
|
-
source = source != null ? source : {};
|
|
80
|
-
if (Object.getOwnPropertyDescriptors) {
|
|
81
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
82
|
-
} else {
|
|
83
|
-
ownKeys(Object(source)).forEach(function(key) {
|
|
84
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
return target;
|
|
88
|
-
}
|
|
89
|
-
var NativeOrdersImpl = /*#__PURE__*/ function() {
|
|
90
|
-
"use strict";
|
|
91
|
-
function NativeOrdersImpl(address) {
|
|
92
|
-
_class_call_check(this, NativeOrdersImpl);
|
|
93
|
-
_define_property(this, "address", void 0);
|
|
94
|
-
_define_property(this, "iface", void 0);
|
|
95
|
-
this.address = address;
|
|
96
|
-
this.iface = new _ethers.Interface(_NativeOrderImplabijson.default);
|
|
97
|
-
}
|
|
98
|
-
_create_class(NativeOrdersImpl, [
|
|
99
|
-
{
|
|
100
|
-
key: "cancel",
|
|
101
|
-
value: function cancel(maker, order) {
|
|
102
|
-
return {
|
|
103
|
-
to: this.address,
|
|
104
|
-
value: 0n,
|
|
105
|
-
data: this.iface.encodeFunctionData('cancelOrder', [
|
|
106
|
-
_object_spread_props(_object_spread({}, order), {
|
|
107
|
-
maker: maker.toString()
|
|
108
|
-
})
|
|
109
|
-
])
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
key: "cancelExpiredOrderByResolver",
|
|
115
|
-
value: function cancelExpiredOrderByResolver(maker, order, rewardLimit) {
|
|
116
|
-
return {
|
|
117
|
-
to: this.address,
|
|
118
|
-
value: 0n,
|
|
119
|
-
data: this.iface.encodeFunctionData('cancelExpiredOrderByResolver', [
|
|
120
|
-
_object_spread_props(_object_spread({}, order), {
|
|
121
|
-
maker: maker.toString()
|
|
122
|
-
}),
|
|
123
|
-
rewardLimit
|
|
124
|
-
])
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
]);
|
|
129
|
-
return NativeOrdersImpl;
|
|
130
|
-
}();
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "ProxyFactory", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return ProxyFactory;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
var _byteutils = require("@1inch/byte-utils");
|
|
12
|
-
var _limitordersdk = require("@1inch/limit-order-sdk");
|
|
13
|
-
var _ethers = require("ethers");
|
|
14
|
-
var _assert = /*#__PURE__*/ _interop_require_default(require("assert"));
|
|
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 ProxyFactory = /*#__PURE__*/ function() {
|
|
53
|
-
"use strict";
|
|
54
|
-
function ProxyFactory(factory, implementation) {
|
|
55
|
-
_class_call_check(this, ProxyFactory);
|
|
56
|
-
_define_property(this, "factory", void 0);
|
|
57
|
-
_define_property(this, "implementation", void 0);
|
|
58
|
-
this.factory = factory;
|
|
59
|
-
this.implementation = implementation;
|
|
60
|
-
}
|
|
61
|
-
_create_class(ProxyFactory, [
|
|
62
|
-
{
|
|
63
|
-
key: "getProxyAddress",
|
|
64
|
-
value: /**
|
|
65
|
-
* Calculates deterministic address of proxy contract
|
|
66
|
-
*
|
|
67
|
-
* @see https://github.com/OpenZeppelin/openzeppelin-contracts/blob/69c8def5f222ff96f2b5beff05dfba996368aa79/contracts/proxy/Clones.sol#L60
|
|
68
|
-
*
|
|
69
|
-
* @param salt must be valid hex string
|
|
70
|
-
* @returns address of proxy contract
|
|
71
|
-
*/ function getProxyAddress(salt) {
|
|
72
|
-
(0, _assert.default)((0, _byteutils.isHexBytes)(salt), 'invalid salt');
|
|
73
|
-
return new _limitordersdk.Address((0, _ethers.getCreate2Address)(this.factory.toString(), salt, ProxyFactory.calcProxyBytecodeHash(this.implementation)));
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
], [
|
|
77
|
-
{
|
|
78
|
-
key: "calcProxyBytecodeHash",
|
|
79
|
-
value: /**
|
|
80
|
-
* See https://github.com/1inch/cross-chain-swap/blob/03d99b9604d8f7a5a396720fbe1059f7d94db762/contracts/libraries/ProxyHashLib.sol#L14
|
|
81
|
-
*/ function calcProxyBytecodeHash(impl) {
|
|
82
|
-
return (0, _ethers.keccak256)("0x3d602d80600a3d3981f3363d3d373d3d3d363d73".concat((0, _byteutils.trim0x)(impl.toString()), "5af43d82803e903d91602b57fd5bf3"));
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
]);
|
|
86
|
-
return ProxyFactory;
|
|
87
|
-
}();
|
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"type": "constructor",
|
|
4
|
-
"inputs": [
|
|
5
|
-
{
|
|
6
|
-
"name": "weth",
|
|
7
|
-
"type": "address",
|
|
8
|
-
"internalType": "contract IWETH"
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
"name": "nativeOrderImplementation",
|
|
12
|
-
"type": "address",
|
|
13
|
-
"internalType": "address"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"name": "limitOrderProtocol",
|
|
17
|
-
"type": "address",
|
|
18
|
-
"internalType": "address"
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
"name": "accessToken",
|
|
22
|
-
"type": "address",
|
|
23
|
-
"internalType": "contract IERC20"
|
|
24
|
-
}
|
|
25
|
-
],
|
|
26
|
-
"stateMutability": "nonpayable"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"type": "function",
|
|
30
|
-
"name": "create",
|
|
31
|
-
"inputs": [
|
|
32
|
-
{
|
|
33
|
-
"name": "makerOrder",
|
|
34
|
-
"type": "tuple",
|
|
35
|
-
"internalType": "struct IOrderMixin.Order",
|
|
36
|
-
"components": [
|
|
37
|
-
{
|
|
38
|
-
"name": "salt",
|
|
39
|
-
"type": "uint256",
|
|
40
|
-
"internalType": "uint256"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
"name": "maker",
|
|
44
|
-
"type": "uint256",
|
|
45
|
-
"internalType": "Address"
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
"name": "receiver",
|
|
49
|
-
"type": "uint256",
|
|
50
|
-
"internalType": "Address"
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
"name": "makerAsset",
|
|
54
|
-
"type": "uint256",
|
|
55
|
-
"internalType": "Address"
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
"name": "takerAsset",
|
|
59
|
-
"type": "uint256",
|
|
60
|
-
"internalType": "Address"
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
"name": "makingAmount",
|
|
64
|
-
"type": "uint256",
|
|
65
|
-
"internalType": "uint256"
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
"name": "takingAmount",
|
|
69
|
-
"type": "uint256",
|
|
70
|
-
"internalType": "uint256"
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
"name": "makerTraits",
|
|
74
|
-
"type": "uint256",
|
|
75
|
-
"internalType": "MakerTraits"
|
|
76
|
-
}
|
|
77
|
-
]
|
|
78
|
-
}
|
|
79
|
-
],
|
|
80
|
-
"outputs": [
|
|
81
|
-
{"name": "clone", "type": "address", "internalType": "address"}
|
|
82
|
-
],
|
|
83
|
-
"stateMutability": "payable"
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
"type": "function",
|
|
87
|
-
"name": "owner",
|
|
88
|
-
"inputs": [],
|
|
89
|
-
"outputs": [{"name": "", "type": "address", "internalType": "address"}],
|
|
90
|
-
"stateMutability": "view"
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
"type": "function",
|
|
94
|
-
"name": "renounceOwnership",
|
|
95
|
-
"inputs": [],
|
|
96
|
-
"outputs": [],
|
|
97
|
-
"stateMutability": "nonpayable"
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
"type": "function",
|
|
101
|
-
"name": "rescueFunds",
|
|
102
|
-
"inputs": [
|
|
103
|
-
{"name": "token", "type": "address", "internalType": "address"},
|
|
104
|
-
{"name": "to", "type": "address", "internalType": "address"},
|
|
105
|
-
{"name": "amount", "type": "uint256", "internalType": "uint256"}
|
|
106
|
-
],
|
|
107
|
-
"outputs": [],
|
|
108
|
-
"stateMutability": "nonpayable"
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
"type": "function",
|
|
112
|
-
"name": "transferOwnership",
|
|
113
|
-
"inputs": [
|
|
114
|
-
{"name": "newOwner", "type": "address", "internalType": "address"}
|
|
115
|
-
],
|
|
116
|
-
"outputs": [],
|
|
117
|
-
"stateMutability": "nonpayable"
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
"type": "event",
|
|
121
|
-
"name": "NativeOrderCreated",
|
|
122
|
-
"inputs": [
|
|
123
|
-
{
|
|
124
|
-
"name": "maker",
|
|
125
|
-
"type": "address",
|
|
126
|
-
"indexed": false,
|
|
127
|
-
"internalType": "address"
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
"name": "orderHash",
|
|
131
|
-
"type": "bytes32",
|
|
132
|
-
"indexed": false,
|
|
133
|
-
"internalType": "bytes32"
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
"name": "clone",
|
|
137
|
-
"type": "address",
|
|
138
|
-
"indexed": false,
|
|
139
|
-
"internalType": "address"
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
"name": "value",
|
|
143
|
-
"type": "uint256",
|
|
144
|
-
"indexed": false,
|
|
145
|
-
"internalType": "uint256"
|
|
146
|
-
}
|
|
147
|
-
],
|
|
148
|
-
"anonymous": false
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
"type": "event",
|
|
152
|
-
"name": "OwnershipTransferred",
|
|
153
|
-
"inputs": [
|
|
154
|
-
{
|
|
155
|
-
"name": "previousOwner",
|
|
156
|
-
"type": "address",
|
|
157
|
-
"indexed": true,
|
|
158
|
-
"internalType": "address"
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
"name": "newOwner",
|
|
162
|
-
"type": "address",
|
|
163
|
-
"indexed": true,
|
|
164
|
-
"internalType": "address"
|
|
165
|
-
}
|
|
166
|
-
],
|
|
167
|
-
"anonymous": false
|
|
168
|
-
},
|
|
169
|
-
{"type": "error", "name": "FailedDeployment", "inputs": []},
|
|
170
|
-
{
|
|
171
|
-
"type": "error",
|
|
172
|
-
"name": "InsufficientBalance",
|
|
173
|
-
"inputs": [
|
|
174
|
-
{"name": "balance", "type": "uint256", "internalType": "uint256"},
|
|
175
|
-
{"name": "needed", "type": "uint256", "internalType": "uint256"}
|
|
176
|
-
]
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
"type": "error",
|
|
180
|
-
"name": "OrderMakerShouldBeMsgSender",
|
|
181
|
-
"inputs": [
|
|
182
|
-
{"name": "expected", "type": "address", "internalType": "address"},
|
|
183
|
-
{"name": "actual", "type": "address", "internalType": "address"}
|
|
184
|
-
]
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
"type": "error",
|
|
188
|
-
"name": "OrderMakingAmountShouldBeEqualToMsgValue",
|
|
189
|
-
"inputs": [
|
|
190
|
-
{"name": "expected", "type": "uint256", "internalType": "uint256"},
|
|
191
|
-
{"name": "actual", "type": "uint256", "internalType": "uint256"}
|
|
192
|
-
]
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
"type": "error",
|
|
196
|
-
"name": "OrderReceiverShouldNotBeThis",
|
|
197
|
-
"inputs": [
|
|
198
|
-
{"name": "receiver", "type": "address", "internalType": "address"},
|
|
199
|
-
{"name": "self", "type": "address", "internalType": "address"}
|
|
200
|
-
]
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
"type": "error",
|
|
204
|
-
"name": "OwnableInvalidOwner",
|
|
205
|
-
"inputs": [
|
|
206
|
-
{"name": "owner", "type": "address", "internalType": "address"}
|
|
207
|
-
]
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
"type": "error",
|
|
211
|
-
"name": "OwnableUnauthorizedAccount",
|
|
212
|
-
"inputs": [
|
|
213
|
-
{"name": "account", "type": "address", "internalType": "address"}
|
|
214
|
-
]
|
|
215
|
-
},
|
|
216
|
-
{"type": "error", "name": "SafeTransferFailed", "inputs": []}
|
|
217
|
-
]
|