@rabby-wallet/rabby-api 0.9.15-beta.0 → 0.9.15-beta3

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