@rabby-wallet/rabby-api 0.9.26-beta.1 → 0.9.26-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,1204 +1,1193 @@
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, DefaultRPCRes } 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
- submitTxV2: (postData: {
504
- frontend_push_result?: {
505
- success: true;
506
- has_pushed: true;
507
- raw_tx: string;
508
- url: string;
509
- return_tx_id: string;
510
- } | {
511
- success: false;
512
- has_pushed: true;
513
- url: string;
514
- error_msg: string;
515
- };
516
- backend_push_require: {
517
- gas_type: 'gas_account' | 'gasless' | null;
518
- };
519
- context: {
520
- tx: Tx;
521
- origin?: string;
522
- log_id: string;
523
- };
524
- mev_share_model: 'user' | 'rabby';
525
- sig?: string;
526
- }) => Promise<{
527
- tx_id?: string;
528
- access_token?: string;
529
- err?: string;
530
- }>;
531
- getDefaultRPCs: () => Promise<DefaultRPCRes>;
532
- getTxRequests: (ids: string | string[]) => Promise<TxRequest[]>;
533
- getTxRequest: (id: string) => Promise<TxRequest>;
534
- withdrawTx: (reqId: string) => Promise<{
535
- req: TxRequest;
536
- }>;
537
- retryPushTx: (reqId: string) => Promise<{
538
- req: TxRequest;
539
- }>;
540
- mempoolChecks: (txId: string, chainId: string, node_info?: boolean) => Promise<MempoolCheckDetail[]>;
541
- getPendingTxList: (params: {
542
- chain_id: string;
543
- }, options?: Parameters<typeof this.asyncJob>[1]) => Promise<{
544
- pending_tx_list: PendingTxItem[];
545
- token_dict: Record<string, TokenItem | NFTItem>;
546
- }>;
547
- getLatestPreExec: (params: {
548
- id: string;
549
- }) => Promise<LatestExplainTxResponse>;
550
- walletSupportChain: (params: {
551
- chain_id: string;
552
- user_addr: string;
553
- }) => Promise<{
554
- is_success: boolean;
555
- count: number;
556
- }>;
557
- walletSupportOrigin: (params: {
558
- origin: string;
559
- user_addr: string;
560
- text: string;
561
- }) => Promise<{
562
- is_success: boolean;
563
- count: number;
564
- }>;
565
- walletSupportSelector: (params: {
566
- selector: string;
567
- user_addr: string;
568
- chain_id: string;
569
- contract_id: string;
570
- }) => Promise<{
571
- is_success: boolean;
572
- count: number;
573
- }>;
574
- searchDapp: (params?: {
575
- q?: string;
576
- chain_id?: string;
577
- start?: number;
578
- limit?: number;
579
- match_id?: boolean;
580
- }) => Promise<{
581
- page: {
582
- limit: number;
583
- start: number;
584
- total: number;
585
- };
586
- dapps: BasicDappInfo[];
587
- }>;
588
- getDappsInfo: (params: {
589
- ids: string[];
590
- }) => Promise<BasicDappInfo[]>;
591
- getDappHotTags: (params?: {
592
- limit: number;
593
- }) => Promise<string[]>;
594
- getHotDapps: (params?: {
595
- limit: number;
596
- }) => Promise<BasicDappInfo[]>;
597
- getRabbyClaimText: (params: {
598
- id: string;
599
- invite_code?: string;
600
- }) => Promise<{
601
- id: string;
602
- text: string;
603
- }>;
604
- getRabbySignatureText: (params: {
605
- id: string;
606
- }) => Promise<{
607
- id: string;
608
- text: string;
609
- }>;
610
- getRabbyPoints: (params: {
611
- id: string;
612
- }) => Promise<{
613
- id: string;
614
- invite_code?: string;
615
- logo_url: string;
616
- logo_thumbnail_url: string;
617
- web3_id: string;
618
- claimed_points: number;
619
- total_claimed_points: number;
620
- }>;
621
- checkRabbyPointsInviteCode: (params: {
622
- code: string;
623
- }) => Promise<{
624
- invite_code_exist: boolean;
625
- }>;
626
- setRabbyPointsInviteCode: (params: {
627
- id: string;
628
- signature: string;
629
- invite_code: string;
630
- }) => Promise<{
631
- code: number;
632
- }>;
633
- checkRabbyPointClaimable: (params: {
634
- id: string;
635
- }) => Promise<{
636
- claimable: boolean;
637
- }>;
638
- getRabbyPointsSnapshot: (params: {
639
- id: string;
640
- }) => Promise<{
641
- id: string;
642
- address_balance: number;
643
- metamask_swap: number;
644
- rabby_old_user: number;
645
- rabby_nadge: number;
646
- rabby_nft: number;
647
- extra_bouns: number;
648
- claimed: boolean;
649
- snapshot_at: number;
650
- }>;
651
- claimRabbyPointsSnapshot: (params: {
652
- id: string;
653
- signature: string;
654
- invite_code?: string;
655
- }) => Promise<{
656
- error_code: number;
657
- error_msg?: string;
658
- }>;
659
- getRabbyPointsTopUsers: (params: {
660
- id: string;
661
- }) => Promise<{
662
- id: string;
663
- logo_url: string;
664
- logo_thumbnail_url: string;
665
- web3_id: string;
666
- claimed_points: number;
667
- }[]>;
668
- getRabbyPointsList: (params: {
669
- id: string;
670
- }) => Promise<{
671
- id: number;
672
- title: string;
673
- description: string;
674
- start_at: number;
675
- end_at: number;
676
- claimable_points: number;
677
- }[]>;
678
- getRabbyPointsCampaignIsEnded: () => Promise<{
679
- campaign_is_ended: boolean;
680
- }>;
681
- claimRabbyPointsById: (params: {
682
- campaign_id: number;
683
- user_id: string;
684
- signature: string;
685
- }) => Promise<{
686
- error_code: number;
687
- }>;
688
- getRabbyPointsV2: (params: {
689
- id: string;
690
- }) => Promise<{
691
- id: string;
692
- invite_code?: string;
693
- logo_url: string;
694
- logo_thumbnail_url: string;
695
- web3_id: string;
696
- claimed_points: number;
697
- total_claimed_points: number;
698
- }>;
699
- getRabbySignatureTextV2: (params: {
700
- id: string;
701
- }) => Promise<{
702
- id: string;
703
- text: string;
704
- }>;
705
- getRabbyClaimTextV2: (params: {
706
- id: string;
707
- invite_code?: string;
708
- }) => Promise<{
709
- id: string;
710
- text: string;
711
- }>;
712
- setRabbyPointsInviteCodeV2: (params: {
713
- id: string;
714
- signature: string;
715
- invite_code: string;
716
- }) => Promise<{
717
- code: number;
718
- }>;
719
- checkRabbyPointsInviteCodeV2: (params: {
720
- code: string;
721
- }) => Promise<{
722
- invite_code_exist: boolean;
723
- }>;
724
- claimRabbyPointsSnapshotV2: (params: {
725
- id: string;
726
- signature: string;
727
- invite_code?: string;
728
- }) => Promise<{
729
- error_code: number;
730
- error_msg?: string;
731
- }>;
732
- getRabbyPointsTopUsersV2: (params: {
733
- id: string;
734
- }) => Promise<{
735
- id: string;
736
- logo_url: string;
737
- logo_thumbnail_url: string;
738
- web3_id: string;
739
- claimed_points: number;
740
- }[]>;
741
- getRabbyPointsListV2: (params: {
742
- id: string;
743
- }) => Promise<{
744
- id: number;
745
- title: string;
746
- description: string;
747
- start_at: number;
748
- end_at: number;
749
- claimable_points: number;
750
- }[]>;
751
- claimRabbyPointsByIdV2: (params: {
752
- campaign_id: number;
753
- user_id: string;
754
- signature: string;
755
- }) => Promise<{
756
- error_code: number;
757
- }>;
758
- getRabbyPointsSnapshotV2: (params: {
759
- id: string;
760
- }) => Promise<{
761
- id: string;
762
- wallet_balance_reward: number;
763
- active_stats_reward: number;
764
- extra_bouns: number;
765
- claimed: boolean;
766
- snapshot_at: number;
767
- claimed_points: number;
768
- }>;
769
- checkRabbyPointClaimableV2: (params: {
770
- id: string;
771
- }) => Promise<{
772
- claimable: boolean;
773
- }>;
774
- checkClaimInfoV2: (params: {
775
- id: string;
776
- }) => Promise<{
777
- claimable_points: number;
778
- claimed_points: number;
779
- }>;
780
- getRabbyPointsCampaignIsEndedV2: () => Promise<{
781
- campaign_is_ended: boolean;
782
- }>;
783
- getSupportedChains: () => Promise<SupportedChain[]>;
784
- searchChainList: (params?: {
785
- limit?: number;
786
- start?: number;
787
- q?: string;
788
- }) => Promise<{
789
- page: {
790
- start: number;
791
- limit: number;
792
- total: number;
793
- };
794
- chain_list: ChainListItem[];
795
- }>;
796
- getChainListByIds: (params: {
797
- ids: string;
798
- }) => Promise<ChainListItem[]>;
799
- getHistoryCurve: (addr: string) => Promise<HistoryCurve>;
800
- getHistoryCurveSupportedList: () => Promise<{
801
- supported_chains: string[];
802
- }>;
803
- getHistoryCurveStatus: (params: {
804
- id: string;
805
- }) => Promise<{
806
- failed_msg: Record<string, string>;
807
- id: string;
808
- status: 'pending' | 'running' | 'finished' | 'failed';
809
- update_at: number;
810
- }>;
811
- initHistoryCurve: (params: {
812
- id: string;
813
- }) => Promise<{
814
- success: boolean;
815
- }>;
816
- getNodeStatusList: () => Promise<NodeStatus[]>;
817
- getNodeStatusDetail: (params: {
818
- chain_id: string;
819
- }) => Promise<NodeStatusDetail>;
820
- postActionLog: (body: {
821
- id: string;
822
- type: 'tx' | 'typed_data' | 'text';
823
- rules: {
824
- id: string;
825
- level: string | null;
826
- }[];
827
- }) => Promise<any>;
828
- checkSpoofing: ({ from, to, }: {
829
- from: string;
830
- to: string;
831
- }) => Promise<{
832
- is_spoofing: boolean;
833
- }>;
834
- getAddressByDeBankId: (name: string) => Promise<{
835
- addr: string;
836
- web3_id: string;
837
- }>;
838
- getBridgeSupportChain: () => Promise<string[]>;
839
- getBridgeAggregatorList: () => Promise<BridgeAggregator[]>;
840
- getBridgePairList: (params: {
841
- aggregator_ids: string[];
842
- to_chain_id: string;
843
- user_addr: string;
844
- }) => Promise<BridgeTokenPair[]>;
845
- getBridgeQuoteList: (params: {
846
- aggregator_ids: string;
847
- user_addr: string;
848
- from_chain_id: string;
849
- from_token_id: string;
850
- from_token_raw_amount: string;
851
- to_chain_id: string;
852
- to_token_id: string;
853
- }) => Promise<Omit<BridgeQuote, 'tx'>[]>;
854
- getBridgeQuoteListV2: (params: {
855
- aggregator_id: string;
856
- user_addr: string;
857
- from_chain_id: string;
858
- from_token_id: string;
859
- from_token_raw_amount: string;
860
- to_chain_id: string;
861
- to_token_id: string;
862
- }) => Promise<Omit<BridgeQuote, 'tx'>[]>;
863
- getBridgeQuote: (params: {
864
- aggregator_id: string;
865
- bridge_id: string;
866
- user_addr: string;
867
- from_chain_id: string;
868
- from_token_id: string;
869
- from_token_raw_amount: string;
870
- to_chain_id: string;
871
- to_token_id: string;
872
- }) => Promise<BridgeQuote>;
873
- getBridgeHistoryList: (params: {
874
- user_addr: string;
875
- start: number;
876
- limit: number;
877
- }) => Promise<{
878
- history_list: BridgeHistory[];
879
- total_cnt: number;
880
- }>;
881
- postBridgeHistory: (params: {
882
- aggregator_id: string;
883
- bridge_id: string;
884
- from_chain_id: string;
885
- from_token_id: string;
886
- from_token_amount: string | number;
887
- to_chain_id: string;
888
- to_token_id: string;
889
- to_token_amount: string | number;
890
- tx_id: string;
891
- tx: Tx;
892
- rabby_fee: number;
893
- }) => Promise<{
894
- success: boolean;
895
- }>;
896
- getSupportedDEXList: () => Promise<{
897
- dex_list: string[];
898
- }>;
899
- createDbkBridgeHistory: (postData: Pick<DbkBridgeHistoryItem, 'user_addr' | 'from_chain_id' | 'to_chain_id' | 'tx_id' | 'from_token_amount'>) => Promise<{
900
- success: boolean;
901
- }>;
902
- getDbkBridgeHistoryList: (params: {
903
- user_addr: string;
904
- start?: number;
905
- limit?: number;
906
- }) => Promise<{
907
- page: {
908
- total: number;
909
- limit: number;
910
- start: number;
911
- };
912
- data: DbkBridgeHistoryItem[];
913
- }>;
914
- getGasAccountSignText: (account_id: string) => Promise<{
915
- text: string;
916
- }>;
917
- getGasAccountInfo: (params: {
918
- sig: string;
919
- id: string;
920
- }) => Promise<{
921
- account: GasAccountInfo;
922
- }>;
923
- getGasAccountInfoV2: (params: {
924
- id: string;
925
- }) => Promise<{
926
- account: GasAccountInfo;
927
- }>;
928
- createGasAccountPayInfo: (postData: {
929
- id: string;
930
- }) => Promise<{
931
- account: GasAccountInfo;
932
- }>;
933
- confirmIapOrder: (postData: {
934
- transaction_id: string;
935
- device_type: 'android' | 'ios';
936
- product_id: string;
937
- }) => Promise<{
938
- req: TxRequest;
939
- }>;
940
- loginGasAccount: (params: {
941
- sig: string;
942
- account_id: string;
943
- }) => Promise<{
944
- success: boolean;
945
- }>;
946
- logoutGasAccount: (params: {
947
- sig: string;
948
- account_id: string;
949
- }) => Promise<{
950
- success: boolean;
951
- }>;
952
- getGasAccountTokenList: (id: string) => Promise<TokenItem[]>;
953
- rechargeGasAccount: (p: {
954
- sig: string;
955
- account_id: string;
956
- tx_id: string;
957
- chain_id: string;
958
- amount: number;
959
- user_addr: string;
960
- nonce: number;
961
- }) => Promise<{
962
- success: boolean;
963
- }>;
964
- withdrawGasAccount: (p: {
965
- sig: string;
966
- amount: number;
967
- account_id: string;
968
- user_addr: string;
969
- chain_id: string;
970
- fee: number;
971
- }) => Promise<{
972
- success: boolean;
973
- }>;
974
- getWithdrawList: (p: {
975
- sig: string;
976
- id: string;
977
- }) => Promise<WithdrawListAddressItem[]>;
978
- getGasAccountHistory: (p: {
979
- sig: string;
980
- account_id: string;
981
- start: number;
982
- limit: number;
983
- }) => Promise<{
984
- recharge_list: {
985
- amount: number;
986
- chain_id: string;
987
- create_at: number;
988
- gas_account_id: string;
989
- tx_id: string;
990
- user_addr: string;
991
- }[];
992
- withdraw_list: {
993
- amount: number;
994
- chain_id: string;
995
- create_at: number;
996
- gas_account_id: string;
997
- tx_id: string;
998
- user_addr: string;
999
- }[];
1000
- history_list: {
1001
- id: string;
1002
- chain_id: string;
1003
- create_at: number;
1004
- gas_cost_usd_value: number;
1005
- gas_account_id: string;
1006
- tx_id: string;
1007
- usd_value: number;
1008
- user_addr: string;
1009
- history_type: 'tx' | 'recharge' | 'withdraw';
1010
- }[];
1011
- pagination: {
1012
- limit: number;
1013
- start: number;
1014
- total: number;
1015
- };
1016
- }>;
1017
- checkGasAccountTxs: (p: {
1018
- sig?: string;
1019
- account_id: string;
1020
- tx_list: Tx[];
1021
- }) => Promise<GasAccountCheckResult>;
1022
- getGasAccountAml: (id: string) => Promise<{
1023
- is_risk: boolean;
1024
- }>;
1025
- parseCommon: (params: {
1026
- typed_data: Record<string, any>;
1027
- origin: string;
1028
- user_addr: string;
1029
- }) => Promise<ParseCommonResponse>;
1030
- getRecommendBridgeToChain: (params: {
1031
- from_chain_id: string;
1032
- }) => Promise<{
1033
- to_chain_id: string;
1034
- }>;
1035
- getRecommendFromToken: (params: {
1036
- user_addr: string;
1037
- from_chain_id: string;
1038
- from_token_id: string;
1039
- from_token_amount: string;
1040
- to_chain_id: string;
1041
- to_token_id: string;
1042
- }) => Promise<{
1043
- token_list: TokenItem[];
1044
- }>;
1045
- getBridgeToTokenList: (params: {
1046
- from_chain_id: string;
1047
- to_chain_id: string;
1048
- from_token_id?: string;
1049
- q?: string;
1050
- }) => Promise<{
1051
- token_list: (TokenItem & {
1052
- trade_volume_24h: 'low' | 'middle' | 'high';
1053
- })[];
1054
- }>;
1055
- getBridgeQuoteV2: (params: {
1056
- aggregator_id: string;
1057
- user_addr: string;
1058
- from_chain_id: string;
1059
- from_token_id: string;
1060
- from_token_raw_amount: string;
1061
- to_chain_id: string;
1062
- to_token_id: string;
1063
- slippage: string;
1064
- }) => Promise<Omit<BridgeQuote, 'tx'>[]>;
1065
- getBridgeQuoteTxV2: (params: {
1066
- aggregator_id: string;
1067
- bridge_id: string;
1068
- user_addr: string;
1069
- from_chain_id: string;
1070
- from_token_id: string;
1071
- from_token_raw_amount: string;
1072
- to_chain_id: string;
1073
- to_token_id: string;
1074
- slippage: string;
1075
- }) => Promise<BridgeQuote>;
1076
- isSameBridgeToken: (params: {
1077
- from_chain_id: string;
1078
- from_token_id: string;
1079
- to_chain_id: string;
1080
- to_token_id: string;
1081
- }) => Promise<{
1082
- is_same: boolean;
1083
- aggregator_id: string;
1084
- }[]>;
1085
- getBridgeSupportChainV2: () => Promise<string[]>;
1086
- submitFeedback: ({ text, usage, }: {
1087
- text: string;
1088
- /**
1089
- * @description 'usage' is used to submit feedback on rating scene.
1090
- * by default, it means 'uninstall' scene.
1091
- */
1092
- usage?: "rating" | undefined;
1093
- }) => Promise<{
1094
- success: boolean;
1095
- }>;
1096
- uninstalledFeedback: ({ text, }: {
1097
- text: string;
1098
- }) => Promise<{
1099
- success: boolean;
1100
- }>;
1101
- /**
1102
- * @deprecated
1103
- */
1104
- getToken24hPrice: (params: {
1105
- chain_id: string;
1106
- id: string;
1107
- }) => Promise<{
1108
- time_at: number;
1109
- price: number;
1110
- }[]>;
1111
- getTokenPriceCurve: (params: {
1112
- chain_id: string;
1113
- id: string;
1114
- days: number | 1 | 7;
1115
- }) => Promise<{
1116
- time_at: number;
1117
- price: number;
1118
- }[]>;
1119
- getTokenDatePrice: (params: {
1120
- chain_id: string;
1121
- id: string;
1122
- }) => Promise<{
1123
- date_at: string;
1124
- price: number;
1125
- }[]>;
1126
- searchTokens: (params: {
1127
- q: string;
1128
- }) => Promise<TokenItem[]>;
1129
- searchTokensV2: (params: {
1130
- q: string;
1131
- }) => Promise<TokenItemWithEntity[]>;
1132
- getCopyTradingChainList: () => Promise<string[]>;
1133
- getCopyTradingTokenList: (params: {
1134
- chain_id: string;
1135
- limit: number;
1136
- start_time: number;
1137
- }) => Promise<CopyTradeTokenListResponse>;
1138
- getCopyTradingRecentBuyList: (params: {
1139
- chain_id: string;
1140
- token_id: string;
1141
- limit: number;
1142
- }) => Promise<CopyTradeRecentBuyListResponse>;
1143
- getCopyTradingPnlList: (params: {
1144
- user_addr: string;
1145
- }) => Promise<CopyTradePnlListResponse>;
1146
- batchQueryTokens: (uuids: string | string[]) => Promise<TokenItem[]>;
1147
- getBuySupportedCountryList: () => Promise<BuyCountryItem[]>;
1148
- getBuySupportedTokenList: () => Promise<(TokenItem & {
1149
- currency_code: string;
1150
- })[]>;
1151
- getBuyQuote: (params: {
1152
- country_code: string;
1153
- user_addr: string;
1154
- usd_amount: string;
1155
- currency_code: string;
1156
- receive_token_uuid: string;
1157
- }) => Promise<BuyQuoteItem[]>;
1158
- getBuyWidgetUrl: (params: {
1159
- country_code: string;
1160
- user_addr: string;
1161
- usd_amount: string;
1162
- receive_token_uuid: string;
1163
- service_provider: string;
1164
- currency_code: string;
1165
- redirect_url?: string;
1166
- }) => Promise<{
1167
- url: string;
1168
- msg: number;
1169
- }>;
1170
- getBuyHistory: (params: {
1171
- user_addr: string;
1172
- start?: number;
1173
- limit?: number;
1174
- }) => Promise<BuyHistoryList>;
1175
- getBuyPaymentMethods: (params: {
1176
- currency_code: string;
1177
- country_code: string;
1178
- service_provider: string;
1179
- }) => Promise<BuyPaymentMethod[]>;
1180
- getBuyCurrencyList: () => Promise<{
1181
- id: string;
1182
- name: string;
1183
- image_url: string;
1184
- }[]>;
1185
- getOfflineChainList: () => Promise<{
1186
- id: string;
1187
- offline_at: number;
1188
- }[]>;
1189
- isBlockedAddress: (id: string) => Promise<{
1190
- is_blocked: boolean;
1191
- }>;
1192
- estimateGasUsd: ({ tx, origin, address, updateNonce, pending_tx_list, }: {
1193
- tx: Tx;
1194
- origin: string;
1195
- address: string;
1196
- updateNonce: boolean;
1197
- pending_tx_list: Tx[];
1198
- }) => Promise<{
1199
- gas_used?: number;
1200
- safe_gas_used?: number;
1201
- }>;
1202
- getCexSupportList: () => Promise<ProjectItem[]>;
1203
- }
1204
- export {};
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, CopyTradeTokenListV2Response, CopyTradeRecentBuyListV2Response, CopyTradeTokenItemV2 } 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
+ submitFeedback: ({ text, usage, }: {
1058
+ text: string;
1059
+ /**
1060
+ * @description 'usage' is used to submit feedback on rating scene.
1061
+ * by default, it means 'uninstall' scene.
1062
+ */
1063
+ usage?: "rating" | undefined;
1064
+ }) => Promise<{
1065
+ success: boolean;
1066
+ }>;
1067
+ uninstalledFeedback: ({ text, }: {
1068
+ text: string;
1069
+ }) => Promise<{
1070
+ success: boolean;
1071
+ }>;
1072
+ /**
1073
+ * @deprecated
1074
+ */
1075
+ getToken24hPrice: (params: {
1076
+ chain_id: string;
1077
+ id: string;
1078
+ }) => Promise<{
1079
+ time_at: number;
1080
+ price: number;
1081
+ }[]>;
1082
+ getTokenPriceCurve: (params: {
1083
+ chain_id: string;
1084
+ id: string;
1085
+ days: number | 1 | 7;
1086
+ }) => Promise<{
1087
+ time_at: number;
1088
+ price: number;
1089
+ }[]>;
1090
+ getTokenDatePrice: (params: {
1091
+ chain_id: string;
1092
+ id: string;
1093
+ }) => Promise<{
1094
+ date_at: string;
1095
+ price: number;
1096
+ }[]>;
1097
+ searchTokens: (params: {
1098
+ q: string;
1099
+ }) => Promise<TokenItem[]>;
1100
+ searchTokensV2: (params: {
1101
+ q: string;
1102
+ }) => Promise<TokenItemWithEntity[]>;
1103
+ getCopyTradingChainList: () => Promise<string[]>;
1104
+ getCopyTradingTokenList: (params: {
1105
+ chain_id: string;
1106
+ limit: number;
1107
+ start_time: number;
1108
+ }) => Promise<CopyTradeTokenListResponse>;
1109
+ getCopyTradingTokenListV2: (params: {
1110
+ chain_id: string;
1111
+ limit: number;
1112
+ cursor: string;
1113
+ order_by: 'price_change' | 'buy_address_count' | 'token_create_at';
1114
+ order?: 'asc' | 'desc';
1115
+ time_range?: '24h' | '7d' | '30d';
1116
+ }) => Promise<CopyTradeTokenListV2Response>;
1117
+ getCopyTradingRecentBuyList: (params: {
1118
+ chain_id: string;
1119
+ token_id: string;
1120
+ limit: number;
1121
+ }) => Promise<CopyTradeRecentBuyListResponse>;
1122
+ getCopyTradingRecentBuyListV2: (params: {
1123
+ chain_id: string;
1124
+ token_id: string;
1125
+ limit: number;
1126
+ cursor: string;
1127
+ }) => Promise<CopyTradeRecentBuyListV2Response>;
1128
+ getCopyTradingDetail: (params: {
1129
+ chain_id: string;
1130
+ token_id: string;
1131
+ }) => Promise<CopyTradeTokenItemV2>;
1132
+ getCopyTradingPnlList: (params: {
1133
+ user_addr: string;
1134
+ }) => Promise<CopyTradePnlListResponse>;
1135
+ batchQueryTokens: (uuids: string | string[]) => Promise<TokenItem[]>;
1136
+ getBuySupportedCountryList: () => Promise<BuyCountryItem[]>;
1137
+ getBuySupportedTokenList: () => Promise<(TokenItem & {
1138
+ currency_code: string;
1139
+ })[]>;
1140
+ getBuyQuote: (params: {
1141
+ country_code: string;
1142
+ user_addr: string;
1143
+ usd_amount: string;
1144
+ currency_code: string;
1145
+ receive_token_uuid: string;
1146
+ }) => Promise<BuyQuoteItem[]>;
1147
+ getBuyWidgetUrl: (params: {
1148
+ country_code: string;
1149
+ user_addr: string;
1150
+ usd_amount: string;
1151
+ receive_token_uuid: string;
1152
+ service_provider: string;
1153
+ currency_code: string;
1154
+ redirect_url?: string;
1155
+ }) => Promise<{
1156
+ url: string;
1157
+ msg: number;
1158
+ }>;
1159
+ getBuyHistory: (params: {
1160
+ user_addr: string;
1161
+ start?: number;
1162
+ limit?: number;
1163
+ }) => Promise<BuyHistoryList>;
1164
+ getBuyPaymentMethods: (params: {
1165
+ currency_code: string;
1166
+ country_code: string;
1167
+ service_provider: string;
1168
+ }) => Promise<BuyPaymentMethod[]>;
1169
+ getBuyCurrencyList: () => Promise<{
1170
+ id: string;
1171
+ name: string;
1172
+ image_url: string;
1173
+ }[]>;
1174
+ getOfflineChainList: () => Promise<{
1175
+ id: string;
1176
+ offline_at: number;
1177
+ }[]>;
1178
+ isBlockedAddress: (id: string) => Promise<{
1179
+ is_blocked: boolean;
1180
+ }>;
1181
+ estimateGasUsd: ({ tx, origin, address, updateNonce, pending_tx_list, }: {
1182
+ tx: Tx;
1183
+ origin: string;
1184
+ address: string;
1185
+ updateNonce: boolean;
1186
+ pending_tx_list: Tx[];
1187
+ }) => Promise<{
1188
+ gas_used?: number;
1189
+ safe_gas_used?: number;
1190
+ }>;
1191
+ getCexSupportList: () => Promise<ProjectItem[]>;
1192
+ }
1193
+ export {};