@rabby-wallet/rabby-api 0.9.5 → 0.9.6-8.alpha.2
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 +625 -9
- package/dist/index.js +683 -19
- package/dist/types.d.ts +1547 -13
- 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
|
};
|
|
@@ -76,6 +89,52 @@ export class OpenApiService {
|
|
|
76
89
|
yield ((_d = (_c = __classPrivateFieldGet(this, _OpenApiService_plugin, "f")).onInitiateAsync) === null || _d === void 0 ? void 0 : _d.call(_c, Object.assign({}, options)));
|
|
77
90
|
this.initSync(Object.assign({}, options));
|
|
78
91
|
});
|
|
92
|
+
this.getSafePendingTransactions = ({ txServiceUrl, safeAddress, nonce, }) => __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
const { data } = yield this.request.get(`${txServiceUrl}/v1/safes/${safeAddress}/multisig-transactions/`, {
|
|
94
|
+
params: {
|
|
95
|
+
executed: false,
|
|
96
|
+
nonce__gte: nonce,
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
return data;
|
|
100
|
+
});
|
|
101
|
+
this.postSafeTransactions = ({ txServiceUrl, safeAddress, data, }) => __awaiter(this, void 0, void 0, function* () {
|
|
102
|
+
yield this.request.post(`${txServiceUrl}/v1/safes/${safeAddress}/multisig-transactions/`, data);
|
|
103
|
+
});
|
|
104
|
+
this.getSafeInfo = ({ txServiceUrl, safeAddress, }) => __awaiter(this, void 0, void 0, function* () {
|
|
105
|
+
const { data } = yield this.request.get(`${txServiceUrl}/v1/safes/${safeAddress}/`);
|
|
106
|
+
return data;
|
|
107
|
+
});
|
|
108
|
+
this.confirmSafeTransaction = ({ txServiceUrl, safeTransactionHash, data, }) => __awaiter(this, void 0, void 0, function* () {
|
|
109
|
+
yield this.request.post(`${txServiceUrl}/v1/multisig-transactions/${safeTransactionHash}/confirmations/`, data);
|
|
110
|
+
});
|
|
111
|
+
this.getSafeTxGas = ({ txServiceUrl, safeAddress, safeTxData, }) => __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
const { data } = yield this.request.post(`${txServiceUrl}/v1/safes/${safeAddress}/multisig-transactions/estimations/`, {
|
|
113
|
+
to: safeTxData.to,
|
|
114
|
+
value: safeTxData.value || '0',
|
|
115
|
+
data: safeTxData.data,
|
|
116
|
+
operation: safeTxData.operation,
|
|
117
|
+
});
|
|
118
|
+
return data === null || data === void 0 ? void 0 : data.safeTxGas;
|
|
119
|
+
});
|
|
120
|
+
this.getSafeMessages = ({ txServiceUrl, safeAddress, options, }) => __awaiter(this, void 0, void 0, function* () {
|
|
121
|
+
const { data } = yield this.request.get(`${txServiceUrl}/v1/safes/${safeAddress}/messages/`, {
|
|
122
|
+
params: options,
|
|
123
|
+
});
|
|
124
|
+
return data;
|
|
125
|
+
});
|
|
126
|
+
this.addSafeMessage = ({ txServiceUrl, safeAddress, data, }) => __awaiter(this, void 0, void 0, function* () {
|
|
127
|
+
yield this.request.post(`${txServiceUrl}/v1/safes/${safeAddress}/messages/`, data);
|
|
128
|
+
});
|
|
129
|
+
this.getSafeMessage = ({ txServiceUrl, messageHash, }) => __awaiter(this, void 0, void 0, function* () {
|
|
130
|
+
const { data } = yield this.request.get(`${txServiceUrl}/v1/messages/${messageHash}/`);
|
|
131
|
+
return data;
|
|
132
|
+
});
|
|
133
|
+
this.addSafeMessageSignature = ({ txServiceUrl, messageHash, signature, }) => __awaiter(this, void 0, void 0, function* () {
|
|
134
|
+
yield this.request.post(`${txServiceUrl}/v1/messages/${messageHash}/signatures/`, {
|
|
135
|
+
signature,
|
|
136
|
+
});
|
|
137
|
+
});
|
|
79
138
|
this.asyncJob = (url, options) => {
|
|
80
139
|
const _option = Object.assign({ timeout: ASYNC_JOB_TIMEOUT, retryDelay: ASYNC_JOB_RETRY_DELAY }, options);
|
|
81
140
|
const startTime = +new Date();
|
|
@@ -134,6 +193,14 @@ export class OpenApiService {
|
|
|
134
193
|
});
|
|
135
194
|
return data;
|
|
136
195
|
});
|
|
196
|
+
this.get24hTotalBalance = (address) => __awaiter(this, void 0, void 0, function* () {
|
|
197
|
+
const { data } = yield this.request.get('/v1/user/total_balance_24h', {
|
|
198
|
+
params: {
|
|
199
|
+
id: address,
|
|
200
|
+
},
|
|
201
|
+
});
|
|
202
|
+
return data;
|
|
203
|
+
});
|
|
137
204
|
this.getPendingCount = (address) => __awaiter(this, void 0, void 0, function* () {
|
|
138
205
|
const { data } = yield this.request.get('/v1/wallet/pending_tx_count', {
|
|
139
206
|
params: {
|
|
@@ -166,13 +233,14 @@ export class OpenApiService {
|
|
|
166
233
|
});
|
|
167
234
|
return data;
|
|
168
235
|
});
|
|
169
|
-
this.preExecTx = ({ tx, origin, address, updateNonce = false, pending_tx_list = [], }) => __awaiter(this, void 0, void 0, function* () {
|
|
236
|
+
this.preExecTx = ({ tx, origin, address, updateNonce = false, pending_tx_list = [], delegate_call, }) => __awaiter(this, void 0, void 0, function* () {
|
|
170
237
|
const { data } = yield this.request.post('/v1/wallet/pre_exec_tx', {
|
|
171
238
|
tx,
|
|
172
239
|
user_addr: address,
|
|
173
240
|
origin,
|
|
174
241
|
update_nonce: updateNonce,
|
|
175
242
|
pending_tx_list,
|
|
243
|
+
delegate_call,
|
|
176
244
|
});
|
|
177
245
|
return data;
|
|
178
246
|
});
|
|
@@ -298,6 +366,15 @@ export class OpenApiService {
|
|
|
298
366
|
});
|
|
299
367
|
return data;
|
|
300
368
|
});
|
|
369
|
+
this.getTokenEntity = (id, chainId) => __awaiter(this, void 0, void 0, function* () {
|
|
370
|
+
const { data } = yield this.request.get('/v1/token/identity', {
|
|
371
|
+
params: {
|
|
372
|
+
id,
|
|
373
|
+
chain_id: chainId,
|
|
374
|
+
},
|
|
375
|
+
});
|
|
376
|
+
return data;
|
|
377
|
+
});
|
|
301
378
|
this.getHistoryTokenList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
302
379
|
const { data } = yield this.request.get('/v1/user/history_token_list', {
|
|
303
380
|
params: {
|
|
@@ -346,12 +423,31 @@ export class OpenApiService {
|
|
|
346
423
|
});
|
|
347
424
|
return data;
|
|
348
425
|
});
|
|
349
|
-
this.
|
|
426
|
+
this.hasNewTxFrom = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
427
|
+
const { data } = yield this.request.get('/v1/user/has_new_tx', {
|
|
428
|
+
params: {
|
|
429
|
+
id: params.address,
|
|
430
|
+
start_time: params.startTime,
|
|
431
|
+
},
|
|
432
|
+
});
|
|
433
|
+
return data;
|
|
434
|
+
});
|
|
435
|
+
this.getTxCount = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
436
|
+
const { data } = yield this.request.get('/v1/user/tx_count', {
|
|
437
|
+
params,
|
|
438
|
+
});
|
|
439
|
+
return data;
|
|
440
|
+
});
|
|
441
|
+
this.listTxHistory = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
350
442
|
const { data } = yield this.request.get('/v1/user/history_list', {
|
|
351
443
|
params,
|
|
352
444
|
});
|
|
353
445
|
return data;
|
|
354
446
|
});
|
|
447
|
+
/**
|
|
448
|
+
* @deprecated Use `listTxHistory` instead.
|
|
449
|
+
*/
|
|
450
|
+
this.listTxHisotry = this.listTxHistory;
|
|
355
451
|
this.getAllTxHistory = (params, options) => __awaiter(this, void 0, void 0, function* () {
|
|
356
452
|
const data = yield this.asyncJob('/v1/user/history_all_list', Object.assign({ method: 'GET', params }, options));
|
|
357
453
|
return data;
|
|
@@ -364,6 +460,10 @@ export class OpenApiService {
|
|
|
364
460
|
});
|
|
365
461
|
return data;
|
|
366
462
|
});
|
|
463
|
+
this.getTokenPriceList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
464
|
+
const { data } = yield this.request.post('/v1/token/price_list', params);
|
|
465
|
+
return data;
|
|
466
|
+
});
|
|
367
467
|
this.tokenAuthorizedList = (id, chain_id, options) => __awaiter(this, void 0, void 0, function* () {
|
|
368
468
|
const { restfulPrefix = 'v1' } = options || {};
|
|
369
469
|
const { data } = yield this.request.get(`/${restfulPrefix}/user/token_authorized_list`, {
|
|
@@ -394,16 +494,20 @@ export class OpenApiService {
|
|
|
394
494
|
this.getSwapQuote = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
395
495
|
const { data } = yield this.request.get('/v1/wallet/swap_quote', {
|
|
396
496
|
params,
|
|
497
|
+
timeout: 5000,
|
|
397
498
|
});
|
|
398
499
|
return data;
|
|
399
500
|
});
|
|
400
501
|
this.getSwapTokenList = (id, chainId) => __awaiter(this, void 0, void 0, function* () {
|
|
502
|
+
const params = {
|
|
503
|
+
id,
|
|
504
|
+
is_all: false,
|
|
505
|
+
};
|
|
506
|
+
if (chainId) {
|
|
507
|
+
params.chain_id = chainId;
|
|
508
|
+
}
|
|
401
509
|
const { data } = yield this.request.get('/v1/wallet/swap_token_list', {
|
|
402
|
-
params
|
|
403
|
-
id,
|
|
404
|
-
chain_id: chainId,
|
|
405
|
-
is_all: false,
|
|
406
|
-
},
|
|
510
|
+
params,
|
|
407
511
|
});
|
|
408
512
|
return data;
|
|
409
513
|
});
|
|
@@ -480,6 +584,10 @@ export class OpenApiService {
|
|
|
480
584
|
const { data } = yield this.request.get('/v1/wallet/version');
|
|
481
585
|
return data;
|
|
482
586
|
});
|
|
587
|
+
this.getVersionInfo = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
588
|
+
const { data } = yield this.request.get('/v1/wallet/version_info', { params });
|
|
589
|
+
return data;
|
|
590
|
+
});
|
|
483
591
|
this.addOriginFeedback = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
484
592
|
const { data } = yield this.request.post('/v1/wallet/add_origin_feedback', {
|
|
485
593
|
user_addr: params.user_addr,
|
|
@@ -569,6 +677,12 @@ export class OpenApiService {
|
|
|
569
677
|
});
|
|
570
678
|
return data;
|
|
571
679
|
});
|
|
680
|
+
this.getSwapTradeListV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
681
|
+
const { data } = yield this.request.get('/v2/wallet/swap_trade_list', {
|
|
682
|
+
params,
|
|
683
|
+
});
|
|
684
|
+
return data;
|
|
685
|
+
});
|
|
572
686
|
this.postSwap = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
573
687
|
const { data } = yield this.request.post('/v1/wallet/swap_trade', params);
|
|
574
688
|
return data;
|
|
@@ -579,6 +693,12 @@ export class OpenApiService {
|
|
|
579
693
|
});
|
|
580
694
|
return data;
|
|
581
695
|
});
|
|
696
|
+
this.suggestSlippage = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
697
|
+
const { data } = yield this.request.get('v1/wallet/suggest_slippage', {
|
|
698
|
+
params,
|
|
699
|
+
});
|
|
700
|
+
return data;
|
|
701
|
+
});
|
|
582
702
|
this.getOriginPopularityLevel = (origin) => __awaiter(this, void 0, void 0, function* () {
|
|
583
703
|
const { data } = yield this.request.get('/v1/engine/origin/popularity_level', {
|
|
584
704
|
params: {
|
|
@@ -742,6 +862,18 @@ export class OpenApiService {
|
|
|
742
862
|
from_addr: from,
|
|
743
863
|
to_addr: to,
|
|
744
864
|
},
|
|
865
|
+
timeout: 2000,
|
|
866
|
+
});
|
|
867
|
+
return data;
|
|
868
|
+
});
|
|
869
|
+
// 全链两个地址是否发生过转账
|
|
870
|
+
this.hasTransferAllChain = (from, to) => __awaiter(this, void 0, void 0, function* () {
|
|
871
|
+
const { data } = yield this.request.get('/v2/engine/addr/has_transfer', {
|
|
872
|
+
params: {
|
|
873
|
+
from_addr: from,
|
|
874
|
+
to_addr: to,
|
|
875
|
+
},
|
|
876
|
+
timeout: 2000,
|
|
745
877
|
});
|
|
746
878
|
return data;
|
|
747
879
|
});
|
|
@@ -892,7 +1024,21 @@ export class OpenApiService {
|
|
|
892
1024
|
return data;
|
|
893
1025
|
});
|
|
894
1026
|
this.submitTx = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
895
|
-
const {
|
|
1027
|
+
const { sig } = postData, rest = __rest(postData, ["sig"]);
|
|
1028
|
+
const { data } = yield this.request.post('/v1/wallet/submit_tx', Object.assign({}, rest), {
|
|
1029
|
+
headers: sig ? { sig } : undefined,
|
|
1030
|
+
});
|
|
1031
|
+
return data;
|
|
1032
|
+
});
|
|
1033
|
+
this.submitTxV2 = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
1034
|
+
const { sig } = postData, rest = __rest(postData, ["sig"]);
|
|
1035
|
+
const { data } = yield this.request.post('/v2/wallet/submit_tx', Object.assign({}, rest), {
|
|
1036
|
+
headers: sig ? { sig } : undefined,
|
|
1037
|
+
});
|
|
1038
|
+
return data;
|
|
1039
|
+
});
|
|
1040
|
+
this.getDefaultRPCs = () => __awaiter(this, void 0, void 0, function* () {
|
|
1041
|
+
const { data } = yield this.request.get('/v1/chainrpc');
|
|
896
1042
|
return data;
|
|
897
1043
|
});
|
|
898
1044
|
this.getTxRequests = (ids) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1164,6 +1310,30 @@ export class OpenApiService {
|
|
|
1164
1310
|
});
|
|
1165
1311
|
return data;
|
|
1166
1312
|
});
|
|
1313
|
+
this.getStakingPoolList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1314
|
+
const { data } = yield this.request.get('/v1/staking/pool_list', {
|
|
1315
|
+
params,
|
|
1316
|
+
});
|
|
1317
|
+
return data;
|
|
1318
|
+
});
|
|
1319
|
+
this.getStakingFilterList = (params = {}) => __awaiter(this, void 0, void 0, function* () {
|
|
1320
|
+
const { data } = yield this.request.get('/v1/staking/filter_list', {
|
|
1321
|
+
params,
|
|
1322
|
+
});
|
|
1323
|
+
return data;
|
|
1324
|
+
});
|
|
1325
|
+
this.getStakingPool = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1326
|
+
const { data } = yield this.request.get('/v1/staking/pool', {
|
|
1327
|
+
params,
|
|
1328
|
+
});
|
|
1329
|
+
return data;
|
|
1330
|
+
});
|
|
1331
|
+
this.getStakingPoolCurve = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1332
|
+
const { data } = yield this.request.get('/v1/staking/pool_curve', {
|
|
1333
|
+
params,
|
|
1334
|
+
});
|
|
1335
|
+
return data;
|
|
1336
|
+
});
|
|
1167
1337
|
this.getBridgeSupportChain = () => __awaiter(this, void 0, void 0, function* () {
|
|
1168
1338
|
const { data } = yield this.request.get('/v1/bridge/supported_chains');
|
|
1169
1339
|
return data;
|
|
@@ -1202,10 +1372,78 @@ export class OpenApiService {
|
|
|
1202
1372
|
});
|
|
1203
1373
|
return data;
|
|
1204
1374
|
});
|
|
1375
|
+
this.getBridgeHistoryListByTxIds = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1376
|
+
const { data } = yield this.request.post('/v1/bridge/history_list_by_tx_ids', params);
|
|
1377
|
+
return data;
|
|
1378
|
+
});
|
|
1379
|
+
this.buildBridgeTx = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1380
|
+
const { data } = yield this.request.get('/v2/bridge/build_tx', {
|
|
1381
|
+
params,
|
|
1382
|
+
});
|
|
1383
|
+
return data;
|
|
1384
|
+
});
|
|
1205
1385
|
this.postBridgeHistory = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1206
1386
|
const { data } = yield this.request.post('/v1/bridge/history', params);
|
|
1207
1387
|
return data;
|
|
1208
1388
|
});
|
|
1389
|
+
/**
|
|
1390
|
+
* no id just no check address
|
|
1391
|
+
*/
|
|
1392
|
+
this.getPerpPermission = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1393
|
+
const { data } = yield this.request.get('/v1/user/has_hyperliquid_permission', {
|
|
1394
|
+
params,
|
|
1395
|
+
});
|
|
1396
|
+
return data;
|
|
1397
|
+
});
|
|
1398
|
+
/**
|
|
1399
|
+
* @param params.dex_id - The ID of the DEX to get the top tokens for. If not provided, hyperliquid default DEXs will be included. if all is provided, all DEXs will be included. and xyz is xyz dex tokens
|
|
1400
|
+
* @returns A list of top tokens for the given DEX.
|
|
1401
|
+
*/
|
|
1402
|
+
this.getPerpTopTokenList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1403
|
+
const { data } = yield this.request.get('/v1/token/hyperliquid_top', {
|
|
1404
|
+
params,
|
|
1405
|
+
});
|
|
1406
|
+
return data;
|
|
1407
|
+
});
|
|
1408
|
+
/**
|
|
1409
|
+
* @param params.dex_id - The ID of the DEX to get the top tokens for. If not provided, hyperliquid default DEXs will be included. if all is provided, all DEXs will be included. and xyz is xyz dex tokens
|
|
1410
|
+
* @param params.lang - The translations in item.category
|
|
1411
|
+
* @returns A list of top tokens for the given DEX.
|
|
1412
|
+
*/
|
|
1413
|
+
this.getPerpTopTokenListV3 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1414
|
+
const { data } = yield this.request.get('/v1/token/hyperliquid_top_v3', {
|
|
1415
|
+
params,
|
|
1416
|
+
});
|
|
1417
|
+
return data;
|
|
1418
|
+
});
|
|
1419
|
+
this.getPerpTokenDetail = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1420
|
+
const { data } = yield this.request.get('/v1/token/hyperliquid_token_detail_v3', {
|
|
1421
|
+
params,
|
|
1422
|
+
});
|
|
1423
|
+
return data;
|
|
1424
|
+
});
|
|
1425
|
+
this.getPerpTokenCategories = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1426
|
+
const { data } = yield this.request.get('/v1/token/hyperliquid_categories_v3', {
|
|
1427
|
+
params,
|
|
1428
|
+
});
|
|
1429
|
+
return data;
|
|
1430
|
+
});
|
|
1431
|
+
this.getPerpsBridgeIsSupportToken = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1432
|
+
const { data } = yield this.request.get('/v2/bridge/hyperliquid/support_token', {
|
|
1433
|
+
params,
|
|
1434
|
+
});
|
|
1435
|
+
return data;
|
|
1436
|
+
});
|
|
1437
|
+
this.getPerpBridgeQuote = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1438
|
+
const { data } = yield this.request.get('/v2/bridge/hyperliquid/quote', {
|
|
1439
|
+
params,
|
|
1440
|
+
});
|
|
1441
|
+
return data;
|
|
1442
|
+
});
|
|
1443
|
+
this.postPerpBridgeHistory = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1444
|
+
const { data } = yield this.request.post('/v2/bridge/hyperliquid', params);
|
|
1445
|
+
return data;
|
|
1446
|
+
});
|
|
1209
1447
|
this.getSupportedDEXList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1210
1448
|
const { data } = yield this.request.get('/v1/wallet/supported_dex_list');
|
|
1211
1449
|
return data;
|
|
@@ -1238,6 +1476,39 @@ export class OpenApiService {
|
|
|
1238
1476
|
});
|
|
1239
1477
|
return data;
|
|
1240
1478
|
});
|
|
1479
|
+
this.getGasAccountInfoV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1480
|
+
const { data } = yield this.request.get('/v2/gas_account', {
|
|
1481
|
+
params,
|
|
1482
|
+
});
|
|
1483
|
+
return data;
|
|
1484
|
+
});
|
|
1485
|
+
this.createGasAccountPayInfo = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
1486
|
+
const { data } = yield this.request.post('/v2/gas_account/pay_info', postData);
|
|
1487
|
+
return data;
|
|
1488
|
+
});
|
|
1489
|
+
this.checkGasAccountGiftEligibility = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1490
|
+
const { data } = yield this.request.get('/v1/gas_account/check_eligibility', {
|
|
1491
|
+
params,
|
|
1492
|
+
});
|
|
1493
|
+
return data;
|
|
1494
|
+
});
|
|
1495
|
+
this.checkGasAccountGiftEligibilityBatch = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1496
|
+
const { data } = yield this.request.post('/v1/gas_account/check_eligibility/batch', params);
|
|
1497
|
+
return data;
|
|
1498
|
+
});
|
|
1499
|
+
this.confirmIapOrder = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
1500
|
+
const { data } = yield this.request.post('/v1/gas_account/confirm_iap_order', postData);
|
|
1501
|
+
return data;
|
|
1502
|
+
});
|
|
1503
|
+
this.claimGasAccountGift = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1504
|
+
const { sig } = params, others = __rest(params, ["sig"]);
|
|
1505
|
+
const { data } = yield this.request.post('/v1/gas_account/claim', Object.assign({}, others), {
|
|
1506
|
+
headers: {
|
|
1507
|
+
sig,
|
|
1508
|
+
},
|
|
1509
|
+
});
|
|
1510
|
+
return data;
|
|
1511
|
+
});
|
|
1241
1512
|
this.loginGasAccount = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1242
1513
|
const { sig } = params, others = __rest(params, ["sig"]);
|
|
1243
1514
|
const { data } = yield this.request.post('/v1/gas_account/login', Object.assign({}, others), {
|
|
@@ -1264,6 +1535,29 @@ export class OpenApiService {
|
|
|
1264
1535
|
});
|
|
1265
1536
|
return data;
|
|
1266
1537
|
});
|
|
1538
|
+
this.getGasAccountBridgeSupportTokenList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1539
|
+
const { data } = yield this.request.get('/v1/gas_account/bridge/support_token');
|
|
1540
|
+
return data;
|
|
1541
|
+
});
|
|
1542
|
+
this.getGasAccountBridgeQuote = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1543
|
+
const { data } = yield this.request.get('/v1/gas_account/bridge/quote', {
|
|
1544
|
+
params,
|
|
1545
|
+
});
|
|
1546
|
+
return data;
|
|
1547
|
+
});
|
|
1548
|
+
this.createGasAccountBridgeRecharge = (p) => __awaiter(this, void 0, void 0, function* () {
|
|
1549
|
+
const { sig } = p, params = __rest(p, ["sig"]);
|
|
1550
|
+
const { data } = yield this.request.post('/v1/gas_account/bridge/create', params, {
|
|
1551
|
+
headers: {
|
|
1552
|
+
sig,
|
|
1553
|
+
},
|
|
1554
|
+
});
|
|
1555
|
+
return data;
|
|
1556
|
+
});
|
|
1557
|
+
this.getGasAccountBridgeStatus = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1558
|
+
const { data } = yield this.request.post('/v1/gas_account/recharge/status', params);
|
|
1559
|
+
return data;
|
|
1560
|
+
});
|
|
1267
1561
|
this.rechargeGasAccount = (p) => __awaiter(this, void 0, void 0, function* () {
|
|
1268
1562
|
const { sig } = p, params = __rest(p, ["sig"]);
|
|
1269
1563
|
const { data } = yield this.request.post('/v1/gas_account/recharge', params, {
|
|
@@ -1282,6 +1576,16 @@ export class OpenApiService {
|
|
|
1282
1576
|
});
|
|
1283
1577
|
return data;
|
|
1284
1578
|
});
|
|
1579
|
+
this.getWithdrawList = (p) => __awaiter(this, void 0, void 0, function* () {
|
|
1580
|
+
const { sig } = p, params = __rest(p, ["sig"]);
|
|
1581
|
+
const { data } = yield this.request.get('/v1/gas_account/withdraw_list', {
|
|
1582
|
+
params,
|
|
1583
|
+
headers: {
|
|
1584
|
+
sig,
|
|
1585
|
+
},
|
|
1586
|
+
});
|
|
1587
|
+
return data;
|
|
1588
|
+
});
|
|
1285
1589
|
this.getGasAccountHistory = (p) => __awaiter(this, void 0, void 0, function* () {
|
|
1286
1590
|
const { sig } = p, params = __rest(p, ["sig"]);
|
|
1287
1591
|
const { data } = yield this.request.get('/v1/gas_account/history', {
|
|
@@ -1295,9 +1599,11 @@ export class OpenApiService {
|
|
|
1295
1599
|
this.checkGasAccountTxs = (p) => __awaiter(this, void 0, void 0, function* () {
|
|
1296
1600
|
const { sig } = p, params = __rest(p, ["sig"]);
|
|
1297
1601
|
const { data } = yield this.request.post('/v1/gas_account/check_txs', params, {
|
|
1298
|
-
headers:
|
|
1299
|
-
|
|
1300
|
-
|
|
1602
|
+
headers: sig
|
|
1603
|
+
? {
|
|
1604
|
+
sig,
|
|
1605
|
+
}
|
|
1606
|
+
: undefined,
|
|
1301
1607
|
});
|
|
1302
1608
|
return data;
|
|
1303
1609
|
});
|
|
@@ -1353,24 +1659,373 @@ export class OpenApiService {
|
|
|
1353
1659
|
const { data } = yield this.request.get('/v2/bridge/supported_chains');
|
|
1354
1660
|
return data;
|
|
1355
1661
|
});
|
|
1662
|
+
this.submitFeedback = ({ text, usage, }) => __awaiter(this, void 0, void 0, function* () {
|
|
1663
|
+
const { data } = yield this.request.post('v1/feedback', Object.assign({ text }, (usage && { usage })));
|
|
1664
|
+
return data;
|
|
1665
|
+
});
|
|
1356
1666
|
this.uninstalledFeedback = ({ text, }) => __awaiter(this, void 0, void 0, function* () {
|
|
1357
|
-
|
|
1667
|
+
return this.submitFeedback({
|
|
1358
1668
|
text,
|
|
1359
1669
|
});
|
|
1670
|
+
});
|
|
1671
|
+
this.postClientFeedbackMessage = (data) => __awaiter(this, void 0, void 0, function* () {
|
|
1672
|
+
const { data: response } = yield this.request.post('/v1/client_feedback/message', data);
|
|
1673
|
+
return response;
|
|
1674
|
+
});
|
|
1675
|
+
this.getClientFeedbackMessages = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1676
|
+
const { data } = yield this.request.get('/v1/client_feedback/messages', {
|
|
1677
|
+
params,
|
|
1678
|
+
});
|
|
1679
|
+
return data;
|
|
1680
|
+
});
|
|
1681
|
+
this.getClientFeedbackUnread = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1682
|
+
const { data } = yield this.request.get('/v1/client_feedback/unread', {
|
|
1683
|
+
params,
|
|
1684
|
+
});
|
|
1360
1685
|
return data;
|
|
1361
1686
|
});
|
|
1687
|
+
this.uploadClientFeedback = (formData, isRN = false) => __awaiter(this, void 0, void 0, function* () {
|
|
1688
|
+
const config = isRN
|
|
1689
|
+
? {
|
|
1690
|
+
headers: {
|
|
1691
|
+
'Content-Type': 'multipart/form-data',
|
|
1692
|
+
},
|
|
1693
|
+
transformRequest: (data) => data,
|
|
1694
|
+
}
|
|
1695
|
+
: undefined;
|
|
1696
|
+
const { data } = config
|
|
1697
|
+
? yield this.request.post('/v1/client_feedback/upload', formData, config)
|
|
1698
|
+
: yield this.request.post('/v1/client_feedback/upload', formData);
|
|
1699
|
+
return data;
|
|
1700
|
+
});
|
|
1701
|
+
/**
|
|
1702
|
+
* @deprecated
|
|
1703
|
+
*/
|
|
1362
1704
|
this.getToken24hPrice = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1363
1705
|
const { data } = yield this.request.get('/v1/token/24h_price', {
|
|
1364
1706
|
params,
|
|
1365
1707
|
});
|
|
1366
1708
|
return data;
|
|
1367
1709
|
});
|
|
1710
|
+
this.getTokenPriceCurve = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1711
|
+
const { data } = yield this.request.get('/v1/token/price_curve', {
|
|
1712
|
+
params,
|
|
1713
|
+
});
|
|
1714
|
+
return data;
|
|
1715
|
+
});
|
|
1368
1716
|
this.getTokenDatePrice = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1369
1717
|
const { data } = yield this.request.get('/v1/token/date_price', {
|
|
1370
1718
|
params,
|
|
1371
1719
|
});
|
|
1372
1720
|
return data;
|
|
1373
1721
|
});
|
|
1722
|
+
this.searchTokens = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1723
|
+
const { data } = yield this.request.get('/v1/token/search', {
|
|
1724
|
+
params,
|
|
1725
|
+
});
|
|
1726
|
+
return data;
|
|
1727
|
+
});
|
|
1728
|
+
this.searchTokensV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1729
|
+
const { data } = yield this.request.get('/v2/token/search', {
|
|
1730
|
+
params,
|
|
1731
|
+
});
|
|
1732
|
+
return data;
|
|
1733
|
+
});
|
|
1734
|
+
// resp arr of chain_id
|
|
1735
|
+
this.getCopyTradingChainList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1736
|
+
const { data } = yield this.request.get('/v1/copytrading/chain_list');
|
|
1737
|
+
return data;
|
|
1738
|
+
});
|
|
1739
|
+
this.getCopyTradingTokenList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1740
|
+
const { data } = yield this.request.get('/v1/copytrading/token/list', {
|
|
1741
|
+
params,
|
|
1742
|
+
});
|
|
1743
|
+
return data;
|
|
1744
|
+
});
|
|
1745
|
+
this.getCopyTradingTokenListV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1746
|
+
const { data } = yield this.request.get('/v2/copytrading/token/list', {
|
|
1747
|
+
params,
|
|
1748
|
+
});
|
|
1749
|
+
return data;
|
|
1750
|
+
});
|
|
1751
|
+
this.getCopyTradingRecentBuyList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1752
|
+
const { data } = yield this.request.get('/v1/copytrading/recent_buy/list', {
|
|
1753
|
+
params,
|
|
1754
|
+
});
|
|
1755
|
+
return data;
|
|
1756
|
+
});
|
|
1757
|
+
this.getCopyTradingRecentBuyListV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1758
|
+
const { data } = yield this.request.get('/v2/copytrading/recent_buy/list', {
|
|
1759
|
+
params,
|
|
1760
|
+
});
|
|
1761
|
+
return data;
|
|
1762
|
+
});
|
|
1763
|
+
this.getCopyTradingDetail = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1764
|
+
const { data } = yield this.request.get('/v2/copytrading/token/detail', {
|
|
1765
|
+
params,
|
|
1766
|
+
});
|
|
1767
|
+
return data;
|
|
1768
|
+
});
|
|
1769
|
+
this.getCopyTradingSameName = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1770
|
+
const { data } = yield this.request.get('/v1/token/same_name', {
|
|
1771
|
+
params,
|
|
1772
|
+
});
|
|
1773
|
+
return data;
|
|
1774
|
+
});
|
|
1775
|
+
this.getCopyTradingPnlList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1776
|
+
const { data } = yield this.request.get('/v1/copytrading/smart_money/pnl/list', {
|
|
1777
|
+
params,
|
|
1778
|
+
});
|
|
1779
|
+
return data;
|
|
1780
|
+
});
|
|
1781
|
+
this.batchQueryTokens = (uuids) => __awaiter(this, void 0, void 0, function* () {
|
|
1782
|
+
const { data } = yield this.request.get('/v1/token/list_by_uuids', {
|
|
1783
|
+
params: {
|
|
1784
|
+
uuids: Array.isArray(uuids) ? uuids.join(',') : uuids,
|
|
1785
|
+
},
|
|
1786
|
+
});
|
|
1787
|
+
return data;
|
|
1788
|
+
});
|
|
1789
|
+
this.getBuySupportedCountryList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1790
|
+
const { data } = yield this.request.get('/v1/buy/supported_country_list');
|
|
1791
|
+
return data;
|
|
1792
|
+
});
|
|
1793
|
+
this.getBuySupportedTokenList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1794
|
+
const { data } = yield this.request.get('/v1/buy/supported_token_list');
|
|
1795
|
+
return data;
|
|
1796
|
+
});
|
|
1797
|
+
this.getBuyQuote = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1798
|
+
const { data } = yield this.request.get('/v1/buy/quote', {
|
|
1799
|
+
params,
|
|
1800
|
+
});
|
|
1801
|
+
return data;
|
|
1802
|
+
});
|
|
1803
|
+
this.getBuyWidgetUrl = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1804
|
+
const { data } = yield this.request.get('/v1/buy/get_widget_url', { params });
|
|
1805
|
+
return data;
|
|
1806
|
+
});
|
|
1807
|
+
this.getBuyHistory = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1808
|
+
const { data } = yield this.request.get('/v1/buy/history', {
|
|
1809
|
+
params: Object.assign(Object.assign({}, params), { start: params.start || 0, limit: params.limit || 20 }),
|
|
1810
|
+
});
|
|
1811
|
+
return data;
|
|
1812
|
+
});
|
|
1813
|
+
this.getBuyPaymentMethods = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1814
|
+
const { data } = yield this.request.get('/v1/buy/get_payment_method', {
|
|
1815
|
+
params,
|
|
1816
|
+
});
|
|
1817
|
+
return data;
|
|
1818
|
+
});
|
|
1819
|
+
this.getBuyCurrencyList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1820
|
+
const { data } = yield this.request.get('/v1/buy/supported_currency_list');
|
|
1821
|
+
return data;
|
|
1822
|
+
});
|
|
1823
|
+
this.getOfflineChainList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1824
|
+
const { data } = yield this.request.get('/v1/chain/offline_list');
|
|
1825
|
+
return data;
|
|
1826
|
+
});
|
|
1827
|
+
this.isBlockedAddress = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
1828
|
+
const { data } = yield this.request.get('/v1/engine/addr/is_blocked', {
|
|
1829
|
+
params: { id },
|
|
1830
|
+
});
|
|
1831
|
+
return data;
|
|
1832
|
+
});
|
|
1833
|
+
this.estimateGasUsd = ({ tx, origin, address, updateNonce = false, pending_tx_list = [], }) => __awaiter(this, void 0, void 0, function* () {
|
|
1834
|
+
const { data } = yield this.request.post('/v1/wallet/estimate_gas', {
|
|
1835
|
+
tx,
|
|
1836
|
+
user_addr: address,
|
|
1837
|
+
origin,
|
|
1838
|
+
update_nonce: updateNonce,
|
|
1839
|
+
pending_tx_list,
|
|
1840
|
+
});
|
|
1841
|
+
return data;
|
|
1842
|
+
});
|
|
1843
|
+
this.getCexSupportList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1844
|
+
const { data } = yield this.request.get('/v1/cex/supported_list');
|
|
1845
|
+
return data;
|
|
1846
|
+
});
|
|
1847
|
+
this.getAppChainList = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
1848
|
+
const { data } = yield this.request.get('/v1/user/complex_app_list', {
|
|
1849
|
+
params: { id },
|
|
1850
|
+
});
|
|
1851
|
+
return data;
|
|
1852
|
+
});
|
|
1853
|
+
this.checkCex = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
1854
|
+
const { data } = yield this.request.post('/v1/token/check_cex', postData);
|
|
1855
|
+
return data;
|
|
1856
|
+
});
|
|
1857
|
+
// top 20 tokens
|
|
1858
|
+
this.getHotTokenList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1859
|
+
const { data } = yield this.request.get('/v1/token/hot_list');
|
|
1860
|
+
return data;
|
|
1861
|
+
});
|
|
1862
|
+
// uuid: 'chain:token_id'
|
|
1863
|
+
this.getTokensDetailByUuids = (uuids) => __awaiter(this, void 0, void 0, function* () {
|
|
1864
|
+
const { data } = yield this.request.get('/v1/token/list_by_uuids', {
|
|
1865
|
+
params: {
|
|
1866
|
+
uuids: uuids.join(','),
|
|
1867
|
+
},
|
|
1868
|
+
});
|
|
1869
|
+
return data;
|
|
1870
|
+
});
|
|
1871
|
+
this.getTokenKlineData = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1872
|
+
const { data } = yield this.request.get('/v1/token/market/kline', {
|
|
1873
|
+
params,
|
|
1874
|
+
});
|
|
1875
|
+
return data;
|
|
1876
|
+
});
|
|
1877
|
+
this.getTokenMarketInfo = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1878
|
+
const { data } = yield this.request.get('/v1/token/market/info', {
|
|
1879
|
+
params,
|
|
1880
|
+
});
|
|
1881
|
+
return data;
|
|
1882
|
+
});
|
|
1883
|
+
this.getTokenHolderInfo = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1884
|
+
const { data } = yield this.request.get('/v1/token/market/info/holders', {
|
|
1885
|
+
params,
|
|
1886
|
+
});
|
|
1887
|
+
return data;
|
|
1888
|
+
});
|
|
1889
|
+
this.getTokenSupplyInfo = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1890
|
+
const { data } = yield this.request.get('/v1/token/market/info/supply', {
|
|
1891
|
+
params,
|
|
1892
|
+
});
|
|
1893
|
+
return data;
|
|
1894
|
+
});
|
|
1895
|
+
this.postUserFeedback = (data) => __awaiter(this, void 0, void 0, function* () {
|
|
1896
|
+
const { data: response } = yield this.request.post('/v1/feedback/app', data);
|
|
1897
|
+
return response;
|
|
1898
|
+
});
|
|
1899
|
+
this.getUserFeedback = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
1900
|
+
const { data } = yield this.request.get('/v1/feedback/app', {
|
|
1901
|
+
params: { id },
|
|
1902
|
+
});
|
|
1903
|
+
return data;
|
|
1904
|
+
});
|
|
1905
|
+
this.getUserFeedbackList = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
1906
|
+
const ids = Array.isArray(id) ? id : [id];
|
|
1907
|
+
const { data } = yield this.request.post('/v1/feedback/app/list', {
|
|
1908
|
+
ids,
|
|
1909
|
+
});
|
|
1910
|
+
return data;
|
|
1911
|
+
});
|
|
1912
|
+
this.getCurrencyList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1913
|
+
const { data } = yield this.request.get('/v1/currency/exchange_list');
|
|
1914
|
+
return data;
|
|
1915
|
+
});
|
|
1916
|
+
this.getMarketSummary = ({ token_id, chain_id, }) => __awaiter(this, void 0, void 0, function* () {
|
|
1917
|
+
const { data } = yield this.request.get('/v1/token/market/summary', {
|
|
1918
|
+
params: {
|
|
1919
|
+
token_id,
|
|
1920
|
+
chain_id,
|
|
1921
|
+
},
|
|
1922
|
+
});
|
|
1923
|
+
return data;
|
|
1924
|
+
});
|
|
1925
|
+
this.getMarketTradingHistory = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1926
|
+
const { data } = yield this.request.get('/v1/token/market/trading_history/list', {
|
|
1927
|
+
params,
|
|
1928
|
+
});
|
|
1929
|
+
return data;
|
|
1930
|
+
});
|
|
1931
|
+
this.getTokenHolderSummary = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1932
|
+
const { data } = yield this.request.get('/v1/token/market/holders/summary', {
|
|
1933
|
+
params,
|
|
1934
|
+
});
|
|
1935
|
+
return data;
|
|
1936
|
+
});
|
|
1937
|
+
// top 10 holders
|
|
1938
|
+
this.getTokenHolderList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1939
|
+
const { data } = yield this.request.get('/v1/token/market/holders/list', {
|
|
1940
|
+
params,
|
|
1941
|
+
});
|
|
1942
|
+
return data;
|
|
1943
|
+
});
|
|
1944
|
+
// top 5
|
|
1945
|
+
this.getLiquidityPoolList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1946
|
+
const { data } = yield this.request.get('/v1/token/market/liquidity_pool/list', {
|
|
1947
|
+
params,
|
|
1948
|
+
});
|
|
1949
|
+
return data;
|
|
1950
|
+
});
|
|
1951
|
+
this.getLiquidityPoolHistoryList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1952
|
+
const { data } = yield this.request.get('/v1/token/market/liquidity_pool/history/list', {
|
|
1953
|
+
params,
|
|
1954
|
+
});
|
|
1955
|
+
return data;
|
|
1956
|
+
});
|
|
1957
|
+
this.getTokenMarketCategoryList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1958
|
+
const { data } = yield this.request.get('/v1/token/market/category_list');
|
|
1959
|
+
return data;
|
|
1960
|
+
});
|
|
1961
|
+
this.getNFTTradingConfig = () => __awaiter(this, void 0, void 0, function* () {
|
|
1962
|
+
const { data } = yield this.request.get('/v1/nft/trading_config');
|
|
1963
|
+
return data;
|
|
1964
|
+
});
|
|
1965
|
+
this.getNFTDetail = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1966
|
+
const { data } = yield this.request.get('/v1/nft', {
|
|
1967
|
+
params,
|
|
1968
|
+
});
|
|
1969
|
+
return data;
|
|
1970
|
+
});
|
|
1971
|
+
this.getNFTListingOrders = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1972
|
+
const { data } = yield this.request.get('/v1/nft/order/listing', {
|
|
1973
|
+
params,
|
|
1974
|
+
});
|
|
1975
|
+
return data;
|
|
1976
|
+
});
|
|
1977
|
+
this.getNFTFees = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1978
|
+
const { data } = yield this.request.get('/v1/nft/fee', {
|
|
1979
|
+
params,
|
|
1980
|
+
});
|
|
1981
|
+
return data;
|
|
1982
|
+
});
|
|
1983
|
+
this.prepareListingNFT = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
1984
|
+
const { data } = yield this.request.post('/v1/nft/order/listing/prepare', postData);
|
|
1985
|
+
return data;
|
|
1986
|
+
});
|
|
1987
|
+
this.createListingNFT = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
1988
|
+
const { data } = yield this.request.post('/v1/nft/order/listing/post', postData);
|
|
1989
|
+
return data;
|
|
1990
|
+
});
|
|
1991
|
+
this.prepareAcceptNFTOffer = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
1992
|
+
const { data } = yield this.request.post('/v1/nft/order/offer/accept/prepare', postData);
|
|
1993
|
+
return data;
|
|
1994
|
+
});
|
|
1995
|
+
this.submitAcceptNFTOfferTx = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
1996
|
+
const { data } = yield this.request.post('/v1/nft/order/offer/accept/tx', postData);
|
|
1997
|
+
return data;
|
|
1998
|
+
});
|
|
1999
|
+
this.checkTokenDepositForbidden = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
2000
|
+
const { data } = yield this.request.get('/v1/engine/token/deposit_forbidden', {
|
|
2001
|
+
params,
|
|
2002
|
+
});
|
|
2003
|
+
return data;
|
|
2004
|
+
});
|
|
2005
|
+
this.getPolyMarketPermission = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
2006
|
+
const { data } = yield this.request.get('v1/user/has_polymarket_permission', {
|
|
2007
|
+
params,
|
|
2008
|
+
});
|
|
2009
|
+
return data;
|
|
2010
|
+
});
|
|
2011
|
+
this.getDappPermission = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
2012
|
+
const { data } = yield this.request.get('v1/user/has_dapp_permission', {
|
|
2013
|
+
params,
|
|
2014
|
+
});
|
|
2015
|
+
return data;
|
|
2016
|
+
});
|
|
2017
|
+
this.getMemeList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
2018
|
+
const { data } = yield this.request.get('/v1/token/meme_list', {
|
|
2019
|
+
params,
|
|
2020
|
+
});
|
|
2021
|
+
return data;
|
|
2022
|
+
});
|
|
2023
|
+
this.getTokenMarketTokenList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
2024
|
+
const { data } = yield this.request.get('/v1/token/market/token_list', {
|
|
2025
|
+
params,
|
|
2026
|
+
});
|
|
2027
|
+
return data;
|
|
2028
|
+
});
|
|
1374
2029
|
if (store instanceof Promise) {
|
|
1375
2030
|
store.then((resolvedStore) => {
|
|
1376
2031
|
this.store = resolvedStore;
|
|
@@ -1387,13 +2042,18 @@ export class OpenApiService {
|
|
|
1387
2042
|
initSync(options) {
|
|
1388
2043
|
var _a, _b;
|
|
1389
2044
|
(_b = (_a = __classPrivateFieldGet(this, _OpenApiService_plugin, "f")).onInitiate) === null || _b === void 0 ? void 0 : _b.call(_a, Object.assign({}, options));
|
|
2045
|
+
const headers = {
|
|
2046
|
+
'X-Client': __classPrivateFieldGet(this, _OpenApiService_clientName, "f"),
|
|
2047
|
+
'X-Version': __classPrivateFieldGet(this, _OpenApiService_clientVersion, "f"),
|
|
2048
|
+
};
|
|
2049
|
+
if (this.store.apiKey && this.store.apiTime) {
|
|
2050
|
+
headers['X-API-Key'] = this.store.apiKey;
|
|
2051
|
+
headers['X-API-Time'] = this.store.apiTime;
|
|
2052
|
+
}
|
|
1390
2053
|
const request = axios.create({
|
|
1391
2054
|
baseURL: this.store.host,
|
|
1392
2055
|
adapter: __classPrivateFieldGet(this, _OpenApiService_adapter, "f"),
|
|
1393
|
-
headers
|
|
1394
|
-
'X-Client': __classPrivateFieldGet(this, _OpenApiService_clientName, "f"),
|
|
1395
|
-
'X-Version': __classPrivateFieldGet(this, _OpenApiService_clientVersion, "f"),
|
|
1396
|
-
},
|
|
2056
|
+
headers,
|
|
1397
2057
|
});
|
|
1398
2058
|
// sign after rateLimit, timestamp is the latest
|
|
1399
2059
|
request.interceptors.request.use((config) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1406,9 +2066,13 @@ export class OpenApiService {
|
|
|
1406
2066
|
}));
|
|
1407
2067
|
this.request = rateLimit(request, { maxRPS });
|
|
1408
2068
|
this.request.interceptors.response.use((response) => {
|
|
1409
|
-
var _a, _b, _c, _d;
|
|
1410
|
-
const
|
|
1411
|
-
|
|
2069
|
+
var _a, _b, _c, _d, _e;
|
|
2070
|
+
const newAPIKey = (_a = response.headers) === null || _a === void 0 ? void 0 : _a['x-set-api-key'];
|
|
2071
|
+
if (newAPIKey) {
|
|
2072
|
+
this.setAPIKey(newAPIKey);
|
|
2073
|
+
}
|
|
2074
|
+
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);
|
|
2075
|
+
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);
|
|
1412
2076
|
if (code && code !== 200) {
|
|
1413
2077
|
if (msg) {
|
|
1414
2078
|
let err;
|