@rabby-wallet/rabby-api 0.9.36 → 0.9.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -28
- package/dist/const.d.ts +3 -3
- package/dist/const.js +8 -8
- package/dist/index.d.ts +1283 -1276
- package/dist/index.js +1723 -1706
- package/dist/plugins/intf.d.ts +19 -19
- package/dist/plugins/intf.js +1 -1
- package/dist/plugins/web-sign.d.ts +2 -2
- package/dist/plugins/web-sign.js +39 -39
- package/dist/types.d.ts +1653 -1643
- package/dist/types.js +1 -1
- package/dist/utils.d.ts +13 -13
- package/dist/utils.js +55 -55
- package/package.json +57 -57
package/dist/index.js
CHANGED
|
@@ -1,1706 +1,1723 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
11
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
12
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
13
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
14
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
15
|
-
};
|
|
16
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
17
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
18
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
19
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
20
|
-
};
|
|
21
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
22
|
-
var t = {};
|
|
23
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
24
|
-
t[p] = s[p];
|
|
25
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
26
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
27
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
28
|
-
t[p[i]] = s[p[i]];
|
|
29
|
-
}
|
|
30
|
-
return t;
|
|
31
|
-
};
|
|
32
|
-
var _OpenApiService_adapter, _OpenApiService_plugin, _OpenApiService_clientName, _OpenApiService_clientVersion;
|
|
33
|
-
import axios from 'axios';
|
|
34
|
-
import rateLimit from 'axios-rate-limit';
|
|
35
|
-
import { ethErrors } from 'eth-rpc-errors';
|
|
36
|
-
import { genSignParams, sleep } from './utils';
|
|
37
|
-
import { omit } from 'lodash';
|
|
38
|
-
import { ASYNC_JOB_RETRY_DELAY, ASYNC_JOB_TIMEOUT } from './const';
|
|
39
|
-
var CurveDayType;
|
|
40
|
-
(function (CurveDayType) {
|
|
41
|
-
CurveDayType[CurveDayType["DAY"] = 1] = "DAY";
|
|
42
|
-
CurveDayType[CurveDayType["WEEK"] = 7] = "WEEK";
|
|
43
|
-
})(CurveDayType || (CurveDayType = {}));
|
|
44
|
-
const maxRPS = 500;
|
|
45
|
-
export class OpenApiService {
|
|
46
|
-
constructor(_a) {
|
|
47
|
-
var _b;
|
|
48
|
-
var { store, plugin, adapter, clientName = 'Rabby', clientVersion = (_b = process.env.release) !== null && _b !== void 0 ? _b : '0.0.0', } = _a;
|
|
49
|
-
_OpenApiService_adapter.set(this, void 0);
|
|
50
|
-
_OpenApiService_plugin.set(this, void 0);
|
|
51
|
-
_OpenApiService_clientName.set(this, void 0);
|
|
52
|
-
_OpenApiService_clientVersion.set(this, void 0);
|
|
53
|
-
this.setHost = (host) => __awaiter(this, void 0, void 0, function* () {
|
|
54
|
-
this.store.host = host;
|
|
55
|
-
yield this.init();
|
|
56
|
-
});
|
|
57
|
-
this.setHostSync = (host) => {
|
|
58
|
-
this.store.host = host;
|
|
59
|
-
this.initSync();
|
|
60
|
-
};
|
|
61
|
-
this.getHost = () => {
|
|
62
|
-
return this.store.host;
|
|
63
|
-
};
|
|
64
|
-
this.setTestnetHost = (host) => __awaiter(this, void 0, void 0, function* () {
|
|
65
|
-
this.store.testnetHost = host;
|
|
66
|
-
});
|
|
67
|
-
this.getTestnetHost = () => {
|
|
68
|
-
return this.store.testnetHost;
|
|
69
|
-
};
|
|
70
|
-
this.ethRpc = () => __awaiter(this, void 0, void 0, function* () {
|
|
71
|
-
throw ethErrors.provider.disconnected();
|
|
72
|
-
});
|
|
73
|
-
this.init = (options) => __awaiter(this, void 0, void 0, function* () {
|
|
74
|
-
var _c, _d;
|
|
75
|
-
options = typeof options === 'string' ? { webHf: options } : options;
|
|
76
|
-
yield ((_d = (_c = __classPrivateFieldGet(this, _OpenApiService_plugin, "f")).onInitiateAsync) === null || _d === void 0 ? void 0 : _d.call(_c, Object.assign({}, options)));
|
|
77
|
-
this.initSync(Object.assign({}, options));
|
|
78
|
-
});
|
|
79
|
-
this.asyncJob = (url, options) => {
|
|
80
|
-
const _option = Object.assign({ timeout: ASYNC_JOB_TIMEOUT, retryDelay: ASYNC_JOB_RETRY_DELAY }, options);
|
|
81
|
-
const startTime = +new Date();
|
|
82
|
-
return this.request(url, omit(Object.assign({ method: 'GET' }, _option), 'retryDelay')).then((res) => {
|
|
83
|
-
const data = res.data;
|
|
84
|
-
if (data.result) {
|
|
85
|
-
return data.result.data;
|
|
86
|
-
}
|
|
87
|
-
const deltaTime = +new Date() - startTime;
|
|
88
|
-
_option.timeout = _option.timeout - deltaTime - _option.retryDelay;
|
|
89
|
-
return sleep(_option.retryDelay, _option.signal).then(() => this.asyncJob(url, _option));
|
|
90
|
-
});
|
|
91
|
-
};
|
|
92
|
-
this._mountMethods = () => {
|
|
93
|
-
this.ethRpc = (chain_id, { origin = 'rabby', method, params }) => {
|
|
94
|
-
return this.request
|
|
95
|
-
.post(`/v1/wallet/eth_rpc?origin=${origin}&method=${method}`, {
|
|
96
|
-
chain_id,
|
|
97
|
-
method,
|
|
98
|
-
params,
|
|
99
|
-
})
|
|
100
|
-
.then(({ data }) => {
|
|
101
|
-
if (data === null || data === void 0 ? void 0 : data.error) {
|
|
102
|
-
throw data.error;
|
|
103
|
-
}
|
|
104
|
-
return data === null || data === void 0 ? void 0 : data.result;
|
|
105
|
-
});
|
|
106
|
-
};
|
|
107
|
-
};
|
|
108
|
-
this.getRecommendChains = (address, origin) => __awaiter(this, void 0, void 0, function* () {
|
|
109
|
-
const { data } = yield this.request.get('/v1/wallet/recommend_chains', {
|
|
110
|
-
params: {
|
|
111
|
-
user_addr: address,
|
|
112
|
-
origin,
|
|
113
|
-
},
|
|
114
|
-
});
|
|
115
|
-
return data;
|
|
116
|
-
});
|
|
117
|
-
this.getTotalBalance = (address, isCore = false) => __awaiter(this, void 0, void 0, function* () {
|
|
118
|
-
const { data } = yield this.request.get('/v1/user/total_balance', {
|
|
119
|
-
params: {
|
|
120
|
-
id: address,
|
|
121
|
-
is_core: isCore,
|
|
122
|
-
},
|
|
123
|
-
});
|
|
124
|
-
return data;
|
|
125
|
-
});
|
|
126
|
-
this.getTotalBalanceV2 = ({ address, isCore = false, included_token_uuids = [], excluded_token_uuids = [], excluded_protocol_ids = [], excluded_chain_ids = [], }) => __awaiter(this, void 0, void 0, function* () {
|
|
127
|
-
const { data } = yield this.request.post('/v2/user/total_balance', {
|
|
128
|
-
id: address,
|
|
129
|
-
is_core: isCore,
|
|
130
|
-
included_token_uuids: included_token_uuids,
|
|
131
|
-
excluded_token_uuids: excluded_token_uuids,
|
|
132
|
-
excluded_protocol_ids: excluded_protocol_ids,
|
|
133
|
-
excluded_chain_ids: excluded_chain_ids,
|
|
134
|
-
});
|
|
135
|
-
return data;
|
|
136
|
-
});
|
|
137
|
-
this.getPendingCount = (address) => __awaiter(this, void 0, void 0, function* () {
|
|
138
|
-
const { data } = yield this.request.get('/v1/wallet/pending_tx_count', {
|
|
139
|
-
params: {
|
|
140
|
-
user_addr: address,
|
|
141
|
-
},
|
|
142
|
-
});
|
|
143
|
-
return data;
|
|
144
|
-
});
|
|
145
|
-
this.checkOrigin = (address, origin) => __awaiter(this, void 0, void 0, function* () {
|
|
146
|
-
const { data } = yield this.request.post('/v1/wallet/check_origin', {
|
|
147
|
-
user_addr: address,
|
|
148
|
-
origin,
|
|
149
|
-
});
|
|
150
|
-
return data;
|
|
151
|
-
});
|
|
152
|
-
this.checkText = (address, origin, text) => __awaiter(this, void 0, void 0, function* () {
|
|
153
|
-
const { data } = yield this.request.post('/v1/wallet/check_text', {
|
|
154
|
-
user_addr: address,
|
|
155
|
-
origin,
|
|
156
|
-
text,
|
|
157
|
-
});
|
|
158
|
-
return data;
|
|
159
|
-
});
|
|
160
|
-
this.checkTx = (tx, origin, address, update_nonce = false) => __awaiter(this, void 0, void 0, function* () {
|
|
161
|
-
const { data } = yield this.request.post('/v1/wallet/check_tx', {
|
|
162
|
-
user_addr: address,
|
|
163
|
-
origin,
|
|
164
|
-
tx,
|
|
165
|
-
update_nonce,
|
|
166
|
-
});
|
|
167
|
-
return data;
|
|
168
|
-
});
|
|
169
|
-
this.preExecTx = ({ tx, origin, address, updateNonce = false, pending_tx_list = [], delegate_call, }) => __awaiter(this, void 0, void 0, function* () {
|
|
170
|
-
const { data } = yield this.request.post('/v1/wallet/pre_exec_tx', {
|
|
171
|
-
tx,
|
|
172
|
-
user_addr: address,
|
|
173
|
-
origin,
|
|
174
|
-
update_nonce: updateNonce,
|
|
175
|
-
pending_tx_list,
|
|
176
|
-
delegate_call,
|
|
177
|
-
});
|
|
178
|
-
return data;
|
|
179
|
-
});
|
|
180
|
-
this.historyGasUsed = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
181
|
-
const { data } = yield this.request.post('/v1/wallet/history_tx_used_gas', Object.assign({}, params));
|
|
182
|
-
return data;
|
|
183
|
-
});
|
|
184
|
-
this.pendingTxList = (tx, origin, address, update_nonce = false) => __awaiter(this, void 0, void 0, function* () {
|
|
185
|
-
const { data } = yield this.request.post('/v1/wallet/pending_tx_list', {
|
|
186
|
-
tx,
|
|
187
|
-
user_addr: address,
|
|
188
|
-
origin,
|
|
189
|
-
update_nonce,
|
|
190
|
-
});
|
|
191
|
-
return data;
|
|
192
|
-
});
|
|
193
|
-
this.traceTx = (txId, traceId, chainId) => __awaiter(this, void 0, void 0, function* () {
|
|
194
|
-
const { data } = yield this.request.post('/v1/wallet/trace_tx', {
|
|
195
|
-
tx_id: txId,
|
|
196
|
-
trace_id: traceId,
|
|
197
|
-
chain_id: chainId,
|
|
198
|
-
});
|
|
199
|
-
return data;
|
|
200
|
-
});
|
|
201
|
-
this.pushTx = (tx, traceId) => __awaiter(this, void 0, void 0, function* () {
|
|
202
|
-
const { data } = yield this.request.post('/v1/wallet/push_tx', {
|
|
203
|
-
tx,
|
|
204
|
-
trace_id: traceId,
|
|
205
|
-
});
|
|
206
|
-
return data;
|
|
207
|
-
});
|
|
208
|
-
this.explainText = (origin, address, text) => __awaiter(this, void 0, void 0, function* () {
|
|
209
|
-
const { data } = yield this.request.post('/v1/wallet/explain_text', {
|
|
210
|
-
user_addr: address,
|
|
211
|
-
origin,
|
|
212
|
-
text,
|
|
213
|
-
});
|
|
214
|
-
return data;
|
|
215
|
-
});
|
|
216
|
-
this.gasMarket = (chainId, customGas) => __awaiter(this, void 0, void 0, function* () {
|
|
217
|
-
const { data } = yield this.request.get('/v1/wallet/gas_market', {
|
|
218
|
-
params: {
|
|
219
|
-
chain_id: chainId,
|
|
220
|
-
custom_price: customGas,
|
|
221
|
-
},
|
|
222
|
-
});
|
|
223
|
-
return data;
|
|
224
|
-
});
|
|
225
|
-
this.gasMarketV2 = (options) => __awaiter(this, void 0, void 0, function* () {
|
|
226
|
-
const { data } = yield this.request.post('/v2/wallet/gas_market', {
|
|
227
|
-
chain_id: options.chainId,
|
|
228
|
-
custom_price: options.customGas,
|
|
229
|
-
tx: options.tx,
|
|
230
|
-
});
|
|
231
|
-
return data;
|
|
232
|
-
});
|
|
233
|
-
this.getTx = (chainId, hash, gasPrice) => __awaiter(this, void 0, void 0, function* () {
|
|
234
|
-
const { data } = yield this.request.get('/v1/wallet/get_tx', {
|
|
235
|
-
params: {
|
|
236
|
-
chain_id: chainId,
|
|
237
|
-
gas_price: gasPrice,
|
|
238
|
-
tx_id: hash,
|
|
239
|
-
},
|
|
240
|
-
});
|
|
241
|
-
return data;
|
|
242
|
-
});
|
|
243
|
-
this.getEnsAddressByName = (name) => __awaiter(this, void 0, void 0, function* () {
|
|
244
|
-
const { data } = yield this.request.get('/v1/wallet/ens', {
|
|
245
|
-
params: {
|
|
246
|
-
text: name,
|
|
247
|
-
},
|
|
248
|
-
});
|
|
249
|
-
return data;
|
|
250
|
-
});
|
|
251
|
-
this.searchToken = (id, q, chainId, is_all = false) => __awaiter(this, void 0, void 0, function* () {
|
|
252
|
-
const { data } = yield this.request.get('/v1/user/token_search', {
|
|
253
|
-
params: {
|
|
254
|
-
id,
|
|
255
|
-
q,
|
|
256
|
-
has_balance: false,
|
|
257
|
-
is_all,
|
|
258
|
-
chain_id: chainId,
|
|
259
|
-
},
|
|
260
|
-
});
|
|
261
|
-
return data;
|
|
262
|
-
});
|
|
263
|
-
this.searchSwapToken = (id, chainId, q, is_all = false) => __awaiter(this, void 0, void 0, function* () {
|
|
264
|
-
const { data } = yield this.request.get('/v1/user/token_search', {
|
|
265
|
-
params: {
|
|
266
|
-
id,
|
|
267
|
-
chain_id: chainId,
|
|
268
|
-
q,
|
|
269
|
-
is_all,
|
|
270
|
-
},
|
|
271
|
-
});
|
|
272
|
-
return data;
|
|
273
|
-
});
|
|
274
|
-
this.getToken = (id, chainId, tokenId) => __awaiter(this, void 0, void 0, function* () {
|
|
275
|
-
const { data } = yield this.request.get('/v1/user/token', {
|
|
276
|
-
params: {
|
|
277
|
-
id,
|
|
278
|
-
chain_id: chainId,
|
|
279
|
-
token_id: tokenId,
|
|
280
|
-
},
|
|
281
|
-
});
|
|
282
|
-
return data;
|
|
283
|
-
});
|
|
284
|
-
this.getCachedTokenList = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
285
|
-
const { data } = yield this.request.get('/v1/user/cache_token_list', {
|
|
286
|
-
params: {
|
|
287
|
-
id,
|
|
288
|
-
},
|
|
289
|
-
});
|
|
290
|
-
return data;
|
|
291
|
-
});
|
|
292
|
-
this.listToken = (id, chainId, isAll = false) => __awaiter(this, void 0, void 0, function* () {
|
|
293
|
-
const { data } = yield this.request.get('/v1/user/token_list', {
|
|
294
|
-
params: {
|
|
295
|
-
id,
|
|
296
|
-
is_all: isAll,
|
|
297
|
-
chain_id: chainId,
|
|
298
|
-
},
|
|
299
|
-
});
|
|
300
|
-
return data;
|
|
301
|
-
});
|
|
302
|
-
this.getTokenEntity = (id, chainId) => __awaiter(this, void 0, void 0, function* () {
|
|
303
|
-
const { data } = yield this.request.get('/v1/token/identity', {
|
|
304
|
-
params: {
|
|
305
|
-
id,
|
|
306
|
-
chain_id: chainId,
|
|
307
|
-
},
|
|
308
|
-
});
|
|
309
|
-
return data;
|
|
310
|
-
});
|
|
311
|
-
this.getHistoryTokenList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
312
|
-
const { data } = yield this.request.get('/v1/user/history_token_list', {
|
|
313
|
-
params: {
|
|
314
|
-
id: params.id,
|
|
315
|
-
chain_id: params.chainId,
|
|
316
|
-
time_at: params.timeAt,
|
|
317
|
-
date_at: params.dateAt,
|
|
318
|
-
},
|
|
319
|
-
});
|
|
320
|
-
return data;
|
|
321
|
-
});
|
|
322
|
-
this.customListToken = (uuids, id) => __awaiter(this, void 0, void 0, function* () {
|
|
323
|
-
if (!(uuids === null || uuids === void 0 ? void 0 : uuids.length) || !id) {
|
|
324
|
-
return [];
|
|
325
|
-
}
|
|
326
|
-
const { data } = yield this.request.post('/v1/user/specific_token_list', {
|
|
327
|
-
id,
|
|
328
|
-
uuids,
|
|
329
|
-
});
|
|
330
|
-
return data;
|
|
331
|
-
});
|
|
332
|
-
this.listChainAssets = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
333
|
-
const { data } = yield this.request.get('/v1/user/simple_protocol_list', {
|
|
334
|
-
params: {
|
|
335
|
-
id,
|
|
336
|
-
},
|
|
337
|
-
});
|
|
338
|
-
return data;
|
|
339
|
-
});
|
|
340
|
-
this.listNFT = (id, isAll = true, sortByCredit) => __awaiter(this, void 0, void 0, function* () {
|
|
341
|
-
const { data } = yield this.request.get('/v1/user/nft_list', {
|
|
342
|
-
params: Object.assign({
|
|
343
|
-
id,
|
|
344
|
-
is_all: isAll,
|
|
345
|
-
}, sortByCredit
|
|
346
|
-
? {
|
|
347
|
-
sort_by: 'credit_score',
|
|
348
|
-
}
|
|
349
|
-
: {}),
|
|
350
|
-
});
|
|
351
|
-
return data;
|
|
352
|
-
});
|
|
353
|
-
this.listCollection = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
354
|
-
const { data } = yield this.request.get('/v1/nft/collections', {
|
|
355
|
-
params,
|
|
356
|
-
});
|
|
357
|
-
return data;
|
|
358
|
-
});
|
|
359
|
-
this.listTxHisotry = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
360
|
-
const { data } = yield this.request.get('/v1/user/history_list', {
|
|
361
|
-
params,
|
|
362
|
-
});
|
|
363
|
-
return data;
|
|
364
|
-
});
|
|
365
|
-
this.getAllTxHistory = (params, options) => __awaiter(this, void 0, void 0, function* () {
|
|
366
|
-
const data = yield this.asyncJob('/v1/user/history_all_list', Object.assign({ method: 'GET', params }, options));
|
|
367
|
-
return data;
|
|
368
|
-
});
|
|
369
|
-
this.tokenPrice = (tokenName) => __awaiter(this, void 0, void 0, function* () {
|
|
370
|
-
const { data } = yield this.request.get('/v1/token/price_change', {
|
|
371
|
-
params: {
|
|
372
|
-
token: tokenName,
|
|
373
|
-
},
|
|
374
|
-
});
|
|
375
|
-
return data;
|
|
376
|
-
});
|
|
377
|
-
this.tokenAuthorizedList = (id, chain_id, options) => __awaiter(this, void 0, void 0, function* () {
|
|
378
|
-
const { restfulPrefix = 'v1' } = options || {};
|
|
379
|
-
const { data } = yield this.request.get(`/${restfulPrefix}/user/token_authorized_list`, {
|
|
380
|
-
params: {
|
|
381
|
-
id,
|
|
382
|
-
chain_id,
|
|
383
|
-
},
|
|
384
|
-
});
|
|
385
|
-
return data;
|
|
386
|
-
});
|
|
387
|
-
this.userNFTAuthorizedList = (id, chain_id) => __awaiter(this, void 0, void 0, function* () {
|
|
388
|
-
const { data } = yield this.request.get('/v1/user/nft_authorized_list', {
|
|
389
|
-
params: {
|
|
390
|
-
id,
|
|
391
|
-
chain_id,
|
|
392
|
-
},
|
|
393
|
-
});
|
|
394
|
-
return data;
|
|
395
|
-
});
|
|
396
|
-
this.getDEXList = (chain_id) => __awaiter(this, void 0, void 0, function* () {
|
|
397
|
-
const { data } = yield this.request.get('/v1/wallet/swap_dex_list', {
|
|
398
|
-
params: {
|
|
399
|
-
chain_id,
|
|
400
|
-
},
|
|
401
|
-
});
|
|
402
|
-
return data;
|
|
403
|
-
});
|
|
404
|
-
this.getSwapQuote = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
405
|
-
const { data } = yield this.request.get('/v1/wallet/swap_quote', {
|
|
406
|
-
params,
|
|
407
|
-
timeout: 5000,
|
|
408
|
-
});
|
|
409
|
-
return data;
|
|
410
|
-
});
|
|
411
|
-
this.getSwapTokenList = (id, chainId) => __awaiter(this, void 0, void 0, function* () {
|
|
412
|
-
const { data } = yield this.request.get('/v1/wallet/swap_token_list', {
|
|
413
|
-
params: {
|
|
414
|
-
id,
|
|
415
|
-
chain_id: chainId,
|
|
416
|
-
is_all: false,
|
|
417
|
-
},
|
|
418
|
-
});
|
|
419
|
-
return data;
|
|
420
|
-
});
|
|
421
|
-
this.postGasStationOrder = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
422
|
-
const { data } = yield this.request.post('/v1/wallet/gas_station_order', {
|
|
423
|
-
order: {
|
|
424
|
-
user_addr: params.userAddr,
|
|
425
|
-
from_chain_id: params.fromChainId,
|
|
426
|
-
from_tx_id: params.fromTxId,
|
|
427
|
-
from_token_id: params.fromTokenId,
|
|
428
|
-
from_token_amount: params.fromTokenAmount,
|
|
429
|
-
to_chain_id: params.toChainId,
|
|
430
|
-
to_token_amount: params.toTokenAmount,
|
|
431
|
-
from_usd_value: params.fromUsdValue,
|
|
432
|
-
},
|
|
433
|
-
});
|
|
434
|
-
return data;
|
|
435
|
-
});
|
|
436
|
-
this.getGasStationChainBalance = (chain_id, addr) => __awaiter(this, void 0, void 0, function* () {
|
|
437
|
-
const { data } = yield this.request.get('/v1/wallet/gas_station_usd_value', {
|
|
438
|
-
params: {
|
|
439
|
-
chain_id,
|
|
440
|
-
addr,
|
|
441
|
-
},
|
|
442
|
-
});
|
|
443
|
-
return data;
|
|
444
|
-
});
|
|
445
|
-
this.getApprovalCount = (address) => __awaiter(this, void 0, void 0, function* () {
|
|
446
|
-
const { data } = yield this.request.get('/v1/user/total_approval_asset_cnt', {
|
|
447
|
-
params: {
|
|
448
|
-
id: address,
|
|
449
|
-
},
|
|
450
|
-
});
|
|
451
|
-
return data;
|
|
452
|
-
});
|
|
453
|
-
this.getGasStationTokenList = () => __awaiter(this, void 0, void 0, function* () {
|
|
454
|
-
const { data } = yield this.request.get('/v1/wallet/gas_station_token_list');
|
|
455
|
-
return data;
|
|
456
|
-
});
|
|
457
|
-
this.explainTypedData = (user_addr, origin, data) => __awaiter(this, void 0, void 0, function* () {
|
|
458
|
-
const { data: resData } = yield this.request.post('/v1/wallet/explain_typed_data', {
|
|
459
|
-
user_addr,
|
|
460
|
-
origin,
|
|
461
|
-
data,
|
|
462
|
-
});
|
|
463
|
-
return resData;
|
|
464
|
-
});
|
|
465
|
-
this.checkTypedData = (user_addr, origin, data) => __awaiter(this, void 0, void 0, function* () {
|
|
466
|
-
const { data: resData } = yield this.request.post('/v1/wallet/check_typed_data', {
|
|
467
|
-
user_addr,
|
|
468
|
-
origin,
|
|
469
|
-
data,
|
|
470
|
-
});
|
|
471
|
-
return resData;
|
|
472
|
-
});
|
|
473
|
-
this.approvalStatus = (id, options) => __awaiter(this, void 0, void 0, function* () {
|
|
474
|
-
const { restfulPrefix = 'v1' } = options || {};
|
|
475
|
-
const { data } = yield this.request.get(`/${restfulPrefix}/user/approval_status`, {
|
|
476
|
-
params: {
|
|
477
|
-
id,
|
|
478
|
-
},
|
|
479
|
-
});
|
|
480
|
-
return data;
|
|
481
|
-
});
|
|
482
|
-
this.usedChainList = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
483
|
-
const { data } = yield this.request.get('/v1/user/used_chain_list', {
|
|
484
|
-
params: {
|
|
485
|
-
id,
|
|
486
|
-
},
|
|
487
|
-
});
|
|
488
|
-
return data;
|
|
489
|
-
});
|
|
490
|
-
this.getLatestVersion = () => __awaiter(this, void 0, void 0, function* () {
|
|
491
|
-
const { data } = yield this.request.get('/v1/wallet/version');
|
|
492
|
-
return data;
|
|
493
|
-
});
|
|
494
|
-
this.addOriginFeedback = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
495
|
-
const { data } = yield this.request.post('/v1/wallet/add_origin_feedback', {
|
|
496
|
-
user_addr: params.user_addr,
|
|
497
|
-
origin: params.origin,
|
|
498
|
-
is_safe: params.is_safe,
|
|
499
|
-
});
|
|
500
|
-
return data;
|
|
501
|
-
});
|
|
502
|
-
this.getProtocolList = (addr) => __awaiter(this, void 0, void 0, function* () {
|
|
503
|
-
const { data } = yield this.request.get('/v1/user/protocol_list', {
|
|
504
|
-
params: {
|
|
505
|
-
id: addr,
|
|
506
|
-
},
|
|
507
|
-
});
|
|
508
|
-
return data;
|
|
509
|
-
});
|
|
510
|
-
this.getComplexProtocolList = (addr) => __awaiter(this, void 0, void 0, function* () {
|
|
511
|
-
const { data } = yield this.request.get('/v1/user/complex_protocol_list', {
|
|
512
|
-
params: {
|
|
513
|
-
id: addr,
|
|
514
|
-
},
|
|
515
|
-
});
|
|
516
|
-
return data;
|
|
517
|
-
});
|
|
518
|
-
this.getProtocol = ({ addr, id, }) => __awaiter(this, void 0, void 0, function* () {
|
|
519
|
-
const { data } = yield this.request.get('/v1/user/protocol', {
|
|
520
|
-
params: {
|
|
521
|
-
id: addr,
|
|
522
|
-
protocol_id: id,
|
|
523
|
-
},
|
|
524
|
-
});
|
|
525
|
-
return data;
|
|
526
|
-
});
|
|
527
|
-
this.getHistoryProtocol = ({ addr, id, timeAt, dateAt, }) => __awaiter(this, void 0, void 0, function* () {
|
|
528
|
-
const { data } = yield this.request.get('/v1/user/history_protocol', {
|
|
529
|
-
params: {
|
|
530
|
-
id: addr,
|
|
531
|
-
protocol_id: id,
|
|
532
|
-
time_at: timeAt,
|
|
533
|
-
date_at: dateAt,
|
|
534
|
-
},
|
|
535
|
-
});
|
|
536
|
-
return data;
|
|
537
|
-
});
|
|
538
|
-
this.getTokenHistoryPrice = ({ chainId, id, timeAt, }) => __awaiter(this, void 0, void 0, function* () {
|
|
539
|
-
const { data } = yield this.request.get('/v1/token/history_price', {
|
|
540
|
-
params: {
|
|
541
|
-
chain_id: chainId,
|
|
542
|
-
id,
|
|
543
|
-
time_at: timeAt,
|
|
544
|
-
},
|
|
545
|
-
});
|
|
546
|
-
return data;
|
|
547
|
-
});
|
|
548
|
-
this.getTokenHistoryDict = ({ chainId, ids, timeAt, }) => __awaiter(this, void 0, void 0, function* () {
|
|
549
|
-
const { data } = yield this.request.get('/v1/token/history_price_dict', {
|
|
550
|
-
params: {
|
|
551
|
-
chain_id: chainId,
|
|
552
|
-
ids,
|
|
553
|
-
time_at: timeAt,
|
|
554
|
-
},
|
|
555
|
-
});
|
|
556
|
-
return data;
|
|
557
|
-
});
|
|
558
|
-
this.getNetCurve = (addr, days = CurveDayType.DAY) => __awaiter(this, void 0, void 0, function* () {
|
|
559
|
-
const { data } = yield this.request.get('/v1/user/total_net_curve', {
|
|
560
|
-
params: {
|
|
561
|
-
id: addr,
|
|
562
|
-
days,
|
|
563
|
-
},
|
|
564
|
-
});
|
|
565
|
-
return data;
|
|
566
|
-
});
|
|
567
|
-
this.getChainList = () => __awaiter(this, void 0, void 0, function* () {
|
|
568
|
-
const { data } = yield this.request.get('/v1/chain/list');
|
|
569
|
-
return data;
|
|
570
|
-
});
|
|
571
|
-
this.getCEXSwapQuote = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
572
|
-
const { data } = yield this.request.get('/v1/wallet/cex_swap_quote', {
|
|
573
|
-
params,
|
|
574
|
-
});
|
|
575
|
-
return data;
|
|
576
|
-
});
|
|
577
|
-
this.getSwapTradeList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
578
|
-
const { data } = yield this.request.get('/v1/wallet/swap_trade_list', {
|
|
579
|
-
params,
|
|
580
|
-
});
|
|
581
|
-
return data;
|
|
582
|
-
});
|
|
583
|
-
this.getSwapTradeListV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
584
|
-
const { data } = yield this.request.get('/v2/wallet/swap_trade_list', {
|
|
585
|
-
params,
|
|
586
|
-
});
|
|
587
|
-
return data;
|
|
588
|
-
});
|
|
589
|
-
this.postSwap = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
590
|
-
const { data } = yield this.request.post('/v1/wallet/swap_trade', params);
|
|
591
|
-
return data;
|
|
592
|
-
});
|
|
593
|
-
this.checkSlippage = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
594
|
-
const { data } = yield this.request.get('/v1/wallet/check_slippage', {
|
|
595
|
-
params,
|
|
596
|
-
});
|
|
597
|
-
return data;
|
|
598
|
-
});
|
|
599
|
-
this.suggestSlippage = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
600
|
-
const { data } = yield this.request.get('v1/wallet/suggest_slippage', {
|
|
601
|
-
params,
|
|
602
|
-
});
|
|
603
|
-
return data;
|
|
604
|
-
});
|
|
605
|
-
this.getOriginPopularityLevel = (origin) => __awaiter(this, void 0, void 0, function* () {
|
|
606
|
-
const { data } = yield this.request.get('/v1/engine/origin/popularity_level', {
|
|
607
|
-
params: {
|
|
608
|
-
origin,
|
|
609
|
-
},
|
|
610
|
-
});
|
|
611
|
-
return data;
|
|
612
|
-
});
|
|
613
|
-
this.getOriginIsScam = (origin, source) => __awaiter(this, void 0, void 0, function* () {
|
|
614
|
-
const { data } = yield this.request.get('/v1/engine/origin/is_scam', {
|
|
615
|
-
params: {
|
|
616
|
-
origin,
|
|
617
|
-
source,
|
|
618
|
-
},
|
|
619
|
-
});
|
|
620
|
-
return data;
|
|
621
|
-
});
|
|
622
|
-
this.getOriginThirdPartyCollectList = (origin) => __awaiter(this, void 0, void 0, function* () {
|
|
623
|
-
const { data } = yield this.request.get('/v1/engine/origin/third_party_collect_list', {
|
|
624
|
-
params: {
|
|
625
|
-
origin,
|
|
626
|
-
},
|
|
627
|
-
});
|
|
628
|
-
return data;
|
|
629
|
-
});
|
|
630
|
-
this.getSummarizedAssetList = (id, chain_id) => __awaiter(this, void 0, void 0, function* () {
|
|
631
|
-
const { data } = yield this.request.get('/v1/user/summarized_asset_list', {
|
|
632
|
-
params: {
|
|
633
|
-
id,
|
|
634
|
-
chain_id,
|
|
635
|
-
},
|
|
636
|
-
});
|
|
637
|
-
return data;
|
|
638
|
-
});
|
|
639
|
-
this.unexpectedAddrList = ({ chainId, tx, origin, addr, }) => __awaiter(this, void 0, void 0, function* () {
|
|
640
|
-
const { data } = yield this.request.post('/v1/engine/addr/unexpected_list', {
|
|
641
|
-
chain_id: chainId,
|
|
642
|
-
tx,
|
|
643
|
-
origin,
|
|
644
|
-
user_addr: addr,
|
|
645
|
-
});
|
|
646
|
-
return data;
|
|
647
|
-
});
|
|
648
|
-
this.gasLessTxCheck = ({ tx, usdValue, preExecSuccess, gasUsed, }) => __awaiter(this, void 0, void 0, function* () {
|
|
649
|
-
const { data } = yield this.request.post('/v1/wallet/tx_is_gasless', {
|
|
650
|
-
gas_used: gasUsed,
|
|
651
|
-
pre_exec_success: preExecSuccess,
|
|
652
|
-
tx,
|
|
653
|
-
usd_value: usdValue,
|
|
654
|
-
});
|
|
655
|
-
return data;
|
|
656
|
-
});
|
|
657
|
-
this.gasLessTxsCheck = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
658
|
-
const { data } = yield this.request.post('/v1/wallet/txs_is_gasless', postData);
|
|
659
|
-
return data;
|
|
660
|
-
});
|
|
661
|
-
this.parseTx = ({ chainId, tx, origin, addr, }) => __awaiter(this, void 0, void 0, function* () {
|
|
662
|
-
const { data } = yield this.request.post('/v1/engine/action/parse_tx', {
|
|
663
|
-
chain_id: chainId,
|
|
664
|
-
tx,
|
|
665
|
-
origin,
|
|
666
|
-
user_addr: addr,
|
|
667
|
-
});
|
|
668
|
-
return data;
|
|
669
|
-
});
|
|
670
|
-
this.isSuspiciousToken = (id, chainId) => __awaiter(this, void 0, void 0, function* () {
|
|
671
|
-
const { data } = yield this.request.get('/v1/engine/token/is_suspicious', {
|
|
672
|
-
params: {
|
|
673
|
-
chain_id: chainId,
|
|
674
|
-
id,
|
|
675
|
-
},
|
|
676
|
-
});
|
|
677
|
-
return data;
|
|
678
|
-
});
|
|
679
|
-
this.depositCexSupport = (id, chainId, cexId) => __awaiter(this, void 0, void 0, function* () {
|
|
680
|
-
const { data } = yield this.request.get('/v1/engine/token/deposit_cex_support', {
|
|
681
|
-
params: {
|
|
682
|
-
chain_id: chainId,
|
|
683
|
-
id,
|
|
684
|
-
cex_id: cexId,
|
|
685
|
-
},
|
|
686
|
-
});
|
|
687
|
-
return data;
|
|
688
|
-
});
|
|
689
|
-
// Token 可充值的 CEX 列表
|
|
690
|
-
this.depositCexList = (id, chainId) => __awaiter(this, void 0, void 0, function* () {
|
|
691
|
-
const { data } = yield this.request.get('/v1/engine/token/deposit_cex_list', {
|
|
692
|
-
params: {
|
|
693
|
-
chain_id: chainId,
|
|
694
|
-
id,
|
|
695
|
-
},
|
|
696
|
-
});
|
|
697
|
-
return data;
|
|
698
|
-
});
|
|
699
|
-
// 合约信用分
|
|
700
|
-
this.getContractCredit = (id, chainId) => __awaiter(this, void 0, void 0, function* () {
|
|
701
|
-
const { data } = yield this.request.get('/v1/engine/contract/credit', {
|
|
702
|
-
params: {
|
|
703
|
-
chain_id: chainId,
|
|
704
|
-
id,
|
|
705
|
-
},
|
|
706
|
-
});
|
|
707
|
-
return data;
|
|
708
|
-
});
|
|
709
|
-
// 是否跟地址交互过
|
|
710
|
-
this.hasInteraction = (addr, chainId, contractId) => __awaiter(this, void 0, void 0, function* () {
|
|
711
|
-
const { data } = yield this.request.get('/v1/engine/contract/has_interaction', {
|
|
712
|
-
params: {
|
|
713
|
-
chain_id: chainId,
|
|
714
|
-
user_addr: addr,
|
|
715
|
-
contract_id: contractId,
|
|
716
|
-
},
|
|
717
|
-
});
|
|
718
|
-
return data;
|
|
719
|
-
});
|
|
720
|
-
/**
|
|
721
|
-
* @deprecated
|
|
722
|
-
* 授权风险敞口
|
|
723
|
-
*/
|
|
724
|
-
this.tokenApproveExposure = (id, chainId) => __awaiter(this, void 0, void 0, function* () {
|
|
725
|
-
const { data } = yield this.request.get('/v1/engine/contract/token_approval_exposure', {
|
|
726
|
-
params: {
|
|
727
|
-
chain_id: chainId,
|
|
728
|
-
id,
|
|
729
|
-
},
|
|
730
|
-
});
|
|
731
|
-
return data;
|
|
732
|
-
});
|
|
733
|
-
this.tokenApproveTrustValue = (id, chainId) => __awaiter(this, void 0, void 0, function* () {
|
|
734
|
-
const { data } = yield this.request.get('/v1/engine/contract/spend_usd_value', {
|
|
735
|
-
params: {
|
|
736
|
-
chain_id: chainId,
|
|
737
|
-
id,
|
|
738
|
-
},
|
|
739
|
-
});
|
|
740
|
-
return data;
|
|
741
|
-
});
|
|
742
|
-
this.getContractInfo = (id, chainId) => __awaiter(this, void 0, void 0, function* () {
|
|
743
|
-
const { data } = yield this.request.get('/v1/contract', {
|
|
744
|
-
params: {
|
|
745
|
-
chain_id: chainId,
|
|
746
|
-
id,
|
|
747
|
-
},
|
|
748
|
-
});
|
|
749
|
-
return data.contract;
|
|
750
|
-
});
|
|
751
|
-
// 地址描述
|
|
752
|
-
this.addrDesc = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
753
|
-
const { data } = yield this.request.get('/v1/engine/addr/desc', {
|
|
754
|
-
params: {
|
|
755
|
-
id,
|
|
756
|
-
},
|
|
757
|
-
});
|
|
758
|
-
return data;
|
|
759
|
-
});
|
|
760
|
-
// 两个地址是否发生过转账
|
|
761
|
-
this.hasTransfer = (chainId, from, to) => __awaiter(this, void 0, void 0, function* () {
|
|
762
|
-
const { data } = yield this.request.get('/v1/engine/addr/has_transfer', {
|
|
763
|
-
params: {
|
|
764
|
-
chain_id: chainId,
|
|
765
|
-
from_addr: from,
|
|
766
|
-
to_addr: to,
|
|
767
|
-
},
|
|
768
|
-
timeout: 2000,
|
|
769
|
-
});
|
|
770
|
-
return data;
|
|
771
|
-
});
|
|
772
|
-
// 全链两个地址是否发生过转账
|
|
773
|
-
this.hasTransferAllChain = (from, to) => __awaiter(this, void 0, void 0, function* () {
|
|
774
|
-
const { data } = yield this.request.get('/v2/engine/addr/has_transfer', {
|
|
775
|
-
params: {
|
|
776
|
-
from_addr: from,
|
|
777
|
-
to_addr: to,
|
|
778
|
-
},
|
|
779
|
-
timeout: 2000,
|
|
780
|
-
});
|
|
781
|
-
return data;
|
|
782
|
-
});
|
|
783
|
-
this.isTokenContract = (chainId, id) => __awaiter(this, void 0, void 0, function* () {
|
|
784
|
-
const { data } = yield this.request.get('/v1/engine/contract/is_token', {
|
|
785
|
-
params: {
|
|
786
|
-
id,
|
|
787
|
-
chain_id: chainId,
|
|
788
|
-
},
|
|
789
|
-
});
|
|
790
|
-
return data;
|
|
791
|
-
});
|
|
792
|
-
this.addrUsedChainList = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
793
|
-
const { data } = yield this.request.get('/v1/engine/addr/used_chain_list', {
|
|
794
|
-
params: { id },
|
|
795
|
-
});
|
|
796
|
-
return data;
|
|
797
|
-
});
|
|
798
|
-
/**
|
|
799
|
-
* @deprecated
|
|
800
|
-
*/
|
|
801
|
-
this.getTokenNFTExposure = (chainId, id) => __awaiter(this, void 0, void 0, function* () {
|
|
802
|
-
const { data } = yield this.request.get('/v1/engine/contract/top_nft_approval_exposure', {
|
|
803
|
-
params: { chain_id: chainId, id },
|
|
804
|
-
});
|
|
805
|
-
return data;
|
|
806
|
-
});
|
|
807
|
-
this.getTokenNFTTrustValue = (chainId, id) => __awaiter(this, void 0, void 0, function* () {
|
|
808
|
-
const { data } = yield this.request.get('/v1/engine/contract/top_nft_spend_usd_value', {
|
|
809
|
-
params: { chain_id: chainId, id },
|
|
810
|
-
});
|
|
811
|
-
return data;
|
|
812
|
-
});
|
|
813
|
-
this.getCollection = (chainId, id) => __awaiter(this, void 0, void 0, function* () {
|
|
814
|
-
const { data } = yield this.request.get('/v1/engine/collection', {
|
|
815
|
-
params: { chain_id: chainId, id },
|
|
816
|
-
});
|
|
817
|
-
return data;
|
|
818
|
-
});
|
|
819
|
-
this.isSuspiciousCollection = (chainId, id) => __awaiter(this, void 0, void 0, function* () {
|
|
820
|
-
const { data } = yield this.request.get('/v1/engine/collection/is_suspicious', {
|
|
821
|
-
params: { chain_id: chainId, id },
|
|
822
|
-
});
|
|
823
|
-
return data;
|
|
824
|
-
});
|
|
825
|
-
this.isOriginVerified = (origin) => __awaiter(this, void 0, void 0, function* () {
|
|
826
|
-
const { data } = yield this.request.get('/v1/engine/origin/is_verified', {
|
|
827
|
-
params: { origin },
|
|
828
|
-
});
|
|
829
|
-
return data;
|
|
830
|
-
});
|
|
831
|
-
this.parseTypedData = ({ typedData, origin, address, }) => __awaiter(this, void 0, void 0, function* () {
|
|
832
|
-
const { data } = yield this.request.post('/v1/engine/action/parse_typed_data', {
|
|
833
|
-
typed_data: typedData,
|
|
834
|
-
origin,
|
|
835
|
-
user_addr: address,
|
|
836
|
-
});
|
|
837
|
-
return data;
|
|
838
|
-
});
|
|
839
|
-
this.parseText = ({ text, origin, address, }) => __awaiter(this, void 0, void 0, function* () {
|
|
840
|
-
const { data } = yield this.request.post('/v1/engine/action/parse_text', {
|
|
841
|
-
text,
|
|
842
|
-
origin,
|
|
843
|
-
user_addr: address,
|
|
844
|
-
});
|
|
845
|
-
return data;
|
|
846
|
-
});
|
|
847
|
-
this.collectionList = ({ id, chainId, isAll, }) => __awaiter(this, void 0, void 0, function* () {
|
|
848
|
-
const { data } = yield this.request.get('/v1/user/collection_list', {
|
|
849
|
-
params: {
|
|
850
|
-
id,
|
|
851
|
-
chain_id: chainId,
|
|
852
|
-
is_all: isAll,
|
|
853
|
-
},
|
|
854
|
-
});
|
|
855
|
-
return data;
|
|
856
|
-
});
|
|
857
|
-
this.gasPriceStats = (chainId) => __awaiter(this, void 0, void 0, function* () {
|
|
858
|
-
const { data } = yield this.request.get('/v1/wallet/gas_price_stats', {
|
|
859
|
-
params: {
|
|
860
|
-
chain_id: chainId,
|
|
861
|
-
},
|
|
862
|
-
});
|
|
863
|
-
return data;
|
|
864
|
-
});
|
|
865
|
-
this.badgeHasClaimed = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
866
|
-
const { data } = yield this.request.get('/v1/badge/code/user_has_claimed', {
|
|
867
|
-
params: {
|
|
868
|
-
user_id: id,
|
|
869
|
-
},
|
|
870
|
-
});
|
|
871
|
-
return data;
|
|
872
|
-
});
|
|
873
|
-
this.badgeHasMinted = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
874
|
-
const { data } = yield this.request.get('/v1/badge/user_has_minted', {
|
|
875
|
-
params: {
|
|
876
|
-
user_id: id,
|
|
877
|
-
},
|
|
878
|
-
});
|
|
879
|
-
return data;
|
|
880
|
-
});
|
|
881
|
-
this.mintBadge = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
882
|
-
const { data } = yield this.request.post('/v1/badge/mint', {
|
|
883
|
-
code: params.code,
|
|
884
|
-
user_id: params.userAddr,
|
|
885
|
-
});
|
|
886
|
-
return data;
|
|
887
|
-
});
|
|
888
|
-
this.badgeHasClaimedByName = ({ id, name, }) => __awaiter(this, void 0, void 0, function* () {
|
|
889
|
-
const { data } = yield this.request.get(`/v1/badge/code/user_has_claimed/${name}`, {
|
|
890
|
-
params: {
|
|
891
|
-
user_id: id,
|
|
892
|
-
},
|
|
893
|
-
});
|
|
894
|
-
return data;
|
|
895
|
-
});
|
|
896
|
-
this.badgeHasMintedByName = ({ id, name, }) => __awaiter(this, void 0, void 0, function* () {
|
|
897
|
-
const { data } = yield this.request.get(`/v1/badge/user_has_minted/${name}`, {
|
|
898
|
-
params: {
|
|
899
|
-
user_id: id,
|
|
900
|
-
},
|
|
901
|
-
});
|
|
902
|
-
return data;
|
|
903
|
-
});
|
|
904
|
-
this.mintBadgeByName = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
905
|
-
const { data } = yield this.request.post(`/v1/badge/mint/${params.name}`, {
|
|
906
|
-
code: params.code,
|
|
907
|
-
user_id: params.userAddr,
|
|
908
|
-
});
|
|
909
|
-
return data;
|
|
910
|
-
});
|
|
911
|
-
this.userHasRequestedFaucet = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
912
|
-
const { data } = yield this.request.get('/v1/faucet/user_has_requested', {
|
|
913
|
-
params,
|
|
914
|
-
});
|
|
915
|
-
return data;
|
|
916
|
-
});
|
|
917
|
-
this.requestFaucet = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
918
|
-
const { data } = yield this.request.post('/v1/faucet/request', Object.assign({}, params));
|
|
919
|
-
return data;
|
|
920
|
-
});
|
|
921
|
-
this.gasSupportedPushType = (chainId) => __awaiter(this, void 0, void 0, function* () {
|
|
922
|
-
const { data } = yield this.request.get('/v1/wallet/supported_push_type', {
|
|
923
|
-
params: {
|
|
924
|
-
chain_id: chainId,
|
|
925
|
-
},
|
|
926
|
-
});
|
|
927
|
-
return data;
|
|
928
|
-
});
|
|
929
|
-
this.submitTx = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
930
|
-
const { sig } = postData, rest = __rest(postData, ["sig"]);
|
|
931
|
-
const { data } = yield this.request.post('/v1/wallet/submit_tx', Object.assign({}, rest), {
|
|
932
|
-
headers: sig ? { sig } : undefined,
|
|
933
|
-
});
|
|
934
|
-
return data;
|
|
935
|
-
});
|
|
936
|
-
this.submitTxV2 = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
937
|
-
const { sig } = postData, rest = __rest(postData, ["sig"]);
|
|
938
|
-
const { data } = yield this.request.post('/v2/wallet/submit_tx', Object.assign({}, rest), {
|
|
939
|
-
headers: sig ? { sig } : undefined,
|
|
940
|
-
});
|
|
941
|
-
return data;
|
|
942
|
-
});
|
|
943
|
-
this.getDefaultRPCs = () => __awaiter(this, void 0, void 0, function* () {
|
|
944
|
-
const { data } = yield this.request.get('/v1/chainrpc');
|
|
945
|
-
return data;
|
|
946
|
-
});
|
|
947
|
-
this.getTxRequests = (ids) => __awaiter(this, void 0, void 0, function* () {
|
|
948
|
-
const { data } = yield this.request.get('/v1/wallet/get_tx_requests', {
|
|
949
|
-
params: {
|
|
950
|
-
ids: Array.isArray(ids) ? ids.join(',') : ids,
|
|
951
|
-
},
|
|
952
|
-
});
|
|
953
|
-
return data;
|
|
954
|
-
});
|
|
955
|
-
this.getTxRequest = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
956
|
-
const { data } = yield this.request.get('/v1/wallet/get_tx_request', {
|
|
957
|
-
params: {
|
|
958
|
-
id,
|
|
959
|
-
},
|
|
960
|
-
});
|
|
961
|
-
return data;
|
|
962
|
-
});
|
|
963
|
-
this.withdrawTx = (reqId) => __awaiter(this, void 0, void 0, function* () {
|
|
964
|
-
const { data } = yield this.request.post('/v1/wallet/withdraw_tx', {
|
|
965
|
-
id: reqId,
|
|
966
|
-
});
|
|
967
|
-
return data;
|
|
968
|
-
});
|
|
969
|
-
this.retryPushTx = (reqId) => __awaiter(this, void 0, void 0, function* () {
|
|
970
|
-
const { data } = yield this.request.post('/v1/wallet/retry_push_tx', {
|
|
971
|
-
id: reqId,
|
|
972
|
-
});
|
|
973
|
-
return data;
|
|
974
|
-
});
|
|
975
|
-
this.mempoolChecks = (txId, chainId, node_info) => __awaiter(this, void 0, void 0, function* () {
|
|
976
|
-
const { data } = yield this.request.get('/v1/wallet/mempool_checks', {
|
|
977
|
-
params: {
|
|
978
|
-
tx_id: txId,
|
|
979
|
-
chain_id: chainId,
|
|
980
|
-
node_info: node_info ? 1 : 0,
|
|
981
|
-
},
|
|
982
|
-
});
|
|
983
|
-
return data;
|
|
984
|
-
});
|
|
985
|
-
this.getPendingTxList = (params, options) => __awaiter(this, void 0, void 0, function* () {
|
|
986
|
-
const data = yield this.asyncJob('/v1/wallet/get_pending_tx_list', Object.assign({ params }, options));
|
|
987
|
-
return data;
|
|
988
|
-
});
|
|
989
|
-
this.getLatestPreExec = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
990
|
-
const { data } = yield this.request.get('/v1/wallet/get_latest_pre_exec', {
|
|
991
|
-
params,
|
|
992
|
-
});
|
|
993
|
-
return data;
|
|
994
|
-
});
|
|
995
|
-
this.walletSupportChain = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
996
|
-
const { data } = yield this.request.post('/v1/wallet/support_chain', params);
|
|
997
|
-
return data;
|
|
998
|
-
});
|
|
999
|
-
this.walletSupportOrigin = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1000
|
-
const { data } = yield this.request.post('/v1/wallet/support_origin', params);
|
|
1001
|
-
return data;
|
|
1002
|
-
});
|
|
1003
|
-
this.walletSupportSelector = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1004
|
-
const { data } = yield this.request.post('/v1/wallet/support_selector', params);
|
|
1005
|
-
return data;
|
|
1006
|
-
});
|
|
1007
|
-
this.searchDapp = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1008
|
-
const { data } = yield this.request.get('/v1/dapp/search', { params });
|
|
1009
|
-
return data;
|
|
1010
|
-
});
|
|
1011
|
-
this.getDappsInfo = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1012
|
-
var _e;
|
|
1013
|
-
const { data } = yield this.request.get('/v1/dapp/list', {
|
|
1014
|
-
params: {
|
|
1015
|
-
ids: (_e = params === null || params === void 0 ? void 0 : params.ids) === null || _e === void 0 ? void 0 : _e.join(','),
|
|
1016
|
-
},
|
|
1017
|
-
});
|
|
1018
|
-
return data;
|
|
1019
|
-
});
|
|
1020
|
-
this.getDappHotTags = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1021
|
-
const { data } = yield this.request.get('/v1/dapp/hot_tags', {
|
|
1022
|
-
params,
|
|
1023
|
-
});
|
|
1024
|
-
return data;
|
|
1025
|
-
});
|
|
1026
|
-
this.getHotDapps = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1027
|
-
const { data } = yield this.request.get('/v1/dapp/hot_list', { params });
|
|
1028
|
-
return data;
|
|
1029
|
-
});
|
|
1030
|
-
this.getRabbyClaimText = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1031
|
-
const { data } = yield this.request.get('/v1/points/user/claim_text', {
|
|
1032
|
-
params,
|
|
1033
|
-
});
|
|
1034
|
-
return data;
|
|
1035
|
-
});
|
|
1036
|
-
this.getRabbySignatureText = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1037
|
-
const { data } = yield this.request.get('/v1/points/user/sign_text', {
|
|
1038
|
-
params,
|
|
1039
|
-
});
|
|
1040
|
-
return data;
|
|
1041
|
-
});
|
|
1042
|
-
this.getRabbyPoints = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1043
|
-
const { data } = yield this.request.get('/v1/points/user', { params });
|
|
1044
|
-
return data;
|
|
1045
|
-
});
|
|
1046
|
-
this.checkRabbyPointsInviteCode = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1047
|
-
const { data } = yield this.request.get('/v1/points/user/invite_code_exist', { params });
|
|
1048
|
-
return data;
|
|
1049
|
-
});
|
|
1050
|
-
this.setRabbyPointsInviteCode = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1051
|
-
const { data } = yield this.request.post('/v1/points/user/invite_code', params);
|
|
1052
|
-
return data;
|
|
1053
|
-
});
|
|
1054
|
-
this.checkRabbyPointClaimable = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1055
|
-
const { data } = yield this.request.get('/v1/points/user/claimable', {
|
|
1056
|
-
params,
|
|
1057
|
-
});
|
|
1058
|
-
return data;
|
|
1059
|
-
});
|
|
1060
|
-
this.getRabbyPointsSnapshot = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1061
|
-
const { data } = yield this.request.get('/v1/points/snapshot', { params });
|
|
1062
|
-
return data;
|
|
1063
|
-
});
|
|
1064
|
-
this.claimRabbyPointsSnapshot = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1065
|
-
const { data } = yield this.request.post('/v1/points/claim_snapshot', params);
|
|
1066
|
-
return data;
|
|
1067
|
-
});
|
|
1068
|
-
this.getRabbyPointsTopUsers = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1069
|
-
const { data } = yield this.request.get('/v1/points/top_user', { params });
|
|
1070
|
-
return data;
|
|
1071
|
-
});
|
|
1072
|
-
this.getRabbyPointsList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1073
|
-
const { data } = yield this.request.get('/v1/points/campaign_list', {
|
|
1074
|
-
params,
|
|
1075
|
-
});
|
|
1076
|
-
return data;
|
|
1077
|
-
});
|
|
1078
|
-
this.getRabbyPointsCampaignIsEnded = () => __awaiter(this, void 0, void 0, function* () {
|
|
1079
|
-
const { data } = yield this.request.get('v1/points/campaign');
|
|
1080
|
-
return data;
|
|
1081
|
-
});
|
|
1082
|
-
this.claimRabbyPointsById = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1083
|
-
const { data } = yield this.request.post('/v1/points/claim_campaign', params);
|
|
1084
|
-
return data;
|
|
1085
|
-
});
|
|
1086
|
-
this.getRabbyPointsV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1087
|
-
const { data } = yield this.request.get('/v2/points/user', { params });
|
|
1088
|
-
return data;
|
|
1089
|
-
});
|
|
1090
|
-
this.getRabbySignatureTextV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1091
|
-
const { data } = yield this.request.get('/v2/points/user/sign_text', {
|
|
1092
|
-
params,
|
|
1093
|
-
});
|
|
1094
|
-
return data;
|
|
1095
|
-
});
|
|
1096
|
-
this.getRabbyClaimTextV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1097
|
-
const { data } = yield this.request.get('/v2/points/user/claim_text', {
|
|
1098
|
-
params,
|
|
1099
|
-
});
|
|
1100
|
-
return data;
|
|
1101
|
-
});
|
|
1102
|
-
this.setRabbyPointsInviteCodeV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1103
|
-
const { data } = yield this.request.post('/v2/points/user/invite_code', params);
|
|
1104
|
-
return data;
|
|
1105
|
-
});
|
|
1106
|
-
this.checkRabbyPointsInviteCodeV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1107
|
-
const { data } = yield this.request.get('/v2/points/user/invite_code_exist', {
|
|
1108
|
-
params,
|
|
1109
|
-
});
|
|
1110
|
-
return data;
|
|
1111
|
-
});
|
|
1112
|
-
this.claimRabbyPointsSnapshotV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1113
|
-
const { data } = yield this.request.post('/v2/points/claim_snapshot', params);
|
|
1114
|
-
return data;
|
|
1115
|
-
});
|
|
1116
|
-
this.getRabbyPointsTopUsersV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1117
|
-
const { data } = yield this.request.get('/v2/points/top_user', {
|
|
1118
|
-
params,
|
|
1119
|
-
});
|
|
1120
|
-
return data;
|
|
1121
|
-
});
|
|
1122
|
-
this.getRabbyPointsListV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1123
|
-
const { data } = yield this.request.get('/v2/points/campaign_list', {
|
|
1124
|
-
params,
|
|
1125
|
-
});
|
|
1126
|
-
return data;
|
|
1127
|
-
});
|
|
1128
|
-
this.claimRabbyPointsByIdV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1129
|
-
const { data } = yield this.request.post('/v2/points/claim_campaign', params);
|
|
1130
|
-
return data;
|
|
1131
|
-
});
|
|
1132
|
-
this.getRabbyPointsSnapshotV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1133
|
-
const { data } = yield this.request.get('/v2/points/snapshot', {
|
|
1134
|
-
params,
|
|
1135
|
-
});
|
|
1136
|
-
return data;
|
|
1137
|
-
});
|
|
1138
|
-
this.checkRabbyPointClaimableV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1139
|
-
const { data } = yield this.request.get('/v2/points/user/claimable', {
|
|
1140
|
-
params,
|
|
1141
|
-
});
|
|
1142
|
-
return data;
|
|
1143
|
-
});
|
|
1144
|
-
this.checkClaimInfoV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1145
|
-
const { data } = yield this.request.get('/v2/points/user/claim_info', {
|
|
1146
|
-
params,
|
|
1147
|
-
});
|
|
1148
|
-
return data;
|
|
1149
|
-
});
|
|
1150
|
-
this.getRabbyPointsCampaignIsEndedV2 = () => __awaiter(this, void 0, void 0, function* () {
|
|
1151
|
-
const { data } = yield this.request.get('v2/points/campaign');
|
|
1152
|
-
return data;
|
|
1153
|
-
});
|
|
1154
|
-
this.getSupportedChains = () => __awaiter(this, void 0, void 0, function* () {
|
|
1155
|
-
const { data } = yield this.request.get('/v1/wallet/supported_chains');
|
|
1156
|
-
return data;
|
|
1157
|
-
});
|
|
1158
|
-
this.searchChainList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1159
|
-
const { data } = yield this.request.get('/v1/chain/total_list', {
|
|
1160
|
-
params,
|
|
1161
|
-
});
|
|
1162
|
-
return data;
|
|
1163
|
-
});
|
|
1164
|
-
this.getChainListByIds = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1165
|
-
const { data } = yield this.request.get('/v1/chain/get_list', {
|
|
1166
|
-
params,
|
|
1167
|
-
});
|
|
1168
|
-
return data;
|
|
1169
|
-
});
|
|
1170
|
-
this.getHistoryCurve = (addr) => __awaiter(this, void 0, void 0, function* () {
|
|
1171
|
-
const { data } = yield this.request.get('/v1/user/history_curve', {
|
|
1172
|
-
params: { id: addr },
|
|
1173
|
-
});
|
|
1174
|
-
return data;
|
|
1175
|
-
});
|
|
1176
|
-
this.getHistoryCurveSupportedList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1177
|
-
const { data } = yield this.request.get('/v1/chain/classify_supported_list');
|
|
1178
|
-
return data;
|
|
1179
|
-
});
|
|
1180
|
-
this.getHistoryCurveStatus = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1181
|
-
const { data } = yield this.request.get('/v1/user/history_curve/status', {
|
|
1182
|
-
params,
|
|
1183
|
-
});
|
|
1184
|
-
return data;
|
|
1185
|
-
});
|
|
1186
|
-
this.initHistoryCurve = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1187
|
-
const { data } = yield this.request.post('/v1/user/history_curve/init', params);
|
|
1188
|
-
return data;
|
|
1189
|
-
});
|
|
1190
|
-
this.getNodeStatusList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1191
|
-
const { data } = yield this.request.get('/v1/node/list');
|
|
1192
|
-
return data;
|
|
1193
|
-
});
|
|
1194
|
-
this.getNodeStatusDetail = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1195
|
-
const { data } = yield this.request.get('/v1/node', { params });
|
|
1196
|
-
return data;
|
|
1197
|
-
});
|
|
1198
|
-
this.postActionLog = (body) => __awaiter(this, void 0, void 0, function* () {
|
|
1199
|
-
const { data } = yield this.request.post('/v1/engine/action/log', body);
|
|
1200
|
-
return data;
|
|
1201
|
-
});
|
|
1202
|
-
this.checkSpoofing = ({ from, to, }) => __awaiter(this, void 0, void 0, function* () {
|
|
1203
|
-
const { data } = yield this.request.get('/v1/engine/addr/is_spoofing', {
|
|
1204
|
-
params: { user_addr: from, dest_addr: to },
|
|
1205
|
-
});
|
|
1206
|
-
return data;
|
|
1207
|
-
});
|
|
1208
|
-
this.getAddressByDeBankId = (name) => __awaiter(this, void 0, void 0, function* () {
|
|
1209
|
-
const { data } = yield this.request.get('/v1/user/web3_id', {
|
|
1210
|
-
params: {
|
|
1211
|
-
text: name,
|
|
1212
|
-
},
|
|
1213
|
-
});
|
|
1214
|
-
return data;
|
|
1215
|
-
});
|
|
1216
|
-
this.getBridgeSupportChain = () => __awaiter(this, void 0, void 0, function* () {
|
|
1217
|
-
const { data } = yield this.request.get('/v1/bridge/supported_chains');
|
|
1218
|
-
return data;
|
|
1219
|
-
});
|
|
1220
|
-
this.getBridgeAggregatorList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1221
|
-
const { data } = yield this.request.get('/v1/bridge/list');
|
|
1222
|
-
return data;
|
|
1223
|
-
});
|
|
1224
|
-
this.getBridgePairList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1225
|
-
const { data } = yield this.request.get('/v1/bridge/pair_list', {
|
|
1226
|
-
params: Object.assign(Object.assign({}, params), { aggregator_ids: params.aggregator_ids.join(',') }),
|
|
1227
|
-
});
|
|
1228
|
-
return data;
|
|
1229
|
-
});
|
|
1230
|
-
this.getBridgeQuoteList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1231
|
-
const { data } = yield this.request.get('/v1/bridge/quote_list', {
|
|
1232
|
-
params,
|
|
1233
|
-
});
|
|
1234
|
-
return data;
|
|
1235
|
-
});
|
|
1236
|
-
this.getBridgeQuoteListV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1237
|
-
const { data } = yield this.request.get('/v2/bridge/quote_list', {
|
|
1238
|
-
params,
|
|
1239
|
-
});
|
|
1240
|
-
return data;
|
|
1241
|
-
});
|
|
1242
|
-
this.getBridgeQuote = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1243
|
-
const { data } = yield this.request.get('/v1/bridge/quote', {
|
|
1244
|
-
params,
|
|
1245
|
-
});
|
|
1246
|
-
return data;
|
|
1247
|
-
});
|
|
1248
|
-
this.getBridgeHistoryList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1249
|
-
const { data } = yield this.request.get('/v1/bridge/history_list', {
|
|
1250
|
-
params,
|
|
1251
|
-
});
|
|
1252
|
-
return data;
|
|
1253
|
-
});
|
|
1254
|
-
this.buildBridgeTx = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1255
|
-
const { data } = yield this.request.get('/v2/bridge/build_tx', {
|
|
1256
|
-
params,
|
|
1257
|
-
});
|
|
1258
|
-
return data;
|
|
1259
|
-
});
|
|
1260
|
-
this.postBridgeHistory = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1261
|
-
const { data } = yield this.request.post('/v1/bridge/history', params);
|
|
1262
|
-
return data;
|
|
1263
|
-
});
|
|
1264
|
-
/**
|
|
1265
|
-
* no id just no check address
|
|
1266
|
-
*/
|
|
1267
|
-
this.getPerpPermission = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1268
|
-
const { data } = yield this.request.get('/v1/user/has_hyperliquid_permission', {
|
|
1269
|
-
params,
|
|
1270
|
-
});
|
|
1271
|
-
return data;
|
|
1272
|
-
});
|
|
1273
|
-
this.getPerpTopTokenList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1274
|
-
const { data } = yield this.request.get('/v1/token/hyperliquid_top');
|
|
1275
|
-
return data;
|
|
1276
|
-
});
|
|
1277
|
-
this.getSupportedDEXList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1278
|
-
const { data } = yield this.request.get('/v1/wallet/supported_dex_list');
|
|
1279
|
-
return data;
|
|
1280
|
-
});
|
|
1281
|
-
this.createDbkBridgeHistory = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
1282
|
-
const { data } = yield this.request.post('/v1/user/dbk/bridge_history', postData);
|
|
1283
|
-
return data;
|
|
1284
|
-
});
|
|
1285
|
-
this.getDbkBridgeHistoryList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1286
|
-
const { data } = yield this.request.get('/v1/user/dbk/bridge_history_list', {
|
|
1287
|
-
params,
|
|
1288
|
-
});
|
|
1289
|
-
return data;
|
|
1290
|
-
});
|
|
1291
|
-
this.getGasAccountSignText = (account_id) => __awaiter(this, void 0, void 0, function* () {
|
|
1292
|
-
const { data } = yield this.request.get('/v1/gas_account/sign_text', {
|
|
1293
|
-
params: {
|
|
1294
|
-
account_id,
|
|
1295
|
-
},
|
|
1296
|
-
});
|
|
1297
|
-
return data;
|
|
1298
|
-
});
|
|
1299
|
-
this.getGasAccountInfo = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1300
|
-
const { sig } = params, others = __rest(params, ["sig"]);
|
|
1301
|
-
const { data } = yield this.request.get('/v1/gas_account', {
|
|
1302
|
-
params: Object.assign({}, others),
|
|
1303
|
-
headers: {
|
|
1304
|
-
sig,
|
|
1305
|
-
},
|
|
1306
|
-
});
|
|
1307
|
-
return data;
|
|
1308
|
-
});
|
|
1309
|
-
this.getGasAccountInfoV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1310
|
-
const { data } = yield this.request.get('/v2/gas_account', {
|
|
1311
|
-
params,
|
|
1312
|
-
});
|
|
1313
|
-
return data;
|
|
1314
|
-
});
|
|
1315
|
-
this.createGasAccountPayInfo = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
1316
|
-
const { data } = yield this.request.post('/v2/gas_account/pay_info', postData);
|
|
1317
|
-
return data;
|
|
1318
|
-
});
|
|
1319
|
-
this.checkGasAccountGiftEligibility = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1320
|
-
const { data } = yield this.request.get('/v1/gas_account/check_eligibility', {
|
|
1321
|
-
params,
|
|
1322
|
-
});
|
|
1323
|
-
return data;
|
|
1324
|
-
});
|
|
1325
|
-
this.checkGasAccountGiftEligibilityBatch = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1326
|
-
const { data } = yield this.request.post('/v1/gas_account/check_eligibility/batch', params);
|
|
1327
|
-
return data;
|
|
1328
|
-
});
|
|
1329
|
-
this.confirmIapOrder = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
1330
|
-
const { data } = yield this.request.post('/v1/gas_account/confirm_iap_order', postData);
|
|
1331
|
-
return data;
|
|
1332
|
-
});
|
|
1333
|
-
this.claimGasAccountGift = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1334
|
-
const { sig } = params, others = __rest(params, ["sig"]);
|
|
1335
|
-
const { data } = yield this.request.post('/v1/gas_account/claim', Object.assign({}, others), {
|
|
1336
|
-
headers: {
|
|
1337
|
-
sig,
|
|
1338
|
-
},
|
|
1339
|
-
});
|
|
1340
|
-
return data;
|
|
1341
|
-
});
|
|
1342
|
-
this.loginGasAccount = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1343
|
-
const { sig } = params, others = __rest(params, ["sig"]);
|
|
1344
|
-
const { data } = yield this.request.post('/v1/gas_account/login', Object.assign({}, others), {
|
|
1345
|
-
headers: {
|
|
1346
|
-
sig,
|
|
1347
|
-
},
|
|
1348
|
-
});
|
|
1349
|
-
return data;
|
|
1350
|
-
});
|
|
1351
|
-
this.logoutGasAccount = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1352
|
-
const { sig } = params, others = __rest(params, ["sig"]);
|
|
1353
|
-
const { data } = yield this.request.post('/v1/gas_account/logout', Object.assign({}, others), {
|
|
1354
|
-
headers: {
|
|
1355
|
-
sig,
|
|
1356
|
-
},
|
|
1357
|
-
});
|
|
1358
|
-
return data;
|
|
1359
|
-
});
|
|
1360
|
-
this.getGasAccountTokenList = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
1361
|
-
const { data } = yield this.request.get('/v1/user/recharge_token_list', {
|
|
1362
|
-
params: {
|
|
1363
|
-
id,
|
|
1364
|
-
},
|
|
1365
|
-
});
|
|
1366
|
-
return data;
|
|
1367
|
-
});
|
|
1368
|
-
this.rechargeGasAccount = (p) => __awaiter(this, void 0, void 0, function* () {
|
|
1369
|
-
const { sig } = p, params = __rest(p, ["sig"]);
|
|
1370
|
-
const { data } = yield this.request.post('/v1/gas_account/recharge', params, {
|
|
1371
|
-
headers: {
|
|
1372
|
-
sig,
|
|
1373
|
-
},
|
|
1374
|
-
});
|
|
1375
|
-
return data;
|
|
1376
|
-
});
|
|
1377
|
-
this.withdrawGasAccount = (p) => __awaiter(this, void 0, void 0, function* () {
|
|
1378
|
-
const { sig } = p, params = __rest(p, ["sig"]);
|
|
1379
|
-
const { data } = yield this.request.post('/v1/gas_account/withdraw', params, {
|
|
1380
|
-
headers: {
|
|
1381
|
-
sig,
|
|
1382
|
-
},
|
|
1383
|
-
});
|
|
1384
|
-
return data;
|
|
1385
|
-
});
|
|
1386
|
-
this.getWithdrawList = (p) => __awaiter(this, void 0, void 0, function* () {
|
|
1387
|
-
const { sig } = p, params = __rest(p, ["sig"]);
|
|
1388
|
-
const { data } = yield this.request.get('/v1/gas_account/withdraw_list', {
|
|
1389
|
-
params,
|
|
1390
|
-
headers: {
|
|
1391
|
-
sig,
|
|
1392
|
-
},
|
|
1393
|
-
});
|
|
1394
|
-
return data;
|
|
1395
|
-
});
|
|
1396
|
-
this.getGasAccountHistory = (p) => __awaiter(this, void 0, void 0, function* () {
|
|
1397
|
-
const { sig } = p, params = __rest(p, ["sig"]);
|
|
1398
|
-
const { data } = yield this.request.get('/v1/gas_account/history', {
|
|
1399
|
-
params,
|
|
1400
|
-
headers: {
|
|
1401
|
-
sig,
|
|
1402
|
-
},
|
|
1403
|
-
});
|
|
1404
|
-
return data;
|
|
1405
|
-
});
|
|
1406
|
-
this.checkGasAccountTxs = (p) => __awaiter(this, void 0, void 0, function* () {
|
|
1407
|
-
const { sig } = p, params = __rest(p, ["sig"]);
|
|
1408
|
-
const { data } = yield this.request.post('/v1/gas_account/check_txs', params, {
|
|
1409
|
-
headers: sig
|
|
1410
|
-
? {
|
|
1411
|
-
sig,
|
|
1412
|
-
}
|
|
1413
|
-
: undefined,
|
|
1414
|
-
});
|
|
1415
|
-
return data;
|
|
1416
|
-
});
|
|
1417
|
-
this.getGasAccountAml = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
1418
|
-
const { data } = yield this.request.get('/v1/gas_account/aml', {
|
|
1419
|
-
params: {
|
|
1420
|
-
id,
|
|
1421
|
-
},
|
|
1422
|
-
});
|
|
1423
|
-
return data;
|
|
1424
|
-
});
|
|
1425
|
-
this.parseCommon = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1426
|
-
const { data } = yield this.request.post('/v1/engine/action/parse_common', params);
|
|
1427
|
-
return data;
|
|
1428
|
-
});
|
|
1429
|
-
this.getRecommendBridgeToChain = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1430
|
-
const { data } = yield this.request.get('/v2/bridge/recommend/to_chain', {
|
|
1431
|
-
params,
|
|
1432
|
-
});
|
|
1433
|
-
return data;
|
|
1434
|
-
});
|
|
1435
|
-
this.getRecommendFromToken = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1436
|
-
const { data } = yield this.request.get('/v2/bridge/recommend/from_token_list', {
|
|
1437
|
-
params,
|
|
1438
|
-
});
|
|
1439
|
-
return data;
|
|
1440
|
-
});
|
|
1441
|
-
this.getBridgeToTokenList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1442
|
-
const { data } = yield this.request.get('/v2/bridge/recommend/to_token_list', {
|
|
1443
|
-
params,
|
|
1444
|
-
});
|
|
1445
|
-
return data;
|
|
1446
|
-
});
|
|
1447
|
-
this.getBridgeQuoteV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1448
|
-
const { data } = yield this.request.get('/v2/bridge/quote_list', {
|
|
1449
|
-
params,
|
|
1450
|
-
});
|
|
1451
|
-
return data;
|
|
1452
|
-
});
|
|
1453
|
-
this.getBridgeQuoteTxV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1454
|
-
const { data } = yield this.request.get('/v2/bridge/quote', {
|
|
1455
|
-
params,
|
|
1456
|
-
});
|
|
1457
|
-
return data;
|
|
1458
|
-
});
|
|
1459
|
-
this.isSameBridgeToken = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1460
|
-
const { data } = yield this.request.get('/v2/bridge/same_token', {
|
|
1461
|
-
params,
|
|
1462
|
-
});
|
|
1463
|
-
return data;
|
|
1464
|
-
});
|
|
1465
|
-
this.getBridgeSupportChainV2 = () => __awaiter(this, void 0, void 0, function* () {
|
|
1466
|
-
const { data } = yield this.request.get('/v2/bridge/supported_chains');
|
|
1467
|
-
return data;
|
|
1468
|
-
});
|
|
1469
|
-
this.submitFeedback = ({ text, usage, }) => __awaiter(this, void 0, void 0, function* () {
|
|
1470
|
-
const { data } = yield this.request.post('v1/feedback', Object.assign({ text }, (usage && { usage })));
|
|
1471
|
-
return data;
|
|
1472
|
-
});
|
|
1473
|
-
this.uninstalledFeedback = ({ text, }) => __awaiter(this, void 0, void 0, function* () {
|
|
1474
|
-
return this.submitFeedback({
|
|
1475
|
-
text,
|
|
1476
|
-
});
|
|
1477
|
-
});
|
|
1478
|
-
/**
|
|
1479
|
-
* @deprecated
|
|
1480
|
-
*/
|
|
1481
|
-
this.getToken24hPrice = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1482
|
-
const { data } = yield this.request.get('/v1/token/24h_price', {
|
|
1483
|
-
params,
|
|
1484
|
-
});
|
|
1485
|
-
return data;
|
|
1486
|
-
});
|
|
1487
|
-
this.getTokenPriceCurve = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1488
|
-
const { data } = yield this.request.get('/v1/token/price_curve', {
|
|
1489
|
-
params,
|
|
1490
|
-
});
|
|
1491
|
-
return data;
|
|
1492
|
-
});
|
|
1493
|
-
this.getTokenDatePrice = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1494
|
-
const { data } = yield this.request.get('/v1/token/date_price', {
|
|
1495
|
-
params,
|
|
1496
|
-
});
|
|
1497
|
-
return data;
|
|
1498
|
-
});
|
|
1499
|
-
this.searchTokens = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1500
|
-
const { data } = yield this.request.get('/v1/token/search', {
|
|
1501
|
-
params,
|
|
1502
|
-
});
|
|
1503
|
-
return data;
|
|
1504
|
-
});
|
|
1505
|
-
this.searchTokensV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1506
|
-
const { data } = yield this.request.get('/v2/token/search', {
|
|
1507
|
-
params,
|
|
1508
|
-
});
|
|
1509
|
-
return data;
|
|
1510
|
-
});
|
|
1511
|
-
// resp arr of chain_id
|
|
1512
|
-
this.getCopyTradingChainList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1513
|
-
const { data } = yield this.request.get('/v1/copytrading/chain_list');
|
|
1514
|
-
return data;
|
|
1515
|
-
});
|
|
1516
|
-
this.getCopyTradingTokenList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1517
|
-
const { data } = yield this.request.get('/v1/copytrading/token/list', {
|
|
1518
|
-
params,
|
|
1519
|
-
});
|
|
1520
|
-
return data;
|
|
1521
|
-
});
|
|
1522
|
-
this.getCopyTradingTokenListV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1523
|
-
const { data } = yield this.request.get('/v2/copytrading/token/list', {
|
|
1524
|
-
params,
|
|
1525
|
-
});
|
|
1526
|
-
return data;
|
|
1527
|
-
});
|
|
1528
|
-
this.getCopyTradingRecentBuyList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1529
|
-
const { data } = yield this.request.get('/v1/copytrading/recent_buy/list', {
|
|
1530
|
-
params,
|
|
1531
|
-
});
|
|
1532
|
-
return data;
|
|
1533
|
-
});
|
|
1534
|
-
this.getCopyTradingRecentBuyListV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1535
|
-
const { data } = yield this.request.get('/v2/copytrading/recent_buy/list', {
|
|
1536
|
-
params,
|
|
1537
|
-
});
|
|
1538
|
-
return data;
|
|
1539
|
-
});
|
|
1540
|
-
this.getCopyTradingDetail = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1541
|
-
const { data } = yield this.request.get('/v2/copytrading/token/detail', {
|
|
1542
|
-
params,
|
|
1543
|
-
});
|
|
1544
|
-
return data;
|
|
1545
|
-
});
|
|
1546
|
-
this.getCopyTradingSameName = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1547
|
-
const { data } = yield this.request.get('/v1/token/same_name', {
|
|
1548
|
-
params,
|
|
1549
|
-
});
|
|
1550
|
-
return data;
|
|
1551
|
-
});
|
|
1552
|
-
this.getCopyTradingPnlList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1553
|
-
const { data } = yield this.request.get('/v1/copytrading/smart_money/pnl/list', {
|
|
1554
|
-
params,
|
|
1555
|
-
});
|
|
1556
|
-
return data;
|
|
1557
|
-
});
|
|
1558
|
-
this.batchQueryTokens = (uuids) => __awaiter(this, void 0, void 0, function* () {
|
|
1559
|
-
const { data } = yield this.request.get('/v1/token/list_by_uuids', {
|
|
1560
|
-
params: {
|
|
1561
|
-
uuids: Array.isArray(uuids) ? uuids.join(',') : uuids,
|
|
1562
|
-
},
|
|
1563
|
-
});
|
|
1564
|
-
return data;
|
|
1565
|
-
});
|
|
1566
|
-
this.getBuySupportedCountryList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1567
|
-
const { data } = yield this.request.get('/v1/buy/supported_country_list');
|
|
1568
|
-
return data;
|
|
1569
|
-
});
|
|
1570
|
-
this.getBuySupportedTokenList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1571
|
-
const { data } = yield this.request.get('/v1/buy/supported_token_list');
|
|
1572
|
-
return data;
|
|
1573
|
-
});
|
|
1574
|
-
this.getBuyQuote = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1575
|
-
const { data } = yield this.request.get('/v1/buy/quote', {
|
|
1576
|
-
params,
|
|
1577
|
-
});
|
|
1578
|
-
return data;
|
|
1579
|
-
});
|
|
1580
|
-
this.getBuyWidgetUrl = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1581
|
-
const { data } = yield this.request.get('/v1/buy/get_widget_url', { params });
|
|
1582
|
-
return data;
|
|
1583
|
-
});
|
|
1584
|
-
this.getBuyHistory = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1585
|
-
const { data } = yield this.request.get('/v1/buy/history', {
|
|
1586
|
-
params: Object.assign(Object.assign({}, params), { start: params.start || 0, limit: params.limit || 20 }),
|
|
1587
|
-
});
|
|
1588
|
-
return data;
|
|
1589
|
-
});
|
|
1590
|
-
this.getBuyPaymentMethods = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1591
|
-
const { data } = yield this.request.get('/v1/buy/get_payment_method', {
|
|
1592
|
-
params,
|
|
1593
|
-
});
|
|
1594
|
-
return data;
|
|
1595
|
-
});
|
|
1596
|
-
this.getBuyCurrencyList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1597
|
-
const { data } = yield this.request.get('/v1/buy/supported_currency_list');
|
|
1598
|
-
return data;
|
|
1599
|
-
});
|
|
1600
|
-
this.getOfflineChainList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1601
|
-
const { data } = yield this.request.get('/v1/chain/offline_list');
|
|
1602
|
-
return data;
|
|
1603
|
-
});
|
|
1604
|
-
this.isBlockedAddress = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
1605
|
-
const { data } = yield this.request.get('/v1/engine/addr/is_blocked', {
|
|
1606
|
-
params: { id },
|
|
1607
|
-
});
|
|
1608
|
-
return data;
|
|
1609
|
-
});
|
|
1610
|
-
this.estimateGasUsd = ({ tx, origin, address, updateNonce = false, pending_tx_list = [], }) => __awaiter(this, void 0, void 0, function* () {
|
|
1611
|
-
const { data } = yield this.request.post('/v1/wallet/estimate_gas', {
|
|
1612
|
-
tx,
|
|
1613
|
-
user_addr: address,
|
|
1614
|
-
origin,
|
|
1615
|
-
update_nonce: updateNonce,
|
|
1616
|
-
pending_tx_list,
|
|
1617
|
-
});
|
|
1618
|
-
return data;
|
|
1619
|
-
});
|
|
1620
|
-
this.getCexSupportList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1621
|
-
const { data } = yield this.request.get('/v1/cex/supported_list');
|
|
1622
|
-
return data;
|
|
1623
|
-
});
|
|
1624
|
-
this.getAppChainList = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
1625
|
-
const { data } = yield this.request.get('/v1/user/complex_app_list', {
|
|
1626
|
-
params: { id },
|
|
1627
|
-
});
|
|
1628
|
-
return data;
|
|
1629
|
-
});
|
|
1630
|
-
this.checkCex = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
1631
|
-
const { data } = yield this.request.post('/v1/token/check_cex', postData);
|
|
1632
|
-
return data;
|
|
1633
|
-
});
|
|
1634
|
-
// top 20 tokens
|
|
1635
|
-
this.getHotTokenList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1636
|
-
const { data } = yield this.request.get('/v1/token/hot_list');
|
|
1637
|
-
return data;
|
|
1638
|
-
});
|
|
1639
|
-
// uuid: 'chain:token_id'
|
|
1640
|
-
this.getTokensDetailByUuids = (uuids) => __awaiter(this, void 0, void 0, function* () {
|
|
1641
|
-
const { data } = yield this.request.get('/v1/token/list_by_uuids', {
|
|
1642
|
-
params: {
|
|
1643
|
-
uuids: uuids.join(','),
|
|
1644
|
-
},
|
|
1645
|
-
});
|
|
1646
|
-
return data;
|
|
1647
|
-
});
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
}));
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
11
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
12
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
13
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
14
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
15
|
+
};
|
|
16
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
17
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
18
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
19
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
20
|
+
};
|
|
21
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
22
|
+
var t = {};
|
|
23
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
24
|
+
t[p] = s[p];
|
|
25
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
26
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
27
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
28
|
+
t[p[i]] = s[p[i]];
|
|
29
|
+
}
|
|
30
|
+
return t;
|
|
31
|
+
};
|
|
32
|
+
var _OpenApiService_adapter, _OpenApiService_plugin, _OpenApiService_clientName, _OpenApiService_clientVersion;
|
|
33
|
+
import axios from 'axios';
|
|
34
|
+
import rateLimit from 'axios-rate-limit';
|
|
35
|
+
import { ethErrors } from 'eth-rpc-errors';
|
|
36
|
+
import { genSignParams, sleep } from './utils';
|
|
37
|
+
import { omit } from 'lodash';
|
|
38
|
+
import { ASYNC_JOB_RETRY_DELAY, ASYNC_JOB_TIMEOUT } from './const';
|
|
39
|
+
var CurveDayType;
|
|
40
|
+
(function (CurveDayType) {
|
|
41
|
+
CurveDayType[CurveDayType["DAY"] = 1] = "DAY";
|
|
42
|
+
CurveDayType[CurveDayType["WEEK"] = 7] = "WEEK";
|
|
43
|
+
})(CurveDayType || (CurveDayType = {}));
|
|
44
|
+
const maxRPS = 500;
|
|
45
|
+
export class OpenApiService {
|
|
46
|
+
constructor(_a) {
|
|
47
|
+
var _b;
|
|
48
|
+
var { store, plugin, adapter, clientName = 'Rabby', clientVersion = (_b = process.env.release) !== null && _b !== void 0 ? _b : '0.0.0', } = _a;
|
|
49
|
+
_OpenApiService_adapter.set(this, void 0);
|
|
50
|
+
_OpenApiService_plugin.set(this, void 0);
|
|
51
|
+
_OpenApiService_clientName.set(this, void 0);
|
|
52
|
+
_OpenApiService_clientVersion.set(this, void 0);
|
|
53
|
+
this.setHost = (host) => __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
this.store.host = host;
|
|
55
|
+
yield this.init();
|
|
56
|
+
});
|
|
57
|
+
this.setHostSync = (host) => {
|
|
58
|
+
this.store.host = host;
|
|
59
|
+
this.initSync();
|
|
60
|
+
};
|
|
61
|
+
this.getHost = () => {
|
|
62
|
+
return this.store.host;
|
|
63
|
+
};
|
|
64
|
+
this.setTestnetHost = (host) => __awaiter(this, void 0, void 0, function* () {
|
|
65
|
+
this.store.testnetHost = host;
|
|
66
|
+
});
|
|
67
|
+
this.getTestnetHost = () => {
|
|
68
|
+
return this.store.testnetHost;
|
|
69
|
+
};
|
|
70
|
+
this.ethRpc = () => __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
throw ethErrors.provider.disconnected();
|
|
72
|
+
});
|
|
73
|
+
this.init = (options) => __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
var _c, _d;
|
|
75
|
+
options = typeof options === 'string' ? { webHf: options } : options;
|
|
76
|
+
yield ((_d = (_c = __classPrivateFieldGet(this, _OpenApiService_plugin, "f")).onInitiateAsync) === null || _d === void 0 ? void 0 : _d.call(_c, Object.assign({}, options)));
|
|
77
|
+
this.initSync(Object.assign({}, options));
|
|
78
|
+
});
|
|
79
|
+
this.asyncJob = (url, options) => {
|
|
80
|
+
const _option = Object.assign({ timeout: ASYNC_JOB_TIMEOUT, retryDelay: ASYNC_JOB_RETRY_DELAY }, options);
|
|
81
|
+
const startTime = +new Date();
|
|
82
|
+
return this.request(url, omit(Object.assign({ method: 'GET' }, _option), 'retryDelay')).then((res) => {
|
|
83
|
+
const data = res.data;
|
|
84
|
+
if (data.result) {
|
|
85
|
+
return data.result.data;
|
|
86
|
+
}
|
|
87
|
+
const deltaTime = +new Date() - startTime;
|
|
88
|
+
_option.timeout = _option.timeout - deltaTime - _option.retryDelay;
|
|
89
|
+
return sleep(_option.retryDelay, _option.signal).then(() => this.asyncJob(url, _option));
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
this._mountMethods = () => {
|
|
93
|
+
this.ethRpc = (chain_id, { origin = 'rabby', method, params }) => {
|
|
94
|
+
return this.request
|
|
95
|
+
.post(`/v1/wallet/eth_rpc?origin=${origin}&method=${method}`, {
|
|
96
|
+
chain_id,
|
|
97
|
+
method,
|
|
98
|
+
params,
|
|
99
|
+
})
|
|
100
|
+
.then(({ data }) => {
|
|
101
|
+
if (data === null || data === void 0 ? void 0 : data.error) {
|
|
102
|
+
throw data.error;
|
|
103
|
+
}
|
|
104
|
+
return data === null || data === void 0 ? void 0 : data.result;
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
this.getRecommendChains = (address, origin) => __awaiter(this, void 0, void 0, function* () {
|
|
109
|
+
const { data } = yield this.request.get('/v1/wallet/recommend_chains', {
|
|
110
|
+
params: {
|
|
111
|
+
user_addr: address,
|
|
112
|
+
origin,
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
return data;
|
|
116
|
+
});
|
|
117
|
+
this.getTotalBalance = (address, isCore = false) => __awaiter(this, void 0, void 0, function* () {
|
|
118
|
+
const { data } = yield this.request.get('/v1/user/total_balance', {
|
|
119
|
+
params: {
|
|
120
|
+
id: address,
|
|
121
|
+
is_core: isCore,
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
return data;
|
|
125
|
+
});
|
|
126
|
+
this.getTotalBalanceV2 = ({ address, isCore = false, included_token_uuids = [], excluded_token_uuids = [], excluded_protocol_ids = [], excluded_chain_ids = [], }) => __awaiter(this, void 0, void 0, function* () {
|
|
127
|
+
const { data } = yield this.request.post('/v2/user/total_balance', {
|
|
128
|
+
id: address,
|
|
129
|
+
is_core: isCore,
|
|
130
|
+
included_token_uuids: included_token_uuids,
|
|
131
|
+
excluded_token_uuids: excluded_token_uuids,
|
|
132
|
+
excluded_protocol_ids: excluded_protocol_ids,
|
|
133
|
+
excluded_chain_ids: excluded_chain_ids,
|
|
134
|
+
});
|
|
135
|
+
return data;
|
|
136
|
+
});
|
|
137
|
+
this.getPendingCount = (address) => __awaiter(this, void 0, void 0, function* () {
|
|
138
|
+
const { data } = yield this.request.get('/v1/wallet/pending_tx_count', {
|
|
139
|
+
params: {
|
|
140
|
+
user_addr: address,
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
return data;
|
|
144
|
+
});
|
|
145
|
+
this.checkOrigin = (address, origin) => __awaiter(this, void 0, void 0, function* () {
|
|
146
|
+
const { data } = yield this.request.post('/v1/wallet/check_origin', {
|
|
147
|
+
user_addr: address,
|
|
148
|
+
origin,
|
|
149
|
+
});
|
|
150
|
+
return data;
|
|
151
|
+
});
|
|
152
|
+
this.checkText = (address, origin, text) => __awaiter(this, void 0, void 0, function* () {
|
|
153
|
+
const { data } = yield this.request.post('/v1/wallet/check_text', {
|
|
154
|
+
user_addr: address,
|
|
155
|
+
origin,
|
|
156
|
+
text,
|
|
157
|
+
});
|
|
158
|
+
return data;
|
|
159
|
+
});
|
|
160
|
+
this.checkTx = (tx, origin, address, update_nonce = false) => __awaiter(this, void 0, void 0, function* () {
|
|
161
|
+
const { data } = yield this.request.post('/v1/wallet/check_tx', {
|
|
162
|
+
user_addr: address,
|
|
163
|
+
origin,
|
|
164
|
+
tx,
|
|
165
|
+
update_nonce,
|
|
166
|
+
});
|
|
167
|
+
return data;
|
|
168
|
+
});
|
|
169
|
+
this.preExecTx = ({ tx, origin, address, updateNonce = false, pending_tx_list = [], delegate_call, }) => __awaiter(this, void 0, void 0, function* () {
|
|
170
|
+
const { data } = yield this.request.post('/v1/wallet/pre_exec_tx', {
|
|
171
|
+
tx,
|
|
172
|
+
user_addr: address,
|
|
173
|
+
origin,
|
|
174
|
+
update_nonce: updateNonce,
|
|
175
|
+
pending_tx_list,
|
|
176
|
+
delegate_call,
|
|
177
|
+
});
|
|
178
|
+
return data;
|
|
179
|
+
});
|
|
180
|
+
this.historyGasUsed = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
181
|
+
const { data } = yield this.request.post('/v1/wallet/history_tx_used_gas', Object.assign({}, params));
|
|
182
|
+
return data;
|
|
183
|
+
});
|
|
184
|
+
this.pendingTxList = (tx, origin, address, update_nonce = false) => __awaiter(this, void 0, void 0, function* () {
|
|
185
|
+
const { data } = yield this.request.post('/v1/wallet/pending_tx_list', {
|
|
186
|
+
tx,
|
|
187
|
+
user_addr: address,
|
|
188
|
+
origin,
|
|
189
|
+
update_nonce,
|
|
190
|
+
});
|
|
191
|
+
return data;
|
|
192
|
+
});
|
|
193
|
+
this.traceTx = (txId, traceId, chainId) => __awaiter(this, void 0, void 0, function* () {
|
|
194
|
+
const { data } = yield this.request.post('/v1/wallet/trace_tx', {
|
|
195
|
+
tx_id: txId,
|
|
196
|
+
trace_id: traceId,
|
|
197
|
+
chain_id: chainId,
|
|
198
|
+
});
|
|
199
|
+
return data;
|
|
200
|
+
});
|
|
201
|
+
this.pushTx = (tx, traceId) => __awaiter(this, void 0, void 0, function* () {
|
|
202
|
+
const { data } = yield this.request.post('/v1/wallet/push_tx', {
|
|
203
|
+
tx,
|
|
204
|
+
trace_id: traceId,
|
|
205
|
+
});
|
|
206
|
+
return data;
|
|
207
|
+
});
|
|
208
|
+
this.explainText = (origin, address, text) => __awaiter(this, void 0, void 0, function* () {
|
|
209
|
+
const { data } = yield this.request.post('/v1/wallet/explain_text', {
|
|
210
|
+
user_addr: address,
|
|
211
|
+
origin,
|
|
212
|
+
text,
|
|
213
|
+
});
|
|
214
|
+
return data;
|
|
215
|
+
});
|
|
216
|
+
this.gasMarket = (chainId, customGas) => __awaiter(this, void 0, void 0, function* () {
|
|
217
|
+
const { data } = yield this.request.get('/v1/wallet/gas_market', {
|
|
218
|
+
params: {
|
|
219
|
+
chain_id: chainId,
|
|
220
|
+
custom_price: customGas,
|
|
221
|
+
},
|
|
222
|
+
});
|
|
223
|
+
return data;
|
|
224
|
+
});
|
|
225
|
+
this.gasMarketV2 = (options) => __awaiter(this, void 0, void 0, function* () {
|
|
226
|
+
const { data } = yield this.request.post('/v2/wallet/gas_market', {
|
|
227
|
+
chain_id: options.chainId,
|
|
228
|
+
custom_price: options.customGas,
|
|
229
|
+
tx: options.tx,
|
|
230
|
+
});
|
|
231
|
+
return data;
|
|
232
|
+
});
|
|
233
|
+
this.getTx = (chainId, hash, gasPrice) => __awaiter(this, void 0, void 0, function* () {
|
|
234
|
+
const { data } = yield this.request.get('/v1/wallet/get_tx', {
|
|
235
|
+
params: {
|
|
236
|
+
chain_id: chainId,
|
|
237
|
+
gas_price: gasPrice,
|
|
238
|
+
tx_id: hash,
|
|
239
|
+
},
|
|
240
|
+
});
|
|
241
|
+
return data;
|
|
242
|
+
});
|
|
243
|
+
this.getEnsAddressByName = (name) => __awaiter(this, void 0, void 0, function* () {
|
|
244
|
+
const { data } = yield this.request.get('/v1/wallet/ens', {
|
|
245
|
+
params: {
|
|
246
|
+
text: name,
|
|
247
|
+
},
|
|
248
|
+
});
|
|
249
|
+
return data;
|
|
250
|
+
});
|
|
251
|
+
this.searchToken = (id, q, chainId, is_all = false) => __awaiter(this, void 0, void 0, function* () {
|
|
252
|
+
const { data } = yield this.request.get('/v1/user/token_search', {
|
|
253
|
+
params: {
|
|
254
|
+
id,
|
|
255
|
+
q,
|
|
256
|
+
has_balance: false,
|
|
257
|
+
is_all,
|
|
258
|
+
chain_id: chainId,
|
|
259
|
+
},
|
|
260
|
+
});
|
|
261
|
+
return data;
|
|
262
|
+
});
|
|
263
|
+
this.searchSwapToken = (id, chainId, q, is_all = false) => __awaiter(this, void 0, void 0, function* () {
|
|
264
|
+
const { data } = yield this.request.get('/v1/user/token_search', {
|
|
265
|
+
params: {
|
|
266
|
+
id,
|
|
267
|
+
chain_id: chainId,
|
|
268
|
+
q,
|
|
269
|
+
is_all,
|
|
270
|
+
},
|
|
271
|
+
});
|
|
272
|
+
return data;
|
|
273
|
+
});
|
|
274
|
+
this.getToken = (id, chainId, tokenId) => __awaiter(this, void 0, void 0, function* () {
|
|
275
|
+
const { data } = yield this.request.get('/v1/user/token', {
|
|
276
|
+
params: {
|
|
277
|
+
id,
|
|
278
|
+
chain_id: chainId,
|
|
279
|
+
token_id: tokenId,
|
|
280
|
+
},
|
|
281
|
+
});
|
|
282
|
+
return data;
|
|
283
|
+
});
|
|
284
|
+
this.getCachedTokenList = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
285
|
+
const { data } = yield this.request.get('/v1/user/cache_token_list', {
|
|
286
|
+
params: {
|
|
287
|
+
id,
|
|
288
|
+
},
|
|
289
|
+
});
|
|
290
|
+
return data;
|
|
291
|
+
});
|
|
292
|
+
this.listToken = (id, chainId, isAll = false) => __awaiter(this, void 0, void 0, function* () {
|
|
293
|
+
const { data } = yield this.request.get('/v1/user/token_list', {
|
|
294
|
+
params: {
|
|
295
|
+
id,
|
|
296
|
+
is_all: isAll,
|
|
297
|
+
chain_id: chainId,
|
|
298
|
+
},
|
|
299
|
+
});
|
|
300
|
+
return data;
|
|
301
|
+
});
|
|
302
|
+
this.getTokenEntity = (id, chainId) => __awaiter(this, void 0, void 0, function* () {
|
|
303
|
+
const { data } = yield this.request.get('/v1/token/identity', {
|
|
304
|
+
params: {
|
|
305
|
+
id,
|
|
306
|
+
chain_id: chainId,
|
|
307
|
+
},
|
|
308
|
+
});
|
|
309
|
+
return data;
|
|
310
|
+
});
|
|
311
|
+
this.getHistoryTokenList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
312
|
+
const { data } = yield this.request.get('/v1/user/history_token_list', {
|
|
313
|
+
params: {
|
|
314
|
+
id: params.id,
|
|
315
|
+
chain_id: params.chainId,
|
|
316
|
+
time_at: params.timeAt,
|
|
317
|
+
date_at: params.dateAt,
|
|
318
|
+
},
|
|
319
|
+
});
|
|
320
|
+
return data;
|
|
321
|
+
});
|
|
322
|
+
this.customListToken = (uuids, id) => __awaiter(this, void 0, void 0, function* () {
|
|
323
|
+
if (!(uuids === null || uuids === void 0 ? void 0 : uuids.length) || !id) {
|
|
324
|
+
return [];
|
|
325
|
+
}
|
|
326
|
+
const { data } = yield this.request.post('/v1/user/specific_token_list', {
|
|
327
|
+
id,
|
|
328
|
+
uuids,
|
|
329
|
+
});
|
|
330
|
+
return data;
|
|
331
|
+
});
|
|
332
|
+
this.listChainAssets = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
333
|
+
const { data } = yield this.request.get('/v1/user/simple_protocol_list', {
|
|
334
|
+
params: {
|
|
335
|
+
id,
|
|
336
|
+
},
|
|
337
|
+
});
|
|
338
|
+
return data;
|
|
339
|
+
});
|
|
340
|
+
this.listNFT = (id, isAll = true, sortByCredit) => __awaiter(this, void 0, void 0, function* () {
|
|
341
|
+
const { data } = yield this.request.get('/v1/user/nft_list', {
|
|
342
|
+
params: Object.assign({
|
|
343
|
+
id,
|
|
344
|
+
is_all: isAll,
|
|
345
|
+
}, sortByCredit
|
|
346
|
+
? {
|
|
347
|
+
sort_by: 'credit_score',
|
|
348
|
+
}
|
|
349
|
+
: {}),
|
|
350
|
+
});
|
|
351
|
+
return data;
|
|
352
|
+
});
|
|
353
|
+
this.listCollection = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
354
|
+
const { data } = yield this.request.get('/v1/nft/collections', {
|
|
355
|
+
params,
|
|
356
|
+
});
|
|
357
|
+
return data;
|
|
358
|
+
});
|
|
359
|
+
this.listTxHisotry = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
360
|
+
const { data } = yield this.request.get('/v1/user/history_list', {
|
|
361
|
+
params,
|
|
362
|
+
});
|
|
363
|
+
return data;
|
|
364
|
+
});
|
|
365
|
+
this.getAllTxHistory = (params, options) => __awaiter(this, void 0, void 0, function* () {
|
|
366
|
+
const data = yield this.asyncJob('/v1/user/history_all_list', Object.assign({ method: 'GET', params }, options));
|
|
367
|
+
return data;
|
|
368
|
+
});
|
|
369
|
+
this.tokenPrice = (tokenName) => __awaiter(this, void 0, void 0, function* () {
|
|
370
|
+
const { data } = yield this.request.get('/v1/token/price_change', {
|
|
371
|
+
params: {
|
|
372
|
+
token: tokenName,
|
|
373
|
+
},
|
|
374
|
+
});
|
|
375
|
+
return data;
|
|
376
|
+
});
|
|
377
|
+
this.tokenAuthorizedList = (id, chain_id, options) => __awaiter(this, void 0, void 0, function* () {
|
|
378
|
+
const { restfulPrefix = 'v1' } = options || {};
|
|
379
|
+
const { data } = yield this.request.get(`/${restfulPrefix}/user/token_authorized_list`, {
|
|
380
|
+
params: {
|
|
381
|
+
id,
|
|
382
|
+
chain_id,
|
|
383
|
+
},
|
|
384
|
+
});
|
|
385
|
+
return data;
|
|
386
|
+
});
|
|
387
|
+
this.userNFTAuthorizedList = (id, chain_id) => __awaiter(this, void 0, void 0, function* () {
|
|
388
|
+
const { data } = yield this.request.get('/v1/user/nft_authorized_list', {
|
|
389
|
+
params: {
|
|
390
|
+
id,
|
|
391
|
+
chain_id,
|
|
392
|
+
},
|
|
393
|
+
});
|
|
394
|
+
return data;
|
|
395
|
+
});
|
|
396
|
+
this.getDEXList = (chain_id) => __awaiter(this, void 0, void 0, function* () {
|
|
397
|
+
const { data } = yield this.request.get('/v1/wallet/swap_dex_list', {
|
|
398
|
+
params: {
|
|
399
|
+
chain_id,
|
|
400
|
+
},
|
|
401
|
+
});
|
|
402
|
+
return data;
|
|
403
|
+
});
|
|
404
|
+
this.getSwapQuote = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
405
|
+
const { data } = yield this.request.get('/v1/wallet/swap_quote', {
|
|
406
|
+
params,
|
|
407
|
+
timeout: 5000,
|
|
408
|
+
});
|
|
409
|
+
return data;
|
|
410
|
+
});
|
|
411
|
+
this.getSwapTokenList = (id, chainId) => __awaiter(this, void 0, void 0, function* () {
|
|
412
|
+
const { data } = yield this.request.get('/v1/wallet/swap_token_list', {
|
|
413
|
+
params: {
|
|
414
|
+
id,
|
|
415
|
+
chain_id: chainId,
|
|
416
|
+
is_all: false,
|
|
417
|
+
},
|
|
418
|
+
});
|
|
419
|
+
return data;
|
|
420
|
+
});
|
|
421
|
+
this.postGasStationOrder = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
422
|
+
const { data } = yield this.request.post('/v1/wallet/gas_station_order', {
|
|
423
|
+
order: {
|
|
424
|
+
user_addr: params.userAddr,
|
|
425
|
+
from_chain_id: params.fromChainId,
|
|
426
|
+
from_tx_id: params.fromTxId,
|
|
427
|
+
from_token_id: params.fromTokenId,
|
|
428
|
+
from_token_amount: params.fromTokenAmount,
|
|
429
|
+
to_chain_id: params.toChainId,
|
|
430
|
+
to_token_amount: params.toTokenAmount,
|
|
431
|
+
from_usd_value: params.fromUsdValue,
|
|
432
|
+
},
|
|
433
|
+
});
|
|
434
|
+
return data;
|
|
435
|
+
});
|
|
436
|
+
this.getGasStationChainBalance = (chain_id, addr) => __awaiter(this, void 0, void 0, function* () {
|
|
437
|
+
const { data } = yield this.request.get('/v1/wallet/gas_station_usd_value', {
|
|
438
|
+
params: {
|
|
439
|
+
chain_id,
|
|
440
|
+
addr,
|
|
441
|
+
},
|
|
442
|
+
});
|
|
443
|
+
return data;
|
|
444
|
+
});
|
|
445
|
+
this.getApprovalCount = (address) => __awaiter(this, void 0, void 0, function* () {
|
|
446
|
+
const { data } = yield this.request.get('/v1/user/total_approval_asset_cnt', {
|
|
447
|
+
params: {
|
|
448
|
+
id: address,
|
|
449
|
+
},
|
|
450
|
+
});
|
|
451
|
+
return data;
|
|
452
|
+
});
|
|
453
|
+
this.getGasStationTokenList = () => __awaiter(this, void 0, void 0, function* () {
|
|
454
|
+
const { data } = yield this.request.get('/v1/wallet/gas_station_token_list');
|
|
455
|
+
return data;
|
|
456
|
+
});
|
|
457
|
+
this.explainTypedData = (user_addr, origin, data) => __awaiter(this, void 0, void 0, function* () {
|
|
458
|
+
const { data: resData } = yield this.request.post('/v1/wallet/explain_typed_data', {
|
|
459
|
+
user_addr,
|
|
460
|
+
origin,
|
|
461
|
+
data,
|
|
462
|
+
});
|
|
463
|
+
return resData;
|
|
464
|
+
});
|
|
465
|
+
this.checkTypedData = (user_addr, origin, data) => __awaiter(this, void 0, void 0, function* () {
|
|
466
|
+
const { data: resData } = yield this.request.post('/v1/wallet/check_typed_data', {
|
|
467
|
+
user_addr,
|
|
468
|
+
origin,
|
|
469
|
+
data,
|
|
470
|
+
});
|
|
471
|
+
return resData;
|
|
472
|
+
});
|
|
473
|
+
this.approvalStatus = (id, options) => __awaiter(this, void 0, void 0, function* () {
|
|
474
|
+
const { restfulPrefix = 'v1' } = options || {};
|
|
475
|
+
const { data } = yield this.request.get(`/${restfulPrefix}/user/approval_status`, {
|
|
476
|
+
params: {
|
|
477
|
+
id,
|
|
478
|
+
},
|
|
479
|
+
});
|
|
480
|
+
return data;
|
|
481
|
+
});
|
|
482
|
+
this.usedChainList = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
483
|
+
const { data } = yield this.request.get('/v1/user/used_chain_list', {
|
|
484
|
+
params: {
|
|
485
|
+
id,
|
|
486
|
+
},
|
|
487
|
+
});
|
|
488
|
+
return data;
|
|
489
|
+
});
|
|
490
|
+
this.getLatestVersion = () => __awaiter(this, void 0, void 0, function* () {
|
|
491
|
+
const { data } = yield this.request.get('/v1/wallet/version');
|
|
492
|
+
return data;
|
|
493
|
+
});
|
|
494
|
+
this.addOriginFeedback = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
495
|
+
const { data } = yield this.request.post('/v1/wallet/add_origin_feedback', {
|
|
496
|
+
user_addr: params.user_addr,
|
|
497
|
+
origin: params.origin,
|
|
498
|
+
is_safe: params.is_safe,
|
|
499
|
+
});
|
|
500
|
+
return data;
|
|
501
|
+
});
|
|
502
|
+
this.getProtocolList = (addr) => __awaiter(this, void 0, void 0, function* () {
|
|
503
|
+
const { data } = yield this.request.get('/v1/user/protocol_list', {
|
|
504
|
+
params: {
|
|
505
|
+
id: addr,
|
|
506
|
+
},
|
|
507
|
+
});
|
|
508
|
+
return data;
|
|
509
|
+
});
|
|
510
|
+
this.getComplexProtocolList = (addr) => __awaiter(this, void 0, void 0, function* () {
|
|
511
|
+
const { data } = yield this.request.get('/v1/user/complex_protocol_list', {
|
|
512
|
+
params: {
|
|
513
|
+
id: addr,
|
|
514
|
+
},
|
|
515
|
+
});
|
|
516
|
+
return data;
|
|
517
|
+
});
|
|
518
|
+
this.getProtocol = ({ addr, id, }) => __awaiter(this, void 0, void 0, function* () {
|
|
519
|
+
const { data } = yield this.request.get('/v1/user/protocol', {
|
|
520
|
+
params: {
|
|
521
|
+
id: addr,
|
|
522
|
+
protocol_id: id,
|
|
523
|
+
},
|
|
524
|
+
});
|
|
525
|
+
return data;
|
|
526
|
+
});
|
|
527
|
+
this.getHistoryProtocol = ({ addr, id, timeAt, dateAt, }) => __awaiter(this, void 0, void 0, function* () {
|
|
528
|
+
const { data } = yield this.request.get('/v1/user/history_protocol', {
|
|
529
|
+
params: {
|
|
530
|
+
id: addr,
|
|
531
|
+
protocol_id: id,
|
|
532
|
+
time_at: timeAt,
|
|
533
|
+
date_at: dateAt,
|
|
534
|
+
},
|
|
535
|
+
});
|
|
536
|
+
return data;
|
|
537
|
+
});
|
|
538
|
+
this.getTokenHistoryPrice = ({ chainId, id, timeAt, }) => __awaiter(this, void 0, void 0, function* () {
|
|
539
|
+
const { data } = yield this.request.get('/v1/token/history_price', {
|
|
540
|
+
params: {
|
|
541
|
+
chain_id: chainId,
|
|
542
|
+
id,
|
|
543
|
+
time_at: timeAt,
|
|
544
|
+
},
|
|
545
|
+
});
|
|
546
|
+
return data;
|
|
547
|
+
});
|
|
548
|
+
this.getTokenHistoryDict = ({ chainId, ids, timeAt, }) => __awaiter(this, void 0, void 0, function* () {
|
|
549
|
+
const { data } = yield this.request.get('/v1/token/history_price_dict', {
|
|
550
|
+
params: {
|
|
551
|
+
chain_id: chainId,
|
|
552
|
+
ids,
|
|
553
|
+
time_at: timeAt,
|
|
554
|
+
},
|
|
555
|
+
});
|
|
556
|
+
return data;
|
|
557
|
+
});
|
|
558
|
+
this.getNetCurve = (addr, days = CurveDayType.DAY) => __awaiter(this, void 0, void 0, function* () {
|
|
559
|
+
const { data } = yield this.request.get('/v1/user/total_net_curve', {
|
|
560
|
+
params: {
|
|
561
|
+
id: addr,
|
|
562
|
+
days,
|
|
563
|
+
},
|
|
564
|
+
});
|
|
565
|
+
return data;
|
|
566
|
+
});
|
|
567
|
+
this.getChainList = () => __awaiter(this, void 0, void 0, function* () {
|
|
568
|
+
const { data } = yield this.request.get('/v1/chain/list');
|
|
569
|
+
return data;
|
|
570
|
+
});
|
|
571
|
+
this.getCEXSwapQuote = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
572
|
+
const { data } = yield this.request.get('/v1/wallet/cex_swap_quote', {
|
|
573
|
+
params,
|
|
574
|
+
});
|
|
575
|
+
return data;
|
|
576
|
+
});
|
|
577
|
+
this.getSwapTradeList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
578
|
+
const { data } = yield this.request.get('/v1/wallet/swap_trade_list', {
|
|
579
|
+
params,
|
|
580
|
+
});
|
|
581
|
+
return data;
|
|
582
|
+
});
|
|
583
|
+
this.getSwapTradeListV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
584
|
+
const { data } = yield this.request.get('/v2/wallet/swap_trade_list', {
|
|
585
|
+
params,
|
|
586
|
+
});
|
|
587
|
+
return data;
|
|
588
|
+
});
|
|
589
|
+
this.postSwap = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
590
|
+
const { data } = yield this.request.post('/v1/wallet/swap_trade', params);
|
|
591
|
+
return data;
|
|
592
|
+
});
|
|
593
|
+
this.checkSlippage = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
594
|
+
const { data } = yield this.request.get('/v1/wallet/check_slippage', {
|
|
595
|
+
params,
|
|
596
|
+
});
|
|
597
|
+
return data;
|
|
598
|
+
});
|
|
599
|
+
this.suggestSlippage = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
600
|
+
const { data } = yield this.request.get('v1/wallet/suggest_slippage', {
|
|
601
|
+
params,
|
|
602
|
+
});
|
|
603
|
+
return data;
|
|
604
|
+
});
|
|
605
|
+
this.getOriginPopularityLevel = (origin) => __awaiter(this, void 0, void 0, function* () {
|
|
606
|
+
const { data } = yield this.request.get('/v1/engine/origin/popularity_level', {
|
|
607
|
+
params: {
|
|
608
|
+
origin,
|
|
609
|
+
},
|
|
610
|
+
});
|
|
611
|
+
return data;
|
|
612
|
+
});
|
|
613
|
+
this.getOriginIsScam = (origin, source) => __awaiter(this, void 0, void 0, function* () {
|
|
614
|
+
const { data } = yield this.request.get('/v1/engine/origin/is_scam', {
|
|
615
|
+
params: {
|
|
616
|
+
origin,
|
|
617
|
+
source,
|
|
618
|
+
},
|
|
619
|
+
});
|
|
620
|
+
return data;
|
|
621
|
+
});
|
|
622
|
+
this.getOriginThirdPartyCollectList = (origin) => __awaiter(this, void 0, void 0, function* () {
|
|
623
|
+
const { data } = yield this.request.get('/v1/engine/origin/third_party_collect_list', {
|
|
624
|
+
params: {
|
|
625
|
+
origin,
|
|
626
|
+
},
|
|
627
|
+
});
|
|
628
|
+
return data;
|
|
629
|
+
});
|
|
630
|
+
this.getSummarizedAssetList = (id, chain_id) => __awaiter(this, void 0, void 0, function* () {
|
|
631
|
+
const { data } = yield this.request.get('/v1/user/summarized_asset_list', {
|
|
632
|
+
params: {
|
|
633
|
+
id,
|
|
634
|
+
chain_id,
|
|
635
|
+
},
|
|
636
|
+
});
|
|
637
|
+
return data;
|
|
638
|
+
});
|
|
639
|
+
this.unexpectedAddrList = ({ chainId, tx, origin, addr, }) => __awaiter(this, void 0, void 0, function* () {
|
|
640
|
+
const { data } = yield this.request.post('/v1/engine/addr/unexpected_list', {
|
|
641
|
+
chain_id: chainId,
|
|
642
|
+
tx,
|
|
643
|
+
origin,
|
|
644
|
+
user_addr: addr,
|
|
645
|
+
});
|
|
646
|
+
return data;
|
|
647
|
+
});
|
|
648
|
+
this.gasLessTxCheck = ({ tx, usdValue, preExecSuccess, gasUsed, }) => __awaiter(this, void 0, void 0, function* () {
|
|
649
|
+
const { data } = yield this.request.post('/v1/wallet/tx_is_gasless', {
|
|
650
|
+
gas_used: gasUsed,
|
|
651
|
+
pre_exec_success: preExecSuccess,
|
|
652
|
+
tx,
|
|
653
|
+
usd_value: usdValue,
|
|
654
|
+
});
|
|
655
|
+
return data;
|
|
656
|
+
});
|
|
657
|
+
this.gasLessTxsCheck = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
658
|
+
const { data } = yield this.request.post('/v1/wallet/txs_is_gasless', postData);
|
|
659
|
+
return data;
|
|
660
|
+
});
|
|
661
|
+
this.parseTx = ({ chainId, tx, origin, addr, }) => __awaiter(this, void 0, void 0, function* () {
|
|
662
|
+
const { data } = yield this.request.post('/v1/engine/action/parse_tx', {
|
|
663
|
+
chain_id: chainId,
|
|
664
|
+
tx,
|
|
665
|
+
origin,
|
|
666
|
+
user_addr: addr,
|
|
667
|
+
});
|
|
668
|
+
return data;
|
|
669
|
+
});
|
|
670
|
+
this.isSuspiciousToken = (id, chainId) => __awaiter(this, void 0, void 0, function* () {
|
|
671
|
+
const { data } = yield this.request.get('/v1/engine/token/is_suspicious', {
|
|
672
|
+
params: {
|
|
673
|
+
chain_id: chainId,
|
|
674
|
+
id,
|
|
675
|
+
},
|
|
676
|
+
});
|
|
677
|
+
return data;
|
|
678
|
+
});
|
|
679
|
+
this.depositCexSupport = (id, chainId, cexId) => __awaiter(this, void 0, void 0, function* () {
|
|
680
|
+
const { data } = yield this.request.get('/v1/engine/token/deposit_cex_support', {
|
|
681
|
+
params: {
|
|
682
|
+
chain_id: chainId,
|
|
683
|
+
id,
|
|
684
|
+
cex_id: cexId,
|
|
685
|
+
},
|
|
686
|
+
});
|
|
687
|
+
return data;
|
|
688
|
+
});
|
|
689
|
+
// Token 可充值的 CEX 列表
|
|
690
|
+
this.depositCexList = (id, chainId) => __awaiter(this, void 0, void 0, function* () {
|
|
691
|
+
const { data } = yield this.request.get('/v1/engine/token/deposit_cex_list', {
|
|
692
|
+
params: {
|
|
693
|
+
chain_id: chainId,
|
|
694
|
+
id,
|
|
695
|
+
},
|
|
696
|
+
});
|
|
697
|
+
return data;
|
|
698
|
+
});
|
|
699
|
+
// 合约信用分
|
|
700
|
+
this.getContractCredit = (id, chainId) => __awaiter(this, void 0, void 0, function* () {
|
|
701
|
+
const { data } = yield this.request.get('/v1/engine/contract/credit', {
|
|
702
|
+
params: {
|
|
703
|
+
chain_id: chainId,
|
|
704
|
+
id,
|
|
705
|
+
},
|
|
706
|
+
});
|
|
707
|
+
return data;
|
|
708
|
+
});
|
|
709
|
+
// 是否跟地址交互过
|
|
710
|
+
this.hasInteraction = (addr, chainId, contractId) => __awaiter(this, void 0, void 0, function* () {
|
|
711
|
+
const { data } = yield this.request.get('/v1/engine/contract/has_interaction', {
|
|
712
|
+
params: {
|
|
713
|
+
chain_id: chainId,
|
|
714
|
+
user_addr: addr,
|
|
715
|
+
contract_id: contractId,
|
|
716
|
+
},
|
|
717
|
+
});
|
|
718
|
+
return data;
|
|
719
|
+
});
|
|
720
|
+
/**
|
|
721
|
+
* @deprecated
|
|
722
|
+
* 授权风险敞口
|
|
723
|
+
*/
|
|
724
|
+
this.tokenApproveExposure = (id, chainId) => __awaiter(this, void 0, void 0, function* () {
|
|
725
|
+
const { data } = yield this.request.get('/v1/engine/contract/token_approval_exposure', {
|
|
726
|
+
params: {
|
|
727
|
+
chain_id: chainId,
|
|
728
|
+
id,
|
|
729
|
+
},
|
|
730
|
+
});
|
|
731
|
+
return data;
|
|
732
|
+
});
|
|
733
|
+
this.tokenApproveTrustValue = (id, chainId) => __awaiter(this, void 0, void 0, function* () {
|
|
734
|
+
const { data } = yield this.request.get('/v1/engine/contract/spend_usd_value', {
|
|
735
|
+
params: {
|
|
736
|
+
chain_id: chainId,
|
|
737
|
+
id,
|
|
738
|
+
},
|
|
739
|
+
});
|
|
740
|
+
return data;
|
|
741
|
+
});
|
|
742
|
+
this.getContractInfo = (id, chainId) => __awaiter(this, void 0, void 0, function* () {
|
|
743
|
+
const { data } = yield this.request.get('/v1/contract', {
|
|
744
|
+
params: {
|
|
745
|
+
chain_id: chainId,
|
|
746
|
+
id,
|
|
747
|
+
},
|
|
748
|
+
});
|
|
749
|
+
return data.contract;
|
|
750
|
+
});
|
|
751
|
+
// 地址描述
|
|
752
|
+
this.addrDesc = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
753
|
+
const { data } = yield this.request.get('/v1/engine/addr/desc', {
|
|
754
|
+
params: {
|
|
755
|
+
id,
|
|
756
|
+
},
|
|
757
|
+
});
|
|
758
|
+
return data;
|
|
759
|
+
});
|
|
760
|
+
// 两个地址是否发生过转账
|
|
761
|
+
this.hasTransfer = (chainId, from, to) => __awaiter(this, void 0, void 0, function* () {
|
|
762
|
+
const { data } = yield this.request.get('/v1/engine/addr/has_transfer', {
|
|
763
|
+
params: {
|
|
764
|
+
chain_id: chainId,
|
|
765
|
+
from_addr: from,
|
|
766
|
+
to_addr: to,
|
|
767
|
+
},
|
|
768
|
+
timeout: 2000,
|
|
769
|
+
});
|
|
770
|
+
return data;
|
|
771
|
+
});
|
|
772
|
+
// 全链两个地址是否发生过转账
|
|
773
|
+
this.hasTransferAllChain = (from, to) => __awaiter(this, void 0, void 0, function* () {
|
|
774
|
+
const { data } = yield this.request.get('/v2/engine/addr/has_transfer', {
|
|
775
|
+
params: {
|
|
776
|
+
from_addr: from,
|
|
777
|
+
to_addr: to,
|
|
778
|
+
},
|
|
779
|
+
timeout: 2000,
|
|
780
|
+
});
|
|
781
|
+
return data;
|
|
782
|
+
});
|
|
783
|
+
this.isTokenContract = (chainId, id) => __awaiter(this, void 0, void 0, function* () {
|
|
784
|
+
const { data } = yield this.request.get('/v1/engine/contract/is_token', {
|
|
785
|
+
params: {
|
|
786
|
+
id,
|
|
787
|
+
chain_id: chainId,
|
|
788
|
+
},
|
|
789
|
+
});
|
|
790
|
+
return data;
|
|
791
|
+
});
|
|
792
|
+
this.addrUsedChainList = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
793
|
+
const { data } = yield this.request.get('/v1/engine/addr/used_chain_list', {
|
|
794
|
+
params: { id },
|
|
795
|
+
});
|
|
796
|
+
return data;
|
|
797
|
+
});
|
|
798
|
+
/**
|
|
799
|
+
* @deprecated
|
|
800
|
+
*/
|
|
801
|
+
this.getTokenNFTExposure = (chainId, id) => __awaiter(this, void 0, void 0, function* () {
|
|
802
|
+
const { data } = yield this.request.get('/v1/engine/contract/top_nft_approval_exposure', {
|
|
803
|
+
params: { chain_id: chainId, id },
|
|
804
|
+
});
|
|
805
|
+
return data;
|
|
806
|
+
});
|
|
807
|
+
this.getTokenNFTTrustValue = (chainId, id) => __awaiter(this, void 0, void 0, function* () {
|
|
808
|
+
const { data } = yield this.request.get('/v1/engine/contract/top_nft_spend_usd_value', {
|
|
809
|
+
params: { chain_id: chainId, id },
|
|
810
|
+
});
|
|
811
|
+
return data;
|
|
812
|
+
});
|
|
813
|
+
this.getCollection = (chainId, id) => __awaiter(this, void 0, void 0, function* () {
|
|
814
|
+
const { data } = yield this.request.get('/v1/engine/collection', {
|
|
815
|
+
params: { chain_id: chainId, id },
|
|
816
|
+
});
|
|
817
|
+
return data;
|
|
818
|
+
});
|
|
819
|
+
this.isSuspiciousCollection = (chainId, id) => __awaiter(this, void 0, void 0, function* () {
|
|
820
|
+
const { data } = yield this.request.get('/v1/engine/collection/is_suspicious', {
|
|
821
|
+
params: { chain_id: chainId, id },
|
|
822
|
+
});
|
|
823
|
+
return data;
|
|
824
|
+
});
|
|
825
|
+
this.isOriginVerified = (origin) => __awaiter(this, void 0, void 0, function* () {
|
|
826
|
+
const { data } = yield this.request.get('/v1/engine/origin/is_verified', {
|
|
827
|
+
params: { origin },
|
|
828
|
+
});
|
|
829
|
+
return data;
|
|
830
|
+
});
|
|
831
|
+
this.parseTypedData = ({ typedData, origin, address, }) => __awaiter(this, void 0, void 0, function* () {
|
|
832
|
+
const { data } = yield this.request.post('/v1/engine/action/parse_typed_data', {
|
|
833
|
+
typed_data: typedData,
|
|
834
|
+
origin,
|
|
835
|
+
user_addr: address,
|
|
836
|
+
});
|
|
837
|
+
return data;
|
|
838
|
+
});
|
|
839
|
+
this.parseText = ({ text, origin, address, }) => __awaiter(this, void 0, void 0, function* () {
|
|
840
|
+
const { data } = yield this.request.post('/v1/engine/action/parse_text', {
|
|
841
|
+
text,
|
|
842
|
+
origin,
|
|
843
|
+
user_addr: address,
|
|
844
|
+
});
|
|
845
|
+
return data;
|
|
846
|
+
});
|
|
847
|
+
this.collectionList = ({ id, chainId, isAll, }) => __awaiter(this, void 0, void 0, function* () {
|
|
848
|
+
const { data } = yield this.request.get('/v1/user/collection_list', {
|
|
849
|
+
params: {
|
|
850
|
+
id,
|
|
851
|
+
chain_id: chainId,
|
|
852
|
+
is_all: isAll,
|
|
853
|
+
},
|
|
854
|
+
});
|
|
855
|
+
return data;
|
|
856
|
+
});
|
|
857
|
+
this.gasPriceStats = (chainId) => __awaiter(this, void 0, void 0, function* () {
|
|
858
|
+
const { data } = yield this.request.get('/v1/wallet/gas_price_stats', {
|
|
859
|
+
params: {
|
|
860
|
+
chain_id: chainId,
|
|
861
|
+
},
|
|
862
|
+
});
|
|
863
|
+
return data;
|
|
864
|
+
});
|
|
865
|
+
this.badgeHasClaimed = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
866
|
+
const { data } = yield this.request.get('/v1/badge/code/user_has_claimed', {
|
|
867
|
+
params: {
|
|
868
|
+
user_id: id,
|
|
869
|
+
},
|
|
870
|
+
});
|
|
871
|
+
return data;
|
|
872
|
+
});
|
|
873
|
+
this.badgeHasMinted = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
874
|
+
const { data } = yield this.request.get('/v1/badge/user_has_minted', {
|
|
875
|
+
params: {
|
|
876
|
+
user_id: id,
|
|
877
|
+
},
|
|
878
|
+
});
|
|
879
|
+
return data;
|
|
880
|
+
});
|
|
881
|
+
this.mintBadge = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
882
|
+
const { data } = yield this.request.post('/v1/badge/mint', {
|
|
883
|
+
code: params.code,
|
|
884
|
+
user_id: params.userAddr,
|
|
885
|
+
});
|
|
886
|
+
return data;
|
|
887
|
+
});
|
|
888
|
+
this.badgeHasClaimedByName = ({ id, name, }) => __awaiter(this, void 0, void 0, function* () {
|
|
889
|
+
const { data } = yield this.request.get(`/v1/badge/code/user_has_claimed/${name}`, {
|
|
890
|
+
params: {
|
|
891
|
+
user_id: id,
|
|
892
|
+
},
|
|
893
|
+
});
|
|
894
|
+
return data;
|
|
895
|
+
});
|
|
896
|
+
this.badgeHasMintedByName = ({ id, name, }) => __awaiter(this, void 0, void 0, function* () {
|
|
897
|
+
const { data } = yield this.request.get(`/v1/badge/user_has_minted/${name}`, {
|
|
898
|
+
params: {
|
|
899
|
+
user_id: id,
|
|
900
|
+
},
|
|
901
|
+
});
|
|
902
|
+
return data;
|
|
903
|
+
});
|
|
904
|
+
this.mintBadgeByName = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
905
|
+
const { data } = yield this.request.post(`/v1/badge/mint/${params.name}`, {
|
|
906
|
+
code: params.code,
|
|
907
|
+
user_id: params.userAddr,
|
|
908
|
+
});
|
|
909
|
+
return data;
|
|
910
|
+
});
|
|
911
|
+
this.userHasRequestedFaucet = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
912
|
+
const { data } = yield this.request.get('/v1/faucet/user_has_requested', {
|
|
913
|
+
params,
|
|
914
|
+
});
|
|
915
|
+
return data;
|
|
916
|
+
});
|
|
917
|
+
this.requestFaucet = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
918
|
+
const { data } = yield this.request.post('/v1/faucet/request', Object.assign({}, params));
|
|
919
|
+
return data;
|
|
920
|
+
});
|
|
921
|
+
this.gasSupportedPushType = (chainId) => __awaiter(this, void 0, void 0, function* () {
|
|
922
|
+
const { data } = yield this.request.get('/v1/wallet/supported_push_type', {
|
|
923
|
+
params: {
|
|
924
|
+
chain_id: chainId,
|
|
925
|
+
},
|
|
926
|
+
});
|
|
927
|
+
return data;
|
|
928
|
+
});
|
|
929
|
+
this.submitTx = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
930
|
+
const { sig } = postData, rest = __rest(postData, ["sig"]);
|
|
931
|
+
const { data } = yield this.request.post('/v1/wallet/submit_tx', Object.assign({}, rest), {
|
|
932
|
+
headers: sig ? { sig } : undefined,
|
|
933
|
+
});
|
|
934
|
+
return data;
|
|
935
|
+
});
|
|
936
|
+
this.submitTxV2 = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
937
|
+
const { sig } = postData, rest = __rest(postData, ["sig"]);
|
|
938
|
+
const { data } = yield this.request.post('/v2/wallet/submit_tx', Object.assign({}, rest), {
|
|
939
|
+
headers: sig ? { sig } : undefined,
|
|
940
|
+
});
|
|
941
|
+
return data;
|
|
942
|
+
});
|
|
943
|
+
this.getDefaultRPCs = () => __awaiter(this, void 0, void 0, function* () {
|
|
944
|
+
const { data } = yield this.request.get('/v1/chainrpc');
|
|
945
|
+
return data;
|
|
946
|
+
});
|
|
947
|
+
this.getTxRequests = (ids) => __awaiter(this, void 0, void 0, function* () {
|
|
948
|
+
const { data } = yield this.request.get('/v1/wallet/get_tx_requests', {
|
|
949
|
+
params: {
|
|
950
|
+
ids: Array.isArray(ids) ? ids.join(',') : ids,
|
|
951
|
+
},
|
|
952
|
+
});
|
|
953
|
+
return data;
|
|
954
|
+
});
|
|
955
|
+
this.getTxRequest = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
956
|
+
const { data } = yield this.request.get('/v1/wallet/get_tx_request', {
|
|
957
|
+
params: {
|
|
958
|
+
id,
|
|
959
|
+
},
|
|
960
|
+
});
|
|
961
|
+
return data;
|
|
962
|
+
});
|
|
963
|
+
this.withdrawTx = (reqId) => __awaiter(this, void 0, void 0, function* () {
|
|
964
|
+
const { data } = yield this.request.post('/v1/wallet/withdraw_tx', {
|
|
965
|
+
id: reqId,
|
|
966
|
+
});
|
|
967
|
+
return data;
|
|
968
|
+
});
|
|
969
|
+
this.retryPushTx = (reqId) => __awaiter(this, void 0, void 0, function* () {
|
|
970
|
+
const { data } = yield this.request.post('/v1/wallet/retry_push_tx', {
|
|
971
|
+
id: reqId,
|
|
972
|
+
});
|
|
973
|
+
return data;
|
|
974
|
+
});
|
|
975
|
+
this.mempoolChecks = (txId, chainId, node_info) => __awaiter(this, void 0, void 0, function* () {
|
|
976
|
+
const { data } = yield this.request.get('/v1/wallet/mempool_checks', {
|
|
977
|
+
params: {
|
|
978
|
+
tx_id: txId,
|
|
979
|
+
chain_id: chainId,
|
|
980
|
+
node_info: node_info ? 1 : 0,
|
|
981
|
+
},
|
|
982
|
+
});
|
|
983
|
+
return data;
|
|
984
|
+
});
|
|
985
|
+
this.getPendingTxList = (params, options) => __awaiter(this, void 0, void 0, function* () {
|
|
986
|
+
const data = yield this.asyncJob('/v1/wallet/get_pending_tx_list', Object.assign({ params }, options));
|
|
987
|
+
return data;
|
|
988
|
+
});
|
|
989
|
+
this.getLatestPreExec = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
990
|
+
const { data } = yield this.request.get('/v1/wallet/get_latest_pre_exec', {
|
|
991
|
+
params,
|
|
992
|
+
});
|
|
993
|
+
return data;
|
|
994
|
+
});
|
|
995
|
+
this.walletSupportChain = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
996
|
+
const { data } = yield this.request.post('/v1/wallet/support_chain', params);
|
|
997
|
+
return data;
|
|
998
|
+
});
|
|
999
|
+
this.walletSupportOrigin = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1000
|
+
const { data } = yield this.request.post('/v1/wallet/support_origin', params);
|
|
1001
|
+
return data;
|
|
1002
|
+
});
|
|
1003
|
+
this.walletSupportSelector = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1004
|
+
const { data } = yield this.request.post('/v1/wallet/support_selector', params);
|
|
1005
|
+
return data;
|
|
1006
|
+
});
|
|
1007
|
+
this.searchDapp = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1008
|
+
const { data } = yield this.request.get('/v1/dapp/search', { params });
|
|
1009
|
+
return data;
|
|
1010
|
+
});
|
|
1011
|
+
this.getDappsInfo = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1012
|
+
var _e;
|
|
1013
|
+
const { data } = yield this.request.get('/v1/dapp/list', {
|
|
1014
|
+
params: {
|
|
1015
|
+
ids: (_e = params === null || params === void 0 ? void 0 : params.ids) === null || _e === void 0 ? void 0 : _e.join(','),
|
|
1016
|
+
},
|
|
1017
|
+
});
|
|
1018
|
+
return data;
|
|
1019
|
+
});
|
|
1020
|
+
this.getDappHotTags = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1021
|
+
const { data } = yield this.request.get('/v1/dapp/hot_tags', {
|
|
1022
|
+
params,
|
|
1023
|
+
});
|
|
1024
|
+
return data;
|
|
1025
|
+
});
|
|
1026
|
+
this.getHotDapps = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1027
|
+
const { data } = yield this.request.get('/v1/dapp/hot_list', { params });
|
|
1028
|
+
return data;
|
|
1029
|
+
});
|
|
1030
|
+
this.getRabbyClaimText = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1031
|
+
const { data } = yield this.request.get('/v1/points/user/claim_text', {
|
|
1032
|
+
params,
|
|
1033
|
+
});
|
|
1034
|
+
return data;
|
|
1035
|
+
});
|
|
1036
|
+
this.getRabbySignatureText = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1037
|
+
const { data } = yield this.request.get('/v1/points/user/sign_text', {
|
|
1038
|
+
params,
|
|
1039
|
+
});
|
|
1040
|
+
return data;
|
|
1041
|
+
});
|
|
1042
|
+
this.getRabbyPoints = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1043
|
+
const { data } = yield this.request.get('/v1/points/user', { params });
|
|
1044
|
+
return data;
|
|
1045
|
+
});
|
|
1046
|
+
this.checkRabbyPointsInviteCode = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1047
|
+
const { data } = yield this.request.get('/v1/points/user/invite_code_exist', { params });
|
|
1048
|
+
return data;
|
|
1049
|
+
});
|
|
1050
|
+
this.setRabbyPointsInviteCode = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1051
|
+
const { data } = yield this.request.post('/v1/points/user/invite_code', params);
|
|
1052
|
+
return data;
|
|
1053
|
+
});
|
|
1054
|
+
this.checkRabbyPointClaimable = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1055
|
+
const { data } = yield this.request.get('/v1/points/user/claimable', {
|
|
1056
|
+
params,
|
|
1057
|
+
});
|
|
1058
|
+
return data;
|
|
1059
|
+
});
|
|
1060
|
+
this.getRabbyPointsSnapshot = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1061
|
+
const { data } = yield this.request.get('/v1/points/snapshot', { params });
|
|
1062
|
+
return data;
|
|
1063
|
+
});
|
|
1064
|
+
this.claimRabbyPointsSnapshot = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1065
|
+
const { data } = yield this.request.post('/v1/points/claim_snapshot', params);
|
|
1066
|
+
return data;
|
|
1067
|
+
});
|
|
1068
|
+
this.getRabbyPointsTopUsers = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1069
|
+
const { data } = yield this.request.get('/v1/points/top_user', { params });
|
|
1070
|
+
return data;
|
|
1071
|
+
});
|
|
1072
|
+
this.getRabbyPointsList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1073
|
+
const { data } = yield this.request.get('/v1/points/campaign_list', {
|
|
1074
|
+
params,
|
|
1075
|
+
});
|
|
1076
|
+
return data;
|
|
1077
|
+
});
|
|
1078
|
+
this.getRabbyPointsCampaignIsEnded = () => __awaiter(this, void 0, void 0, function* () {
|
|
1079
|
+
const { data } = yield this.request.get('v1/points/campaign');
|
|
1080
|
+
return data;
|
|
1081
|
+
});
|
|
1082
|
+
this.claimRabbyPointsById = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1083
|
+
const { data } = yield this.request.post('/v1/points/claim_campaign', params);
|
|
1084
|
+
return data;
|
|
1085
|
+
});
|
|
1086
|
+
this.getRabbyPointsV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1087
|
+
const { data } = yield this.request.get('/v2/points/user', { params });
|
|
1088
|
+
return data;
|
|
1089
|
+
});
|
|
1090
|
+
this.getRabbySignatureTextV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1091
|
+
const { data } = yield this.request.get('/v2/points/user/sign_text', {
|
|
1092
|
+
params,
|
|
1093
|
+
});
|
|
1094
|
+
return data;
|
|
1095
|
+
});
|
|
1096
|
+
this.getRabbyClaimTextV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1097
|
+
const { data } = yield this.request.get('/v2/points/user/claim_text', {
|
|
1098
|
+
params,
|
|
1099
|
+
});
|
|
1100
|
+
return data;
|
|
1101
|
+
});
|
|
1102
|
+
this.setRabbyPointsInviteCodeV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1103
|
+
const { data } = yield this.request.post('/v2/points/user/invite_code', params);
|
|
1104
|
+
return data;
|
|
1105
|
+
});
|
|
1106
|
+
this.checkRabbyPointsInviteCodeV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1107
|
+
const { data } = yield this.request.get('/v2/points/user/invite_code_exist', {
|
|
1108
|
+
params,
|
|
1109
|
+
});
|
|
1110
|
+
return data;
|
|
1111
|
+
});
|
|
1112
|
+
this.claimRabbyPointsSnapshotV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1113
|
+
const { data } = yield this.request.post('/v2/points/claim_snapshot', params);
|
|
1114
|
+
return data;
|
|
1115
|
+
});
|
|
1116
|
+
this.getRabbyPointsTopUsersV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1117
|
+
const { data } = yield this.request.get('/v2/points/top_user', {
|
|
1118
|
+
params,
|
|
1119
|
+
});
|
|
1120
|
+
return data;
|
|
1121
|
+
});
|
|
1122
|
+
this.getRabbyPointsListV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1123
|
+
const { data } = yield this.request.get('/v2/points/campaign_list', {
|
|
1124
|
+
params,
|
|
1125
|
+
});
|
|
1126
|
+
return data;
|
|
1127
|
+
});
|
|
1128
|
+
this.claimRabbyPointsByIdV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1129
|
+
const { data } = yield this.request.post('/v2/points/claim_campaign', params);
|
|
1130
|
+
return data;
|
|
1131
|
+
});
|
|
1132
|
+
this.getRabbyPointsSnapshotV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1133
|
+
const { data } = yield this.request.get('/v2/points/snapshot', {
|
|
1134
|
+
params,
|
|
1135
|
+
});
|
|
1136
|
+
return data;
|
|
1137
|
+
});
|
|
1138
|
+
this.checkRabbyPointClaimableV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1139
|
+
const { data } = yield this.request.get('/v2/points/user/claimable', {
|
|
1140
|
+
params,
|
|
1141
|
+
});
|
|
1142
|
+
return data;
|
|
1143
|
+
});
|
|
1144
|
+
this.checkClaimInfoV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1145
|
+
const { data } = yield this.request.get('/v2/points/user/claim_info', {
|
|
1146
|
+
params,
|
|
1147
|
+
});
|
|
1148
|
+
return data;
|
|
1149
|
+
});
|
|
1150
|
+
this.getRabbyPointsCampaignIsEndedV2 = () => __awaiter(this, void 0, void 0, function* () {
|
|
1151
|
+
const { data } = yield this.request.get('v2/points/campaign');
|
|
1152
|
+
return data;
|
|
1153
|
+
});
|
|
1154
|
+
this.getSupportedChains = () => __awaiter(this, void 0, void 0, function* () {
|
|
1155
|
+
const { data } = yield this.request.get('/v1/wallet/supported_chains');
|
|
1156
|
+
return data;
|
|
1157
|
+
});
|
|
1158
|
+
this.searchChainList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1159
|
+
const { data } = yield this.request.get('/v1/chain/total_list', {
|
|
1160
|
+
params,
|
|
1161
|
+
});
|
|
1162
|
+
return data;
|
|
1163
|
+
});
|
|
1164
|
+
this.getChainListByIds = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1165
|
+
const { data } = yield this.request.get('/v1/chain/get_list', {
|
|
1166
|
+
params,
|
|
1167
|
+
});
|
|
1168
|
+
return data;
|
|
1169
|
+
});
|
|
1170
|
+
this.getHistoryCurve = (addr) => __awaiter(this, void 0, void 0, function* () {
|
|
1171
|
+
const { data } = yield this.request.get('/v1/user/history_curve', {
|
|
1172
|
+
params: { id: addr },
|
|
1173
|
+
});
|
|
1174
|
+
return data;
|
|
1175
|
+
});
|
|
1176
|
+
this.getHistoryCurveSupportedList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1177
|
+
const { data } = yield this.request.get('/v1/chain/classify_supported_list');
|
|
1178
|
+
return data;
|
|
1179
|
+
});
|
|
1180
|
+
this.getHistoryCurveStatus = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1181
|
+
const { data } = yield this.request.get('/v1/user/history_curve/status', {
|
|
1182
|
+
params,
|
|
1183
|
+
});
|
|
1184
|
+
return data;
|
|
1185
|
+
});
|
|
1186
|
+
this.initHistoryCurve = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1187
|
+
const { data } = yield this.request.post('/v1/user/history_curve/init', params);
|
|
1188
|
+
return data;
|
|
1189
|
+
});
|
|
1190
|
+
this.getNodeStatusList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1191
|
+
const { data } = yield this.request.get('/v1/node/list');
|
|
1192
|
+
return data;
|
|
1193
|
+
});
|
|
1194
|
+
this.getNodeStatusDetail = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1195
|
+
const { data } = yield this.request.get('/v1/node', { params });
|
|
1196
|
+
return data;
|
|
1197
|
+
});
|
|
1198
|
+
this.postActionLog = (body) => __awaiter(this, void 0, void 0, function* () {
|
|
1199
|
+
const { data } = yield this.request.post('/v1/engine/action/log', body);
|
|
1200
|
+
return data;
|
|
1201
|
+
});
|
|
1202
|
+
this.checkSpoofing = ({ from, to, }) => __awaiter(this, void 0, void 0, function* () {
|
|
1203
|
+
const { data } = yield this.request.get('/v1/engine/addr/is_spoofing', {
|
|
1204
|
+
params: { user_addr: from, dest_addr: to },
|
|
1205
|
+
});
|
|
1206
|
+
return data;
|
|
1207
|
+
});
|
|
1208
|
+
this.getAddressByDeBankId = (name) => __awaiter(this, void 0, void 0, function* () {
|
|
1209
|
+
const { data } = yield this.request.get('/v1/user/web3_id', {
|
|
1210
|
+
params: {
|
|
1211
|
+
text: name,
|
|
1212
|
+
},
|
|
1213
|
+
});
|
|
1214
|
+
return data;
|
|
1215
|
+
});
|
|
1216
|
+
this.getBridgeSupportChain = () => __awaiter(this, void 0, void 0, function* () {
|
|
1217
|
+
const { data } = yield this.request.get('/v1/bridge/supported_chains');
|
|
1218
|
+
return data;
|
|
1219
|
+
});
|
|
1220
|
+
this.getBridgeAggregatorList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1221
|
+
const { data } = yield this.request.get('/v1/bridge/list');
|
|
1222
|
+
return data;
|
|
1223
|
+
});
|
|
1224
|
+
this.getBridgePairList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1225
|
+
const { data } = yield this.request.get('/v1/bridge/pair_list', {
|
|
1226
|
+
params: Object.assign(Object.assign({}, params), { aggregator_ids: params.aggregator_ids.join(',') }),
|
|
1227
|
+
});
|
|
1228
|
+
return data;
|
|
1229
|
+
});
|
|
1230
|
+
this.getBridgeQuoteList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1231
|
+
const { data } = yield this.request.get('/v1/bridge/quote_list', {
|
|
1232
|
+
params,
|
|
1233
|
+
});
|
|
1234
|
+
return data;
|
|
1235
|
+
});
|
|
1236
|
+
this.getBridgeQuoteListV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1237
|
+
const { data } = yield this.request.get('/v2/bridge/quote_list', {
|
|
1238
|
+
params,
|
|
1239
|
+
});
|
|
1240
|
+
return data;
|
|
1241
|
+
});
|
|
1242
|
+
this.getBridgeQuote = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1243
|
+
const { data } = yield this.request.get('/v1/bridge/quote', {
|
|
1244
|
+
params,
|
|
1245
|
+
});
|
|
1246
|
+
return data;
|
|
1247
|
+
});
|
|
1248
|
+
this.getBridgeHistoryList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1249
|
+
const { data } = yield this.request.get('/v1/bridge/history_list', {
|
|
1250
|
+
params,
|
|
1251
|
+
});
|
|
1252
|
+
return data;
|
|
1253
|
+
});
|
|
1254
|
+
this.buildBridgeTx = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1255
|
+
const { data } = yield this.request.get('/v2/bridge/build_tx', {
|
|
1256
|
+
params,
|
|
1257
|
+
});
|
|
1258
|
+
return data;
|
|
1259
|
+
});
|
|
1260
|
+
this.postBridgeHistory = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1261
|
+
const { data } = yield this.request.post('/v1/bridge/history', params);
|
|
1262
|
+
return data;
|
|
1263
|
+
});
|
|
1264
|
+
/**
|
|
1265
|
+
* no id just no check address
|
|
1266
|
+
*/
|
|
1267
|
+
this.getPerpPermission = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1268
|
+
const { data } = yield this.request.get('/v1/user/has_hyperliquid_permission', {
|
|
1269
|
+
params,
|
|
1270
|
+
});
|
|
1271
|
+
return data;
|
|
1272
|
+
});
|
|
1273
|
+
this.getPerpTopTokenList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1274
|
+
const { data } = yield this.request.get('/v1/token/hyperliquid_top');
|
|
1275
|
+
return data;
|
|
1276
|
+
});
|
|
1277
|
+
this.getSupportedDEXList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1278
|
+
const { data } = yield this.request.get('/v1/wallet/supported_dex_list');
|
|
1279
|
+
return data;
|
|
1280
|
+
});
|
|
1281
|
+
this.createDbkBridgeHistory = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
1282
|
+
const { data } = yield this.request.post('/v1/user/dbk/bridge_history', postData);
|
|
1283
|
+
return data;
|
|
1284
|
+
});
|
|
1285
|
+
this.getDbkBridgeHistoryList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1286
|
+
const { data } = yield this.request.get('/v1/user/dbk/bridge_history_list', {
|
|
1287
|
+
params,
|
|
1288
|
+
});
|
|
1289
|
+
return data;
|
|
1290
|
+
});
|
|
1291
|
+
this.getGasAccountSignText = (account_id) => __awaiter(this, void 0, void 0, function* () {
|
|
1292
|
+
const { data } = yield this.request.get('/v1/gas_account/sign_text', {
|
|
1293
|
+
params: {
|
|
1294
|
+
account_id,
|
|
1295
|
+
},
|
|
1296
|
+
});
|
|
1297
|
+
return data;
|
|
1298
|
+
});
|
|
1299
|
+
this.getGasAccountInfo = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1300
|
+
const { sig } = params, others = __rest(params, ["sig"]);
|
|
1301
|
+
const { data } = yield this.request.get('/v1/gas_account', {
|
|
1302
|
+
params: Object.assign({}, others),
|
|
1303
|
+
headers: {
|
|
1304
|
+
sig,
|
|
1305
|
+
},
|
|
1306
|
+
});
|
|
1307
|
+
return data;
|
|
1308
|
+
});
|
|
1309
|
+
this.getGasAccountInfoV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1310
|
+
const { data } = yield this.request.get('/v2/gas_account', {
|
|
1311
|
+
params,
|
|
1312
|
+
});
|
|
1313
|
+
return data;
|
|
1314
|
+
});
|
|
1315
|
+
this.createGasAccountPayInfo = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
1316
|
+
const { data } = yield this.request.post('/v2/gas_account/pay_info', postData);
|
|
1317
|
+
return data;
|
|
1318
|
+
});
|
|
1319
|
+
this.checkGasAccountGiftEligibility = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1320
|
+
const { data } = yield this.request.get('/v1/gas_account/check_eligibility', {
|
|
1321
|
+
params,
|
|
1322
|
+
});
|
|
1323
|
+
return data;
|
|
1324
|
+
});
|
|
1325
|
+
this.checkGasAccountGiftEligibilityBatch = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1326
|
+
const { data } = yield this.request.post('/v1/gas_account/check_eligibility/batch', params);
|
|
1327
|
+
return data;
|
|
1328
|
+
});
|
|
1329
|
+
this.confirmIapOrder = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
1330
|
+
const { data } = yield this.request.post('/v1/gas_account/confirm_iap_order', postData);
|
|
1331
|
+
return data;
|
|
1332
|
+
});
|
|
1333
|
+
this.claimGasAccountGift = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1334
|
+
const { sig } = params, others = __rest(params, ["sig"]);
|
|
1335
|
+
const { data } = yield this.request.post('/v1/gas_account/claim', Object.assign({}, others), {
|
|
1336
|
+
headers: {
|
|
1337
|
+
sig,
|
|
1338
|
+
},
|
|
1339
|
+
});
|
|
1340
|
+
return data;
|
|
1341
|
+
});
|
|
1342
|
+
this.loginGasAccount = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1343
|
+
const { sig } = params, others = __rest(params, ["sig"]);
|
|
1344
|
+
const { data } = yield this.request.post('/v1/gas_account/login', Object.assign({}, others), {
|
|
1345
|
+
headers: {
|
|
1346
|
+
sig,
|
|
1347
|
+
},
|
|
1348
|
+
});
|
|
1349
|
+
return data;
|
|
1350
|
+
});
|
|
1351
|
+
this.logoutGasAccount = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1352
|
+
const { sig } = params, others = __rest(params, ["sig"]);
|
|
1353
|
+
const { data } = yield this.request.post('/v1/gas_account/logout', Object.assign({}, others), {
|
|
1354
|
+
headers: {
|
|
1355
|
+
sig,
|
|
1356
|
+
},
|
|
1357
|
+
});
|
|
1358
|
+
return data;
|
|
1359
|
+
});
|
|
1360
|
+
this.getGasAccountTokenList = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
1361
|
+
const { data } = yield this.request.get('/v1/user/recharge_token_list', {
|
|
1362
|
+
params: {
|
|
1363
|
+
id,
|
|
1364
|
+
},
|
|
1365
|
+
});
|
|
1366
|
+
return data;
|
|
1367
|
+
});
|
|
1368
|
+
this.rechargeGasAccount = (p) => __awaiter(this, void 0, void 0, function* () {
|
|
1369
|
+
const { sig } = p, params = __rest(p, ["sig"]);
|
|
1370
|
+
const { data } = yield this.request.post('/v1/gas_account/recharge', params, {
|
|
1371
|
+
headers: {
|
|
1372
|
+
sig,
|
|
1373
|
+
},
|
|
1374
|
+
});
|
|
1375
|
+
return data;
|
|
1376
|
+
});
|
|
1377
|
+
this.withdrawGasAccount = (p) => __awaiter(this, void 0, void 0, function* () {
|
|
1378
|
+
const { sig } = p, params = __rest(p, ["sig"]);
|
|
1379
|
+
const { data } = yield this.request.post('/v1/gas_account/withdraw', params, {
|
|
1380
|
+
headers: {
|
|
1381
|
+
sig,
|
|
1382
|
+
},
|
|
1383
|
+
});
|
|
1384
|
+
return data;
|
|
1385
|
+
});
|
|
1386
|
+
this.getWithdrawList = (p) => __awaiter(this, void 0, void 0, function* () {
|
|
1387
|
+
const { sig } = p, params = __rest(p, ["sig"]);
|
|
1388
|
+
const { data } = yield this.request.get('/v1/gas_account/withdraw_list', {
|
|
1389
|
+
params,
|
|
1390
|
+
headers: {
|
|
1391
|
+
sig,
|
|
1392
|
+
},
|
|
1393
|
+
});
|
|
1394
|
+
return data;
|
|
1395
|
+
});
|
|
1396
|
+
this.getGasAccountHistory = (p) => __awaiter(this, void 0, void 0, function* () {
|
|
1397
|
+
const { sig } = p, params = __rest(p, ["sig"]);
|
|
1398
|
+
const { data } = yield this.request.get('/v1/gas_account/history', {
|
|
1399
|
+
params,
|
|
1400
|
+
headers: {
|
|
1401
|
+
sig,
|
|
1402
|
+
},
|
|
1403
|
+
});
|
|
1404
|
+
return data;
|
|
1405
|
+
});
|
|
1406
|
+
this.checkGasAccountTxs = (p) => __awaiter(this, void 0, void 0, function* () {
|
|
1407
|
+
const { sig } = p, params = __rest(p, ["sig"]);
|
|
1408
|
+
const { data } = yield this.request.post('/v1/gas_account/check_txs', params, {
|
|
1409
|
+
headers: sig
|
|
1410
|
+
? {
|
|
1411
|
+
sig,
|
|
1412
|
+
}
|
|
1413
|
+
: undefined,
|
|
1414
|
+
});
|
|
1415
|
+
return data;
|
|
1416
|
+
});
|
|
1417
|
+
this.getGasAccountAml = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
1418
|
+
const { data } = yield this.request.get('/v1/gas_account/aml', {
|
|
1419
|
+
params: {
|
|
1420
|
+
id,
|
|
1421
|
+
},
|
|
1422
|
+
});
|
|
1423
|
+
return data;
|
|
1424
|
+
});
|
|
1425
|
+
this.parseCommon = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1426
|
+
const { data } = yield this.request.post('/v1/engine/action/parse_common', params);
|
|
1427
|
+
return data;
|
|
1428
|
+
});
|
|
1429
|
+
this.getRecommendBridgeToChain = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1430
|
+
const { data } = yield this.request.get('/v2/bridge/recommend/to_chain', {
|
|
1431
|
+
params,
|
|
1432
|
+
});
|
|
1433
|
+
return data;
|
|
1434
|
+
});
|
|
1435
|
+
this.getRecommendFromToken = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1436
|
+
const { data } = yield this.request.get('/v2/bridge/recommend/from_token_list', {
|
|
1437
|
+
params,
|
|
1438
|
+
});
|
|
1439
|
+
return data;
|
|
1440
|
+
});
|
|
1441
|
+
this.getBridgeToTokenList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1442
|
+
const { data } = yield this.request.get('/v2/bridge/recommend/to_token_list', {
|
|
1443
|
+
params,
|
|
1444
|
+
});
|
|
1445
|
+
return data;
|
|
1446
|
+
});
|
|
1447
|
+
this.getBridgeQuoteV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1448
|
+
const { data } = yield this.request.get('/v2/bridge/quote_list', {
|
|
1449
|
+
params,
|
|
1450
|
+
});
|
|
1451
|
+
return data;
|
|
1452
|
+
});
|
|
1453
|
+
this.getBridgeQuoteTxV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1454
|
+
const { data } = yield this.request.get('/v2/bridge/quote', {
|
|
1455
|
+
params,
|
|
1456
|
+
});
|
|
1457
|
+
return data;
|
|
1458
|
+
});
|
|
1459
|
+
this.isSameBridgeToken = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1460
|
+
const { data } = yield this.request.get('/v2/bridge/same_token', {
|
|
1461
|
+
params,
|
|
1462
|
+
});
|
|
1463
|
+
return data;
|
|
1464
|
+
});
|
|
1465
|
+
this.getBridgeSupportChainV2 = () => __awaiter(this, void 0, void 0, function* () {
|
|
1466
|
+
const { data } = yield this.request.get('/v2/bridge/supported_chains');
|
|
1467
|
+
return data;
|
|
1468
|
+
});
|
|
1469
|
+
this.submitFeedback = ({ text, usage, }) => __awaiter(this, void 0, void 0, function* () {
|
|
1470
|
+
const { data } = yield this.request.post('v1/feedback', Object.assign({ text }, (usage && { usage })));
|
|
1471
|
+
return data;
|
|
1472
|
+
});
|
|
1473
|
+
this.uninstalledFeedback = ({ text, }) => __awaiter(this, void 0, void 0, function* () {
|
|
1474
|
+
return this.submitFeedback({
|
|
1475
|
+
text,
|
|
1476
|
+
});
|
|
1477
|
+
});
|
|
1478
|
+
/**
|
|
1479
|
+
* @deprecated
|
|
1480
|
+
*/
|
|
1481
|
+
this.getToken24hPrice = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1482
|
+
const { data } = yield this.request.get('/v1/token/24h_price', {
|
|
1483
|
+
params,
|
|
1484
|
+
});
|
|
1485
|
+
return data;
|
|
1486
|
+
});
|
|
1487
|
+
this.getTokenPriceCurve = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1488
|
+
const { data } = yield this.request.get('/v1/token/price_curve', {
|
|
1489
|
+
params,
|
|
1490
|
+
});
|
|
1491
|
+
return data;
|
|
1492
|
+
});
|
|
1493
|
+
this.getTokenDatePrice = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1494
|
+
const { data } = yield this.request.get('/v1/token/date_price', {
|
|
1495
|
+
params,
|
|
1496
|
+
});
|
|
1497
|
+
return data;
|
|
1498
|
+
});
|
|
1499
|
+
this.searchTokens = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1500
|
+
const { data } = yield this.request.get('/v1/token/search', {
|
|
1501
|
+
params,
|
|
1502
|
+
});
|
|
1503
|
+
return data;
|
|
1504
|
+
});
|
|
1505
|
+
this.searchTokensV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1506
|
+
const { data } = yield this.request.get('/v2/token/search', {
|
|
1507
|
+
params,
|
|
1508
|
+
});
|
|
1509
|
+
return data;
|
|
1510
|
+
});
|
|
1511
|
+
// resp arr of chain_id
|
|
1512
|
+
this.getCopyTradingChainList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1513
|
+
const { data } = yield this.request.get('/v1/copytrading/chain_list');
|
|
1514
|
+
return data;
|
|
1515
|
+
});
|
|
1516
|
+
this.getCopyTradingTokenList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1517
|
+
const { data } = yield this.request.get('/v1/copytrading/token/list', {
|
|
1518
|
+
params,
|
|
1519
|
+
});
|
|
1520
|
+
return data;
|
|
1521
|
+
});
|
|
1522
|
+
this.getCopyTradingTokenListV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1523
|
+
const { data } = yield this.request.get('/v2/copytrading/token/list', {
|
|
1524
|
+
params,
|
|
1525
|
+
});
|
|
1526
|
+
return data;
|
|
1527
|
+
});
|
|
1528
|
+
this.getCopyTradingRecentBuyList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1529
|
+
const { data } = yield this.request.get('/v1/copytrading/recent_buy/list', {
|
|
1530
|
+
params,
|
|
1531
|
+
});
|
|
1532
|
+
return data;
|
|
1533
|
+
});
|
|
1534
|
+
this.getCopyTradingRecentBuyListV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1535
|
+
const { data } = yield this.request.get('/v2/copytrading/recent_buy/list', {
|
|
1536
|
+
params,
|
|
1537
|
+
});
|
|
1538
|
+
return data;
|
|
1539
|
+
});
|
|
1540
|
+
this.getCopyTradingDetail = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1541
|
+
const { data } = yield this.request.get('/v2/copytrading/token/detail', {
|
|
1542
|
+
params,
|
|
1543
|
+
});
|
|
1544
|
+
return data;
|
|
1545
|
+
});
|
|
1546
|
+
this.getCopyTradingSameName = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1547
|
+
const { data } = yield this.request.get('/v1/token/same_name', {
|
|
1548
|
+
params,
|
|
1549
|
+
});
|
|
1550
|
+
return data;
|
|
1551
|
+
});
|
|
1552
|
+
this.getCopyTradingPnlList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1553
|
+
const { data } = yield this.request.get('/v1/copytrading/smart_money/pnl/list', {
|
|
1554
|
+
params,
|
|
1555
|
+
});
|
|
1556
|
+
return data;
|
|
1557
|
+
});
|
|
1558
|
+
this.batchQueryTokens = (uuids) => __awaiter(this, void 0, void 0, function* () {
|
|
1559
|
+
const { data } = yield this.request.get('/v1/token/list_by_uuids', {
|
|
1560
|
+
params: {
|
|
1561
|
+
uuids: Array.isArray(uuids) ? uuids.join(',') : uuids,
|
|
1562
|
+
},
|
|
1563
|
+
});
|
|
1564
|
+
return data;
|
|
1565
|
+
});
|
|
1566
|
+
this.getBuySupportedCountryList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1567
|
+
const { data } = yield this.request.get('/v1/buy/supported_country_list');
|
|
1568
|
+
return data;
|
|
1569
|
+
});
|
|
1570
|
+
this.getBuySupportedTokenList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1571
|
+
const { data } = yield this.request.get('/v1/buy/supported_token_list');
|
|
1572
|
+
return data;
|
|
1573
|
+
});
|
|
1574
|
+
this.getBuyQuote = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1575
|
+
const { data } = yield this.request.get('/v1/buy/quote', {
|
|
1576
|
+
params,
|
|
1577
|
+
});
|
|
1578
|
+
return data;
|
|
1579
|
+
});
|
|
1580
|
+
this.getBuyWidgetUrl = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1581
|
+
const { data } = yield this.request.get('/v1/buy/get_widget_url', { params });
|
|
1582
|
+
return data;
|
|
1583
|
+
});
|
|
1584
|
+
this.getBuyHistory = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1585
|
+
const { data } = yield this.request.get('/v1/buy/history', {
|
|
1586
|
+
params: Object.assign(Object.assign({}, params), { start: params.start || 0, limit: params.limit || 20 }),
|
|
1587
|
+
});
|
|
1588
|
+
return data;
|
|
1589
|
+
});
|
|
1590
|
+
this.getBuyPaymentMethods = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1591
|
+
const { data } = yield this.request.get('/v1/buy/get_payment_method', {
|
|
1592
|
+
params,
|
|
1593
|
+
});
|
|
1594
|
+
return data;
|
|
1595
|
+
});
|
|
1596
|
+
this.getBuyCurrencyList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1597
|
+
const { data } = yield this.request.get('/v1/buy/supported_currency_list');
|
|
1598
|
+
return data;
|
|
1599
|
+
});
|
|
1600
|
+
this.getOfflineChainList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1601
|
+
const { data } = yield this.request.get('/v1/chain/offline_list');
|
|
1602
|
+
return data;
|
|
1603
|
+
});
|
|
1604
|
+
this.isBlockedAddress = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
1605
|
+
const { data } = yield this.request.get('/v1/engine/addr/is_blocked', {
|
|
1606
|
+
params: { id },
|
|
1607
|
+
});
|
|
1608
|
+
return data;
|
|
1609
|
+
});
|
|
1610
|
+
this.estimateGasUsd = ({ tx, origin, address, updateNonce = false, pending_tx_list = [], }) => __awaiter(this, void 0, void 0, function* () {
|
|
1611
|
+
const { data } = yield this.request.post('/v1/wallet/estimate_gas', {
|
|
1612
|
+
tx,
|
|
1613
|
+
user_addr: address,
|
|
1614
|
+
origin,
|
|
1615
|
+
update_nonce: updateNonce,
|
|
1616
|
+
pending_tx_list,
|
|
1617
|
+
});
|
|
1618
|
+
return data;
|
|
1619
|
+
});
|
|
1620
|
+
this.getCexSupportList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1621
|
+
const { data } = yield this.request.get('/v1/cex/supported_list');
|
|
1622
|
+
return data;
|
|
1623
|
+
});
|
|
1624
|
+
this.getAppChainList = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
1625
|
+
const { data } = yield this.request.get('/v1/user/complex_app_list', {
|
|
1626
|
+
params: { id },
|
|
1627
|
+
});
|
|
1628
|
+
return data;
|
|
1629
|
+
});
|
|
1630
|
+
this.checkCex = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
1631
|
+
const { data } = yield this.request.post('/v1/token/check_cex', postData);
|
|
1632
|
+
return data;
|
|
1633
|
+
});
|
|
1634
|
+
// top 20 tokens
|
|
1635
|
+
this.getHotTokenList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1636
|
+
const { data } = yield this.request.get('/v1/token/hot_list');
|
|
1637
|
+
return data;
|
|
1638
|
+
});
|
|
1639
|
+
// uuid: 'chain:token_id'
|
|
1640
|
+
this.getTokensDetailByUuids = (uuids) => __awaiter(this, void 0, void 0, function* () {
|
|
1641
|
+
const { data } = yield this.request.get('/v1/token/list_by_uuids', {
|
|
1642
|
+
params: {
|
|
1643
|
+
uuids: uuids.join(','),
|
|
1644
|
+
},
|
|
1645
|
+
});
|
|
1646
|
+
return data;
|
|
1647
|
+
});
|
|
1648
|
+
this.postUserFeedback = (data) => __awaiter(this, void 0, void 0, function* () {
|
|
1649
|
+
const { data: response } = yield this.request.post('/v1/feedback/app', data);
|
|
1650
|
+
return response;
|
|
1651
|
+
});
|
|
1652
|
+
this.getUserFeedback = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
1653
|
+
const { data } = yield this.request.get('/v1/feedback/app', {
|
|
1654
|
+
params: { id },
|
|
1655
|
+
});
|
|
1656
|
+
return data;
|
|
1657
|
+
});
|
|
1658
|
+
this.getUserFeedbackList = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
1659
|
+
const ids = Array.isArray(id) ? id : [id];
|
|
1660
|
+
const { data } = yield this.request.post('/v1/feedback/app/list', {
|
|
1661
|
+
ids,
|
|
1662
|
+
});
|
|
1663
|
+
return data;
|
|
1664
|
+
});
|
|
1665
|
+
if (store instanceof Promise) {
|
|
1666
|
+
store.then((resolvedStore) => {
|
|
1667
|
+
this.store = resolvedStore;
|
|
1668
|
+
});
|
|
1669
|
+
}
|
|
1670
|
+
else {
|
|
1671
|
+
this.store = store;
|
|
1672
|
+
}
|
|
1673
|
+
__classPrivateFieldSet(this, _OpenApiService_plugin, plugin, "f");
|
|
1674
|
+
__classPrivateFieldSet(this, _OpenApiService_adapter, adapter, "f");
|
|
1675
|
+
__classPrivateFieldSet(this, _OpenApiService_clientName, clientName, "f");
|
|
1676
|
+
__classPrivateFieldSet(this, _OpenApiService_clientVersion, clientVersion, "f");
|
|
1677
|
+
}
|
|
1678
|
+
initSync(options) {
|
|
1679
|
+
var _a, _b;
|
|
1680
|
+
(_b = (_a = __classPrivateFieldGet(this, _OpenApiService_plugin, "f")).onInitiate) === null || _b === void 0 ? void 0 : _b.call(_a, Object.assign({}, options));
|
|
1681
|
+
const request = axios.create({
|
|
1682
|
+
baseURL: this.store.host,
|
|
1683
|
+
adapter: __classPrivateFieldGet(this, _OpenApiService_adapter, "f"),
|
|
1684
|
+
headers: {
|
|
1685
|
+
'X-Client': __classPrivateFieldGet(this, _OpenApiService_clientName, "f"),
|
|
1686
|
+
'X-Version': __classPrivateFieldGet(this, _OpenApiService_clientVersion, "f"),
|
|
1687
|
+
},
|
|
1688
|
+
});
|
|
1689
|
+
// sign after rateLimit, timestamp is the latest
|
|
1690
|
+
request.interceptors.request.use((config) => __awaiter(this, void 0, void 0, function* () {
|
|
1691
|
+
const { method, url, params } = genSignParams(config);
|
|
1692
|
+
yield __classPrivateFieldGet(this, _OpenApiService_plugin, "f").onSignRequest({
|
|
1693
|
+
axiosRequestConfig: config,
|
|
1694
|
+
parsed: { method, url, params },
|
|
1695
|
+
});
|
|
1696
|
+
return config;
|
|
1697
|
+
}));
|
|
1698
|
+
this.request = rateLimit(request, { maxRPS });
|
|
1699
|
+
this.request.interceptors.response.use((response) => {
|
|
1700
|
+
var _a, _b, _c, _d;
|
|
1701
|
+
const code = ((_a = response.data) === null || _a === void 0 ? void 0 : _a.err_code) || ((_b = response.data) === null || _b === void 0 ? void 0 : _b.error_code);
|
|
1702
|
+
const msg = ((_c = response.data) === null || _c === void 0 ? void 0 : _c.err_msg) || ((_d = response.data) === null || _d === void 0 ? void 0 : _d.error_msg);
|
|
1703
|
+
if (code && code !== 200) {
|
|
1704
|
+
if (msg) {
|
|
1705
|
+
let err;
|
|
1706
|
+
try {
|
|
1707
|
+
err = new Error(JSON.parse(msg));
|
|
1708
|
+
}
|
|
1709
|
+
catch (e) {
|
|
1710
|
+
err = new Error(msg);
|
|
1711
|
+
}
|
|
1712
|
+
throw err;
|
|
1713
|
+
}
|
|
1714
|
+
throw new Error(typeof response.data === 'string'
|
|
1715
|
+
? response.data
|
|
1716
|
+
: JSON.stringify(response.data));
|
|
1717
|
+
}
|
|
1718
|
+
return response;
|
|
1719
|
+
});
|
|
1720
|
+
this._mountMethods();
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
_OpenApiService_adapter = new WeakMap(), _OpenApiService_plugin = new WeakMap(), _OpenApiService_clientName = new WeakMap(), _OpenApiService_clientVersion = new WeakMap();
|