@rabby-wallet/rabby-api 0.9.36 → 0.9.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,1276 +1,1283 @@
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, AppChainListResponse, CopyTradeTokenListV2Response, CopyTradeRecentBuyListV2Response, CopyTradeTokenItemV2, CopyTradeSameToken, DefaultRPCRes, TokenDetailWithPriceCurve, GiftEligibilityItem, PerpTopToken } 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
- is_all?: boolean;
878
- }) => Promise<{
879
- history_list: BridgeHistory[];
880
- total_cnt: number;
881
- }>;
882
- buildBridgeTx: (params: {
883
- aggregator_id: string;
884
- bridge_id: string;
885
- user_addr: string;
886
- from_chain_id: string;
887
- from_token_id: string;
888
- from_token_raw_amount: string;
889
- to_chain_id: string;
890
- to_token_id: string;
891
- slippage: string;
892
- quote_key: string;
893
- }) => Promise<Tx>;
894
- postBridgeHistory: (params: {
895
- aggregator_id: string;
896
- bridge_id: string;
897
- from_chain_id: string;
898
- from_token_id: string;
899
- from_token_amount: string | number;
900
- to_chain_id: string;
901
- to_token_id: string;
902
- to_token_amount: string | number;
903
- tx_id: string;
904
- tx: Tx;
905
- rabby_fee: number;
906
- }) => Promise<{
907
- success: boolean;
908
- }>;
909
- /**
910
- * no id just no check address
911
- */
912
- getPerpPermission: (params: {
913
- id?: string;
914
- }) => Promise<{
915
- has_permission: boolean;
916
- }>;
917
- getPerpTopTokenList: () => Promise<PerpTopToken[]>;
918
- getSupportedDEXList: () => Promise<{
919
- dex_list: string[];
920
- }>;
921
- createDbkBridgeHistory: (postData: Pick<DbkBridgeHistoryItem, 'user_addr' | 'from_chain_id' | 'to_chain_id' | 'tx_id' | 'from_token_amount'>) => Promise<{
922
- success: boolean;
923
- }>;
924
- getDbkBridgeHistoryList: (params: {
925
- user_addr: string;
926
- start?: number;
927
- limit?: number;
928
- }) => Promise<{
929
- page: {
930
- total: number;
931
- limit: number;
932
- start: number;
933
- };
934
- data: DbkBridgeHistoryItem[];
935
- }>;
936
- getGasAccountSignText: (account_id: string) => Promise<{
937
- text: string;
938
- }>;
939
- getGasAccountInfo: (params: {
940
- sig: string;
941
- id: string;
942
- }) => Promise<{
943
- account: GasAccountInfo;
944
- }>;
945
- getGasAccountInfoV2: (params: {
946
- id: string;
947
- }) => Promise<{
948
- account: GasAccountInfo;
949
- }>;
950
- createGasAccountPayInfo: (postData: {
951
- id: string;
952
- }) => Promise<{
953
- account: GasAccountInfo;
954
- }>;
955
- checkGasAccountGiftEligibility: (params: {
956
- id: string;
957
- }) => Promise<{
958
- has_eligibility: boolean;
959
- can_claimed_usd_value: number;
960
- }>;
961
- checkGasAccountGiftEligibilityBatch: (params: {
962
- ids: string[];
963
- }) => Promise<GiftEligibilityItem[]>;
964
- confirmIapOrder: (postData: {
965
- transaction_id: string;
966
- device_type: 'android' | 'ios';
967
- product_id: string;
968
- }) => Promise<{
969
- req: TxRequest;
970
- }>;
971
- claimGasAccountGift: (params: {
972
- sig: string;
973
- id: string;
974
- }) => Promise<{
975
- success: boolean;
976
- }>;
977
- loginGasAccount: (params: {
978
- sig: string;
979
- account_id: string;
980
- }) => Promise<{
981
- success: boolean;
982
- }>;
983
- logoutGasAccount: (params: {
984
- sig: string;
985
- account_id: string;
986
- }) => Promise<{
987
- success: boolean;
988
- }>;
989
- getGasAccountTokenList: (id: string) => Promise<TokenItem[]>;
990
- rechargeGasAccount: (p: {
991
- sig: string;
992
- account_id: string;
993
- tx_id: string;
994
- chain_id: string;
995
- amount: number;
996
- user_addr: string;
997
- nonce: number;
998
- }) => Promise<{
999
- success: boolean;
1000
- }>;
1001
- withdrawGasAccount: (p: {
1002
- sig: string;
1003
- amount: number;
1004
- account_id: string;
1005
- user_addr: string;
1006
- chain_id: string;
1007
- fee: number;
1008
- }) => Promise<{
1009
- success: boolean;
1010
- }>;
1011
- getWithdrawList: (p: {
1012
- sig: string;
1013
- id: string;
1014
- }) => Promise<WithdrawListAddressItem[]>;
1015
- getGasAccountHistory: (p: {
1016
- sig: string;
1017
- account_id: string;
1018
- start: number;
1019
- limit: number;
1020
- }) => Promise<{
1021
- recharge_list: {
1022
- amount: number;
1023
- chain_id: string;
1024
- create_at: number;
1025
- gas_account_id: string;
1026
- tx_id: string;
1027
- user_addr: string;
1028
- }[];
1029
- withdraw_list: {
1030
- amount: number;
1031
- chain_id: string;
1032
- create_at: number;
1033
- gas_account_id: string;
1034
- tx_id: string;
1035
- user_addr: string;
1036
- }[];
1037
- history_list: {
1038
- id: string;
1039
- chain_id: string;
1040
- create_at: number;
1041
- gas_cost_usd_value: number;
1042
- gas_account_id: string;
1043
- tx_id: string;
1044
- usd_value: number;
1045
- user_addr: string;
1046
- history_type: 'tx' | 'recharge' | 'withdraw';
1047
- source: string;
1048
- }[];
1049
- pagination: {
1050
- limit: number;
1051
- start: number;
1052
- total: number;
1053
- };
1054
- }>;
1055
- checkGasAccountTxs: (p: {
1056
- sig?: string;
1057
- account_id: string;
1058
- tx_list: Tx[];
1059
- }) => Promise<GasAccountCheckResult>;
1060
- getGasAccountAml: (id: string) => Promise<{
1061
- is_risk: boolean;
1062
- }>;
1063
- parseCommon: (params: {
1064
- typed_data: Record<string, any>;
1065
- origin: string;
1066
- user_addr: string;
1067
- }) => Promise<ParseCommonResponse>;
1068
- getRecommendBridgeToChain: (params: {
1069
- from_chain_id: string;
1070
- }) => Promise<{
1071
- to_chain_id: string;
1072
- }>;
1073
- getRecommendFromToken: (params: {
1074
- user_addr: string;
1075
- from_chain_id: string;
1076
- from_token_id: string;
1077
- from_token_amount: string;
1078
- to_chain_id: string;
1079
- to_token_id: string;
1080
- }) => Promise<{
1081
- token_list: TokenItem[];
1082
- }>;
1083
- getBridgeToTokenList: (params: {
1084
- from_chain_id: string;
1085
- to_chain_id: string;
1086
- from_token_id?: string;
1087
- q?: string;
1088
- user_addr?: string;
1089
- }) => Promise<{
1090
- token_list: (TokenItem & {
1091
- trade_volume_24h: 'low' | 'middle' | 'high';
1092
- })[];
1093
- }>;
1094
- getBridgeQuoteV2: (params: {
1095
- aggregator_id: string;
1096
- user_addr: string;
1097
- from_chain_id: string;
1098
- from_token_id: string;
1099
- from_token_raw_amount: string;
1100
- to_chain_id: string;
1101
- to_token_id: string;
1102
- slippage: string;
1103
- }) => Promise<Omit<BridgeQuote, 'tx'>[]>;
1104
- getBridgeQuoteTxV2: (params: {
1105
- aggregator_id: string;
1106
- bridge_id: string;
1107
- user_addr: string;
1108
- from_chain_id: string;
1109
- from_token_id: string;
1110
- from_token_raw_amount: string;
1111
- to_chain_id: string;
1112
- to_token_id: string;
1113
- slippage: string;
1114
- }) => Promise<BridgeQuote>;
1115
- isSameBridgeToken: (params: {
1116
- from_chain_id: string;
1117
- from_token_id: string;
1118
- to_chain_id: string;
1119
- to_token_id: string;
1120
- }) => Promise<{
1121
- is_same: boolean;
1122
- aggregator_id: string;
1123
- }[]>;
1124
- getBridgeSupportChainV2: () => Promise<string[]>;
1125
- submitFeedback: ({ text, usage, }: {
1126
- text: string;
1127
- /**
1128
- * @description 'usage' is used to submit feedback on rating scene.
1129
- * by default, it means 'uninstall' scene.
1130
- */
1131
- usage?: "rating" | undefined;
1132
- }) => Promise<{
1133
- success: boolean;
1134
- }>;
1135
- uninstalledFeedback: ({ text, }: {
1136
- text: string;
1137
- }) => Promise<{
1138
- success: boolean;
1139
- }>;
1140
- /**
1141
- * @deprecated
1142
- */
1143
- getToken24hPrice: (params: {
1144
- chain_id: string;
1145
- id: string;
1146
- }) => Promise<{
1147
- time_at: number;
1148
- price: number;
1149
- }[]>;
1150
- getTokenPriceCurve: (params: {
1151
- chain_id: string;
1152
- id: string;
1153
- days: number | 1 | 7;
1154
- }) => Promise<{
1155
- time_at: number;
1156
- price: number;
1157
- }[]>;
1158
- getTokenDatePrice: (params: {
1159
- chain_id: string;
1160
- id: string;
1161
- }) => Promise<{
1162
- date_at: string;
1163
- price: number;
1164
- }[]>;
1165
- searchTokens: (params: {
1166
- q: string;
1167
- }) => Promise<TokenItem[]>;
1168
- searchTokensV2: (params: {
1169
- q: string;
1170
- chain_id?: string;
1171
- }) => Promise<TokenItemWithEntity[]>;
1172
- getCopyTradingChainList: () => Promise<string[]>;
1173
- getCopyTradingTokenList: (params: {
1174
- chain_id: string;
1175
- limit: number;
1176
- start_time: number;
1177
- }) => Promise<CopyTradeTokenListResponse>;
1178
- getCopyTradingTokenListV2: (params: {
1179
- chain_id: string;
1180
- limit: number;
1181
- cursor: string;
1182
- order_by: 'price_change' | 'buy_address_count' | 'token_create_at';
1183
- order?: 'asc' | 'desc';
1184
- time_range?: '24h' | '7d' | '30d';
1185
- }) => Promise<CopyTradeTokenListV2Response>;
1186
- getCopyTradingRecentBuyList: (params: {
1187
- chain_id: string;
1188
- token_id: string;
1189
- limit: number;
1190
- }) => Promise<CopyTradeRecentBuyListResponse>;
1191
- getCopyTradingRecentBuyListV2: (params: {
1192
- chain_id: string;
1193
- token_id: string;
1194
- limit: number;
1195
- cursor: string;
1196
- }) => Promise<CopyTradeRecentBuyListV2Response>;
1197
- getCopyTradingDetail: (params: {
1198
- chain_id: string;
1199
- token_id: string;
1200
- }) => Promise<CopyTradeTokenItemV2>;
1201
- getCopyTradingSameName: (params: {
1202
- chain_id: string;
1203
- token_id: string;
1204
- }) => Promise<CopyTradeSameToken[]>;
1205
- getCopyTradingPnlList: (params: {
1206
- user_addr: string;
1207
- }) => Promise<CopyTradePnlListResponse>;
1208
- batchQueryTokens: (uuids: string | string[]) => Promise<TokenItem[]>;
1209
- getBuySupportedCountryList: () => Promise<BuyCountryItem[]>;
1210
- getBuySupportedTokenList: () => Promise<(TokenItem & {
1211
- currency_code: string;
1212
- })[]>;
1213
- getBuyQuote: (params: {
1214
- country_code: string;
1215
- user_addr: string;
1216
- usd_amount: string;
1217
- currency_code: string;
1218
- receive_token_uuid: string;
1219
- }) => Promise<BuyQuoteItem[]>;
1220
- getBuyWidgetUrl: (params: {
1221
- country_code: string;
1222
- user_addr: string;
1223
- usd_amount: string;
1224
- receive_token_uuid: string;
1225
- service_provider: string;
1226
- currency_code: string;
1227
- redirect_url?: string;
1228
- }) => Promise<{
1229
- url: string;
1230
- msg: number;
1231
- }>;
1232
- getBuyHistory: (params: {
1233
- user_addr: string;
1234
- start?: number;
1235
- limit?: number;
1236
- }) => Promise<BuyHistoryList>;
1237
- getBuyPaymentMethods: (params: {
1238
- currency_code: string;
1239
- country_code: string;
1240
- service_provider: string;
1241
- }) => Promise<BuyPaymentMethod[]>;
1242
- getBuyCurrencyList: () => Promise<{
1243
- id: string;
1244
- name: string;
1245
- image_url: string;
1246
- }[]>;
1247
- getOfflineChainList: () => Promise<{
1248
- id: string;
1249
- offline_at: number;
1250
- }[]>;
1251
- isBlockedAddress: (id: string) => Promise<{
1252
- is_blocked: boolean;
1253
- }>;
1254
- estimateGasUsd: ({ tx, origin, address, updateNonce, pending_tx_list, }: {
1255
- tx: Tx;
1256
- origin: string;
1257
- address: string;
1258
- updateNonce: boolean;
1259
- pending_tx_list: Tx[];
1260
- }) => Promise<{
1261
- gas_used?: number;
1262
- safe_gas_used?: number;
1263
- }>;
1264
- getCexSupportList: () => Promise<ProjectItem[]>;
1265
- getAppChainList: (id: string) => Promise<AppChainListResponse>;
1266
- checkCex: (postData: {
1267
- chain_id: string;
1268
- id: string;
1269
- cex_id: string;
1270
- }) => Promise<{
1271
- success: boolean;
1272
- }>;
1273
- getHotTokenList: () => Promise<TokenDetailWithPriceCurve[]>;
1274
- getTokensDetailByUuids: (uuids: string[]) => Promise<TokenDetailWithPriceCurve[]>;
1275
- }
1276
- 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, AppChainListResponse, CopyTradeTokenListV2Response, CopyTradeRecentBuyListV2Response, CopyTradeTokenItemV2, CopyTradeSameToken, DefaultRPCRes, TokenDetailWithPriceCurve, GiftEligibilityItem, UserFeedbackItem, PerpTopToken } 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
+ is_all?: boolean;
878
+ }) => Promise<{
879
+ history_list: BridgeHistory[];
880
+ total_cnt: number;
881
+ }>;
882
+ buildBridgeTx: (params: {
883
+ aggregator_id: string;
884
+ bridge_id: string;
885
+ user_addr: string;
886
+ from_chain_id: string;
887
+ from_token_id: string;
888
+ from_token_raw_amount: string;
889
+ to_chain_id: string;
890
+ to_token_id: string;
891
+ slippage: string;
892
+ quote_key: string;
893
+ }) => Promise<Tx>;
894
+ postBridgeHistory: (params: {
895
+ aggregator_id: string;
896
+ bridge_id: string;
897
+ from_chain_id: string;
898
+ from_token_id: string;
899
+ from_token_amount: string | number;
900
+ to_chain_id: string;
901
+ to_token_id: string;
902
+ to_token_amount: string | number;
903
+ tx_id: string;
904
+ tx: Tx;
905
+ rabby_fee: number;
906
+ }) => Promise<{
907
+ success: boolean;
908
+ }>;
909
+ /**
910
+ * no id just no check address
911
+ */
912
+ getPerpPermission: (params: {
913
+ id?: string;
914
+ }) => Promise<{
915
+ has_permission: boolean;
916
+ }>;
917
+ getPerpTopTokenList: () => Promise<PerpTopToken[]>;
918
+ getSupportedDEXList: () => Promise<{
919
+ dex_list: string[];
920
+ }>;
921
+ createDbkBridgeHistory: (postData: Pick<DbkBridgeHistoryItem, 'user_addr' | 'from_chain_id' | 'to_chain_id' | 'tx_id' | 'from_token_amount'>) => Promise<{
922
+ success: boolean;
923
+ }>;
924
+ getDbkBridgeHistoryList: (params: {
925
+ user_addr: string;
926
+ start?: number;
927
+ limit?: number;
928
+ }) => Promise<{
929
+ page: {
930
+ total: number;
931
+ limit: number;
932
+ start: number;
933
+ };
934
+ data: DbkBridgeHistoryItem[];
935
+ }>;
936
+ getGasAccountSignText: (account_id: string) => Promise<{
937
+ text: string;
938
+ }>;
939
+ getGasAccountInfo: (params: {
940
+ sig: string;
941
+ id: string;
942
+ }) => Promise<{
943
+ account: GasAccountInfo;
944
+ }>;
945
+ getGasAccountInfoV2: (params: {
946
+ id: string;
947
+ }) => Promise<{
948
+ account: GasAccountInfo;
949
+ }>;
950
+ createGasAccountPayInfo: (postData: {
951
+ id: string;
952
+ }) => Promise<{
953
+ account: GasAccountInfo;
954
+ }>;
955
+ checkGasAccountGiftEligibility: (params: {
956
+ id: string;
957
+ }) => Promise<{
958
+ has_eligibility: boolean;
959
+ can_claimed_usd_value: number;
960
+ }>;
961
+ checkGasAccountGiftEligibilityBatch: (params: {
962
+ ids: string[];
963
+ }) => Promise<GiftEligibilityItem[]>;
964
+ confirmIapOrder: (postData: {
965
+ transaction_id: string;
966
+ device_type: 'android' | 'ios';
967
+ product_id: string;
968
+ }) => Promise<{
969
+ req: TxRequest;
970
+ }>;
971
+ claimGasAccountGift: (params: {
972
+ sig: string;
973
+ id: string;
974
+ }) => Promise<{
975
+ success: boolean;
976
+ }>;
977
+ loginGasAccount: (params: {
978
+ sig: string;
979
+ account_id: string;
980
+ }) => Promise<{
981
+ success: boolean;
982
+ }>;
983
+ logoutGasAccount: (params: {
984
+ sig: string;
985
+ account_id: string;
986
+ }) => Promise<{
987
+ success: boolean;
988
+ }>;
989
+ getGasAccountTokenList: (id: string) => Promise<TokenItem[]>;
990
+ rechargeGasAccount: (p: {
991
+ sig: string;
992
+ account_id: string;
993
+ tx_id: string;
994
+ chain_id: string;
995
+ amount: number;
996
+ user_addr: string;
997
+ nonce: number;
998
+ }) => Promise<{
999
+ success: boolean;
1000
+ }>;
1001
+ withdrawGasAccount: (p: {
1002
+ sig: string;
1003
+ amount: number;
1004
+ account_id: string;
1005
+ user_addr: string;
1006
+ chain_id: string;
1007
+ fee: number;
1008
+ }) => Promise<{
1009
+ success: boolean;
1010
+ }>;
1011
+ getWithdrawList: (p: {
1012
+ sig: string;
1013
+ id: string;
1014
+ }) => Promise<WithdrawListAddressItem[]>;
1015
+ getGasAccountHistory: (p: {
1016
+ sig: string;
1017
+ account_id: string;
1018
+ start: number;
1019
+ limit: number;
1020
+ }) => Promise<{
1021
+ recharge_list: {
1022
+ amount: number;
1023
+ chain_id: string;
1024
+ create_at: number;
1025
+ gas_account_id: string;
1026
+ tx_id: string;
1027
+ user_addr: string;
1028
+ }[];
1029
+ withdraw_list: {
1030
+ amount: number;
1031
+ chain_id: string;
1032
+ create_at: number;
1033
+ gas_account_id: string;
1034
+ tx_id: string;
1035
+ user_addr: string;
1036
+ }[];
1037
+ history_list: {
1038
+ id: string;
1039
+ chain_id: string;
1040
+ create_at: number;
1041
+ gas_cost_usd_value: number;
1042
+ gas_account_id: string;
1043
+ tx_id: string;
1044
+ usd_value: number;
1045
+ user_addr: string;
1046
+ history_type: 'tx' | 'recharge' | 'withdraw';
1047
+ source: string;
1048
+ }[];
1049
+ pagination: {
1050
+ limit: number;
1051
+ start: number;
1052
+ total: number;
1053
+ };
1054
+ }>;
1055
+ checkGasAccountTxs: (p: {
1056
+ sig?: string;
1057
+ account_id: string;
1058
+ tx_list: Tx[];
1059
+ }) => Promise<GasAccountCheckResult>;
1060
+ getGasAccountAml: (id: string) => Promise<{
1061
+ is_risk: boolean;
1062
+ }>;
1063
+ parseCommon: (params: {
1064
+ typed_data: Record<string, any>;
1065
+ origin: string;
1066
+ user_addr: string;
1067
+ }) => Promise<ParseCommonResponse>;
1068
+ getRecommendBridgeToChain: (params: {
1069
+ from_chain_id: string;
1070
+ }) => Promise<{
1071
+ to_chain_id: string;
1072
+ }>;
1073
+ getRecommendFromToken: (params: {
1074
+ user_addr: string;
1075
+ from_chain_id: string;
1076
+ from_token_id: string;
1077
+ from_token_amount: string;
1078
+ to_chain_id: string;
1079
+ to_token_id: string;
1080
+ }) => Promise<{
1081
+ token_list: TokenItem[];
1082
+ }>;
1083
+ getBridgeToTokenList: (params: {
1084
+ from_chain_id: string;
1085
+ to_chain_id: string;
1086
+ from_token_id?: string;
1087
+ q?: string;
1088
+ user_addr?: string;
1089
+ }) => Promise<{
1090
+ token_list: (TokenItem & {
1091
+ trade_volume_24h: 'low' | 'middle' | 'high';
1092
+ })[];
1093
+ }>;
1094
+ getBridgeQuoteV2: (params: {
1095
+ aggregator_id: string;
1096
+ user_addr: string;
1097
+ from_chain_id: string;
1098
+ from_token_id: string;
1099
+ from_token_raw_amount: string;
1100
+ to_chain_id: string;
1101
+ to_token_id: string;
1102
+ slippage: string;
1103
+ }) => Promise<Omit<BridgeQuote, 'tx'>[]>;
1104
+ getBridgeQuoteTxV2: (params: {
1105
+ aggregator_id: string;
1106
+ bridge_id: string;
1107
+ user_addr: string;
1108
+ from_chain_id: string;
1109
+ from_token_id: string;
1110
+ from_token_raw_amount: string;
1111
+ to_chain_id: string;
1112
+ to_token_id: string;
1113
+ slippage: string;
1114
+ }) => Promise<BridgeQuote>;
1115
+ isSameBridgeToken: (params: {
1116
+ from_chain_id: string;
1117
+ from_token_id: string;
1118
+ to_chain_id: string;
1119
+ to_token_id: string;
1120
+ }) => Promise<{
1121
+ is_same: boolean;
1122
+ aggregator_id: string;
1123
+ }[]>;
1124
+ getBridgeSupportChainV2: () => Promise<string[]>;
1125
+ submitFeedback: ({ text, usage, }: {
1126
+ text: string;
1127
+ /**
1128
+ * @description 'usage' is used to submit feedback on rating scene.
1129
+ * by default, it means 'uninstall' scene.
1130
+ */
1131
+ usage?: "rating" | undefined;
1132
+ }) => Promise<{
1133
+ success: boolean;
1134
+ }>;
1135
+ uninstalledFeedback: ({ text, }: {
1136
+ text: string;
1137
+ }) => Promise<{
1138
+ success: boolean;
1139
+ }>;
1140
+ /**
1141
+ * @deprecated
1142
+ */
1143
+ getToken24hPrice: (params: {
1144
+ chain_id: string;
1145
+ id: string;
1146
+ }) => Promise<{
1147
+ time_at: number;
1148
+ price: number;
1149
+ }[]>;
1150
+ getTokenPriceCurve: (params: {
1151
+ chain_id: string;
1152
+ id: string;
1153
+ days: number | 1 | 7;
1154
+ }) => Promise<{
1155
+ time_at: number;
1156
+ price: number;
1157
+ }[]>;
1158
+ getTokenDatePrice: (params: {
1159
+ chain_id: string;
1160
+ id: string;
1161
+ }) => Promise<{
1162
+ date_at: string;
1163
+ price: number;
1164
+ }[]>;
1165
+ searchTokens: (params: {
1166
+ q: string;
1167
+ }) => Promise<TokenItem[]>;
1168
+ searchTokensV2: (params: {
1169
+ q: string;
1170
+ chain_id?: string;
1171
+ }) => Promise<TokenItemWithEntity[]>;
1172
+ getCopyTradingChainList: () => Promise<string[]>;
1173
+ getCopyTradingTokenList: (params: {
1174
+ chain_id: string;
1175
+ limit: number;
1176
+ start_time: number;
1177
+ }) => Promise<CopyTradeTokenListResponse>;
1178
+ getCopyTradingTokenListV2: (params: {
1179
+ chain_id: string;
1180
+ limit: number;
1181
+ cursor: string;
1182
+ order_by: 'price_change' | 'buy_address_count' | 'token_create_at';
1183
+ order?: 'asc' | 'desc';
1184
+ time_range?: '24h' | '7d' | '30d';
1185
+ }) => Promise<CopyTradeTokenListV2Response>;
1186
+ getCopyTradingRecentBuyList: (params: {
1187
+ chain_id: string;
1188
+ token_id: string;
1189
+ limit: number;
1190
+ }) => Promise<CopyTradeRecentBuyListResponse>;
1191
+ getCopyTradingRecentBuyListV2: (params: {
1192
+ chain_id: string;
1193
+ token_id: string;
1194
+ limit: number;
1195
+ cursor: string;
1196
+ }) => Promise<CopyTradeRecentBuyListV2Response>;
1197
+ getCopyTradingDetail: (params: {
1198
+ chain_id: string;
1199
+ token_id: string;
1200
+ }) => Promise<CopyTradeTokenItemV2>;
1201
+ getCopyTradingSameName: (params: {
1202
+ chain_id: string;
1203
+ token_id: string;
1204
+ }) => Promise<CopyTradeSameToken[]>;
1205
+ getCopyTradingPnlList: (params: {
1206
+ user_addr: string;
1207
+ }) => Promise<CopyTradePnlListResponse>;
1208
+ batchQueryTokens: (uuids: string | string[]) => Promise<TokenItem[]>;
1209
+ getBuySupportedCountryList: () => Promise<BuyCountryItem[]>;
1210
+ getBuySupportedTokenList: () => Promise<(TokenItem & {
1211
+ currency_code: string;
1212
+ })[]>;
1213
+ getBuyQuote: (params: {
1214
+ country_code: string;
1215
+ user_addr: string;
1216
+ usd_amount: string;
1217
+ currency_code: string;
1218
+ receive_token_uuid: string;
1219
+ }) => Promise<BuyQuoteItem[]>;
1220
+ getBuyWidgetUrl: (params: {
1221
+ country_code: string;
1222
+ user_addr: string;
1223
+ usd_amount: string;
1224
+ receive_token_uuid: string;
1225
+ service_provider: string;
1226
+ currency_code: string;
1227
+ redirect_url?: string;
1228
+ }) => Promise<{
1229
+ url: string;
1230
+ msg: number;
1231
+ }>;
1232
+ getBuyHistory: (params: {
1233
+ user_addr: string;
1234
+ start?: number;
1235
+ limit?: number;
1236
+ }) => Promise<BuyHistoryList>;
1237
+ getBuyPaymentMethods: (params: {
1238
+ currency_code: string;
1239
+ country_code: string;
1240
+ service_provider: string;
1241
+ }) => Promise<BuyPaymentMethod[]>;
1242
+ getBuyCurrencyList: () => Promise<{
1243
+ id: string;
1244
+ name: string;
1245
+ image_url: string;
1246
+ }[]>;
1247
+ getOfflineChainList: () => Promise<{
1248
+ id: string;
1249
+ offline_at: number;
1250
+ }[]>;
1251
+ isBlockedAddress: (id: string) => Promise<{
1252
+ is_blocked: boolean;
1253
+ }>;
1254
+ estimateGasUsd: ({ tx, origin, address, updateNonce, pending_tx_list, }: {
1255
+ tx: Tx;
1256
+ origin: string;
1257
+ address: string;
1258
+ updateNonce: boolean;
1259
+ pending_tx_list: Tx[];
1260
+ }) => Promise<{
1261
+ gas_used?: number;
1262
+ safe_gas_used?: number;
1263
+ }>;
1264
+ getCexSupportList: () => Promise<ProjectItem[]>;
1265
+ getAppChainList: (id: string) => Promise<AppChainListResponse>;
1266
+ checkCex: (postData: {
1267
+ chain_id: string;
1268
+ id: string;
1269
+ cex_id: string;
1270
+ }) => Promise<{
1271
+ success: boolean;
1272
+ }>;
1273
+ getHotTokenList: () => Promise<TokenDetailWithPriceCurve[]>;
1274
+ getTokensDetailByUuids: (uuids: string[]) => Promise<TokenDetailWithPriceCurve[]>;
1275
+ postUserFeedback: (data: {
1276
+ title: string;
1277
+ image_url_list: string[];
1278
+ content: string;
1279
+ }) => Promise<UserFeedbackItem>;
1280
+ getUserFeedback: (id: string) => Promise<UserFeedbackItem>;
1281
+ getUserFeedbackList: (id: string | string[]) => Promise<UserFeedbackItem[]>;
1282
+ }
1283
+ export {};