@1inch/fusion-sdk 2.3.8 → 2.3.9-rc.1
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/NativeOrderImpl.abi.json +281 -0
- package/dist/cjs/api/quoter/quote/quote.js +29 -4
- package/dist/cjs/contracts/index.js +20 -0
- package/dist/cjs/contracts/native-order-factory.js +115 -0
- package/dist/cjs/contracts/native-order-impl.js +129 -0
- package/dist/cjs/contracts/proxy-factory.js +87 -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.js +71 -25
- package/dist/cjs/fusion-order/fusion-order.spec.js +73 -0
- package/dist/cjs/fusion-order/index.js +1 -0
- package/dist/cjs/fusion-order/types.js +4 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/sdk/sdk.js +83 -28
- package/dist/esm/abi/NativeOrderFactory.abi.json +217 -0
- package/dist/esm/abi/NativeOrderImpl.abi.json +281 -0
- package/dist/esm/api/quoter/quote/quote.js +24 -4
- package/dist/esm/contracts/index.js +3 -0
- package/dist/esm/contracts/native-order-factory.js +100 -0
- package/dist/esm/contracts/native-order-impl.js +114 -0
- package/dist/esm/contracts/proxy-factory.js +72 -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.js +69 -23
- package/dist/esm/fusion-order/fusion-order.spec.js +73 -0
- package/dist/esm/fusion-order/index.js +1 -0
- package/dist/esm/fusion-order/types.js +11 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/package.json +1 -1
- package/dist/esm/sdk/sdk.js +83 -28
- package/dist/types/src/api/quoter/quote/quote.d.ts +3 -0
- package/dist/types/src/api/quoter/types.d.ts +2 -0
- package/dist/types/src/contracts/index.d.ts +3 -0
- package/dist/types/src/contracts/native-order-factory.d.ts +9 -0
- package/dist/types/src/contracts/native-order-impl.d.ts +10 -0
- package/dist/types/src/contracts/proxy-factory.d.ts +8 -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.d.ts +9 -27
- package/dist/types/src/fusion-order/index.d.ts +1 -0
- package/dist/types/src/fusion-order/types.d.ts +20 -0
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/sdk/sdk.d.ts +4 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,217 @@
|
|
|
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
|
+
]
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"type": "constructor",
|
|
4
|
+
"inputs": [
|
|
5
|
+
{
|
|
6
|
+
"name": "weth",
|
|
7
|
+
"type": "address",
|
|
8
|
+
"internalType": "contract IWETH"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"name": "nativeOrderFactory",
|
|
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
|
+
{"type": "receive", "stateMutability": "payable"},
|
|
29
|
+
{
|
|
30
|
+
"type": "function",
|
|
31
|
+
"name": "cancelExpiredOrderByResolver",
|
|
32
|
+
"inputs": [
|
|
33
|
+
{
|
|
34
|
+
"name": "makerOrder",
|
|
35
|
+
"type": "tuple",
|
|
36
|
+
"internalType": "struct IOrderMixin.Order",
|
|
37
|
+
"components": [
|
|
38
|
+
{
|
|
39
|
+
"name": "salt",
|
|
40
|
+
"type": "uint256",
|
|
41
|
+
"internalType": "uint256"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": "maker",
|
|
45
|
+
"type": "uint256",
|
|
46
|
+
"internalType": "Address"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "receiver",
|
|
50
|
+
"type": "uint256",
|
|
51
|
+
"internalType": "Address"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "makerAsset",
|
|
55
|
+
"type": "uint256",
|
|
56
|
+
"internalType": "Address"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"name": "takerAsset",
|
|
60
|
+
"type": "uint256",
|
|
61
|
+
"internalType": "Address"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"name": "makingAmount",
|
|
65
|
+
"type": "uint256",
|
|
66
|
+
"internalType": "uint256"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"name": "takingAmount",
|
|
70
|
+
"type": "uint256",
|
|
71
|
+
"internalType": "uint256"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"name": "makerTraits",
|
|
75
|
+
"type": "uint256",
|
|
76
|
+
"internalType": "MakerTraits"
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
"outputs": [],
|
|
82
|
+
"stateMutability": "nonpayable"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"type": "function",
|
|
86
|
+
"name": "cancelOrder",
|
|
87
|
+
"inputs": [
|
|
88
|
+
{
|
|
89
|
+
"name": "makerOrder",
|
|
90
|
+
"type": "tuple",
|
|
91
|
+
"internalType": "struct IOrderMixin.Order",
|
|
92
|
+
"components": [
|
|
93
|
+
{
|
|
94
|
+
"name": "salt",
|
|
95
|
+
"type": "uint256",
|
|
96
|
+
"internalType": "uint256"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"name": "maker",
|
|
100
|
+
"type": "uint256",
|
|
101
|
+
"internalType": "Address"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"name": "receiver",
|
|
105
|
+
"type": "uint256",
|
|
106
|
+
"internalType": "Address"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"name": "makerAsset",
|
|
110
|
+
"type": "uint256",
|
|
111
|
+
"internalType": "Address"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"name": "takerAsset",
|
|
115
|
+
"type": "uint256",
|
|
116
|
+
"internalType": "Address"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"name": "makingAmount",
|
|
120
|
+
"type": "uint256",
|
|
121
|
+
"internalType": "uint256"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"name": "takingAmount",
|
|
125
|
+
"type": "uint256",
|
|
126
|
+
"internalType": "uint256"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"name": "makerTraits",
|
|
130
|
+
"type": "uint256",
|
|
131
|
+
"internalType": "MakerTraits"
|
|
132
|
+
}
|
|
133
|
+
]
|
|
134
|
+
}
|
|
135
|
+
],
|
|
136
|
+
"outputs": [],
|
|
137
|
+
"stateMutability": "nonpayable"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"type": "function",
|
|
141
|
+
"name": "decimals",
|
|
142
|
+
"inputs": [],
|
|
143
|
+
"outputs": [{"name": "", "type": "uint8", "internalType": "uint8"}],
|
|
144
|
+
"stateMutability": "pure"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"type": "function",
|
|
148
|
+
"name": "depositAndApprove",
|
|
149
|
+
"inputs": [],
|
|
150
|
+
"outputs": [],
|
|
151
|
+
"stateMutability": "payable"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"type": "function",
|
|
155
|
+
"name": "isValidSignature",
|
|
156
|
+
"inputs": [
|
|
157
|
+
{"name": "hash", "type": "bytes32", "internalType": "bytes32"},
|
|
158
|
+
{"name": "signature", "type": "bytes", "internalType": "bytes"}
|
|
159
|
+
],
|
|
160
|
+
"outputs": [{"name": "", "type": "bytes4", "internalType": "bytes4"}],
|
|
161
|
+
"stateMutability": "view"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"type": "function",
|
|
165
|
+
"name": "name",
|
|
166
|
+
"inputs": [],
|
|
167
|
+
"outputs": [{"name": "", "type": "string", "internalType": "string"}],
|
|
168
|
+
"stateMutability": "pure"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"type": "function",
|
|
172
|
+
"name": "rescueFunds",
|
|
173
|
+
"inputs": [
|
|
174
|
+
{"name": "token", "type": "address", "internalType": "address"},
|
|
175
|
+
{"name": "to", "type": "address", "internalType": "address"},
|
|
176
|
+
{"name": "amount", "type": "uint256", "internalType": "uint256"}
|
|
177
|
+
],
|
|
178
|
+
"outputs": [],
|
|
179
|
+
"stateMutability": "nonpayable"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"type": "function",
|
|
183
|
+
"name": "symbol",
|
|
184
|
+
"inputs": [],
|
|
185
|
+
"outputs": [{"name": "", "type": "string", "internalType": "string"}],
|
|
186
|
+
"stateMutability": "pure"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"type": "event",
|
|
190
|
+
"name": "NativeOrderCancelled",
|
|
191
|
+
"inputs": [
|
|
192
|
+
{
|
|
193
|
+
"name": "makerOrderHash",
|
|
194
|
+
"type": "bytes32",
|
|
195
|
+
"indexed": false,
|
|
196
|
+
"internalType": "bytes32"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"name": "balance",
|
|
200
|
+
"type": "uint256",
|
|
201
|
+
"indexed": false,
|
|
202
|
+
"internalType": "uint256"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"name": "resolverReward",
|
|
206
|
+
"type": "uint256",
|
|
207
|
+
"indexed": false,
|
|
208
|
+
"internalType": "uint256"
|
|
209
|
+
}
|
|
210
|
+
],
|
|
211
|
+
"anonymous": false
|
|
212
|
+
},
|
|
213
|
+
{"type": "error", "name": "CanNotCancelForZeroBalance", "inputs": []},
|
|
214
|
+
{"type": "error", "name": "EthDepositRejected", "inputs": []},
|
|
215
|
+
{"type": "error", "name": "ForceApproveFailed", "inputs": []},
|
|
216
|
+
{
|
|
217
|
+
"type": "error",
|
|
218
|
+
"name": "OnlyFactoryViolation",
|
|
219
|
+
"inputs": [
|
|
220
|
+
{"name": "sender", "type": "address", "internalType": "address"},
|
|
221
|
+
{"name": "factory", "type": "address", "internalType": "address"}
|
|
222
|
+
]
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"type": "error",
|
|
226
|
+
"name": "OnlyLimitOrderProtocolViolation",
|
|
227
|
+
"inputs": [
|
|
228
|
+
{"name": "sender", "type": "address", "internalType": "address"},
|
|
229
|
+
{
|
|
230
|
+
"name": "limitOrderProtocol",
|
|
231
|
+
"type": "address",
|
|
232
|
+
"internalType": "address"
|
|
233
|
+
}
|
|
234
|
+
]
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
"type": "error",
|
|
238
|
+
"name": "OrderIsIncorrect",
|
|
239
|
+
"inputs": [
|
|
240
|
+
{"name": "expected", "type": "address", "internalType": "address"},
|
|
241
|
+
{"name": "actual", "type": "address", "internalType": "address"}
|
|
242
|
+
]
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
"type": "error",
|
|
246
|
+
"name": "OrderShouldBeExpired",
|
|
247
|
+
"inputs": [
|
|
248
|
+
{
|
|
249
|
+
"name": "currentTime",
|
|
250
|
+
"type": "uint256",
|
|
251
|
+
"internalType": "uint256"
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"name": "expirationTime",
|
|
255
|
+
"type": "uint256",
|
|
256
|
+
"internalType": "uint256"
|
|
257
|
+
}
|
|
258
|
+
]
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
"type": "error",
|
|
262
|
+
"name": "RescueFundsTooMuch",
|
|
263
|
+
"inputs": [
|
|
264
|
+
{"name": "requested", "type": "uint256", "internalType": "uint256"},
|
|
265
|
+
{"name": "available", "type": "uint256", "internalType": "uint256"}
|
|
266
|
+
]
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"type": "error",
|
|
270
|
+
"name": "ResolverAccessTokenMissing",
|
|
271
|
+
"inputs": [
|
|
272
|
+
{"name": "resolver", "type": "address", "internalType": "address"},
|
|
273
|
+
{
|
|
274
|
+
"name": "accessToken",
|
|
275
|
+
"type": "address",
|
|
276
|
+
"internalType": "address"
|
|
277
|
+
}
|
|
278
|
+
]
|
|
279
|
+
},
|
|
280
|
+
{"type": "error", "name": "SafeTransferFailed", "inputs": []}
|
|
281
|
+
]
|
|
@@ -10,12 +10,14 @@ 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");
|
|
16
17
|
var _index = require("../../../fusion-order/index.js");
|
|
17
18
|
var _constants = require("../../../fusion-order/constants.js");
|
|
18
19
|
var _index1 = require("../../../fusion-order/fees/index.js");
|
|
20
|
+
var _index2 = require("../../../index.js");
|
|
19
21
|
function _class_call_check(instance, Constructor) {
|
|
20
22
|
if (!(instance instanceof Constructor)) {
|
|
21
23
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -48,6 +50,11 @@ function _define_property(obj, key, value) {
|
|
|
48
50
|
}
|
|
49
51
|
return obj;
|
|
50
52
|
}
|
|
53
|
+
function _interop_require_default(obj) {
|
|
54
|
+
return obj && obj.__esModule ? obj : {
|
|
55
|
+
default: obj
|
|
56
|
+
};
|
|
57
|
+
}
|
|
51
58
|
var Quote = /*#__PURE__*/ function() {
|
|
52
59
|
"use strict";
|
|
53
60
|
function Quote(params, response) {
|
|
@@ -57,6 +64,10 @@ var Quote = /*#__PURE__*/ function() {
|
|
|
57
64
|
* Fusion extension address
|
|
58
65
|
* @see https://github.com/1inch/limit-order-settlement
|
|
59
66
|
*/ _define_property(this, "settlementAddress", void 0);
|
|
67
|
+
/**
|
|
68
|
+
* Native asset extension address
|
|
69
|
+
* @see https://github.com/1inch/limit-order-settlement todo: update link
|
|
70
|
+
*/ _define_property(this, "nativeOrderFactory", void 0);
|
|
60
71
|
_define_property(this, "fromTokenAmount", void 0);
|
|
61
72
|
_define_property(this, "presets", void 0);
|
|
62
73
|
_define_property(this, "recommendedPreset", void 0);
|
|
@@ -85,6 +96,7 @@ var Quote = /*#__PURE__*/ function() {
|
|
|
85
96
|
this.recommendedPreset = response.recommended_preset;
|
|
86
97
|
this.slippage = response.autoK;
|
|
87
98
|
this.settlementAddress = new _limitordersdk.Address(response.settlementAddress);
|
|
99
|
+
this.nativeOrderFactory = response.nativeOrderFactoryAddress && response.nativeOrderImplAddress ? new _index2.ProxyFactory(new _limitordersdk.Address(response.nativeOrderFactoryAddress), new _limitordersdk.Address(response.nativeOrderImplAddress)) : undefined;
|
|
88
100
|
this.resolverFeePreset = {
|
|
89
101
|
receiver: new _limitordersdk.Address(response.fee.receiver),
|
|
90
102
|
whitelistDiscountPercent: _limitordersdk.Bps.fromPercent(response.fee.whitelistDiscountPercent),
|
|
@@ -119,18 +131,20 @@ var Quote = /*#__PURE__*/ function() {
|
|
|
119
131
|
var _params_nonce;
|
|
120
132
|
var nonce = isNonceRequired ? (_params_nonce = params.nonce) !== null && _params_nonce !== void 0 ? _params_nonce : (0, _limitordersdk.randBigInt)(_byteutils.UINT_40_MAX) : params.nonce;
|
|
121
133
|
var takerAsset = this.params.toTokenAddress.isNative() ? _constants.CHAIN_TO_WRAPPER[paramsData.network] : this.params.toTokenAddress;
|
|
122
|
-
|
|
134
|
+
var orderInfo = {
|
|
123
135
|
makerAsset: this.params.fromTokenAddress,
|
|
124
136
|
takerAsset: takerAsset,
|
|
125
137
|
makingAmount: this.fromTokenAmount,
|
|
126
138
|
takingAmount: preset.auctionEndAmount,
|
|
127
139
|
maker: this.params.walletAddress,
|
|
128
140
|
receiver: params.receiver
|
|
129
|
-
}
|
|
141
|
+
};
|
|
142
|
+
var details = {
|
|
130
143
|
auction: auctionDetails,
|
|
131
144
|
whitelist: this.getWhitelist(auctionDetails.startTime, preset.exclusiveResolver),
|
|
132
145
|
surplus: new _index.SurplusParams(this.marketReturn, _limitordersdk.Bps.fromPercent(this.surplusFee || 0))
|
|
133
|
-
}
|
|
146
|
+
};
|
|
147
|
+
var extra = {
|
|
134
148
|
nonce: nonce,
|
|
135
149
|
unwrapWETH: this.params.toTokenAddress.isNative(),
|
|
136
150
|
permit: params.permit,
|
|
@@ -140,7 +154,8 @@ var Quote = /*#__PURE__*/ function() {
|
|
|
140
154
|
source: this.params.source,
|
|
141
155
|
enablePermit2: params.isPermit2,
|
|
142
156
|
fees: buildFees(this.resolverFeePreset, this.params.integratorFee || this.integratorFeeParams, this.surplusFee)
|
|
143
|
-
}
|
|
157
|
+
};
|
|
158
|
+
return this._createOrder(paramsData.network, this.settlementAddress, orderInfo, details, extra);
|
|
144
159
|
}
|
|
145
160
|
},
|
|
146
161
|
{
|
|
@@ -169,6 +184,16 @@ var Quote = /*#__PURE__*/ function() {
|
|
|
169
184
|
};
|
|
170
185
|
}));
|
|
171
186
|
}
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
key: "_createOrder",
|
|
190
|
+
value: function _createOrder(chainId, settlementExtension, orderInfo, details, extra) {
|
|
191
|
+
if (this.params.fromTokenAddress.isNative()) {
|
|
192
|
+
(0, _assert.default)(this.nativeOrderFactory, 'expected nativeOrderFactory to be set for order from native asset');
|
|
193
|
+
return _index.FusionOrder.fromNative(chainId, this.nativeOrderFactory, settlementExtension, orderInfo, details, extra);
|
|
194
|
+
}
|
|
195
|
+
return _index.FusionOrder.new(settlementExtension, orderInfo, details, extra);
|
|
196
|
+
}
|
|
172
197
|
}
|
|
173
198
|
]);
|
|
174
199
|
return Quote;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
_export_star(require("./native-order-factory.js"), exports);
|
|
6
|
+
_export_star(require("./native-order-impl.js"), exports);
|
|
7
|
+
_export_star(require("./proxy-factory.js"), exports);
|
|
8
|
+
function _export_star(from, to) {
|
|
9
|
+
Object.keys(from).forEach(function(k) {
|
|
10
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
11
|
+
Object.defineProperty(to, k, {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function() {
|
|
14
|
+
return from[k];
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
return from;
|
|
20
|
+
}
|