@rabby-wallet/rabby-api 0.9.4 → 0.9.5-1.beta.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/index.d.ts +459 -10
- package/dist/index.js +499 -22
- package/dist/types.d.ts +1215 -11
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -58,6 +58,19 @@ export class OpenApiService {
|
|
|
58
58
|
this.store.host = host;
|
|
59
59
|
this.initSync();
|
|
60
60
|
};
|
|
61
|
+
this.setAPIKey = (apiKey) => __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
this.store.apiKey = apiKey;
|
|
63
|
+
yield this.init();
|
|
64
|
+
});
|
|
65
|
+
this.setAPITime = (apiTime) => __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
this.store.apiTime = apiTime;
|
|
67
|
+
yield this.init();
|
|
68
|
+
});
|
|
69
|
+
this.removeAPIKey = () => __awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
this.store.apiKey = null;
|
|
71
|
+
this.store.apiTime = null;
|
|
72
|
+
yield this.init();
|
|
73
|
+
});
|
|
61
74
|
this.getHost = () => {
|
|
62
75
|
return this.store.host;
|
|
63
76
|
};
|
|
@@ -123,6 +136,25 @@ export class OpenApiService {
|
|
|
123
136
|
});
|
|
124
137
|
return data;
|
|
125
138
|
});
|
|
139
|
+
this.getTotalBalanceV2 = ({ address, isCore = false, included_token_uuids = [], excluded_token_uuids = [], excluded_protocol_ids = [], excluded_chain_ids = [], }) => __awaiter(this, void 0, void 0, function* () {
|
|
140
|
+
const { data } = yield this.request.post('/v2/user/total_balance', {
|
|
141
|
+
id: address,
|
|
142
|
+
is_core: isCore,
|
|
143
|
+
included_token_uuids: included_token_uuids,
|
|
144
|
+
excluded_token_uuids: excluded_token_uuids,
|
|
145
|
+
excluded_protocol_ids: excluded_protocol_ids,
|
|
146
|
+
excluded_chain_ids: excluded_chain_ids,
|
|
147
|
+
});
|
|
148
|
+
return data;
|
|
149
|
+
});
|
|
150
|
+
this.get24hTotalBalance = (address) => __awaiter(this, void 0, void 0, function* () {
|
|
151
|
+
const { data } = yield this.request.get('/v1/user/total_balance_24h', {
|
|
152
|
+
params: {
|
|
153
|
+
id: address,
|
|
154
|
+
},
|
|
155
|
+
});
|
|
156
|
+
return data;
|
|
157
|
+
});
|
|
126
158
|
this.getPendingCount = (address) => __awaiter(this, void 0, void 0, function* () {
|
|
127
159
|
const { data } = yield this.request.get('/v1/wallet/pending_tx_count', {
|
|
128
160
|
params: {
|
|
@@ -155,13 +187,14 @@ export class OpenApiService {
|
|
|
155
187
|
});
|
|
156
188
|
return data;
|
|
157
189
|
});
|
|
158
|
-
this.preExecTx = ({ tx, origin, address, updateNonce = false, pending_tx_list = [], }) => __awaiter(this, void 0, void 0, function* () {
|
|
190
|
+
this.preExecTx = ({ tx, origin, address, updateNonce = false, pending_tx_list = [], delegate_call, }) => __awaiter(this, void 0, void 0, function* () {
|
|
159
191
|
const { data } = yield this.request.post('/v1/wallet/pre_exec_tx', {
|
|
160
192
|
tx,
|
|
161
193
|
user_addr: address,
|
|
162
194
|
origin,
|
|
163
195
|
update_nonce: updateNonce,
|
|
164
196
|
pending_tx_list,
|
|
197
|
+
delegate_call,
|
|
165
198
|
});
|
|
166
199
|
return data;
|
|
167
200
|
});
|
|
@@ -287,6 +320,15 @@ export class OpenApiService {
|
|
|
287
320
|
});
|
|
288
321
|
return data;
|
|
289
322
|
});
|
|
323
|
+
this.getTokenEntity = (id, chainId) => __awaiter(this, void 0, void 0, function* () {
|
|
324
|
+
const { data } = yield this.request.get('/v1/token/identity', {
|
|
325
|
+
params: {
|
|
326
|
+
id,
|
|
327
|
+
chain_id: chainId,
|
|
328
|
+
},
|
|
329
|
+
});
|
|
330
|
+
return data;
|
|
331
|
+
});
|
|
290
332
|
this.getHistoryTokenList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
291
333
|
const { data } = yield this.request.get('/v1/user/history_token_list', {
|
|
292
334
|
params: {
|
|
@@ -316,12 +358,16 @@ export class OpenApiService {
|
|
|
316
358
|
});
|
|
317
359
|
return data;
|
|
318
360
|
});
|
|
319
|
-
this.listNFT = (id, isAll = true) => __awaiter(this, void 0, void 0, function* () {
|
|
361
|
+
this.listNFT = (id, isAll = true, sortByCredit) => __awaiter(this, void 0, void 0, function* () {
|
|
320
362
|
const { data } = yield this.request.get('/v1/user/nft_list', {
|
|
321
|
-
params: {
|
|
363
|
+
params: Object.assign({
|
|
322
364
|
id,
|
|
323
365
|
is_all: isAll,
|
|
324
|
-
},
|
|
366
|
+
}, sortByCredit
|
|
367
|
+
? {
|
|
368
|
+
sort_by: 'credit_score',
|
|
369
|
+
}
|
|
370
|
+
: {}),
|
|
325
371
|
});
|
|
326
372
|
return data;
|
|
327
373
|
});
|
|
@@ -331,6 +377,15 @@ export class OpenApiService {
|
|
|
331
377
|
});
|
|
332
378
|
return data;
|
|
333
379
|
});
|
|
380
|
+
this.hasNewTxFrom = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
381
|
+
const { data } = yield this.request.get('/v1/user/has_new_tx', {
|
|
382
|
+
params: {
|
|
383
|
+
id: params.address,
|
|
384
|
+
start_time: params.startTime,
|
|
385
|
+
},
|
|
386
|
+
});
|
|
387
|
+
return data;
|
|
388
|
+
});
|
|
334
389
|
this.listTxHisotry = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
335
390
|
const { data } = yield this.request.get('/v1/user/history_list', {
|
|
336
391
|
params,
|
|
@@ -379,16 +434,20 @@ export class OpenApiService {
|
|
|
379
434
|
this.getSwapQuote = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
380
435
|
const { data } = yield this.request.get('/v1/wallet/swap_quote', {
|
|
381
436
|
params,
|
|
437
|
+
timeout: 5000,
|
|
382
438
|
});
|
|
383
439
|
return data;
|
|
384
440
|
});
|
|
385
441
|
this.getSwapTokenList = (id, chainId) => __awaiter(this, void 0, void 0, function* () {
|
|
442
|
+
const params = {
|
|
443
|
+
id,
|
|
444
|
+
is_all: false,
|
|
445
|
+
};
|
|
446
|
+
if (chainId) {
|
|
447
|
+
params.chain_id = chainId;
|
|
448
|
+
}
|
|
386
449
|
const { data } = yield this.request.get('/v1/wallet/swap_token_list', {
|
|
387
|
-
params
|
|
388
|
-
id,
|
|
389
|
-
chain_id: chainId,
|
|
390
|
-
is_all: false,
|
|
391
|
-
},
|
|
450
|
+
params,
|
|
392
451
|
});
|
|
393
452
|
return data;
|
|
394
453
|
});
|
|
@@ -554,6 +613,12 @@ export class OpenApiService {
|
|
|
554
613
|
});
|
|
555
614
|
return data;
|
|
556
615
|
});
|
|
616
|
+
this.getSwapTradeListV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
617
|
+
const { data } = yield this.request.get('/v2/wallet/swap_trade_list', {
|
|
618
|
+
params,
|
|
619
|
+
});
|
|
620
|
+
return data;
|
|
621
|
+
});
|
|
557
622
|
this.postSwap = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
558
623
|
const { data } = yield this.request.post('/v1/wallet/swap_trade', params);
|
|
559
624
|
return data;
|
|
@@ -564,6 +629,12 @@ export class OpenApiService {
|
|
|
564
629
|
});
|
|
565
630
|
return data;
|
|
566
631
|
});
|
|
632
|
+
this.suggestSlippage = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
633
|
+
const { data } = yield this.request.get('v1/wallet/suggest_slippage', {
|
|
634
|
+
params,
|
|
635
|
+
});
|
|
636
|
+
return data;
|
|
637
|
+
});
|
|
567
638
|
this.getOriginPopularityLevel = (origin) => __awaiter(this, void 0, void 0, function* () {
|
|
568
639
|
const { data } = yield this.request.get('/v1/engine/origin/popularity_level', {
|
|
569
640
|
params: {
|
|
@@ -727,6 +798,18 @@ export class OpenApiService {
|
|
|
727
798
|
from_addr: from,
|
|
728
799
|
to_addr: to,
|
|
729
800
|
},
|
|
801
|
+
timeout: 2000,
|
|
802
|
+
});
|
|
803
|
+
return data;
|
|
804
|
+
});
|
|
805
|
+
// 全链两个地址是否发生过转账
|
|
806
|
+
this.hasTransferAllChain = (from, to) => __awaiter(this, void 0, void 0, function* () {
|
|
807
|
+
const { data } = yield this.request.get('/v2/engine/addr/has_transfer', {
|
|
808
|
+
params: {
|
|
809
|
+
from_addr: from,
|
|
810
|
+
to_addr: to,
|
|
811
|
+
},
|
|
812
|
+
timeout: 2000,
|
|
730
813
|
});
|
|
731
814
|
return data;
|
|
732
815
|
});
|
|
@@ -877,7 +960,21 @@ export class OpenApiService {
|
|
|
877
960
|
return data;
|
|
878
961
|
});
|
|
879
962
|
this.submitTx = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
880
|
-
const {
|
|
963
|
+
const { sig } = postData, rest = __rest(postData, ["sig"]);
|
|
964
|
+
const { data } = yield this.request.post('/v1/wallet/submit_tx', Object.assign({}, rest), {
|
|
965
|
+
headers: sig ? { sig } : undefined,
|
|
966
|
+
});
|
|
967
|
+
return data;
|
|
968
|
+
});
|
|
969
|
+
this.submitTxV2 = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
970
|
+
const { sig } = postData, rest = __rest(postData, ["sig"]);
|
|
971
|
+
const { data } = yield this.request.post('/v2/wallet/submit_tx', Object.assign({}, rest), {
|
|
972
|
+
headers: sig ? { sig } : undefined,
|
|
973
|
+
});
|
|
974
|
+
return data;
|
|
975
|
+
});
|
|
976
|
+
this.getDefaultRPCs = () => __awaiter(this, void 0, void 0, function* () {
|
|
977
|
+
const { data } = yield this.request.get('/v1/chainrpc');
|
|
881
978
|
return data;
|
|
882
979
|
});
|
|
883
980
|
this.getTxRequests = (ids) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1187,10 +1284,45 @@ export class OpenApiService {
|
|
|
1187
1284
|
});
|
|
1188
1285
|
return data;
|
|
1189
1286
|
});
|
|
1287
|
+
this.buildBridgeTx = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1288
|
+
const { data } = yield this.request.get('/v2/bridge/build_tx', {
|
|
1289
|
+
params,
|
|
1290
|
+
});
|
|
1291
|
+
return data;
|
|
1292
|
+
});
|
|
1190
1293
|
this.postBridgeHistory = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1191
1294
|
const { data } = yield this.request.post('/v1/bridge/history', params);
|
|
1192
1295
|
return data;
|
|
1193
1296
|
});
|
|
1297
|
+
/**
|
|
1298
|
+
* no id just no check address
|
|
1299
|
+
*/
|
|
1300
|
+
this.getPerpPermission = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1301
|
+
const { data } = yield this.request.get('/v1/user/has_hyperliquid_permission', {
|
|
1302
|
+
params,
|
|
1303
|
+
});
|
|
1304
|
+
return data;
|
|
1305
|
+
});
|
|
1306
|
+
this.getPerpTopTokenList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1307
|
+
const { data } = yield this.request.get('/v1/token/hyperliquid_top');
|
|
1308
|
+
return data;
|
|
1309
|
+
});
|
|
1310
|
+
this.getPerpsBridgeIsSupportToken = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1311
|
+
const { data } = yield this.request.get('/v2/bridge/hyperliquid/support_token', {
|
|
1312
|
+
params,
|
|
1313
|
+
});
|
|
1314
|
+
return data;
|
|
1315
|
+
});
|
|
1316
|
+
this.getPerpBridgeQuote = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1317
|
+
const { data } = yield this.request.get('/v2/bridge/hyperliquid/quote', {
|
|
1318
|
+
params,
|
|
1319
|
+
});
|
|
1320
|
+
return data;
|
|
1321
|
+
});
|
|
1322
|
+
this.postPerpBridgeHistory = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1323
|
+
const { data } = yield this.request.post('/v2/bridge/hyperliquid', params);
|
|
1324
|
+
return data;
|
|
1325
|
+
});
|
|
1194
1326
|
this.getSupportedDEXList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1195
1327
|
const { data } = yield this.request.get('/v1/wallet/supported_dex_list');
|
|
1196
1328
|
return data;
|
|
@@ -1223,6 +1355,39 @@ export class OpenApiService {
|
|
|
1223
1355
|
});
|
|
1224
1356
|
return data;
|
|
1225
1357
|
});
|
|
1358
|
+
this.getGasAccountInfoV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1359
|
+
const { data } = yield this.request.get('/v2/gas_account', {
|
|
1360
|
+
params,
|
|
1361
|
+
});
|
|
1362
|
+
return data;
|
|
1363
|
+
});
|
|
1364
|
+
this.createGasAccountPayInfo = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
1365
|
+
const { data } = yield this.request.post('/v2/gas_account/pay_info', postData);
|
|
1366
|
+
return data;
|
|
1367
|
+
});
|
|
1368
|
+
this.checkGasAccountGiftEligibility = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1369
|
+
const { data } = yield this.request.get('/v1/gas_account/check_eligibility', {
|
|
1370
|
+
params,
|
|
1371
|
+
});
|
|
1372
|
+
return data;
|
|
1373
|
+
});
|
|
1374
|
+
this.checkGasAccountGiftEligibilityBatch = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1375
|
+
const { data } = yield this.request.post('/v1/gas_account/check_eligibility/batch', params);
|
|
1376
|
+
return data;
|
|
1377
|
+
});
|
|
1378
|
+
this.confirmIapOrder = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
1379
|
+
const { data } = yield this.request.post('/v1/gas_account/confirm_iap_order', postData);
|
|
1380
|
+
return data;
|
|
1381
|
+
});
|
|
1382
|
+
this.claimGasAccountGift = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1383
|
+
const { sig } = params, others = __rest(params, ["sig"]);
|
|
1384
|
+
const { data } = yield this.request.post('/v1/gas_account/claim', Object.assign({}, others), {
|
|
1385
|
+
headers: {
|
|
1386
|
+
sig,
|
|
1387
|
+
},
|
|
1388
|
+
});
|
|
1389
|
+
return data;
|
|
1390
|
+
});
|
|
1226
1391
|
this.loginGasAccount = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1227
1392
|
const { sig } = params, others = __rest(params, ["sig"]);
|
|
1228
1393
|
const { data } = yield this.request.post('/v1/gas_account/login', Object.assign({}, others), {
|
|
@@ -1267,6 +1432,16 @@ export class OpenApiService {
|
|
|
1267
1432
|
});
|
|
1268
1433
|
return data;
|
|
1269
1434
|
});
|
|
1435
|
+
this.getWithdrawList = (p) => __awaiter(this, void 0, void 0, function* () {
|
|
1436
|
+
const { sig } = p, params = __rest(p, ["sig"]);
|
|
1437
|
+
const { data } = yield this.request.get('/v1/gas_account/withdraw_list', {
|
|
1438
|
+
params,
|
|
1439
|
+
headers: {
|
|
1440
|
+
sig,
|
|
1441
|
+
},
|
|
1442
|
+
});
|
|
1443
|
+
return data;
|
|
1444
|
+
});
|
|
1270
1445
|
this.getGasAccountHistory = (p) => __awaiter(this, void 0, void 0, function* () {
|
|
1271
1446
|
const { sig } = p, params = __rest(p, ["sig"]);
|
|
1272
1447
|
const { data } = yield this.request.get('/v1/gas_account/history', {
|
|
@@ -1280,9 +1455,11 @@ export class OpenApiService {
|
|
|
1280
1455
|
this.checkGasAccountTxs = (p) => __awaiter(this, void 0, void 0, function* () {
|
|
1281
1456
|
const { sig } = p, params = __rest(p, ["sig"]);
|
|
1282
1457
|
const { data } = yield this.request.post('/v1/gas_account/check_txs', params, {
|
|
1283
|
-
headers:
|
|
1284
|
-
|
|
1285
|
-
|
|
1458
|
+
headers: sig
|
|
1459
|
+
? {
|
|
1460
|
+
sig,
|
|
1461
|
+
}
|
|
1462
|
+
: undefined,
|
|
1286
1463
|
});
|
|
1287
1464
|
return data;
|
|
1288
1465
|
});
|
|
@@ -1338,24 +1515,315 @@ export class OpenApiService {
|
|
|
1338
1515
|
const { data } = yield this.request.get('/v2/bridge/supported_chains');
|
|
1339
1516
|
return data;
|
|
1340
1517
|
});
|
|
1518
|
+
this.submitFeedback = ({ text, usage, }) => __awaiter(this, void 0, void 0, function* () {
|
|
1519
|
+
const { data } = yield this.request.post('v1/feedback', Object.assign({ text }, (usage && { usage })));
|
|
1520
|
+
return data;
|
|
1521
|
+
});
|
|
1341
1522
|
this.uninstalledFeedback = ({ text, }) => __awaiter(this, void 0, void 0, function* () {
|
|
1342
|
-
|
|
1523
|
+
return this.submitFeedback({
|
|
1343
1524
|
text,
|
|
1344
1525
|
});
|
|
1345
|
-
return data;
|
|
1346
1526
|
});
|
|
1527
|
+
/**
|
|
1528
|
+
* @deprecated
|
|
1529
|
+
*/
|
|
1347
1530
|
this.getToken24hPrice = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1348
1531
|
const { data } = yield this.request.get('/v1/token/24h_price', {
|
|
1349
1532
|
params,
|
|
1350
1533
|
});
|
|
1351
1534
|
return data;
|
|
1352
1535
|
});
|
|
1536
|
+
this.getTokenPriceCurve = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1537
|
+
const { data } = yield this.request.get('/v1/token/price_curve', {
|
|
1538
|
+
params,
|
|
1539
|
+
});
|
|
1540
|
+
return data;
|
|
1541
|
+
});
|
|
1353
1542
|
this.getTokenDatePrice = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1354
1543
|
const { data } = yield this.request.get('/v1/token/date_price', {
|
|
1355
1544
|
params,
|
|
1356
1545
|
});
|
|
1357
1546
|
return data;
|
|
1358
1547
|
});
|
|
1548
|
+
this.searchTokens = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1549
|
+
const { data } = yield this.request.get('/v1/token/search', {
|
|
1550
|
+
params,
|
|
1551
|
+
});
|
|
1552
|
+
return data;
|
|
1553
|
+
});
|
|
1554
|
+
this.searchTokensV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1555
|
+
const { data } = yield this.request.get('/v2/token/search', {
|
|
1556
|
+
params,
|
|
1557
|
+
});
|
|
1558
|
+
return data;
|
|
1559
|
+
});
|
|
1560
|
+
// resp arr of chain_id
|
|
1561
|
+
this.getCopyTradingChainList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1562
|
+
const { data } = yield this.request.get('/v1/copytrading/chain_list');
|
|
1563
|
+
return data;
|
|
1564
|
+
});
|
|
1565
|
+
this.getCopyTradingTokenList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1566
|
+
const { data } = yield this.request.get('/v1/copytrading/token/list', {
|
|
1567
|
+
params,
|
|
1568
|
+
});
|
|
1569
|
+
return data;
|
|
1570
|
+
});
|
|
1571
|
+
this.getCopyTradingTokenListV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1572
|
+
const { data } = yield this.request.get('/v2/copytrading/token/list', {
|
|
1573
|
+
params,
|
|
1574
|
+
});
|
|
1575
|
+
return data;
|
|
1576
|
+
});
|
|
1577
|
+
this.getCopyTradingRecentBuyList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1578
|
+
const { data } = yield this.request.get('/v1/copytrading/recent_buy/list', {
|
|
1579
|
+
params,
|
|
1580
|
+
});
|
|
1581
|
+
return data;
|
|
1582
|
+
});
|
|
1583
|
+
this.getCopyTradingRecentBuyListV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1584
|
+
const { data } = yield this.request.get('/v2/copytrading/recent_buy/list', {
|
|
1585
|
+
params,
|
|
1586
|
+
});
|
|
1587
|
+
return data;
|
|
1588
|
+
});
|
|
1589
|
+
this.getCopyTradingDetail = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1590
|
+
const { data } = yield this.request.get('/v2/copytrading/token/detail', {
|
|
1591
|
+
params,
|
|
1592
|
+
});
|
|
1593
|
+
return data;
|
|
1594
|
+
});
|
|
1595
|
+
this.getCopyTradingSameName = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1596
|
+
const { data } = yield this.request.get('/v1/token/same_name', {
|
|
1597
|
+
params,
|
|
1598
|
+
});
|
|
1599
|
+
return data;
|
|
1600
|
+
});
|
|
1601
|
+
this.getCopyTradingPnlList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1602
|
+
const { data } = yield this.request.get('/v1/copytrading/smart_money/pnl/list', {
|
|
1603
|
+
params,
|
|
1604
|
+
});
|
|
1605
|
+
return data;
|
|
1606
|
+
});
|
|
1607
|
+
this.batchQueryTokens = (uuids) => __awaiter(this, void 0, void 0, function* () {
|
|
1608
|
+
const { data } = yield this.request.get('/v1/token/list_by_uuids', {
|
|
1609
|
+
params: {
|
|
1610
|
+
uuids: Array.isArray(uuids) ? uuids.join(',') : uuids,
|
|
1611
|
+
},
|
|
1612
|
+
});
|
|
1613
|
+
return data;
|
|
1614
|
+
});
|
|
1615
|
+
this.getBuySupportedCountryList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1616
|
+
const { data } = yield this.request.get('/v1/buy/supported_country_list');
|
|
1617
|
+
return data;
|
|
1618
|
+
});
|
|
1619
|
+
this.getBuySupportedTokenList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1620
|
+
const { data } = yield this.request.get('/v1/buy/supported_token_list');
|
|
1621
|
+
return data;
|
|
1622
|
+
});
|
|
1623
|
+
this.getBuyQuote = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1624
|
+
const { data } = yield this.request.get('/v1/buy/quote', {
|
|
1625
|
+
params,
|
|
1626
|
+
});
|
|
1627
|
+
return data;
|
|
1628
|
+
});
|
|
1629
|
+
this.getBuyWidgetUrl = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1630
|
+
const { data } = yield this.request.get('/v1/buy/get_widget_url', { params });
|
|
1631
|
+
return data;
|
|
1632
|
+
});
|
|
1633
|
+
this.getBuyHistory = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1634
|
+
const { data } = yield this.request.get('/v1/buy/history', {
|
|
1635
|
+
params: Object.assign(Object.assign({}, params), { start: params.start || 0, limit: params.limit || 20 }),
|
|
1636
|
+
});
|
|
1637
|
+
return data;
|
|
1638
|
+
});
|
|
1639
|
+
this.getBuyPaymentMethods = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1640
|
+
const { data } = yield this.request.get('/v1/buy/get_payment_method', {
|
|
1641
|
+
params,
|
|
1642
|
+
});
|
|
1643
|
+
return data;
|
|
1644
|
+
});
|
|
1645
|
+
this.getBuyCurrencyList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1646
|
+
const { data } = yield this.request.get('/v1/buy/supported_currency_list');
|
|
1647
|
+
return data;
|
|
1648
|
+
});
|
|
1649
|
+
this.getOfflineChainList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1650
|
+
const { data } = yield this.request.get('/v1/chain/offline_list');
|
|
1651
|
+
return data;
|
|
1652
|
+
});
|
|
1653
|
+
this.isBlockedAddress = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
1654
|
+
const { data } = yield this.request.get('/v1/engine/addr/is_blocked', {
|
|
1655
|
+
params: { id },
|
|
1656
|
+
});
|
|
1657
|
+
return data;
|
|
1658
|
+
});
|
|
1659
|
+
this.estimateGasUsd = ({ tx, origin, address, updateNonce = false, pending_tx_list = [], }) => __awaiter(this, void 0, void 0, function* () {
|
|
1660
|
+
const { data } = yield this.request.post('/v1/wallet/estimate_gas', {
|
|
1661
|
+
tx,
|
|
1662
|
+
user_addr: address,
|
|
1663
|
+
origin,
|
|
1664
|
+
update_nonce: updateNonce,
|
|
1665
|
+
pending_tx_list,
|
|
1666
|
+
});
|
|
1667
|
+
return data;
|
|
1668
|
+
});
|
|
1669
|
+
this.getCexSupportList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1670
|
+
const { data } = yield this.request.get('/v1/cex/supported_list');
|
|
1671
|
+
return data;
|
|
1672
|
+
});
|
|
1673
|
+
this.getAppChainList = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
1674
|
+
const { data } = yield this.request.get('/v1/user/complex_app_list', {
|
|
1675
|
+
params: { id },
|
|
1676
|
+
});
|
|
1677
|
+
return data;
|
|
1678
|
+
});
|
|
1679
|
+
this.checkCex = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
1680
|
+
const { data } = yield this.request.post('/v1/token/check_cex', postData);
|
|
1681
|
+
return data;
|
|
1682
|
+
});
|
|
1683
|
+
// top 20 tokens
|
|
1684
|
+
this.getHotTokenList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1685
|
+
const { data } = yield this.request.get('/v1/token/hot_list');
|
|
1686
|
+
return data;
|
|
1687
|
+
});
|
|
1688
|
+
// uuid: 'chain:token_id'
|
|
1689
|
+
this.getTokensDetailByUuids = (uuids) => __awaiter(this, void 0, void 0, function* () {
|
|
1690
|
+
const { data } = yield this.request.get('/v1/token/list_by_uuids', {
|
|
1691
|
+
params: {
|
|
1692
|
+
uuids: uuids.join(','),
|
|
1693
|
+
},
|
|
1694
|
+
});
|
|
1695
|
+
return data;
|
|
1696
|
+
});
|
|
1697
|
+
this.getTokenKlineData = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1698
|
+
const { data } = yield this.request.get('/v1/token/market/kline', {
|
|
1699
|
+
params,
|
|
1700
|
+
});
|
|
1701
|
+
return data;
|
|
1702
|
+
});
|
|
1703
|
+
this.getTokenMarketInfo = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1704
|
+
const { data } = yield this.request.get('/v1/token/market/info', {
|
|
1705
|
+
params,
|
|
1706
|
+
});
|
|
1707
|
+
return data;
|
|
1708
|
+
});
|
|
1709
|
+
this.getTokenHolderInfo = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1710
|
+
const { data } = yield this.request.get('/v1/token/market/info/holders', {
|
|
1711
|
+
params,
|
|
1712
|
+
});
|
|
1713
|
+
return data;
|
|
1714
|
+
});
|
|
1715
|
+
this.getTokenSupplyInfo = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1716
|
+
const { data } = yield this.request.get('/v1/token/market/info/supply', {
|
|
1717
|
+
params,
|
|
1718
|
+
});
|
|
1719
|
+
return data;
|
|
1720
|
+
});
|
|
1721
|
+
this.postUserFeedback = (data) => __awaiter(this, void 0, void 0, function* () {
|
|
1722
|
+
const { data: response } = yield this.request.post('/v1/feedback/app', data);
|
|
1723
|
+
return response;
|
|
1724
|
+
});
|
|
1725
|
+
this.getUserFeedback = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
1726
|
+
const { data } = yield this.request.get('/v1/feedback/app', {
|
|
1727
|
+
params: { id },
|
|
1728
|
+
});
|
|
1729
|
+
return data;
|
|
1730
|
+
});
|
|
1731
|
+
this.getUserFeedbackList = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
1732
|
+
const ids = Array.isArray(id) ? id : [id];
|
|
1733
|
+
const { data } = yield this.request.post('/v1/feedback/app/list', {
|
|
1734
|
+
ids,
|
|
1735
|
+
});
|
|
1736
|
+
return data;
|
|
1737
|
+
});
|
|
1738
|
+
this.getCurrencyList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1739
|
+
const { data } = yield this.request.get('/v1/currency/exchange_list');
|
|
1740
|
+
return data;
|
|
1741
|
+
});
|
|
1742
|
+
this.getMarketSummary = ({ token_id, chain_id, }) => __awaiter(this, void 0, void 0, function* () {
|
|
1743
|
+
const { data } = yield this.request.get('/v1/token/market/summary', {
|
|
1744
|
+
params: {
|
|
1745
|
+
token_id,
|
|
1746
|
+
chain_id,
|
|
1747
|
+
},
|
|
1748
|
+
});
|
|
1749
|
+
return data;
|
|
1750
|
+
});
|
|
1751
|
+
this.getMarketTradingHistory = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1752
|
+
const { data } = yield this.request.get('/v1/token/market/trading_history/list', {
|
|
1753
|
+
params,
|
|
1754
|
+
});
|
|
1755
|
+
return data;
|
|
1756
|
+
});
|
|
1757
|
+
this.getTokenHolderSummary = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1758
|
+
const { data } = yield this.request.get('/v1/token/market/holders/summary', {
|
|
1759
|
+
params,
|
|
1760
|
+
});
|
|
1761
|
+
return data;
|
|
1762
|
+
});
|
|
1763
|
+
// top 10 holders
|
|
1764
|
+
this.getTokenHolderList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1765
|
+
const { data } = yield this.request.get('/v1/token/market/holders/list', {
|
|
1766
|
+
params,
|
|
1767
|
+
});
|
|
1768
|
+
return data;
|
|
1769
|
+
});
|
|
1770
|
+
// top 5
|
|
1771
|
+
this.getLiquidityPoolList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1772
|
+
const { data } = yield this.request.get('/v1/token/market/liquidity_pool/list', {
|
|
1773
|
+
params,
|
|
1774
|
+
});
|
|
1775
|
+
return data;
|
|
1776
|
+
});
|
|
1777
|
+
this.getLiquidityPoolHistoryList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1778
|
+
const { data } = yield this.request.get('/v1/token/market/liquidity_pool/history/list', {
|
|
1779
|
+
params,
|
|
1780
|
+
});
|
|
1781
|
+
return data;
|
|
1782
|
+
});
|
|
1783
|
+
this.getNFTTradingConfig = () => __awaiter(this, void 0, void 0, function* () {
|
|
1784
|
+
const { data } = yield this.request.get('/v1/nft/trading_config');
|
|
1785
|
+
return data;
|
|
1786
|
+
});
|
|
1787
|
+
this.getNFTDetail = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1788
|
+
const { data } = yield this.request.get('/v1/nft', {
|
|
1789
|
+
params,
|
|
1790
|
+
});
|
|
1791
|
+
return data;
|
|
1792
|
+
});
|
|
1793
|
+
this.getNFTListingOrders = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1794
|
+
const { data } = yield this.request.get('/v1/nft/order/listing', {
|
|
1795
|
+
params,
|
|
1796
|
+
});
|
|
1797
|
+
return data;
|
|
1798
|
+
});
|
|
1799
|
+
this.getNFTFees = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1800
|
+
const { data } = yield this.request.get('/v1/nft/fee', {
|
|
1801
|
+
params,
|
|
1802
|
+
});
|
|
1803
|
+
return data;
|
|
1804
|
+
});
|
|
1805
|
+
this.prepareListingNFT = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
1806
|
+
const { data } = yield this.request.post('/v1/nft/order/listing/prepare', postData);
|
|
1807
|
+
return data;
|
|
1808
|
+
});
|
|
1809
|
+
this.createListingNFT = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
1810
|
+
const { data } = yield this.request.post('/v1/nft/order/listing/post', postData);
|
|
1811
|
+
return data;
|
|
1812
|
+
});
|
|
1813
|
+
this.prepareAcceptNFTOffer = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
1814
|
+
const { data } = yield this.request.post('/v1/nft/order/offer/accept/prepare', postData);
|
|
1815
|
+
return data;
|
|
1816
|
+
});
|
|
1817
|
+
this.submitAcceptNFTOfferTx = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
1818
|
+
const { data } = yield this.request.post('/v1/nft/order/offer/accept/tx', postData);
|
|
1819
|
+
return data;
|
|
1820
|
+
});
|
|
1821
|
+
this.checkTokenDepositForbidden = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1822
|
+
const { data } = yield this.request.get('/v1/engine/token/deposit_forbidden', {
|
|
1823
|
+
params,
|
|
1824
|
+
});
|
|
1825
|
+
return data;
|
|
1826
|
+
});
|
|
1359
1827
|
if (store instanceof Promise) {
|
|
1360
1828
|
store.then((resolvedStore) => {
|
|
1361
1829
|
this.store = resolvedStore;
|
|
@@ -1372,13 +1840,18 @@ export class OpenApiService {
|
|
|
1372
1840
|
initSync(options) {
|
|
1373
1841
|
var _a, _b;
|
|
1374
1842
|
(_b = (_a = __classPrivateFieldGet(this, _OpenApiService_plugin, "f")).onInitiate) === null || _b === void 0 ? void 0 : _b.call(_a, Object.assign({}, options));
|
|
1843
|
+
const headers = {
|
|
1844
|
+
'X-Client': __classPrivateFieldGet(this, _OpenApiService_clientName, "f"),
|
|
1845
|
+
'X-Version': __classPrivateFieldGet(this, _OpenApiService_clientVersion, "f"),
|
|
1846
|
+
};
|
|
1847
|
+
if (this.store.apiKey && this.store.apiTime) {
|
|
1848
|
+
headers['X-API-Key'] = this.store.apiKey;
|
|
1849
|
+
headers['X-API-Time'] = this.store.apiTime;
|
|
1850
|
+
}
|
|
1375
1851
|
const request = axios.create({
|
|
1376
1852
|
baseURL: this.store.host,
|
|
1377
1853
|
adapter: __classPrivateFieldGet(this, _OpenApiService_adapter, "f"),
|
|
1378
|
-
headers
|
|
1379
|
-
'X-Client': __classPrivateFieldGet(this, _OpenApiService_clientName, "f"),
|
|
1380
|
-
'X-Version': __classPrivateFieldGet(this, _OpenApiService_clientVersion, "f"),
|
|
1381
|
-
},
|
|
1854
|
+
headers,
|
|
1382
1855
|
});
|
|
1383
1856
|
// sign after rateLimit, timestamp is the latest
|
|
1384
1857
|
request.interceptors.request.use((config) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1391,9 +1864,13 @@ export class OpenApiService {
|
|
|
1391
1864
|
}));
|
|
1392
1865
|
this.request = rateLimit(request, { maxRPS });
|
|
1393
1866
|
this.request.interceptors.response.use((response) => {
|
|
1394
|
-
var _a, _b, _c, _d;
|
|
1395
|
-
const
|
|
1396
|
-
|
|
1867
|
+
var _a, _b, _c, _d, _e;
|
|
1868
|
+
const newAPIKey = (_a = response.headers) === null || _a === void 0 ? void 0 : _a['x-set-api-key'];
|
|
1869
|
+
if (newAPIKey) {
|
|
1870
|
+
this.setAPIKey(newAPIKey);
|
|
1871
|
+
}
|
|
1872
|
+
const code = ((_b = response.data) === null || _b === void 0 ? void 0 : _b.err_code) || ((_c = response.data) === null || _c === void 0 ? void 0 : _c.error_code);
|
|
1873
|
+
const msg = ((_d = response.data) === null || _d === void 0 ? void 0 : _d.err_msg) || ((_e = response.data) === null || _e === void 0 ? void 0 : _e.error_msg);
|
|
1397
1874
|
if (code && code !== 200) {
|
|
1398
1875
|
if (msg) {
|
|
1399
1876
|
let err;
|