@rabby-wallet/rabby-api 0.9.21 → 0.9.23-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -28
- package/dist/const.d.ts +3 -3
- package/dist/const.js +8 -8
- package/dist/index.d.ts +1165 -1141
- package/dist/index.js +1606 -1576
- 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 +1527 -1490
- 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.d.ts
CHANGED
|
@@ -1,1141 +1,1165 @@
|
|
|
1
|
-
import { AxiosAdapter, AxiosRequestConfig } from 'axios';
|
|
2
|
-
import { RateLimitedAxiosInstance } from 'axios-rate-limit';
|
|
3
|
-
import { InitOptions, RabbyApiPlugin } from './plugins/intf';
|
|
4
|
-
import { AddrDescResponse, BridgeAggregator, ApprovalStatus, AssetItem, BasicDappInfo, CEXQuote, Cex, ChainListItem, ChainWithPendingCount, Collection, CollectionList, CollectionWithFloorPrice, ComplexProtocol, ContractCredit, DbkBridgeHistoryItem, ExplainTxResponse, ExplainTypedDataResponse, GasLevel, GetTxResponse, HistoryCurve, LatestExplainTxResponse, MempoolCheckDetail, NFTApprovalResponse, NFTItem, NodeStatus, NodeStatusDetail, ParseTextResponse, ParseTxResponse, ParseTypedDataResponse, PendingTxItem, Protocol, SecurityCheckResponse, ServerChain, SlippageStatus, Summary, SupportedChain, SwapTradeList, TokenApproval, TokenItem, TotalBalanceResponse, Tx, TxAllHistoryResult, TxHistoryResult, TxPushType, TxRequest, UsedChain, BridgeTokenPair, BridgeQuote, BridgeHistory, ContractInfo, GasAccountCheckResult, ParseCommonResponse, WithdrawListAddressItem, BuyCountryItem, BuyQuoteItem, BuyHistoryList, BuyPaymentMethod, GasAccountInfo, TokenEntityDetail, TokenItemWithEntity, ProjectItem } from './types';
|
|
5
|
-
interface OpenApiStore {
|
|
6
|
-
host: string;
|
|
7
|
-
testnetHost?: string;
|
|
8
|
-
}
|
|
9
|
-
interface Options {
|
|
10
|
-
store: OpenApiStore | Promise<OpenApiStore>;
|
|
11
|
-
plugin: RabbyApiPlugin;
|
|
12
|
-
adapter?: AxiosAdapter;
|
|
13
|
-
clientName?: string;
|
|
14
|
-
clientVersion?: string;
|
|
15
|
-
}
|
|
16
|
-
declare enum CurveDayType {
|
|
17
|
-
DAY = 1,
|
|
18
|
-
WEEK = 7
|
|
19
|
-
}
|
|
20
|
-
declare type VersionPrefix = 'v1' | 'v2';
|
|
21
|
-
declare type ApiOptions<V extends VersionPrefix | void = VersionPrefix> = {
|
|
22
|
-
restfulPrefix?: V;
|
|
23
|
-
};
|
|
24
|
-
export declare class OpenApiService {
|
|
25
|
-
#private;
|
|
26
|
-
store: OpenApiStore;
|
|
27
|
-
request: RateLimitedAxiosInstance;
|
|
28
|
-
constructor({ store, plugin, adapter, clientName, clientVersion, }: Options);
|
|
29
|
-
setHost: (host: string) => Promise<void>;
|
|
30
|
-
setHostSync: (host: string) => void;
|
|
31
|
-
getHost: () => string;
|
|
32
|
-
setTestnetHost: (host: string) => Promise<void>;
|
|
33
|
-
getTestnetHost: () => string | undefined;
|
|
34
|
-
ethRpc: ((chainId: string, arg: {
|
|
35
|
-
method: string;
|
|
36
|
-
params: Array<any>;
|
|
37
|
-
origin?: string;
|
|
38
|
-
}) => Promise<any>) | (() => Promise<never>);
|
|
39
|
-
init: (options?: string | InitOptions) => Promise<void>;
|
|
40
|
-
initSync(options?: InitOptions): void;
|
|
41
|
-
asyncJob: <T = any>(url: string, options?: AxiosRequestConfig & {
|
|
42
|
-
retryDelay?: number;
|
|
43
|
-
}) => Promise<T>;
|
|
44
|
-
private _mountMethods;
|
|
45
|
-
getRecommendChains: (address: string, origin: string) => Promise<ServerChain[]>;
|
|
46
|
-
getTotalBalance: (address: string, isCore?: boolean) => Promise<TotalBalanceResponse>;
|
|
47
|
-
getTotalBalanceV2: ({ address, isCore, included_token_uuids, excluded_token_uuids, excluded_protocol_ids, excluded_chain_ids, }: {
|
|
48
|
-
address: string;
|
|
49
|
-
isCore: boolean;
|
|
50
|
-
included_token_uuids: string[];
|
|
51
|
-
excluded_token_uuids: string[];
|
|
52
|
-
excluded_protocol_ids: string[];
|
|
53
|
-
excluded_chain_ids: string[];
|
|
54
|
-
}) => Promise<TotalBalanceResponse>;
|
|
55
|
-
getPendingCount: (address: string) => Promise<{
|
|
56
|
-
total_count: number;
|
|
57
|
-
chains: ChainWithPendingCount[];
|
|
58
|
-
}>;
|
|
59
|
-
checkOrigin: (address: string, origin: string) => Promise<SecurityCheckResponse>;
|
|
60
|
-
checkText: (address: string, origin: string, text: string) => Promise<SecurityCheckResponse>;
|
|
61
|
-
checkTx: (tx: Tx, origin: string, address: string, update_nonce?: boolean) => Promise<SecurityCheckResponse>;
|
|
62
|
-
preExecTx: ({ tx, origin, address, updateNonce, pending_tx_list, }: {
|
|
63
|
-
tx: Tx;
|
|
64
|
-
origin: string;
|
|
65
|
-
address: string;
|
|
66
|
-
updateNonce: boolean;
|
|
67
|
-
pending_tx_list: Tx[];
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
}>;
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
}>;
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
}>;
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
}>;
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
}) => Promise<
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
}>;
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
}>;
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
}) => Promise<{
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
}>;
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
}) => Promise<{
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
}) => Promise<
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
}) => Promise<
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
}>;
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
}) => Promise<
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
id: string;
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
}) => Promise<{
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
id: string;
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
}[]>;
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
}>;
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
id: string;
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
}[]>;
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
}) => Promise<
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
}
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
}>;
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
user_addr: string;
|
|
828
|
-
from_chain_id: string;
|
|
829
|
-
from_token_id: string;
|
|
830
|
-
from_token_raw_amount: string;
|
|
831
|
-
to_chain_id: string;
|
|
832
|
-
to_token_id: string;
|
|
833
|
-
}) => Promise<BridgeQuote>;
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
}
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
id: string;
|
|
891
|
-
}) => Promise<{
|
|
892
|
-
account: GasAccountInfo;
|
|
893
|
-
}>;
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
}
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
}
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
}
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
}) => Promise<{
|
|
933
|
-
success: boolean;
|
|
934
|
-
}>;
|
|
935
|
-
|
|
936
|
-
sig: string;
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
}
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
user_addr: string;
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
}>;
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
}) => Promise<{
|
|
1004
|
-
|
|
1005
|
-
}>;
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
from_token_id
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
}>;
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
}
|
|
1026
|
-
|
|
1027
|
-
aggregator_id: string;
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
}
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
}
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
}) => Promise<
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
}>;
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
})
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
}) => Promise<
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1
|
+
import { AxiosAdapter, AxiosRequestConfig } from 'axios';
|
|
2
|
+
import { RateLimitedAxiosInstance } from 'axios-rate-limit';
|
|
3
|
+
import { InitOptions, RabbyApiPlugin } from './plugins/intf';
|
|
4
|
+
import { AddrDescResponse, BridgeAggregator, ApprovalStatus, AssetItem, BasicDappInfo, CEXQuote, Cex, ChainListItem, ChainWithPendingCount, Collection, CollectionList, CollectionWithFloorPrice, ComplexProtocol, ContractCredit, DbkBridgeHistoryItem, ExplainTxResponse, ExplainTypedDataResponse, GasLevel, GetTxResponse, HistoryCurve, LatestExplainTxResponse, MempoolCheckDetail, NFTApprovalResponse, NFTItem, NodeStatus, NodeStatusDetail, ParseTextResponse, ParseTxResponse, ParseTypedDataResponse, PendingTxItem, Protocol, SecurityCheckResponse, ServerChain, SlippageStatus, Summary, SupportedChain, SwapTradeList, TokenApproval, TokenItem, TotalBalanceResponse, Tx, TxAllHistoryResult, TxHistoryResult, TxPushType, TxRequest, UsedChain, BridgeTokenPair, BridgeQuote, BridgeHistory, ContractInfo, GasAccountCheckResult, ParseCommonResponse, WithdrawListAddressItem, BuyCountryItem, BuyQuoteItem, BuyHistoryList, BuyPaymentMethod, GasAccountInfo, TokenEntityDetail, TokenItemWithEntity, ProjectItem, CopyTradeTokenListResponse, CopyTradeRecentBuyListResponse, CopyTradePnlListResponse } from './types';
|
|
5
|
+
interface OpenApiStore {
|
|
6
|
+
host: string;
|
|
7
|
+
testnetHost?: string;
|
|
8
|
+
}
|
|
9
|
+
interface Options {
|
|
10
|
+
store: OpenApiStore | Promise<OpenApiStore>;
|
|
11
|
+
plugin: RabbyApiPlugin;
|
|
12
|
+
adapter?: AxiosAdapter;
|
|
13
|
+
clientName?: string;
|
|
14
|
+
clientVersion?: string;
|
|
15
|
+
}
|
|
16
|
+
declare enum CurveDayType {
|
|
17
|
+
DAY = 1,
|
|
18
|
+
WEEK = 7
|
|
19
|
+
}
|
|
20
|
+
declare type VersionPrefix = 'v1' | 'v2';
|
|
21
|
+
declare type ApiOptions<V extends VersionPrefix | void = VersionPrefix> = {
|
|
22
|
+
restfulPrefix?: V;
|
|
23
|
+
};
|
|
24
|
+
export declare class OpenApiService {
|
|
25
|
+
#private;
|
|
26
|
+
store: OpenApiStore;
|
|
27
|
+
request: RateLimitedAxiosInstance;
|
|
28
|
+
constructor({ store, plugin, adapter, clientName, clientVersion, }: Options);
|
|
29
|
+
setHost: (host: string) => Promise<void>;
|
|
30
|
+
setHostSync: (host: string) => void;
|
|
31
|
+
getHost: () => string;
|
|
32
|
+
setTestnetHost: (host: string) => Promise<void>;
|
|
33
|
+
getTestnetHost: () => string | undefined;
|
|
34
|
+
ethRpc: ((chainId: string, arg: {
|
|
35
|
+
method: string;
|
|
36
|
+
params: Array<any>;
|
|
37
|
+
origin?: string;
|
|
38
|
+
}) => Promise<any>) | (() => Promise<never>);
|
|
39
|
+
init: (options?: string | InitOptions) => Promise<void>;
|
|
40
|
+
initSync(options?: InitOptions): void;
|
|
41
|
+
asyncJob: <T = any>(url: string, options?: AxiosRequestConfig & {
|
|
42
|
+
retryDelay?: number;
|
|
43
|
+
}) => Promise<T>;
|
|
44
|
+
private _mountMethods;
|
|
45
|
+
getRecommendChains: (address: string, origin: string) => Promise<ServerChain[]>;
|
|
46
|
+
getTotalBalance: (address: string, isCore?: boolean) => Promise<TotalBalanceResponse>;
|
|
47
|
+
getTotalBalanceV2: ({ address, isCore, included_token_uuids, excluded_token_uuids, excluded_protocol_ids, excluded_chain_ids, }: {
|
|
48
|
+
address: string;
|
|
49
|
+
isCore: boolean;
|
|
50
|
+
included_token_uuids: string[];
|
|
51
|
+
excluded_token_uuids: string[];
|
|
52
|
+
excluded_protocol_ids: string[];
|
|
53
|
+
excluded_chain_ids: string[];
|
|
54
|
+
}) => Promise<TotalBalanceResponse>;
|
|
55
|
+
getPendingCount: (address: string) => Promise<{
|
|
56
|
+
total_count: number;
|
|
57
|
+
chains: ChainWithPendingCount[];
|
|
58
|
+
}>;
|
|
59
|
+
checkOrigin: (address: string, origin: string) => Promise<SecurityCheckResponse>;
|
|
60
|
+
checkText: (address: string, origin: string, text: string) => Promise<SecurityCheckResponse>;
|
|
61
|
+
checkTx: (tx: Tx, origin: string, address: string, update_nonce?: boolean) => Promise<SecurityCheckResponse>;
|
|
62
|
+
preExecTx: ({ tx, origin, address, updateNonce, pending_tx_list, delegate_call, }: {
|
|
63
|
+
tx: Tx;
|
|
64
|
+
origin: string;
|
|
65
|
+
address: string;
|
|
66
|
+
updateNonce: boolean;
|
|
67
|
+
pending_tx_list: Tx[];
|
|
68
|
+
delegate_call?: boolean | undefined;
|
|
69
|
+
}) => Promise<ExplainTxResponse>;
|
|
70
|
+
historyGasUsed: (params: {
|
|
71
|
+
tx: Tx;
|
|
72
|
+
user_addr: string;
|
|
73
|
+
}) => Promise<{
|
|
74
|
+
gas_used: number;
|
|
75
|
+
}>;
|
|
76
|
+
pendingTxList: (tx: Tx, origin: string, address: string, update_nonce?: boolean) => Promise<Tx[]>;
|
|
77
|
+
traceTx: (txId: string, traceId: string, chainId: string) => Promise<void>;
|
|
78
|
+
pushTx: (tx: Tx, traceId?: string) => Promise<any>;
|
|
79
|
+
explainText: (origin: string, address: string, text: string) => Promise<{
|
|
80
|
+
comment: string;
|
|
81
|
+
}>;
|
|
82
|
+
gasMarket: (chainId: string, customGas?: number) => Promise<GasLevel[]>;
|
|
83
|
+
gasMarketV2: (options: {
|
|
84
|
+
chainId: string;
|
|
85
|
+
tx?: Tx;
|
|
86
|
+
customGas?: number;
|
|
87
|
+
}) => Promise<GasLevel[]>;
|
|
88
|
+
getTx: (chainId: string, hash: string, gasPrice: number) => Promise<GetTxResponse>;
|
|
89
|
+
getEnsAddressByName: (name: string) => Promise<{
|
|
90
|
+
addr: string;
|
|
91
|
+
name: string;
|
|
92
|
+
}>;
|
|
93
|
+
searchToken: (id: string, q: string, chainId?: string, is_all?: boolean) => Promise<TokenItem[]>;
|
|
94
|
+
searchSwapToken: (id: string, chainId: string, q: string, is_all?: boolean) => Promise<any>;
|
|
95
|
+
getToken: (id: string, chainId: string, tokenId: string) => Promise<TokenItem>;
|
|
96
|
+
getCachedTokenList: (id: string) => Promise<TokenItem[]>;
|
|
97
|
+
listToken: (id: string, chainId?: string, isAll?: boolean) => Promise<TokenItem[]>;
|
|
98
|
+
getTokenEntity: (id: string, chainId?: string) => Promise<TokenEntityDetail>;
|
|
99
|
+
getHistoryTokenList: (params: {
|
|
100
|
+
id: string;
|
|
101
|
+
chainId?: string;
|
|
102
|
+
timeAt?: number;
|
|
103
|
+
dateAt?: string;
|
|
104
|
+
}) => Promise<TokenItem[]>;
|
|
105
|
+
customListToken: (uuids: string[], id: string) => Promise<TokenItem[]>;
|
|
106
|
+
listChainAssets: (id: string) => Promise<AssetItem[]>;
|
|
107
|
+
listNFT: (id: string, isAll?: boolean, sortByCredit?: boolean) => Promise<NFTItem[]>;
|
|
108
|
+
listCollection: (params: {
|
|
109
|
+
collection_ids: string;
|
|
110
|
+
}) => Promise<Collection[]>;
|
|
111
|
+
listTxHisotry: (params: {
|
|
112
|
+
id?: string;
|
|
113
|
+
chain_id?: string;
|
|
114
|
+
token_id?: string;
|
|
115
|
+
coin_id?: string;
|
|
116
|
+
start_time?: number;
|
|
117
|
+
page_count?: number;
|
|
118
|
+
}) => Promise<TxHistoryResult>;
|
|
119
|
+
getAllTxHistory: (params: {
|
|
120
|
+
id: string;
|
|
121
|
+
start_time?: number;
|
|
122
|
+
page_count?: number;
|
|
123
|
+
}, options?: Parameters<typeof this.asyncJob>[1]) => Promise<TxAllHistoryResult>;
|
|
124
|
+
tokenPrice: (tokenName: string) => Promise<{
|
|
125
|
+
change_percent: number;
|
|
126
|
+
last_price: number;
|
|
127
|
+
}>;
|
|
128
|
+
tokenAuthorizedList: <V extends VersionPrefix | undefined>(id: string, chain_id: string, options?: ApiOptions<V> | undefined) => Promise<TokenApproval[]>;
|
|
129
|
+
userNFTAuthorizedList: (id: string, chain_id: string) => Promise<NFTApprovalResponse>;
|
|
130
|
+
getDEXList: (chain_id: string) => Promise<{
|
|
131
|
+
id: string;
|
|
132
|
+
name: string;
|
|
133
|
+
logo_url: string;
|
|
134
|
+
site_url: string;
|
|
135
|
+
type: string;
|
|
136
|
+
}[]>;
|
|
137
|
+
getSwapQuote: (params: {
|
|
138
|
+
id: string;
|
|
139
|
+
chain_id: string;
|
|
140
|
+
dex_id: string;
|
|
141
|
+
pay_token_id: string;
|
|
142
|
+
pay_token_raw_amount: string;
|
|
143
|
+
receive_token_id: string;
|
|
144
|
+
slippage?: string | number;
|
|
145
|
+
fee?: boolean;
|
|
146
|
+
}) => Promise<{
|
|
147
|
+
receive_token_raw_amount: number;
|
|
148
|
+
dex_approve_to: string;
|
|
149
|
+
dex_swap_to: string;
|
|
150
|
+
dex_swap_calldata: string;
|
|
151
|
+
is_wrapped: boolean;
|
|
152
|
+
gas: {
|
|
153
|
+
gas_used: number;
|
|
154
|
+
gas_price: number;
|
|
155
|
+
gas_cost_value: number;
|
|
156
|
+
gas_cost_usd_value: number;
|
|
157
|
+
};
|
|
158
|
+
pay_token: TokenItem;
|
|
159
|
+
receive_token: TokenItem;
|
|
160
|
+
dex_fee_desc?: string | null | undefined;
|
|
161
|
+
}>;
|
|
162
|
+
getSwapTokenList: (id: string, chainId?: string) => Promise<TokenItem[]>;
|
|
163
|
+
postGasStationOrder: (params: {
|
|
164
|
+
userAddr: string;
|
|
165
|
+
fromChainId: string;
|
|
166
|
+
fromTxId: string;
|
|
167
|
+
toChainId: string;
|
|
168
|
+
toTokenAmount: string;
|
|
169
|
+
fromTokenId: string;
|
|
170
|
+
fromTokenAmount: string;
|
|
171
|
+
fromUsdValue: number;
|
|
172
|
+
}) => Promise<any>;
|
|
173
|
+
getGasStationChainBalance: (chain_id: string, addr: string) => Promise<{
|
|
174
|
+
usd_value: number;
|
|
175
|
+
}>;
|
|
176
|
+
getApprovalCount: (address: string) => Promise<{
|
|
177
|
+
total_asset_cnt: number;
|
|
178
|
+
}>;
|
|
179
|
+
getGasStationTokenList: () => Promise<TokenItem[]>;
|
|
180
|
+
explainTypedData: (user_addr: string, origin: string, data: any) => Promise<ExplainTypedDataResponse>;
|
|
181
|
+
checkTypedData: (user_addr: string, origin: string, data: any) => Promise<SecurityCheckResponse>;
|
|
182
|
+
approvalStatus: (id: string, options?: ApiOptions) => Promise<ApprovalStatus[]>;
|
|
183
|
+
usedChainList: (id: string) => Promise<UsedChain[]>;
|
|
184
|
+
getLatestVersion: () => Promise<{
|
|
185
|
+
version_tag: string;
|
|
186
|
+
}>;
|
|
187
|
+
addOriginFeedback: (params: {
|
|
188
|
+
user_addr: string;
|
|
189
|
+
origin: string;
|
|
190
|
+
is_safe: boolean;
|
|
191
|
+
}) => Promise<{
|
|
192
|
+
is_success: boolean;
|
|
193
|
+
}>;
|
|
194
|
+
getProtocolList: (addr: string) => Promise<Protocol[]>;
|
|
195
|
+
getComplexProtocolList: (addr: string) => Promise<ComplexProtocol[]>;
|
|
196
|
+
getProtocol: ({ addr, id, }: {
|
|
197
|
+
addr: string;
|
|
198
|
+
id: string;
|
|
199
|
+
}) => Promise<ComplexProtocol>;
|
|
200
|
+
getHistoryProtocol: ({ addr, id, timeAt, dateAt, }: {
|
|
201
|
+
addr: string;
|
|
202
|
+
id: string;
|
|
203
|
+
timeAt?: number | undefined;
|
|
204
|
+
dateAt?: number | undefined;
|
|
205
|
+
}) => Promise<ComplexProtocol>;
|
|
206
|
+
getTokenHistoryPrice: ({ chainId, id, timeAt, }: {
|
|
207
|
+
chainId: string;
|
|
208
|
+
id: string;
|
|
209
|
+
timeAt: number;
|
|
210
|
+
}) => Promise<{
|
|
211
|
+
price: number;
|
|
212
|
+
}>;
|
|
213
|
+
getTokenHistoryDict: ({ chainId, ids, timeAt, }: {
|
|
214
|
+
chainId: string;
|
|
215
|
+
ids: string;
|
|
216
|
+
timeAt: number;
|
|
217
|
+
}) => Promise<Record<string, number>>;
|
|
218
|
+
getNetCurve: (addr: string, days?: CurveDayType) => Promise<{
|
|
219
|
+
timestamp: number;
|
|
220
|
+
usd_value: number;
|
|
221
|
+
}[]>;
|
|
222
|
+
getChainList: () => Promise<ServerChain[]>;
|
|
223
|
+
getCEXSwapQuote: (params: {
|
|
224
|
+
cex_id: string;
|
|
225
|
+
pay_token_id: string;
|
|
226
|
+
pay_token_amount: string;
|
|
227
|
+
receive_token_id: string;
|
|
228
|
+
chain_id: string;
|
|
229
|
+
}) => Promise<CEXQuote>;
|
|
230
|
+
getSwapTradeList: (params: {
|
|
231
|
+
user_addr: string;
|
|
232
|
+
start: string;
|
|
233
|
+
limit: string;
|
|
234
|
+
}) => Promise<SwapTradeList>;
|
|
235
|
+
getSwapTradeListV2: (params: {
|
|
236
|
+
user_addr: string;
|
|
237
|
+
limit: number;
|
|
238
|
+
start_time?: number;
|
|
239
|
+
}) => Promise<SwapTradeList>;
|
|
240
|
+
postSwap: (params: {
|
|
241
|
+
quote: {
|
|
242
|
+
pay_token_id: string;
|
|
243
|
+
pay_token_amount: number;
|
|
244
|
+
receive_token_id: string;
|
|
245
|
+
receive_token_amount: number;
|
|
246
|
+
slippage: number;
|
|
247
|
+
};
|
|
248
|
+
dex_id: string;
|
|
249
|
+
tx_id: string;
|
|
250
|
+
tx: Tx;
|
|
251
|
+
}) => Promise<any>;
|
|
252
|
+
checkSlippage: (params: {
|
|
253
|
+
chain_id: string;
|
|
254
|
+
slippage: string;
|
|
255
|
+
from_token_id: string;
|
|
256
|
+
to_token_id: string;
|
|
257
|
+
}) => Promise<SlippageStatus>;
|
|
258
|
+
suggestSlippage: (params: {
|
|
259
|
+
chain_id: string;
|
|
260
|
+
slippage: string;
|
|
261
|
+
from_token_id: string;
|
|
262
|
+
to_token_id: string;
|
|
263
|
+
from_token_amount: string;
|
|
264
|
+
}) => Promise<{
|
|
265
|
+
suggest_slippage: number;
|
|
266
|
+
}>;
|
|
267
|
+
getOriginPopularityLevel: (origin: string) => Promise<{
|
|
268
|
+
level: 'very_low' | 'low' | 'medium' | 'high';
|
|
269
|
+
}>;
|
|
270
|
+
getOriginIsScam: (origin: string, source: string) => Promise<{
|
|
271
|
+
is_scam: boolean;
|
|
272
|
+
}>;
|
|
273
|
+
getOriginThirdPartyCollectList: (origin: string) => Promise<{
|
|
274
|
+
collect_list: {
|
|
275
|
+
name: string;
|
|
276
|
+
logo_url: string;
|
|
277
|
+
}[];
|
|
278
|
+
}>;
|
|
279
|
+
getSummarizedAssetList: (id: string, chain_id?: string) => Promise<Summary>;
|
|
280
|
+
unexpectedAddrList: ({ chainId, tx, origin, addr, }: {
|
|
281
|
+
chainId: string;
|
|
282
|
+
tx: Tx;
|
|
283
|
+
origin: string;
|
|
284
|
+
addr: string;
|
|
285
|
+
}) => Promise<{
|
|
286
|
+
id: string;
|
|
287
|
+
}[]>;
|
|
288
|
+
gasLessTxCheck: ({ tx, usdValue, preExecSuccess, gasUsed, }: {
|
|
289
|
+
gasUsed: number;
|
|
290
|
+
preExecSuccess: boolean;
|
|
291
|
+
tx: Tx;
|
|
292
|
+
usdValue: number;
|
|
293
|
+
}) => Promise<{
|
|
294
|
+
is_gasless: boolean;
|
|
295
|
+
desc?: string;
|
|
296
|
+
promotion?: {
|
|
297
|
+
id: string;
|
|
298
|
+
contract_id: string;
|
|
299
|
+
chain_id: string;
|
|
300
|
+
config: {
|
|
301
|
+
button_text: string;
|
|
302
|
+
before_click_text: string;
|
|
303
|
+
after_click_text: string;
|
|
304
|
+
logo: string;
|
|
305
|
+
theme_color: string;
|
|
306
|
+
dark_color: string;
|
|
307
|
+
};
|
|
308
|
+
};
|
|
309
|
+
}>;
|
|
310
|
+
gasLessTxsCheck: (postData: {
|
|
311
|
+
tx_list: Tx[];
|
|
312
|
+
}) => Promise<{
|
|
313
|
+
is_gasless: boolean;
|
|
314
|
+
desc?: string;
|
|
315
|
+
promotion?: {
|
|
316
|
+
id: string;
|
|
317
|
+
contract_id: string;
|
|
318
|
+
chain_id: string;
|
|
319
|
+
config: {
|
|
320
|
+
button_text: string;
|
|
321
|
+
before_click_text: string;
|
|
322
|
+
after_click_text: string;
|
|
323
|
+
logo: string;
|
|
324
|
+
theme_color: string;
|
|
325
|
+
dark_color: string;
|
|
326
|
+
};
|
|
327
|
+
};
|
|
328
|
+
}>;
|
|
329
|
+
parseTx: ({ chainId, tx, origin, addr, }: {
|
|
330
|
+
chainId: string;
|
|
331
|
+
tx: Tx;
|
|
332
|
+
origin: string;
|
|
333
|
+
addr: string;
|
|
334
|
+
}) => Promise<ParseTxResponse>;
|
|
335
|
+
isSuspiciousToken: (id: string, chainId: string) => Promise<{
|
|
336
|
+
is_suspicious: boolean;
|
|
337
|
+
}>;
|
|
338
|
+
depositCexSupport: (id: string, chainId: string, cexId: string) => Promise<{
|
|
339
|
+
support: boolean;
|
|
340
|
+
}>;
|
|
341
|
+
depositCexList: (id: string, chainId: string) => Promise<{
|
|
342
|
+
cex_list: Cex[];
|
|
343
|
+
}>;
|
|
344
|
+
getContractCredit: (id: string, chainId: string) => Promise<ContractCredit>;
|
|
345
|
+
hasInteraction: (addr: string, chainId: string, contractId: string) => Promise<{
|
|
346
|
+
has_interaction: boolean;
|
|
347
|
+
}>;
|
|
348
|
+
/**
|
|
349
|
+
* @deprecated
|
|
350
|
+
* 授权风险敞口
|
|
351
|
+
*/
|
|
352
|
+
tokenApproveExposure: (id: string, chainId: string) => Promise<{
|
|
353
|
+
usd_value: number;
|
|
354
|
+
}>;
|
|
355
|
+
tokenApproveTrustValue: (id: string, chainId: string) => Promise<{
|
|
356
|
+
usd_value: number;
|
|
357
|
+
}>;
|
|
358
|
+
getContractInfo: (id: string, chainId: string) => Promise<ContractInfo | null>;
|
|
359
|
+
addrDesc: (id: string) => Promise<AddrDescResponse>;
|
|
360
|
+
hasTransfer: (chainId: string, from: string, to: string) => Promise<{
|
|
361
|
+
has_transfer: boolean;
|
|
362
|
+
}>;
|
|
363
|
+
hasTransferAllChain: (from: string, to: string) => Promise<{
|
|
364
|
+
has_transfer: boolean;
|
|
365
|
+
}>;
|
|
366
|
+
isTokenContract: (chainId: string, id: string) => Promise<{
|
|
367
|
+
is_token: boolean;
|
|
368
|
+
}>;
|
|
369
|
+
addrUsedChainList: (id: string) => Promise<UsedChain[]>;
|
|
370
|
+
/**
|
|
371
|
+
* @deprecated
|
|
372
|
+
*/
|
|
373
|
+
getTokenNFTExposure: (chainId: string, id: string) => Promise<{
|
|
374
|
+
usd_value: number;
|
|
375
|
+
}>;
|
|
376
|
+
getTokenNFTTrustValue: (chainId: string, id: string) => Promise<{
|
|
377
|
+
usd_value: number;
|
|
378
|
+
}>;
|
|
379
|
+
getCollection: (chainId: string, id: string) => Promise<{
|
|
380
|
+
collection: CollectionWithFloorPrice;
|
|
381
|
+
}>;
|
|
382
|
+
isSuspiciousCollection: (chainId: string, id: string) => Promise<{
|
|
383
|
+
is_suspicious: boolean;
|
|
384
|
+
}>;
|
|
385
|
+
isOriginVerified: (origin: string) => Promise<{
|
|
386
|
+
is_verified: boolean | null;
|
|
387
|
+
}>;
|
|
388
|
+
parseTypedData: ({ typedData, origin, address, }: {
|
|
389
|
+
typedData: Record<string, any>;
|
|
390
|
+
origin: string;
|
|
391
|
+
address: string;
|
|
392
|
+
}) => Promise<ParseTypedDataResponse>;
|
|
393
|
+
parseText: ({ text, origin, address, }: {
|
|
394
|
+
text: string;
|
|
395
|
+
origin: string;
|
|
396
|
+
address: string;
|
|
397
|
+
}) => Promise<ParseTextResponse>;
|
|
398
|
+
collectionList: ({ id, chainId, isAll, }: {
|
|
399
|
+
id: string;
|
|
400
|
+
chainId?: string | undefined;
|
|
401
|
+
isAll: boolean;
|
|
402
|
+
}) => Promise<CollectionList[]>;
|
|
403
|
+
gasPriceStats: (chainId: string) => Promise<{
|
|
404
|
+
median: number;
|
|
405
|
+
}>;
|
|
406
|
+
badgeHasClaimed: (id: string) => Promise<{
|
|
407
|
+
id: string;
|
|
408
|
+
badge_id: number;
|
|
409
|
+
user_id: string;
|
|
410
|
+
inner_id: number;
|
|
411
|
+
create_at: number;
|
|
412
|
+
update_at: number;
|
|
413
|
+
has_claimed: true;
|
|
414
|
+
} | {
|
|
415
|
+
has_claimed: false;
|
|
416
|
+
}>;
|
|
417
|
+
badgeHasMinted: (id: string) => Promise<{
|
|
418
|
+
id: string;
|
|
419
|
+
badge_id: number;
|
|
420
|
+
user_id: string;
|
|
421
|
+
inner_id: number;
|
|
422
|
+
usd_value: number;
|
|
423
|
+
tvf: number;
|
|
424
|
+
mint_at: number;
|
|
425
|
+
has_minted: true;
|
|
426
|
+
} | {
|
|
427
|
+
has_minted: false;
|
|
428
|
+
}>;
|
|
429
|
+
mintBadge: (params: {
|
|
430
|
+
code: string;
|
|
431
|
+
userAddr: string;
|
|
432
|
+
}) => Promise<{
|
|
433
|
+
is_success: boolean;
|
|
434
|
+
inner_id: number;
|
|
435
|
+
}>;
|
|
436
|
+
badgeHasClaimedByName: ({ id, name, }: {
|
|
437
|
+
id: string;
|
|
438
|
+
name: string;
|
|
439
|
+
}) => Promise<{
|
|
440
|
+
id: string;
|
|
441
|
+
badge_id: number;
|
|
442
|
+
user_id: string;
|
|
443
|
+
inner_id: number;
|
|
444
|
+
create_at: number;
|
|
445
|
+
update_at: number;
|
|
446
|
+
has_claimed: true;
|
|
447
|
+
} | {
|
|
448
|
+
has_claimed: false;
|
|
449
|
+
}>;
|
|
450
|
+
badgeHasMintedByName: ({ id, name, }: {
|
|
451
|
+
id: string;
|
|
452
|
+
name: string;
|
|
453
|
+
}) => Promise<{
|
|
454
|
+
id: string;
|
|
455
|
+
badge_id: number;
|
|
456
|
+
user_id: string;
|
|
457
|
+
inner_id: number;
|
|
458
|
+
usd_value: number;
|
|
459
|
+
tvf: number;
|
|
460
|
+
mint_at: number;
|
|
461
|
+
has_minted: true;
|
|
462
|
+
} | {
|
|
463
|
+
has_minted: false;
|
|
464
|
+
}>;
|
|
465
|
+
mintBadgeByName: (params: {
|
|
466
|
+
name: string;
|
|
467
|
+
code: string;
|
|
468
|
+
userAddr: string;
|
|
469
|
+
}) => Promise<{
|
|
470
|
+
is_success: boolean;
|
|
471
|
+
inner_id: number;
|
|
472
|
+
}>;
|
|
473
|
+
userHasRequestedFaucet: (params: {
|
|
474
|
+
chain_id: string;
|
|
475
|
+
user_addr: string;
|
|
476
|
+
}) => Promise<{
|
|
477
|
+
has_requested: boolean;
|
|
478
|
+
}>;
|
|
479
|
+
requestFaucet: (params: {
|
|
480
|
+
chain_id: string;
|
|
481
|
+
user_addr: string;
|
|
482
|
+
}) => Promise<{
|
|
483
|
+
is_success: boolean;
|
|
484
|
+
}>;
|
|
485
|
+
gasSupportedPushType: (chainId: string) => Promise<{
|
|
486
|
+
low_gas: boolean;
|
|
487
|
+
mev: boolean;
|
|
488
|
+
}>;
|
|
489
|
+
submitTx: (postData: {
|
|
490
|
+
req_id?: string;
|
|
491
|
+
tx: Tx;
|
|
492
|
+
push_type: TxPushType;
|
|
493
|
+
is_gasless?: boolean;
|
|
494
|
+
is_gas_account?: boolean;
|
|
495
|
+
log_id: string;
|
|
496
|
+
low_gas_deadline?: number;
|
|
497
|
+
origin?: string;
|
|
498
|
+
sig?: string;
|
|
499
|
+
}) => Promise<{
|
|
500
|
+
req: TxRequest;
|
|
501
|
+
access_token?: string;
|
|
502
|
+
}>;
|
|
503
|
+
getTxRequests: (ids: string | string[]) => Promise<TxRequest[]>;
|
|
504
|
+
getTxRequest: (id: string) => Promise<TxRequest>;
|
|
505
|
+
withdrawTx: (reqId: string) => Promise<{
|
|
506
|
+
req: TxRequest;
|
|
507
|
+
}>;
|
|
508
|
+
retryPushTx: (reqId: string) => Promise<{
|
|
509
|
+
req: TxRequest;
|
|
510
|
+
}>;
|
|
511
|
+
mempoolChecks: (txId: string, chainId: string, node_info?: boolean) => Promise<MempoolCheckDetail[]>;
|
|
512
|
+
getPendingTxList: (params: {
|
|
513
|
+
chain_id: string;
|
|
514
|
+
}, options?: Parameters<typeof this.asyncJob>[1]) => Promise<{
|
|
515
|
+
pending_tx_list: PendingTxItem[];
|
|
516
|
+
token_dict: Record<string, TokenItem | NFTItem>;
|
|
517
|
+
}>;
|
|
518
|
+
getLatestPreExec: (params: {
|
|
519
|
+
id: string;
|
|
520
|
+
}) => Promise<LatestExplainTxResponse>;
|
|
521
|
+
walletSupportChain: (params: {
|
|
522
|
+
chain_id: string;
|
|
523
|
+
user_addr: string;
|
|
524
|
+
}) => Promise<{
|
|
525
|
+
is_success: boolean;
|
|
526
|
+
count: number;
|
|
527
|
+
}>;
|
|
528
|
+
walletSupportOrigin: (params: {
|
|
529
|
+
origin: string;
|
|
530
|
+
user_addr: string;
|
|
531
|
+
text: string;
|
|
532
|
+
}) => Promise<{
|
|
533
|
+
is_success: boolean;
|
|
534
|
+
count: number;
|
|
535
|
+
}>;
|
|
536
|
+
walletSupportSelector: (params: {
|
|
537
|
+
selector: string;
|
|
538
|
+
user_addr: string;
|
|
539
|
+
chain_id: string;
|
|
540
|
+
contract_id: string;
|
|
541
|
+
}) => Promise<{
|
|
542
|
+
is_success: boolean;
|
|
543
|
+
count: number;
|
|
544
|
+
}>;
|
|
545
|
+
searchDapp: (params?: {
|
|
546
|
+
q?: string;
|
|
547
|
+
chain_id?: string;
|
|
548
|
+
start?: number;
|
|
549
|
+
limit?: number;
|
|
550
|
+
match_id?: boolean;
|
|
551
|
+
}) => Promise<{
|
|
552
|
+
page: {
|
|
553
|
+
limit: number;
|
|
554
|
+
start: number;
|
|
555
|
+
total: number;
|
|
556
|
+
};
|
|
557
|
+
dapps: BasicDappInfo[];
|
|
558
|
+
}>;
|
|
559
|
+
getDappsInfo: (params: {
|
|
560
|
+
ids: string[];
|
|
561
|
+
}) => Promise<BasicDappInfo[]>;
|
|
562
|
+
getDappHotTags: (params?: {
|
|
563
|
+
limit: number;
|
|
564
|
+
}) => Promise<string[]>;
|
|
565
|
+
getHotDapps: (params?: {
|
|
566
|
+
limit: number;
|
|
567
|
+
}) => Promise<BasicDappInfo[]>;
|
|
568
|
+
getRabbyClaimText: (params: {
|
|
569
|
+
id: string;
|
|
570
|
+
invite_code?: string;
|
|
571
|
+
}) => Promise<{
|
|
572
|
+
id: string;
|
|
573
|
+
text: string;
|
|
574
|
+
}>;
|
|
575
|
+
getRabbySignatureText: (params: {
|
|
576
|
+
id: string;
|
|
577
|
+
}) => Promise<{
|
|
578
|
+
id: string;
|
|
579
|
+
text: string;
|
|
580
|
+
}>;
|
|
581
|
+
getRabbyPoints: (params: {
|
|
582
|
+
id: string;
|
|
583
|
+
}) => Promise<{
|
|
584
|
+
id: string;
|
|
585
|
+
invite_code?: string;
|
|
586
|
+
logo_url: string;
|
|
587
|
+
logo_thumbnail_url: string;
|
|
588
|
+
web3_id: string;
|
|
589
|
+
claimed_points: number;
|
|
590
|
+
total_claimed_points: number;
|
|
591
|
+
}>;
|
|
592
|
+
checkRabbyPointsInviteCode: (params: {
|
|
593
|
+
code: string;
|
|
594
|
+
}) => Promise<{
|
|
595
|
+
invite_code_exist: boolean;
|
|
596
|
+
}>;
|
|
597
|
+
setRabbyPointsInviteCode: (params: {
|
|
598
|
+
id: string;
|
|
599
|
+
signature: string;
|
|
600
|
+
invite_code: string;
|
|
601
|
+
}) => Promise<{
|
|
602
|
+
code: number;
|
|
603
|
+
}>;
|
|
604
|
+
checkRabbyPointClaimable: (params: {
|
|
605
|
+
id: string;
|
|
606
|
+
}) => Promise<{
|
|
607
|
+
claimable: boolean;
|
|
608
|
+
}>;
|
|
609
|
+
getRabbyPointsSnapshot: (params: {
|
|
610
|
+
id: string;
|
|
611
|
+
}) => Promise<{
|
|
612
|
+
id: string;
|
|
613
|
+
address_balance: number;
|
|
614
|
+
metamask_swap: number;
|
|
615
|
+
rabby_old_user: number;
|
|
616
|
+
rabby_nadge: number;
|
|
617
|
+
rabby_nft: number;
|
|
618
|
+
extra_bouns: number;
|
|
619
|
+
claimed: boolean;
|
|
620
|
+
snapshot_at: number;
|
|
621
|
+
}>;
|
|
622
|
+
claimRabbyPointsSnapshot: (params: {
|
|
623
|
+
id: string;
|
|
624
|
+
signature: string;
|
|
625
|
+
invite_code?: string;
|
|
626
|
+
}) => Promise<{
|
|
627
|
+
error_code: number;
|
|
628
|
+
error_msg?: string;
|
|
629
|
+
}>;
|
|
630
|
+
getRabbyPointsTopUsers: (params: {
|
|
631
|
+
id: string;
|
|
632
|
+
}) => Promise<{
|
|
633
|
+
id: string;
|
|
634
|
+
logo_url: string;
|
|
635
|
+
logo_thumbnail_url: string;
|
|
636
|
+
web3_id: string;
|
|
637
|
+
claimed_points: number;
|
|
638
|
+
}[]>;
|
|
639
|
+
getRabbyPointsList: (params: {
|
|
640
|
+
id: string;
|
|
641
|
+
}) => Promise<{
|
|
642
|
+
id: number;
|
|
643
|
+
title: string;
|
|
644
|
+
description: string;
|
|
645
|
+
start_at: number;
|
|
646
|
+
end_at: number;
|
|
647
|
+
claimable_points: number;
|
|
648
|
+
}[]>;
|
|
649
|
+
getRabbyPointsCampaignIsEnded: () => Promise<{
|
|
650
|
+
campaign_is_ended: boolean;
|
|
651
|
+
}>;
|
|
652
|
+
claimRabbyPointsById: (params: {
|
|
653
|
+
campaign_id: number;
|
|
654
|
+
user_id: string;
|
|
655
|
+
signature: string;
|
|
656
|
+
}) => Promise<{
|
|
657
|
+
error_code: number;
|
|
658
|
+
}>;
|
|
659
|
+
getRabbyPointsV2: (params: {
|
|
660
|
+
id: string;
|
|
661
|
+
}) => Promise<{
|
|
662
|
+
id: string;
|
|
663
|
+
invite_code?: string;
|
|
664
|
+
logo_url: string;
|
|
665
|
+
logo_thumbnail_url: string;
|
|
666
|
+
web3_id: string;
|
|
667
|
+
claimed_points: number;
|
|
668
|
+
total_claimed_points: number;
|
|
669
|
+
}>;
|
|
670
|
+
getRabbySignatureTextV2: (params: {
|
|
671
|
+
id: string;
|
|
672
|
+
}) => Promise<{
|
|
673
|
+
id: string;
|
|
674
|
+
text: string;
|
|
675
|
+
}>;
|
|
676
|
+
getRabbyClaimTextV2: (params: {
|
|
677
|
+
id: string;
|
|
678
|
+
invite_code?: string;
|
|
679
|
+
}) => Promise<{
|
|
680
|
+
id: string;
|
|
681
|
+
text: string;
|
|
682
|
+
}>;
|
|
683
|
+
setRabbyPointsInviteCodeV2: (params: {
|
|
684
|
+
id: string;
|
|
685
|
+
signature: string;
|
|
686
|
+
invite_code: string;
|
|
687
|
+
}) => Promise<{
|
|
688
|
+
code: number;
|
|
689
|
+
}>;
|
|
690
|
+
checkRabbyPointsInviteCodeV2: (params: {
|
|
691
|
+
code: string;
|
|
692
|
+
}) => Promise<{
|
|
693
|
+
invite_code_exist: boolean;
|
|
694
|
+
}>;
|
|
695
|
+
claimRabbyPointsSnapshotV2: (params: {
|
|
696
|
+
id: string;
|
|
697
|
+
signature: string;
|
|
698
|
+
invite_code?: string;
|
|
699
|
+
}) => Promise<{
|
|
700
|
+
error_code: number;
|
|
701
|
+
error_msg?: string;
|
|
702
|
+
}>;
|
|
703
|
+
getRabbyPointsTopUsersV2: (params: {
|
|
704
|
+
id: string;
|
|
705
|
+
}) => Promise<{
|
|
706
|
+
id: string;
|
|
707
|
+
logo_url: string;
|
|
708
|
+
logo_thumbnail_url: string;
|
|
709
|
+
web3_id: string;
|
|
710
|
+
claimed_points: number;
|
|
711
|
+
}[]>;
|
|
712
|
+
getRabbyPointsListV2: (params: {
|
|
713
|
+
id: string;
|
|
714
|
+
}) => Promise<{
|
|
715
|
+
id: number;
|
|
716
|
+
title: string;
|
|
717
|
+
description: string;
|
|
718
|
+
start_at: number;
|
|
719
|
+
end_at: number;
|
|
720
|
+
claimable_points: number;
|
|
721
|
+
}[]>;
|
|
722
|
+
claimRabbyPointsByIdV2: (params: {
|
|
723
|
+
campaign_id: number;
|
|
724
|
+
user_id: string;
|
|
725
|
+
signature: string;
|
|
726
|
+
}) => Promise<{
|
|
727
|
+
error_code: number;
|
|
728
|
+
}>;
|
|
729
|
+
getRabbyPointsSnapshotV2: (params: {
|
|
730
|
+
id: string;
|
|
731
|
+
}) => Promise<{
|
|
732
|
+
id: string;
|
|
733
|
+
wallet_balance_reward: number;
|
|
734
|
+
active_stats_reward: number;
|
|
735
|
+
extra_bouns: number;
|
|
736
|
+
claimed: boolean;
|
|
737
|
+
snapshot_at: number;
|
|
738
|
+
claimed_points: number;
|
|
739
|
+
}>;
|
|
740
|
+
checkRabbyPointClaimableV2: (params: {
|
|
741
|
+
id: string;
|
|
742
|
+
}) => Promise<{
|
|
743
|
+
claimable: boolean;
|
|
744
|
+
}>;
|
|
745
|
+
checkClaimInfoV2: (params: {
|
|
746
|
+
id: string;
|
|
747
|
+
}) => Promise<{
|
|
748
|
+
claimable_points: number;
|
|
749
|
+
claimed_points: number;
|
|
750
|
+
}>;
|
|
751
|
+
getRabbyPointsCampaignIsEndedV2: () => Promise<{
|
|
752
|
+
campaign_is_ended: boolean;
|
|
753
|
+
}>;
|
|
754
|
+
getSupportedChains: () => Promise<SupportedChain[]>;
|
|
755
|
+
searchChainList: (params?: {
|
|
756
|
+
limit?: number;
|
|
757
|
+
start?: number;
|
|
758
|
+
q?: string;
|
|
759
|
+
}) => Promise<{
|
|
760
|
+
page: {
|
|
761
|
+
start: number;
|
|
762
|
+
limit: number;
|
|
763
|
+
total: number;
|
|
764
|
+
};
|
|
765
|
+
chain_list: ChainListItem[];
|
|
766
|
+
}>;
|
|
767
|
+
getChainListByIds: (params: {
|
|
768
|
+
ids: string;
|
|
769
|
+
}) => Promise<ChainListItem[]>;
|
|
770
|
+
getHistoryCurve: (addr: string) => Promise<HistoryCurve>;
|
|
771
|
+
getHistoryCurveSupportedList: () => Promise<{
|
|
772
|
+
supported_chains: string[];
|
|
773
|
+
}>;
|
|
774
|
+
getHistoryCurveStatus: (params: {
|
|
775
|
+
id: string;
|
|
776
|
+
}) => Promise<{
|
|
777
|
+
failed_msg: Record<string, string>;
|
|
778
|
+
id: string;
|
|
779
|
+
status: 'pending' | 'running' | 'finished' | 'failed';
|
|
780
|
+
update_at: number;
|
|
781
|
+
}>;
|
|
782
|
+
initHistoryCurve: (params: {
|
|
783
|
+
id: string;
|
|
784
|
+
}) => Promise<{
|
|
785
|
+
success: boolean;
|
|
786
|
+
}>;
|
|
787
|
+
getNodeStatusList: () => Promise<NodeStatus[]>;
|
|
788
|
+
getNodeStatusDetail: (params: {
|
|
789
|
+
chain_id: string;
|
|
790
|
+
}) => Promise<NodeStatusDetail>;
|
|
791
|
+
postActionLog: (body: {
|
|
792
|
+
id: string;
|
|
793
|
+
type: 'tx' | 'typed_data' | 'text';
|
|
794
|
+
rules: {
|
|
795
|
+
id: string;
|
|
796
|
+
level: string | null;
|
|
797
|
+
}[];
|
|
798
|
+
}) => Promise<any>;
|
|
799
|
+
checkSpoofing: ({ from, to, }: {
|
|
800
|
+
from: string;
|
|
801
|
+
to: string;
|
|
802
|
+
}) => Promise<{
|
|
803
|
+
is_spoofing: boolean;
|
|
804
|
+
}>;
|
|
805
|
+
getAddressByDeBankId: (name: string) => Promise<{
|
|
806
|
+
addr: string;
|
|
807
|
+
web3_id: string;
|
|
808
|
+
}>;
|
|
809
|
+
getBridgeSupportChain: () => Promise<string[]>;
|
|
810
|
+
getBridgeAggregatorList: () => Promise<BridgeAggregator[]>;
|
|
811
|
+
getBridgePairList: (params: {
|
|
812
|
+
aggregator_ids: string[];
|
|
813
|
+
to_chain_id: string;
|
|
814
|
+
user_addr: string;
|
|
815
|
+
}) => Promise<BridgeTokenPair[]>;
|
|
816
|
+
getBridgeQuoteList: (params: {
|
|
817
|
+
aggregator_ids: string;
|
|
818
|
+
user_addr: string;
|
|
819
|
+
from_chain_id: string;
|
|
820
|
+
from_token_id: string;
|
|
821
|
+
from_token_raw_amount: string;
|
|
822
|
+
to_chain_id: string;
|
|
823
|
+
to_token_id: string;
|
|
824
|
+
}) => Promise<Omit<BridgeQuote, 'tx'>[]>;
|
|
825
|
+
getBridgeQuoteListV2: (params: {
|
|
826
|
+
aggregator_id: string;
|
|
827
|
+
user_addr: string;
|
|
828
|
+
from_chain_id: string;
|
|
829
|
+
from_token_id: string;
|
|
830
|
+
from_token_raw_amount: string;
|
|
831
|
+
to_chain_id: string;
|
|
832
|
+
to_token_id: string;
|
|
833
|
+
}) => Promise<Omit<BridgeQuote, 'tx'>[]>;
|
|
834
|
+
getBridgeQuote: (params: {
|
|
835
|
+
aggregator_id: string;
|
|
836
|
+
bridge_id: string;
|
|
837
|
+
user_addr: string;
|
|
838
|
+
from_chain_id: string;
|
|
839
|
+
from_token_id: string;
|
|
840
|
+
from_token_raw_amount: string;
|
|
841
|
+
to_chain_id: string;
|
|
842
|
+
to_token_id: string;
|
|
843
|
+
}) => Promise<BridgeQuote>;
|
|
844
|
+
getBridgeHistoryList: (params: {
|
|
845
|
+
user_addr: string;
|
|
846
|
+
start: number;
|
|
847
|
+
limit: number;
|
|
848
|
+
}) => Promise<{
|
|
849
|
+
history_list: BridgeHistory[];
|
|
850
|
+
total_cnt: number;
|
|
851
|
+
}>;
|
|
852
|
+
postBridgeHistory: (params: {
|
|
853
|
+
aggregator_id: string;
|
|
854
|
+
bridge_id: string;
|
|
855
|
+
from_chain_id: string;
|
|
856
|
+
from_token_id: string;
|
|
857
|
+
from_token_amount: string | number;
|
|
858
|
+
to_chain_id: string;
|
|
859
|
+
to_token_id: string;
|
|
860
|
+
to_token_amount: string | number;
|
|
861
|
+
tx_id: string;
|
|
862
|
+
tx: Tx;
|
|
863
|
+
rabby_fee: number;
|
|
864
|
+
}) => Promise<{
|
|
865
|
+
success: boolean;
|
|
866
|
+
}>;
|
|
867
|
+
getSupportedDEXList: () => Promise<{
|
|
868
|
+
dex_list: string[];
|
|
869
|
+
}>;
|
|
870
|
+
createDbkBridgeHistory: (postData: Pick<DbkBridgeHistoryItem, 'user_addr' | 'from_chain_id' | 'to_chain_id' | 'tx_id' | 'from_token_amount'>) => Promise<{
|
|
871
|
+
success: boolean;
|
|
872
|
+
}>;
|
|
873
|
+
getDbkBridgeHistoryList: (params: {
|
|
874
|
+
user_addr: string;
|
|
875
|
+
start?: number;
|
|
876
|
+
limit?: number;
|
|
877
|
+
}) => Promise<{
|
|
878
|
+
page: {
|
|
879
|
+
total: number;
|
|
880
|
+
limit: number;
|
|
881
|
+
start: number;
|
|
882
|
+
};
|
|
883
|
+
data: DbkBridgeHistoryItem[];
|
|
884
|
+
}>;
|
|
885
|
+
getGasAccountSignText: (account_id: string) => Promise<{
|
|
886
|
+
text: string;
|
|
887
|
+
}>;
|
|
888
|
+
getGasAccountInfo: (params: {
|
|
889
|
+
sig: string;
|
|
890
|
+
id: string;
|
|
891
|
+
}) => Promise<{
|
|
892
|
+
account: GasAccountInfo;
|
|
893
|
+
}>;
|
|
894
|
+
getGasAccountInfoV2: (params: {
|
|
895
|
+
id: string;
|
|
896
|
+
}) => Promise<{
|
|
897
|
+
account: GasAccountInfo;
|
|
898
|
+
}>;
|
|
899
|
+
createGasAccountPayInfo: (postData: {
|
|
900
|
+
id: string;
|
|
901
|
+
}) => Promise<{
|
|
902
|
+
account: GasAccountInfo;
|
|
903
|
+
}>;
|
|
904
|
+
confirmIapOrder: (postData: {
|
|
905
|
+
transaction_id: string;
|
|
906
|
+
device_type: 'android' | 'ios';
|
|
907
|
+
product_id: string;
|
|
908
|
+
}) => Promise<{
|
|
909
|
+
req: TxRequest;
|
|
910
|
+
}>;
|
|
911
|
+
loginGasAccount: (params: {
|
|
912
|
+
sig: string;
|
|
913
|
+
account_id: string;
|
|
914
|
+
}) => Promise<{
|
|
915
|
+
success: boolean;
|
|
916
|
+
}>;
|
|
917
|
+
logoutGasAccount: (params: {
|
|
918
|
+
sig: string;
|
|
919
|
+
account_id: string;
|
|
920
|
+
}) => Promise<{
|
|
921
|
+
success: boolean;
|
|
922
|
+
}>;
|
|
923
|
+
getGasAccountTokenList: (id: string) => Promise<TokenItem[]>;
|
|
924
|
+
rechargeGasAccount: (p: {
|
|
925
|
+
sig: string;
|
|
926
|
+
account_id: string;
|
|
927
|
+
tx_id: string;
|
|
928
|
+
chain_id: string;
|
|
929
|
+
amount: number;
|
|
930
|
+
user_addr: string;
|
|
931
|
+
nonce: number;
|
|
932
|
+
}) => Promise<{
|
|
933
|
+
success: boolean;
|
|
934
|
+
}>;
|
|
935
|
+
withdrawGasAccount: (p: {
|
|
936
|
+
sig: string;
|
|
937
|
+
amount: number;
|
|
938
|
+
account_id: string;
|
|
939
|
+
user_addr: string;
|
|
940
|
+
chain_id: string;
|
|
941
|
+
fee: number;
|
|
942
|
+
}) => Promise<{
|
|
943
|
+
success: boolean;
|
|
944
|
+
}>;
|
|
945
|
+
getWithdrawList: (p: {
|
|
946
|
+
sig: string;
|
|
947
|
+
id: string;
|
|
948
|
+
}) => Promise<WithdrawListAddressItem[]>;
|
|
949
|
+
getGasAccountHistory: (p: {
|
|
950
|
+
sig: string;
|
|
951
|
+
account_id: string;
|
|
952
|
+
start: number;
|
|
953
|
+
limit: number;
|
|
954
|
+
}) => Promise<{
|
|
955
|
+
recharge_list: {
|
|
956
|
+
amount: number;
|
|
957
|
+
chain_id: string;
|
|
958
|
+
create_at: number;
|
|
959
|
+
gas_account_id: string;
|
|
960
|
+
tx_id: string;
|
|
961
|
+
user_addr: string;
|
|
962
|
+
}[];
|
|
963
|
+
withdraw_list: {
|
|
964
|
+
amount: number;
|
|
965
|
+
chain_id: string;
|
|
966
|
+
create_at: number;
|
|
967
|
+
gas_account_id: string;
|
|
968
|
+
tx_id: string;
|
|
969
|
+
user_addr: string;
|
|
970
|
+
}[];
|
|
971
|
+
history_list: {
|
|
972
|
+
id: string;
|
|
973
|
+
chain_id: string;
|
|
974
|
+
create_at: number;
|
|
975
|
+
gas_cost_usd_value: number;
|
|
976
|
+
gas_account_id: string;
|
|
977
|
+
tx_id: string;
|
|
978
|
+
usd_value: number;
|
|
979
|
+
user_addr: string;
|
|
980
|
+
history_type: 'tx' | 'recharge' | 'withdraw';
|
|
981
|
+
}[];
|
|
982
|
+
pagination: {
|
|
983
|
+
limit: number;
|
|
984
|
+
start: number;
|
|
985
|
+
total: number;
|
|
986
|
+
};
|
|
987
|
+
}>;
|
|
988
|
+
checkGasAccountTxs: (p: {
|
|
989
|
+
sig?: string;
|
|
990
|
+
account_id: string;
|
|
991
|
+
tx_list: Tx[];
|
|
992
|
+
}) => Promise<GasAccountCheckResult>;
|
|
993
|
+
getGasAccountAml: (id: string) => Promise<{
|
|
994
|
+
is_risk: boolean;
|
|
995
|
+
}>;
|
|
996
|
+
parseCommon: (params: {
|
|
997
|
+
typed_data: Record<string, any>;
|
|
998
|
+
origin: string;
|
|
999
|
+
user_addr: string;
|
|
1000
|
+
}) => Promise<ParseCommonResponse>;
|
|
1001
|
+
getRecommendBridgeToChain: (params: {
|
|
1002
|
+
from_chain_id: string;
|
|
1003
|
+
}) => Promise<{
|
|
1004
|
+
to_chain_id: string;
|
|
1005
|
+
}>;
|
|
1006
|
+
getRecommendFromToken: (params: {
|
|
1007
|
+
user_addr: string;
|
|
1008
|
+
from_chain_id: string;
|
|
1009
|
+
from_token_id: string;
|
|
1010
|
+
from_token_amount: string;
|
|
1011
|
+
to_chain_id: string;
|
|
1012
|
+
to_token_id: string;
|
|
1013
|
+
}) => Promise<{
|
|
1014
|
+
token_list: TokenItem[];
|
|
1015
|
+
}>;
|
|
1016
|
+
getBridgeToTokenList: (params: {
|
|
1017
|
+
from_chain_id: string;
|
|
1018
|
+
to_chain_id: string;
|
|
1019
|
+
from_token_id?: string;
|
|
1020
|
+
q?: string;
|
|
1021
|
+
}) => Promise<{
|
|
1022
|
+
token_list: (TokenItem & {
|
|
1023
|
+
trade_volume_24h: 'low' | 'middle' | 'high';
|
|
1024
|
+
})[];
|
|
1025
|
+
}>;
|
|
1026
|
+
getBridgeQuoteV2: (params: {
|
|
1027
|
+
aggregator_id: string;
|
|
1028
|
+
user_addr: string;
|
|
1029
|
+
from_chain_id: string;
|
|
1030
|
+
from_token_id: string;
|
|
1031
|
+
from_token_raw_amount: string;
|
|
1032
|
+
to_chain_id: string;
|
|
1033
|
+
to_token_id: string;
|
|
1034
|
+
slippage: string;
|
|
1035
|
+
}) => Promise<Omit<BridgeQuote, 'tx'>[]>;
|
|
1036
|
+
getBridgeQuoteTxV2: (params: {
|
|
1037
|
+
aggregator_id: string;
|
|
1038
|
+
bridge_id: string;
|
|
1039
|
+
user_addr: string;
|
|
1040
|
+
from_chain_id: string;
|
|
1041
|
+
from_token_id: string;
|
|
1042
|
+
from_token_raw_amount: string;
|
|
1043
|
+
to_chain_id: string;
|
|
1044
|
+
to_token_id: string;
|
|
1045
|
+
slippage: string;
|
|
1046
|
+
}) => Promise<BridgeQuote>;
|
|
1047
|
+
isSameBridgeToken: (params: {
|
|
1048
|
+
from_chain_id: string;
|
|
1049
|
+
from_token_id: string;
|
|
1050
|
+
to_chain_id: string;
|
|
1051
|
+
to_token_id: string;
|
|
1052
|
+
}) => Promise<{
|
|
1053
|
+
is_same: boolean;
|
|
1054
|
+
aggregator_id: string;
|
|
1055
|
+
}[]>;
|
|
1056
|
+
getBridgeSupportChainV2: () => Promise<string[]>;
|
|
1057
|
+
uninstalledFeedback: ({ text, }: {
|
|
1058
|
+
text: string;
|
|
1059
|
+
}) => Promise<{
|
|
1060
|
+
success: boolean;
|
|
1061
|
+
}>;
|
|
1062
|
+
/**
|
|
1063
|
+
* @deprecated
|
|
1064
|
+
*/
|
|
1065
|
+
getToken24hPrice: (params: {
|
|
1066
|
+
chain_id: string;
|
|
1067
|
+
id: string;
|
|
1068
|
+
}) => Promise<{
|
|
1069
|
+
time_at: number;
|
|
1070
|
+
price: number;
|
|
1071
|
+
}[]>;
|
|
1072
|
+
getTokenPriceCurve: (params: {
|
|
1073
|
+
chain_id: string;
|
|
1074
|
+
id: string;
|
|
1075
|
+
days: number | 1 | 7;
|
|
1076
|
+
}) => Promise<{
|
|
1077
|
+
time_at: number;
|
|
1078
|
+
price: number;
|
|
1079
|
+
}[]>;
|
|
1080
|
+
getTokenDatePrice: (params: {
|
|
1081
|
+
chain_id: string;
|
|
1082
|
+
id: string;
|
|
1083
|
+
}) => Promise<{
|
|
1084
|
+
date_at: string;
|
|
1085
|
+
price: number;
|
|
1086
|
+
}[]>;
|
|
1087
|
+
searchTokens: (params: {
|
|
1088
|
+
q: string;
|
|
1089
|
+
}) => Promise<TokenItem[]>;
|
|
1090
|
+
searchTokensV2: (params: {
|
|
1091
|
+
q: string;
|
|
1092
|
+
}) => Promise<TokenItemWithEntity[]>;
|
|
1093
|
+
getCopyTradingChainList: () => Promise<string[]>;
|
|
1094
|
+
getCopyTradingTokenList: (params: {
|
|
1095
|
+
chain_id: string;
|
|
1096
|
+
limit: number;
|
|
1097
|
+
start_time: number;
|
|
1098
|
+
}) => Promise<CopyTradeTokenListResponse>;
|
|
1099
|
+
getCopyTradingRecentBuyList: (params: {
|
|
1100
|
+
chain_id: string;
|
|
1101
|
+
token_id: string;
|
|
1102
|
+
limit: number;
|
|
1103
|
+
}) => Promise<CopyTradeRecentBuyListResponse>;
|
|
1104
|
+
getCopyTradingPnlList: (params: {
|
|
1105
|
+
user_addr: string;
|
|
1106
|
+
}) => Promise<CopyTradePnlListResponse>;
|
|
1107
|
+
batchQueryTokens: (uuids: string | string[]) => Promise<TokenItem[]>;
|
|
1108
|
+
getBuySupportedCountryList: () => Promise<BuyCountryItem[]>;
|
|
1109
|
+
getBuySupportedTokenList: () => Promise<(TokenItem & {
|
|
1110
|
+
currency_code: string;
|
|
1111
|
+
})[]>;
|
|
1112
|
+
getBuyQuote: (params: {
|
|
1113
|
+
country_code: string;
|
|
1114
|
+
user_addr: string;
|
|
1115
|
+
usd_amount: string;
|
|
1116
|
+
currency_code: string;
|
|
1117
|
+
receive_token_uuid: string;
|
|
1118
|
+
}) => Promise<BuyQuoteItem[]>;
|
|
1119
|
+
getBuyWidgetUrl: (params: {
|
|
1120
|
+
country_code: string;
|
|
1121
|
+
user_addr: string;
|
|
1122
|
+
usd_amount: string;
|
|
1123
|
+
receive_token_uuid: string;
|
|
1124
|
+
service_provider: string;
|
|
1125
|
+
currency_code: string;
|
|
1126
|
+
redirect_url?: string;
|
|
1127
|
+
}) => Promise<{
|
|
1128
|
+
url: string;
|
|
1129
|
+
msg: number;
|
|
1130
|
+
}>;
|
|
1131
|
+
getBuyHistory: (params: {
|
|
1132
|
+
user_addr: string;
|
|
1133
|
+
start?: number;
|
|
1134
|
+
limit?: number;
|
|
1135
|
+
}) => Promise<BuyHistoryList>;
|
|
1136
|
+
getBuyPaymentMethods: (params: {
|
|
1137
|
+
currency_code: string;
|
|
1138
|
+
country_code: string;
|
|
1139
|
+
service_provider: string;
|
|
1140
|
+
}) => Promise<BuyPaymentMethod[]>;
|
|
1141
|
+
getBuyCurrencyList: () => Promise<{
|
|
1142
|
+
id: string;
|
|
1143
|
+
name: string;
|
|
1144
|
+
image_url: string;
|
|
1145
|
+
}[]>;
|
|
1146
|
+
getOfflineChainList: () => Promise<{
|
|
1147
|
+
id: string;
|
|
1148
|
+
offline_at: number;
|
|
1149
|
+
}[]>;
|
|
1150
|
+
isBlockedAddress: (id: string) => Promise<{
|
|
1151
|
+
is_blocked: boolean;
|
|
1152
|
+
}>;
|
|
1153
|
+
estimateGasUsd: ({ tx, origin, address, updateNonce, pending_tx_list, }: {
|
|
1154
|
+
tx: Tx;
|
|
1155
|
+
origin: string;
|
|
1156
|
+
address: string;
|
|
1157
|
+
updateNonce: boolean;
|
|
1158
|
+
pending_tx_list: Tx[];
|
|
1159
|
+
}) => Promise<{
|
|
1160
|
+
gas_used?: number;
|
|
1161
|
+
safe_gas_used?: number;
|
|
1162
|
+
}>;
|
|
1163
|
+
getCexSupportList: () => Promise<ProjectItem[]>;
|
|
1164
|
+
}
|
|
1165
|
+
export {};
|