@openocean.finance/openocean-sdk 1.2.6 → 1.2.8
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/lib/index.js +2 -50
- package/package.json +2 -2
- package/lib/api/index.js +0 -139
- package/lib/api/vo/RequestVo.js +0 -398
- package/lib/asset/abi/ERC20_abi.js +0 -119
- package/lib/asset/abi/aggregator.js +0 -391
- package/lib/config/index.js +0 -33
- package/lib/swapSdk/Approve.js +0 -342
- package/lib/swapSdk/NotoMobile.js +0 -141
- package/lib/swapSdk/RequestVo.js +0 -94
- package/lib/swapSdk/Swap.js +0 -1123
- package/lib/swapSdk/getAllowance.js +0 -97
- package/lib/swapSdk/getBalance.js +0 -280
- package/lib/swapSdk/index.js +0 -257
- package/lib/swapSdk/qrcode.d.ts +0 -6
- package/lib/swapSdk/qrcode.js +0 -969
- package/lib/utils/ajx.js +0 -150
- package/lib/utils/index.js +0 -369
- package/lib/utils/web3.js +0 -9
- package/lib/v1/abis/ERC20.js +0 -22
- package/lib/v1/abis/IUniswapV2Pair.js +0 -1434
- package/lib/v1/constants.js +0 -71
- package/lib/v1/entities/currency.js +0 -39
- package/lib/v1/entities/fractions/currencyAmount.js +0 -83
- package/lib/v1/entities/fractions/fraction.js +0 -109
- package/lib/v1/entities/fractions/index.js +0 -21
- package/lib/v1/entities/fractions/percent.js +0 -37
- package/lib/v1/entities/fractions/price.js +0 -90
- package/lib/v1/entities/fractions/tokenAmount.js +0 -43
- package/lib/v1/entities/index.js +0 -22
- package/lib/v1/entities/pair.js +0 -210
- package/lib/v1/entities/route.js +0 -43
- package/lib/v1/entities/token.js +0 -87
- package/lib/v1/entities/trade.js +0 -336
- package/lib/v1/errors.js +0 -56
- package/lib/v1/fetcher.js +0 -140
- package/lib/v1/router.js +0 -97
- package/lib/v1/utils.js +0 -87
|
@@ -1,391 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.aggregator = void 0;
|
|
4
|
-
exports.aggregator = [
|
|
5
|
-
{
|
|
6
|
-
anonymous: false,
|
|
7
|
-
inputs: [
|
|
8
|
-
{
|
|
9
|
-
indexed: false,
|
|
10
|
-
internalType: "address",
|
|
11
|
-
name: "aggregator",
|
|
12
|
-
type: "address",
|
|
13
|
-
},
|
|
14
|
-
],
|
|
15
|
-
name: "AddAggregator",
|
|
16
|
-
type: "event",
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
anonymous: false,
|
|
20
|
-
inputs: [
|
|
21
|
-
{
|
|
22
|
-
indexed: false,
|
|
23
|
-
internalType: "address",
|
|
24
|
-
name: "aggregator",
|
|
25
|
-
type: "address",
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
name: "DelAggregator",
|
|
29
|
-
type: "event",
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
anonymous: false,
|
|
33
|
-
inputs: [
|
|
34
|
-
{
|
|
35
|
-
indexed: false,
|
|
36
|
-
internalType: "uint8",
|
|
37
|
-
name: "version",
|
|
38
|
-
type: "uint8",
|
|
39
|
-
},
|
|
40
|
-
],
|
|
41
|
-
name: "Initialized",
|
|
42
|
-
type: "event",
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
anonymous: false,
|
|
46
|
-
inputs: [
|
|
47
|
-
{
|
|
48
|
-
indexed: true,
|
|
49
|
-
internalType: "address",
|
|
50
|
-
name: "previousOwner",
|
|
51
|
-
type: "address",
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
indexed: true,
|
|
55
|
-
internalType: "address",
|
|
56
|
-
name: "newOwner",
|
|
57
|
-
type: "address",
|
|
58
|
-
},
|
|
59
|
-
],
|
|
60
|
-
name: "OwnershipTransferred",
|
|
61
|
-
type: "event",
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
anonymous: false,
|
|
65
|
-
inputs: [
|
|
66
|
-
{
|
|
67
|
-
indexed: false,
|
|
68
|
-
internalType: "address",
|
|
69
|
-
name: "account",
|
|
70
|
-
type: "address",
|
|
71
|
-
},
|
|
72
|
-
],
|
|
73
|
-
name: "Paused",
|
|
74
|
-
type: "event",
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
anonymous: false,
|
|
78
|
-
inputs: [
|
|
79
|
-
{
|
|
80
|
-
indexed: false,
|
|
81
|
-
internalType: "uint256",
|
|
82
|
-
name: "oldFeeRate",
|
|
83
|
-
type: "uint256",
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
indexed: false,
|
|
87
|
-
internalType: "uint256",
|
|
88
|
-
name: "newFeeRate",
|
|
89
|
-
type: "uint256",
|
|
90
|
-
},
|
|
91
|
-
],
|
|
92
|
-
name: "SetFeeRate",
|
|
93
|
-
type: "event",
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
anonymous: false,
|
|
97
|
-
inputs: [
|
|
98
|
-
{
|
|
99
|
-
indexed: false,
|
|
100
|
-
internalType: "address",
|
|
101
|
-
name: "oldFeeReceiver",
|
|
102
|
-
type: "address",
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
indexed: false,
|
|
106
|
-
internalType: "address",
|
|
107
|
-
name: "newFeeReceiver",
|
|
108
|
-
type: "address",
|
|
109
|
-
},
|
|
110
|
-
],
|
|
111
|
-
name: "SetFeeReceiver",
|
|
112
|
-
type: "event",
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
anonymous: false,
|
|
116
|
-
inputs: [
|
|
117
|
-
{
|
|
118
|
-
indexed: true,
|
|
119
|
-
internalType: "address",
|
|
120
|
-
name: "user",
|
|
121
|
-
type: "address",
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
indexed: true,
|
|
125
|
-
internalType: "address",
|
|
126
|
-
name: "invitee",
|
|
127
|
-
type: "address",
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
indexed: false,
|
|
131
|
-
internalType: "address[]",
|
|
132
|
-
name: "path",
|
|
133
|
-
type: "address[]",
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
indexed: false,
|
|
137
|
-
internalType: "uint256[]",
|
|
138
|
-
name: "amounts",
|
|
139
|
-
type: "uint256[]",
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
indexed: false,
|
|
143
|
-
internalType: "address",
|
|
144
|
-
name: "swapAddr",
|
|
145
|
-
type: "address",
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
indexed: false,
|
|
149
|
-
internalType: "uint256",
|
|
150
|
-
name: "fee",
|
|
151
|
-
type: "uint256",
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
indexed: false,
|
|
155
|
-
internalType: "bytes",
|
|
156
|
-
name: "swapExtraData",
|
|
157
|
-
type: "bytes",
|
|
158
|
-
},
|
|
159
|
-
],
|
|
160
|
-
name: "Swap",
|
|
161
|
-
type: "event",
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
anonymous: false,
|
|
165
|
-
inputs: [
|
|
166
|
-
{
|
|
167
|
-
indexed: false,
|
|
168
|
-
internalType: "address",
|
|
169
|
-
name: "account",
|
|
170
|
-
type: "address",
|
|
171
|
-
},
|
|
172
|
-
],
|
|
173
|
-
name: "Unpaused",
|
|
174
|
-
type: "event",
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
inputs: [
|
|
178
|
-
{
|
|
179
|
-
internalType: "address",
|
|
180
|
-
name: "",
|
|
181
|
-
type: "address",
|
|
182
|
-
},
|
|
183
|
-
],
|
|
184
|
-
name: "_aggregators",
|
|
185
|
-
outputs: [
|
|
186
|
-
{
|
|
187
|
-
internalType: "bool",
|
|
188
|
-
name: "",
|
|
189
|
-
type: "bool",
|
|
190
|
-
},
|
|
191
|
-
],
|
|
192
|
-
stateMutability: "view",
|
|
193
|
-
type: "function",
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
inputs: [],
|
|
197
|
-
name: "_feeRate",
|
|
198
|
-
outputs: [
|
|
199
|
-
{
|
|
200
|
-
internalType: "uint256",
|
|
201
|
-
name: "",
|
|
202
|
-
type: "uint256",
|
|
203
|
-
},
|
|
204
|
-
],
|
|
205
|
-
stateMutability: "view",
|
|
206
|
-
type: "function",
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
inputs: [],
|
|
210
|
-
name: "_feeReceiver",
|
|
211
|
-
outputs: [
|
|
212
|
-
{
|
|
213
|
-
internalType: "address",
|
|
214
|
-
name: "",
|
|
215
|
-
type: "address",
|
|
216
|
-
},
|
|
217
|
-
],
|
|
218
|
-
stateMutability: "view",
|
|
219
|
-
type: "function",
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
inputs: [
|
|
223
|
-
{
|
|
224
|
-
internalType: "address[]",
|
|
225
|
-
name: "aggregators",
|
|
226
|
-
type: "address[]",
|
|
227
|
-
},
|
|
228
|
-
],
|
|
229
|
-
name: "addAggregator",
|
|
230
|
-
outputs: [],
|
|
231
|
-
stateMutability: "nonpayable",
|
|
232
|
-
type: "function",
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
inputs: [
|
|
236
|
-
{
|
|
237
|
-
internalType: "address",
|
|
238
|
-
name: "aggregator",
|
|
239
|
-
type: "address",
|
|
240
|
-
},
|
|
241
|
-
],
|
|
242
|
-
name: "delAggregator",
|
|
243
|
-
outputs: [],
|
|
244
|
-
stateMutability: "nonpayable",
|
|
245
|
-
type: "function",
|
|
246
|
-
},
|
|
247
|
-
{
|
|
248
|
-
inputs: [],
|
|
249
|
-
name: "initialize",
|
|
250
|
-
outputs: [],
|
|
251
|
-
stateMutability: "nonpayable",
|
|
252
|
-
type: "function",
|
|
253
|
-
},
|
|
254
|
-
{
|
|
255
|
-
inputs: [],
|
|
256
|
-
name: "owner",
|
|
257
|
-
outputs: [
|
|
258
|
-
{
|
|
259
|
-
internalType: "address",
|
|
260
|
-
name: "",
|
|
261
|
-
type: "address",
|
|
262
|
-
},
|
|
263
|
-
],
|
|
264
|
-
stateMutability: "view",
|
|
265
|
-
type: "function",
|
|
266
|
-
},
|
|
267
|
-
{
|
|
268
|
-
inputs: [],
|
|
269
|
-
name: "pause",
|
|
270
|
-
outputs: [],
|
|
271
|
-
stateMutability: "nonpayable",
|
|
272
|
-
type: "function",
|
|
273
|
-
},
|
|
274
|
-
{
|
|
275
|
-
inputs: [],
|
|
276
|
-
name: "paused",
|
|
277
|
-
outputs: [
|
|
278
|
-
{
|
|
279
|
-
internalType: "bool",
|
|
280
|
-
name: "",
|
|
281
|
-
type: "bool",
|
|
282
|
-
},
|
|
283
|
-
],
|
|
284
|
-
stateMutability: "view",
|
|
285
|
-
type: "function",
|
|
286
|
-
},
|
|
287
|
-
{
|
|
288
|
-
inputs: [],
|
|
289
|
-
name: "renounceOwnership",
|
|
290
|
-
outputs: [],
|
|
291
|
-
stateMutability: "nonpayable",
|
|
292
|
-
type: "function",
|
|
293
|
-
},
|
|
294
|
-
{
|
|
295
|
-
inputs: [
|
|
296
|
-
{
|
|
297
|
-
internalType: "uint256",
|
|
298
|
-
name: "feeRate",
|
|
299
|
-
type: "uint256",
|
|
300
|
-
},
|
|
301
|
-
],
|
|
302
|
-
name: "setFeeRate",
|
|
303
|
-
outputs: [],
|
|
304
|
-
stateMutability: "nonpayable",
|
|
305
|
-
type: "function",
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
inputs: [
|
|
309
|
-
{
|
|
310
|
-
internalType: "address",
|
|
311
|
-
name: "feeReceiver",
|
|
312
|
-
type: "address",
|
|
313
|
-
},
|
|
314
|
-
],
|
|
315
|
-
name: "setFeeReceiver",
|
|
316
|
-
outputs: [],
|
|
317
|
-
stateMutability: "nonpayable",
|
|
318
|
-
type: "function",
|
|
319
|
-
},
|
|
320
|
-
{
|
|
321
|
-
inputs: [
|
|
322
|
-
{
|
|
323
|
-
internalType: "address",
|
|
324
|
-
name: "invitee",
|
|
325
|
-
type: "address",
|
|
326
|
-
},
|
|
327
|
-
{
|
|
328
|
-
internalType: "address[]",
|
|
329
|
-
name: "path",
|
|
330
|
-
type: "address[]",
|
|
331
|
-
},
|
|
332
|
-
{
|
|
333
|
-
internalType: "uint256[]",
|
|
334
|
-
name: "amounts",
|
|
335
|
-
type: "uint256[]",
|
|
336
|
-
},
|
|
337
|
-
{
|
|
338
|
-
internalType: "address",
|
|
339
|
-
name: "swapAddr",
|
|
340
|
-
type: "address",
|
|
341
|
-
},
|
|
342
|
-
{
|
|
343
|
-
internalType: "bytes",
|
|
344
|
-
name: "swapExtraData",
|
|
345
|
-
type: "bytes",
|
|
346
|
-
},
|
|
347
|
-
],
|
|
348
|
-
name: "swap",
|
|
349
|
-
outputs: [],
|
|
350
|
-
stateMutability: "payable",
|
|
351
|
-
type: "function",
|
|
352
|
-
},
|
|
353
|
-
{
|
|
354
|
-
inputs: [
|
|
355
|
-
{
|
|
356
|
-
internalType: "address",
|
|
357
|
-
name: "newOwner",
|
|
358
|
-
type: "address",
|
|
359
|
-
},
|
|
360
|
-
],
|
|
361
|
-
name: "transferOwnership",
|
|
362
|
-
outputs: [],
|
|
363
|
-
stateMutability: "nonpayable",
|
|
364
|
-
type: "function",
|
|
365
|
-
},
|
|
366
|
-
{
|
|
367
|
-
inputs: [],
|
|
368
|
-
name: "unpause",
|
|
369
|
-
outputs: [],
|
|
370
|
-
stateMutability: "nonpayable",
|
|
371
|
-
type: "function",
|
|
372
|
-
},
|
|
373
|
-
{
|
|
374
|
-
inputs: [
|
|
375
|
-
{
|
|
376
|
-
internalType: "address",
|
|
377
|
-
name: "token",
|
|
378
|
-
type: "address",
|
|
379
|
-
},
|
|
380
|
-
{
|
|
381
|
-
internalType: "uint256",
|
|
382
|
-
name: "amount",
|
|
383
|
-
type: "uint256",
|
|
384
|
-
},
|
|
385
|
-
],
|
|
386
|
-
name: "withdraw",
|
|
387
|
-
outputs: [],
|
|
388
|
-
stateMutability: "nonpayable",
|
|
389
|
-
type: "function",
|
|
390
|
-
},
|
|
391
|
-
];
|
package/lib/config/index.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getProxyContract = exports.config = exports.ERC20_abi = void 0;
|
|
4
|
-
// import { wallets, Wallets } from "./Wallets";
|
|
5
|
-
// import { chains, Chains } from "./Chains";
|
|
6
|
-
var wallet_1 = require("@openocean.finance/wallet");
|
|
7
|
-
exports.ERC20_abi = [{ "constant": true, "inputs": [], "name": "name", "outputs": [{ "name": "", "type": "string" }], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [{ "name": "_spender", "type": "address" }, { "name": "_value", "type": "uint256" }], "name": "approve", "outputs": [{ "name": "", "type": "bool" }], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], "name": "totalSupply", "outputs": [{ "name": "", "type": "uint256" }], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [{ "name": "_from", "type": "address" }, { "name": "_to", "type": "address" }, { "name": "_value", "type": "uint256" }], "name": "transferFrom", "outputs": [{ "name": "", "type": "bool" }], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], "name": "decimals", "outputs": [{ "name": "", "type": "uint8" }], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [{ "name": "_owner", "type": "address" }], "name": "balanceOf", "outputs": [{ "name": "balance", "type": "uint256" }], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "symbol", "outputs": [{ "name": "", "type": "string" }], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [{ "name": "_to", "type": "address" }, { "name": "_value", "type": "uint256" }], "name": "transfer", "outputs": [{ "name": "", "type": "bool" }], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [{ "name": "_owner", "type": "address" }, { "name": "_spender", "type": "address" }], "name": "allowance", "outputs": [{ "name": "", "type": "uint256" }], "payable": false, "stateMutability": "view", "type": "function" }, { "payable": true, "stateMutability": "payable", "type": "fallback" }, { "anonymous": false, "inputs": [{ "indexed": true, "name": "owner", "type": "address" }, { "indexed": true, "name": "spender", "type": "address" }, { "indexed": false, "name": "value", "type": "uint256" }], "name": "Approval", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "name": "from", "type": "address" }, { "indexed": true, "name": "to", "type": "address" }, { "indexed": false, "name": "value", "type": "uint256" }], "name": "Transfer", "type": "event" }];
|
|
8
|
-
exports.config = {
|
|
9
|
-
chains: wallet_1.chainsObj,
|
|
10
|
-
wallets: wallet_1.walletsObj,
|
|
11
|
-
ERC20_abi: exports.ERC20_abi
|
|
12
|
-
};
|
|
13
|
-
function getProxyContract(chainName) {
|
|
14
|
-
return {
|
|
15
|
-
eth: '0x38B7C17E62dcBD1C39f96eFe74848C4A037b3ed3',
|
|
16
|
-
bsc: "0x7aeef1035ba6794c0478718a2330671ec8802af1",
|
|
17
|
-
fantom: "0x38B7C17E62dcBD1C39f96eFe74848C4A037b3ed3",
|
|
18
|
-
avax: "0x38B7C17E62dcBD1C39f96eFe74848C4A037b3ed3",
|
|
19
|
-
polygon: "0x38B7C17E62dcBD1C39f96eFe74848C4A037b3ed3",
|
|
20
|
-
okex: "0x6D5630eC1Ee74C907617a6fb7BCAdC4Bf0EF3fcA",
|
|
21
|
-
optimism: "0x7AeEF1035Ba6794C0478718a2330671Ec8802aF1",
|
|
22
|
-
harmony: "0x7AeEF1035Ba6794C0478718a2330671Ec8802aF1",
|
|
23
|
-
cronos: "0x7AeEF1035Ba6794C0478718a2330671Ec8802aF1",
|
|
24
|
-
moonriver: "0x7AeEF1035Ba6794C0478718a2330671Ec8802aF1",
|
|
25
|
-
arbitrum: "0x7AeEF1035Ba6794C0478718a2330671Ec8802aF1",
|
|
26
|
-
heco: "0x7AeEF1035Ba6794C0478718a2330671Ec8802aF1",
|
|
27
|
-
boba: "0x7AeEF1035Ba6794C0478718a2330671Ec8802aF1",
|
|
28
|
-
xdai: "0x7AeEF1035Ba6794C0478718a2330671Ec8802aF1",
|
|
29
|
-
tron: "TTpcMZbsojNCMhea2a9LFHq9DLCxsgGZVv",
|
|
30
|
-
}[chainName];
|
|
31
|
-
}
|
|
32
|
-
exports.getProxyContract = getProxyContract;
|
|
33
|
-
;
|