@rabby-wallet/rabby-api 0.9.14 → 0.9.15-alpha.0

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,1119 +1,1126 @@
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
- isTokenContract: (chainId: string, id: string) => Promise<{
353
- is_token: boolean;
354
- }>;
355
- addrUsedChainList: (id: string) => Promise<UsedChain[]>;
356
- /**
357
- * @deprecated
358
- */
359
- getTokenNFTExposure: (chainId: string, id: string) => Promise<{
360
- usd_value: number;
361
- }>;
362
- getTokenNFTTrustValue: (chainId: string, id: string) => Promise<{
363
- usd_value: number;
364
- }>;
365
- getCollection: (chainId: string, id: string) => Promise<{
366
- collection: CollectionWithFloorPrice;
367
- }>;
368
- isSuspiciousCollection: (chainId: string, id: string) => Promise<{
369
- is_suspicious: boolean;
370
- }>;
371
- isOriginVerified: (origin: string) => Promise<{
372
- is_verified: boolean | null;
373
- }>;
374
- parseTypedData: ({ typedData, origin, address, }: {
375
- typedData: Record<string, any>;
376
- origin: string;
377
- address: string;
378
- }) => Promise<ParseTypedDataResponse>;
379
- parseText: ({ text, origin, address, }: {
380
- text: string;
381
- origin: string;
382
- address: string;
383
- }) => Promise<ParseTextResponse>;
384
- collectionList: ({ id, chainId, isAll, }: {
385
- id: string;
386
- chainId?: string | undefined;
387
- isAll: boolean;
388
- }) => Promise<CollectionList[]>;
389
- gasPriceStats: (chainId: string) => Promise<{
390
- median: number;
391
- }>;
392
- badgeHasClaimed: (id: string) => Promise<{
393
- id: string;
394
- badge_id: number;
395
- user_id: string;
396
- inner_id: number;
397
- create_at: number;
398
- update_at: number;
399
- has_claimed: true;
400
- } | {
401
- has_claimed: false;
402
- }>;
403
- badgeHasMinted: (id: string) => Promise<{
404
- id: string;
405
- badge_id: number;
406
- user_id: string;
407
- inner_id: number;
408
- usd_value: number;
409
- tvf: number;
410
- mint_at: number;
411
- has_minted: true;
412
- } | {
413
- has_minted: false;
414
- }>;
415
- mintBadge: (params: {
416
- code: string;
417
- userAddr: string;
418
- }) => Promise<{
419
- is_success: boolean;
420
- inner_id: number;
421
- }>;
422
- badgeHasClaimedByName: ({ id, name, }: {
423
- id: string;
424
- name: string;
425
- }) => Promise<{
426
- id: string;
427
- badge_id: number;
428
- user_id: string;
429
- inner_id: number;
430
- create_at: number;
431
- update_at: number;
432
- has_claimed: true;
433
- } | {
434
- has_claimed: false;
435
- }>;
436
- badgeHasMintedByName: ({ 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
- usd_value: number;
445
- tvf: number;
446
- mint_at: number;
447
- has_minted: true;
448
- } | {
449
- has_minted: false;
450
- }>;
451
- mintBadgeByName: (params: {
452
- name: string;
453
- code: string;
454
- userAddr: string;
455
- }) => Promise<{
456
- is_success: boolean;
457
- inner_id: number;
458
- }>;
459
- userHasRequestedFaucet: (params: {
460
- chain_id: string;
461
- user_addr: string;
462
- }) => Promise<{
463
- has_requested: boolean;
464
- }>;
465
- requestFaucet: (params: {
466
- chain_id: string;
467
- user_addr: string;
468
- }) => Promise<{
469
- is_success: boolean;
470
- }>;
471
- gasSupportedPushType: (chainId: string) => Promise<{
472
- low_gas: boolean;
473
- mev: boolean;
474
- }>;
475
- submitTx: (postData: {
476
- req_id?: string;
477
- tx: Tx;
478
- push_type: TxPushType;
479
- is_gasless?: boolean;
480
- is_gas_account?: boolean;
481
- log_id: string;
482
- low_gas_deadline?: number;
483
- origin?: string;
484
- sig?: string;
485
- }) => Promise<{
486
- req: TxRequest;
487
- access_token?: string;
488
- }>;
489
- getTxRequests: (ids: string | string[]) => Promise<TxRequest[]>;
490
- getTxRequest: (id: string) => Promise<TxRequest>;
491
- withdrawTx: (reqId: string) => Promise<{
492
- req: TxRequest;
493
- }>;
494
- retryPushTx: (reqId: string) => Promise<{
495
- req: TxRequest;
496
- }>;
497
- mempoolChecks: (txId: string, chainId: string, node_info?: boolean) => Promise<MempoolCheckDetail[]>;
498
- getPendingTxList: (params: {
499
- chain_id: string;
500
- }, options?: Parameters<typeof this.asyncJob>[1]) => Promise<{
501
- pending_tx_list: PendingTxItem[];
502
- token_dict: Record<string, TokenItem | NFTItem>;
503
- }>;
504
- getLatestPreExec: (params: {
505
- id: string;
506
- }) => Promise<LatestExplainTxResponse>;
507
- walletSupportChain: (params: {
508
- chain_id: string;
509
- user_addr: string;
510
- }) => Promise<{
511
- is_success: boolean;
512
- count: number;
513
- }>;
514
- walletSupportOrigin: (params: {
515
- origin: string;
516
- user_addr: string;
517
- text: string;
518
- }) => Promise<{
519
- is_success: boolean;
520
- count: number;
521
- }>;
522
- walletSupportSelector: (params: {
523
- selector: string;
524
- user_addr: string;
525
- chain_id: string;
526
- contract_id: string;
527
- }) => Promise<{
528
- is_success: boolean;
529
- count: number;
530
- }>;
531
- searchDapp: (params?: {
532
- q?: string;
533
- chain_id?: string;
534
- start?: number;
535
- limit?: number;
536
- }) => Promise<{
537
- page: {
538
- limit: number;
539
- start: number;
540
- total: number;
541
- };
542
- dapps: BasicDappInfo[];
543
- }>;
544
- getDappsInfo: (params: {
545
- ids: string[];
546
- }) => Promise<BasicDappInfo[]>;
547
- getDappHotTags: (params?: {
548
- limit: number;
549
- }) => Promise<string[]>;
550
- getHotDapps: (params?: {
551
- limit: number;
552
- }) => Promise<BasicDappInfo[]>;
553
- getRabbyClaimText: (params: {
554
- id: string;
555
- invite_code?: string;
556
- }) => Promise<{
557
- id: string;
558
- text: string;
559
- }>;
560
- getRabbySignatureText: (params: {
561
- id: string;
562
- }) => Promise<{
563
- id: string;
564
- text: string;
565
- }>;
566
- getRabbyPoints: (params: {
567
- id: string;
568
- }) => Promise<{
569
- id: string;
570
- invite_code?: string;
571
- logo_url: string;
572
- logo_thumbnail_url: string;
573
- web3_id: string;
574
- claimed_points: number;
575
- total_claimed_points: number;
576
- }>;
577
- checkRabbyPointsInviteCode: (params: {
578
- code: string;
579
- }) => Promise<{
580
- invite_code_exist: boolean;
581
- }>;
582
- setRabbyPointsInviteCode: (params: {
583
- id: string;
584
- signature: string;
585
- invite_code: string;
586
- }) => Promise<{
587
- code: number;
588
- }>;
589
- checkRabbyPointClaimable: (params: {
590
- id: string;
591
- }) => Promise<{
592
- claimable: boolean;
593
- }>;
594
- getRabbyPointsSnapshot: (params: {
595
- id: string;
596
- }) => Promise<{
597
- id: string;
598
- address_balance: number;
599
- metamask_swap: number;
600
- rabby_old_user: number;
601
- rabby_nadge: number;
602
- rabby_nft: number;
603
- extra_bouns: number;
604
- claimed: boolean;
605
- snapshot_at: number;
606
- }>;
607
- claimRabbyPointsSnapshot: (params: {
608
- id: string;
609
- signature: string;
610
- invite_code?: string;
611
- }) => Promise<{
612
- error_code: number;
613
- error_msg?: string;
614
- }>;
615
- getRabbyPointsTopUsers: (params: {
616
- id: string;
617
- }) => Promise<{
618
- id: string;
619
- logo_url: string;
620
- logo_thumbnail_url: string;
621
- web3_id: string;
622
- claimed_points: number;
623
- }[]>;
624
- getRabbyPointsList: (params: {
625
- id: string;
626
- }) => Promise<{
627
- id: number;
628
- title: string;
629
- description: string;
630
- start_at: number;
631
- end_at: number;
632
- claimable_points: number;
633
- }[]>;
634
- getRabbyPointsCampaignIsEnded: () => Promise<{
635
- campaign_is_ended: boolean;
636
- }>;
637
- claimRabbyPointsById: (params: {
638
- campaign_id: number;
639
- user_id: string;
640
- signature: string;
641
- }) => Promise<{
642
- error_code: number;
643
- }>;
644
- getRabbyPointsV2: (params: {
645
- id: string;
646
- }) => Promise<{
647
- id: string;
648
- invite_code?: string;
649
- logo_url: string;
650
- logo_thumbnail_url: string;
651
- web3_id: string;
652
- claimed_points: number;
653
- total_claimed_points: number;
654
- }>;
655
- getRabbySignatureTextV2: (params: {
656
- id: string;
657
- }) => Promise<{
658
- id: string;
659
- text: string;
660
- }>;
661
- getRabbyClaimTextV2: (params: {
662
- id: string;
663
- invite_code?: string;
664
- }) => Promise<{
665
- id: string;
666
- text: string;
667
- }>;
668
- setRabbyPointsInviteCodeV2: (params: {
669
- id: string;
670
- signature: string;
671
- invite_code: string;
672
- }) => Promise<{
673
- code: number;
674
- }>;
675
- checkRabbyPointsInviteCodeV2: (params: {
676
- code: string;
677
- }) => Promise<{
678
- invite_code_exist: boolean;
679
- }>;
680
- claimRabbyPointsSnapshotV2: (params: {
681
- id: string;
682
- signature: string;
683
- invite_code?: string;
684
- }) => Promise<{
685
- error_code: number;
686
- error_msg?: string;
687
- }>;
688
- getRabbyPointsTopUsersV2: (params: {
689
- id: string;
690
- }) => Promise<{
691
- id: string;
692
- logo_url: string;
693
- logo_thumbnail_url: string;
694
- web3_id: string;
695
- claimed_points: number;
696
- }[]>;
697
- getRabbyPointsListV2: (params: {
698
- id: string;
699
- }) => Promise<{
700
- id: number;
701
- title: string;
702
- description: string;
703
- start_at: number;
704
- end_at: number;
705
- claimable_points: number;
706
- }[]>;
707
- claimRabbyPointsByIdV2: (params: {
708
- campaign_id: number;
709
- user_id: string;
710
- signature: string;
711
- }) => Promise<{
712
- error_code: number;
713
- }>;
714
- getRabbyPointsSnapshotV2: (params: {
715
- id: string;
716
- }) => Promise<{
717
- id: string;
718
- wallet_balance_reward: number;
719
- active_stats_reward: number;
720
- extra_bouns: number;
721
- claimed: boolean;
722
- snapshot_at: number;
723
- claimed_points: number;
724
- }>;
725
- checkRabbyPointClaimableV2: (params: {
726
- id: string;
727
- }) => Promise<{
728
- claimable: boolean;
729
- }>;
730
- checkClaimInfoV2: (params: {
731
- id: string;
732
- }) => Promise<{
733
- claimable_points: number;
734
- claimed_points: number;
735
- }>;
736
- getRabbyPointsCampaignIsEndedV2: () => Promise<{
737
- campaign_is_ended: boolean;
738
- }>;
739
- getSupportedChains: () => Promise<SupportedChain[]>;
740
- searchChainList: (params?: {
741
- limit?: number;
742
- start?: number;
743
- q?: string;
744
- }) => Promise<{
745
- page: {
746
- start: number;
747
- limit: number;
748
- total: number;
749
- };
750
- chain_list: ChainListItem[];
751
- }>;
752
- getChainListByIds: (params: {
753
- ids: string;
754
- }) => Promise<ChainListItem[]>;
755
- getHistoryCurve: (addr: string) => Promise<HistoryCurve>;
756
- getHistoryCurveSupportedList: () => Promise<{
757
- supported_chains: string[];
758
- }>;
759
- getHistoryCurveStatus: (params: {
760
- id: string;
761
- }) => Promise<{
762
- failed_msg: Record<string, string>;
763
- id: string;
764
- status: 'pending' | 'running' | 'finished' | 'failed';
765
- update_at: number;
766
- }>;
767
- initHistoryCurve: (params: {
768
- id: string;
769
- }) => Promise<{
770
- success: boolean;
771
- }>;
772
- getNodeStatusList: () => Promise<NodeStatus[]>;
773
- getNodeStatusDetail: (params: {
774
- chain_id: string;
775
- }) => Promise<NodeStatusDetail>;
776
- postActionLog: (body: {
777
- id: string;
778
- type: 'tx' | 'typed_data' | 'text';
779
- rules: {
780
- id: string;
781
- level: string | null;
782
- }[];
783
- }) => Promise<any>;
784
- checkSpoofing: ({ from, to, }: {
785
- from: string;
786
- to: string;
787
- }) => Promise<{
788
- is_spoofing: boolean;
789
- }>;
790
- getAddressByDeBankId: (name: string) => Promise<{
791
- addr: string;
792
- web3_id: string;
793
- }>;
794
- getBridgeSupportChain: () => Promise<string[]>;
795
- getBridgeAggregatorList: () => Promise<BridgeAggregator[]>;
796
- getBridgePairList: (params: {
797
- aggregator_ids: string[];
798
- to_chain_id: string;
799
- user_addr: string;
800
- }) => Promise<BridgeTokenPair[]>;
801
- getBridgeQuoteList: (params: {
802
- aggregator_ids: string;
803
- user_addr: string;
804
- from_chain_id: string;
805
- from_token_id: string;
806
- from_token_raw_amount: string;
807
- to_chain_id: string;
808
- to_token_id: string;
809
- }) => Promise<Omit<BridgeQuote, 'tx'>[]>;
810
- getBridgeQuoteListV2: (params: {
811
- aggregator_id: string;
812
- user_addr: string;
813
- from_chain_id: string;
814
- from_token_id: string;
815
- from_token_raw_amount: string;
816
- to_chain_id: string;
817
- to_token_id: string;
818
- }) => Promise<Omit<BridgeQuote, 'tx'>[]>;
819
- getBridgeQuote: (params: {
820
- aggregator_id: string;
821
- bridge_id: string;
822
- user_addr: string;
823
- from_chain_id: string;
824
- from_token_id: string;
825
- from_token_raw_amount: string;
826
- to_chain_id: string;
827
- to_token_id: string;
828
- }) => Promise<BridgeQuote>;
829
- getBridgeHistoryList: (params: {
830
- user_addr: string;
831
- start: number;
832
- limit: number;
833
- }) => Promise<{
834
- history_list: BridgeHistory[];
835
- total_cnt: number;
836
- }>;
837
- postBridgeHistory: (params: {
838
- aggregator_id: string;
839
- bridge_id: string;
840
- from_chain_id: string;
841
- from_token_id: string;
842
- from_token_amount: string | number;
843
- to_chain_id: string;
844
- to_token_id: string;
845
- to_token_amount: string | number;
846
- tx_id: string;
847
- tx: Tx;
848
- rabby_fee: number;
849
- }) => Promise<{
850
- success: boolean;
851
- }>;
852
- getSupportedDEXList: () => Promise<{
853
- dex_list: string[];
854
- }>;
855
- createDbkBridgeHistory: (postData: Pick<DbkBridgeHistoryItem, 'user_addr' | 'from_chain_id' | 'to_chain_id' | 'tx_id' | 'from_token_amount'>) => Promise<{
856
- success: boolean;
857
- }>;
858
- getDbkBridgeHistoryList: (params: {
859
- user_addr: string;
860
- start?: number;
861
- limit?: number;
862
- }) => Promise<{
863
- page: {
864
- total: number;
865
- limit: number;
866
- start: number;
867
- };
868
- data: DbkBridgeHistoryItem[];
869
- }>;
870
- getGasAccountSignText: (account_id: string) => Promise<{
871
- text: string;
872
- }>;
873
- getGasAccountInfo: (params: {
874
- sig: string;
875
- id: string;
876
- }) => Promise<{
877
- account: GasAccountInfo;
878
- }>;
879
- getGasAccountInfoV2: (params: {
880
- id: string;
881
- }) => Promise<{
882
- account: GasAccountInfo;
883
- }>;
884
- createGasAccountPayInfo: (postData: {
885
- id: string;
886
- }) => Promise<{
887
- account: GasAccountInfo;
888
- }>;
889
- confirmIapOrder: (postData: {
890
- transaction_id: string;
891
- device_type: 'android' | 'ios';
892
- product_id: string;
893
- }) => Promise<{
894
- req: TxRequest;
895
- }>;
896
- loginGasAccount: (params: {
897
- sig: string;
898
- account_id: string;
899
- }) => Promise<{
900
- success: boolean;
901
- }>;
902
- logoutGasAccount: (params: {
903
- sig: string;
904
- account_id: string;
905
- }) => Promise<{
906
- success: boolean;
907
- }>;
908
- getGasAccountTokenList: (id: string) => Promise<TokenItem[]>;
909
- rechargeGasAccount: (p: {
910
- sig: string;
911
- account_id: string;
912
- tx_id: string;
913
- chain_id: string;
914
- amount: number;
915
- user_addr: string;
916
- nonce: number;
917
- }) => Promise<{
918
- success: boolean;
919
- }>;
920
- withdrawGasAccount: (p: {
921
- sig: string;
922
- amount: number;
923
- account_id: string;
924
- user_addr: string;
925
- chain_id: string;
926
- fee: number;
927
- }) => Promise<{
928
- success: boolean;
929
- }>;
930
- getWithdrawList: (p: {
931
- sig: string;
932
- id: string;
933
- }) => Promise<WithdrawListAddressItem[]>;
934
- getGasAccountHistory: (p: {
935
- sig: string;
936
- account_id: string;
937
- start: number;
938
- limit: number;
939
- }) => Promise<{
940
- recharge_list: {
941
- amount: number;
942
- chain_id: string;
943
- create_at: number;
944
- gas_account_id: string;
945
- tx_id: string;
946
- user_addr: string;
947
- }[];
948
- withdraw_list: {
949
- amount: number;
950
- chain_id: string;
951
- create_at: number;
952
- gas_account_id: string;
953
- tx_id: string;
954
- user_addr: string;
955
- }[];
956
- history_list: {
957
- id: string;
958
- chain_id: string;
959
- create_at: number;
960
- gas_cost_usd_value: number;
961
- gas_account_id: string;
962
- tx_id: string;
963
- usd_value: number;
964
- user_addr: string;
965
- history_type: 'tx' | 'recharge' | 'withdraw';
966
- }[];
967
- pagination: {
968
- limit: number;
969
- start: number;
970
- total: number;
971
- };
972
- }>;
973
- checkGasAccountTxs: (p: {
974
- sig?: string;
975
- account_id: string;
976
- tx_list: Tx[];
977
- }) => Promise<GasAccountCheckResult>;
978
- getGasAccountAml: (id: string) => Promise<{
979
- is_risk: boolean;
980
- }>;
981
- parseCommon: (params: {
982
- typed_data: Record<string, any>;
983
- origin: string;
984
- user_addr: string;
985
- }) => Promise<ParseCommonResponse>;
986
- getRecommendBridgeToChain: (params: {
987
- from_chain_id: string;
988
- }) => Promise<{
989
- to_chain_id: string;
990
- }>;
991
- getRecommendFromToken: (params: {
992
- user_addr: string;
993
- from_chain_id: string;
994
- from_token_id: string;
995
- from_token_amount: string;
996
- to_chain_id: string;
997
- to_token_id: string;
998
- }) => Promise<{
999
- token_list: TokenItem[];
1000
- }>;
1001
- getBridgeToTokenList: (params: {
1002
- from_chain_id: string;
1003
- to_chain_id: string;
1004
- from_token_id?: string;
1005
- q?: string;
1006
- }) => Promise<{
1007
- token_list: (TokenItem & {
1008
- trade_volume_24h: 'low' | 'middle' | 'high';
1009
- })[];
1010
- }>;
1011
- getBridgeQuoteV2: (params: {
1012
- aggregator_id: string;
1013
- user_addr: string;
1014
- from_chain_id: string;
1015
- from_token_id: string;
1016
- from_token_raw_amount: string;
1017
- to_chain_id: string;
1018
- to_token_id: string;
1019
- slippage: string;
1020
- }) => Promise<Omit<BridgeQuote, 'tx'>[]>;
1021
- getBridgeQuoteTxV2: (params: {
1022
- aggregator_id: string;
1023
- bridge_id: string;
1024
- user_addr: string;
1025
- from_chain_id: string;
1026
- from_token_id: string;
1027
- from_token_raw_amount: string;
1028
- to_chain_id: string;
1029
- to_token_id: string;
1030
- slippage: string;
1031
- }) => Promise<BridgeQuote>;
1032
- isSameBridgeToken: (params: {
1033
- from_chain_id: string;
1034
- from_token_id: string;
1035
- to_chain_id: string;
1036
- to_token_id: string;
1037
- }) => Promise<{
1038
- is_same: boolean;
1039
- aggregator_id: string;
1040
- }[]>;
1041
- getBridgeSupportChainV2: () => Promise<string[]>;
1042
- uninstalledFeedback: ({ text, }: {
1043
- text: string;
1044
- }) => Promise<{
1045
- success: boolean;
1046
- }>;
1047
- /**
1048
- * @deprecated
1049
- */
1050
- getToken24hPrice: (params: {
1051
- chain_id: string;
1052
- id: string;
1053
- }) => Promise<{
1054
- time_at: number;
1055
- price: number;
1056
- }[]>;
1057
- getTokenPriceCurve: (params: {
1058
- chain_id: string;
1059
- id: string;
1060
- days: number | 1 | 7;
1061
- }) => Promise<{
1062
- time_at: number;
1063
- price: number;
1064
- }[]>;
1065
- getTokenDatePrice: (params: {
1066
- chain_id: string;
1067
- id: string;
1068
- }) => Promise<{
1069
- date_at: string;
1070
- price: number;
1071
- }[]>;
1072
- searchTokens: (params: {
1073
- q: string;
1074
- }) => Promise<TokenItem[]>;
1075
- batchQueryTokens: (uuids: string | string[]) => Promise<TokenItem[]>;
1076
- getBuySupportedCountryList: () => Promise<BuyCountryItem[]>;
1077
- getBuySupportedTokenList: () => Promise<(TokenItem & {
1078
- currency_code: string;
1079
- })[]>;
1080
- getBuyQuote: (params: {
1081
- country_code: string;
1082
- user_addr: string;
1083
- usd_amount: string;
1084
- currency_code: string;
1085
- receive_token_uuid: string;
1086
- }) => Promise<BuyQuoteItem[]>;
1087
- getBuyWidgetUrl: (params: {
1088
- country_code: string;
1089
- user_addr: string;
1090
- usd_amount: string;
1091
- receive_token_uuid: string;
1092
- service_provider: string;
1093
- currency_code: string;
1094
- redirect_url?: string;
1095
- }) => Promise<{
1096
- url: string;
1097
- msg: number;
1098
- }>;
1099
- getBuyHistory: (params: {
1100
- user_addr: string;
1101
- start?: number;
1102
- limit?: number;
1103
- }) => Promise<BuyHistoryList>;
1104
- getBuyPaymentMethods: (params: {
1105
- currency_code: string;
1106
- country_code: string;
1107
- service_provider: string;
1108
- }) => Promise<BuyPaymentMethod[]>;
1109
- getBuyCurrencyList: () => Promise<{
1110
- id: string;
1111
- name: string;
1112
- image_url: string;
1113
- }[]>;
1114
- getOfflineChainList: () => Promise<{
1115
- id: string;
1116
- offline_at: number;
1117
- }[]>;
1118
- }
1119
- 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
+ getTokenEntity: (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
+ hasTransferAllChain: (from: string, to: string) => Promise<{
354
+ has_transfer: boolean;
355
+ }>;
356
+ isTokenContract: (chainId: string, id: string) => Promise<{
357
+ is_token: boolean;
358
+ }>;
359
+ addrUsedChainList: (id: string) => Promise<UsedChain[]>;
360
+ /**
361
+ * @deprecated
362
+ */
363
+ getTokenNFTExposure: (chainId: string, id: string) => Promise<{
364
+ usd_value: number;
365
+ }>;
366
+ getTokenNFTTrustValue: (chainId: string, id: string) => Promise<{
367
+ usd_value: number;
368
+ }>;
369
+ getCollection: (chainId: string, id: string) => Promise<{
370
+ collection: CollectionWithFloorPrice;
371
+ }>;
372
+ isSuspiciousCollection: (chainId: string, id: string) => Promise<{
373
+ is_suspicious: boolean;
374
+ }>;
375
+ isOriginVerified: (origin: string) => Promise<{
376
+ is_verified: boolean | null;
377
+ }>;
378
+ parseTypedData: ({ typedData, origin, address, }: {
379
+ typedData: Record<string, any>;
380
+ origin: string;
381
+ address: string;
382
+ }) => Promise<ParseTypedDataResponse>;
383
+ parseText: ({ text, origin, address, }: {
384
+ text: string;
385
+ origin: string;
386
+ address: string;
387
+ }) => Promise<ParseTextResponse>;
388
+ collectionList: ({ id, chainId, isAll, }: {
389
+ id: string;
390
+ chainId?: string | undefined;
391
+ isAll: boolean;
392
+ }) => Promise<CollectionList[]>;
393
+ gasPriceStats: (chainId: string) => Promise<{
394
+ median: number;
395
+ }>;
396
+ badgeHasClaimed: (id: string) => Promise<{
397
+ id: string;
398
+ badge_id: number;
399
+ user_id: string;
400
+ inner_id: number;
401
+ create_at: number;
402
+ update_at: number;
403
+ has_claimed: true;
404
+ } | {
405
+ has_claimed: false;
406
+ }>;
407
+ badgeHasMinted: (id: string) => Promise<{
408
+ id: string;
409
+ badge_id: number;
410
+ user_id: string;
411
+ inner_id: number;
412
+ usd_value: number;
413
+ tvf: number;
414
+ mint_at: number;
415
+ has_minted: true;
416
+ } | {
417
+ has_minted: false;
418
+ }>;
419
+ mintBadge: (params: {
420
+ code: string;
421
+ userAddr: string;
422
+ }) => Promise<{
423
+ is_success: boolean;
424
+ inner_id: number;
425
+ }>;
426
+ badgeHasClaimedByName: ({ id, name, }: {
427
+ id: string;
428
+ name: string;
429
+ }) => Promise<{
430
+ id: string;
431
+ badge_id: number;
432
+ user_id: string;
433
+ inner_id: number;
434
+ create_at: number;
435
+ update_at: number;
436
+ has_claimed: true;
437
+ } | {
438
+ has_claimed: false;
439
+ }>;
440
+ badgeHasMintedByName: ({ id, name, }: {
441
+ id: string;
442
+ name: string;
443
+ }) => Promise<{
444
+ id: string;
445
+ badge_id: number;
446
+ user_id: string;
447
+ inner_id: number;
448
+ usd_value: number;
449
+ tvf: number;
450
+ mint_at: number;
451
+ has_minted: true;
452
+ } | {
453
+ has_minted: false;
454
+ }>;
455
+ mintBadgeByName: (params: {
456
+ name: string;
457
+ code: string;
458
+ userAddr: string;
459
+ }) => Promise<{
460
+ is_success: boolean;
461
+ inner_id: number;
462
+ }>;
463
+ userHasRequestedFaucet: (params: {
464
+ chain_id: string;
465
+ user_addr: string;
466
+ }) => Promise<{
467
+ has_requested: boolean;
468
+ }>;
469
+ requestFaucet: (params: {
470
+ chain_id: string;
471
+ user_addr: string;
472
+ }) => Promise<{
473
+ is_success: boolean;
474
+ }>;
475
+ gasSupportedPushType: (chainId: string) => Promise<{
476
+ low_gas: boolean;
477
+ mev: boolean;
478
+ }>;
479
+ submitTx: (postData: {
480
+ req_id?: string;
481
+ tx: Tx;
482
+ push_type: TxPushType;
483
+ is_gasless?: boolean;
484
+ is_gas_account?: boolean;
485
+ log_id: string;
486
+ low_gas_deadline?: number;
487
+ origin?: string;
488
+ sig?: string;
489
+ }) => Promise<{
490
+ req: TxRequest;
491
+ access_token?: string;
492
+ }>;
493
+ getTxRequests: (ids: string | string[]) => Promise<TxRequest[]>;
494
+ getTxRequest: (id: string) => Promise<TxRequest>;
495
+ withdrawTx: (reqId: string) => Promise<{
496
+ req: TxRequest;
497
+ }>;
498
+ retryPushTx: (reqId: string) => Promise<{
499
+ req: TxRequest;
500
+ }>;
501
+ mempoolChecks: (txId: string, chainId: string, node_info?: boolean) => Promise<MempoolCheckDetail[]>;
502
+ getPendingTxList: (params: {
503
+ chain_id: string;
504
+ }, options?: Parameters<typeof this.asyncJob>[1]) => Promise<{
505
+ pending_tx_list: PendingTxItem[];
506
+ token_dict: Record<string, TokenItem | NFTItem>;
507
+ }>;
508
+ getLatestPreExec: (params: {
509
+ id: string;
510
+ }) => Promise<LatestExplainTxResponse>;
511
+ walletSupportChain: (params: {
512
+ chain_id: string;
513
+ user_addr: string;
514
+ }) => Promise<{
515
+ is_success: boolean;
516
+ count: number;
517
+ }>;
518
+ walletSupportOrigin: (params: {
519
+ origin: string;
520
+ user_addr: string;
521
+ text: string;
522
+ }) => Promise<{
523
+ is_success: boolean;
524
+ count: number;
525
+ }>;
526
+ walletSupportSelector: (params: {
527
+ selector: string;
528
+ user_addr: string;
529
+ chain_id: string;
530
+ contract_id: string;
531
+ }) => Promise<{
532
+ is_success: boolean;
533
+ count: number;
534
+ }>;
535
+ searchDapp: (params?: {
536
+ q?: string;
537
+ chain_id?: string;
538
+ start?: number;
539
+ limit?: number;
540
+ }) => Promise<{
541
+ page: {
542
+ limit: number;
543
+ start: number;
544
+ total: number;
545
+ };
546
+ dapps: BasicDappInfo[];
547
+ }>;
548
+ getDappsInfo: (params: {
549
+ ids: string[];
550
+ }) => Promise<BasicDappInfo[]>;
551
+ getDappHotTags: (params?: {
552
+ limit: number;
553
+ }) => Promise<string[]>;
554
+ getHotDapps: (params?: {
555
+ limit: number;
556
+ }) => Promise<BasicDappInfo[]>;
557
+ getRabbyClaimText: (params: {
558
+ id: string;
559
+ invite_code?: string;
560
+ }) => Promise<{
561
+ id: string;
562
+ text: string;
563
+ }>;
564
+ getRabbySignatureText: (params: {
565
+ id: string;
566
+ }) => Promise<{
567
+ id: string;
568
+ text: string;
569
+ }>;
570
+ getRabbyPoints: (params: {
571
+ id: string;
572
+ }) => Promise<{
573
+ id: string;
574
+ invite_code?: string;
575
+ logo_url: string;
576
+ logo_thumbnail_url: string;
577
+ web3_id: string;
578
+ claimed_points: number;
579
+ total_claimed_points: number;
580
+ }>;
581
+ checkRabbyPointsInviteCode: (params: {
582
+ code: string;
583
+ }) => Promise<{
584
+ invite_code_exist: boolean;
585
+ }>;
586
+ setRabbyPointsInviteCode: (params: {
587
+ id: string;
588
+ signature: string;
589
+ invite_code: string;
590
+ }) => Promise<{
591
+ code: number;
592
+ }>;
593
+ checkRabbyPointClaimable: (params: {
594
+ id: string;
595
+ }) => Promise<{
596
+ claimable: boolean;
597
+ }>;
598
+ getRabbyPointsSnapshot: (params: {
599
+ id: string;
600
+ }) => Promise<{
601
+ id: string;
602
+ address_balance: number;
603
+ metamask_swap: number;
604
+ rabby_old_user: number;
605
+ rabby_nadge: number;
606
+ rabby_nft: number;
607
+ extra_bouns: number;
608
+ claimed: boolean;
609
+ snapshot_at: number;
610
+ }>;
611
+ claimRabbyPointsSnapshot: (params: {
612
+ id: string;
613
+ signature: string;
614
+ invite_code?: string;
615
+ }) => Promise<{
616
+ error_code: number;
617
+ error_msg?: string;
618
+ }>;
619
+ getRabbyPointsTopUsers: (params: {
620
+ id: string;
621
+ }) => Promise<{
622
+ id: string;
623
+ logo_url: string;
624
+ logo_thumbnail_url: string;
625
+ web3_id: string;
626
+ claimed_points: number;
627
+ }[]>;
628
+ getRabbyPointsList: (params: {
629
+ id: string;
630
+ }) => Promise<{
631
+ id: number;
632
+ title: string;
633
+ description: string;
634
+ start_at: number;
635
+ end_at: number;
636
+ claimable_points: number;
637
+ }[]>;
638
+ getRabbyPointsCampaignIsEnded: () => Promise<{
639
+ campaign_is_ended: boolean;
640
+ }>;
641
+ claimRabbyPointsById: (params: {
642
+ campaign_id: number;
643
+ user_id: string;
644
+ signature: string;
645
+ }) => Promise<{
646
+ error_code: number;
647
+ }>;
648
+ getRabbyPointsV2: (params: {
649
+ id: string;
650
+ }) => Promise<{
651
+ id: string;
652
+ invite_code?: string;
653
+ logo_url: string;
654
+ logo_thumbnail_url: string;
655
+ web3_id: string;
656
+ claimed_points: number;
657
+ total_claimed_points: number;
658
+ }>;
659
+ getRabbySignatureTextV2: (params: {
660
+ id: string;
661
+ }) => Promise<{
662
+ id: string;
663
+ text: string;
664
+ }>;
665
+ getRabbyClaimTextV2: (params: {
666
+ id: string;
667
+ invite_code?: string;
668
+ }) => Promise<{
669
+ id: string;
670
+ text: string;
671
+ }>;
672
+ setRabbyPointsInviteCodeV2: (params: {
673
+ id: string;
674
+ signature: string;
675
+ invite_code: string;
676
+ }) => Promise<{
677
+ code: number;
678
+ }>;
679
+ checkRabbyPointsInviteCodeV2: (params: {
680
+ code: string;
681
+ }) => Promise<{
682
+ invite_code_exist: boolean;
683
+ }>;
684
+ claimRabbyPointsSnapshotV2: (params: {
685
+ id: string;
686
+ signature: string;
687
+ invite_code?: string;
688
+ }) => Promise<{
689
+ error_code: number;
690
+ error_msg?: string;
691
+ }>;
692
+ getRabbyPointsTopUsersV2: (params: {
693
+ id: string;
694
+ }) => Promise<{
695
+ id: string;
696
+ logo_url: string;
697
+ logo_thumbnail_url: string;
698
+ web3_id: string;
699
+ claimed_points: number;
700
+ }[]>;
701
+ getRabbyPointsListV2: (params: {
702
+ id: string;
703
+ }) => Promise<{
704
+ id: number;
705
+ title: string;
706
+ description: string;
707
+ start_at: number;
708
+ end_at: number;
709
+ claimable_points: number;
710
+ }[]>;
711
+ claimRabbyPointsByIdV2: (params: {
712
+ campaign_id: number;
713
+ user_id: string;
714
+ signature: string;
715
+ }) => Promise<{
716
+ error_code: number;
717
+ }>;
718
+ getRabbyPointsSnapshotV2: (params: {
719
+ id: string;
720
+ }) => Promise<{
721
+ id: string;
722
+ wallet_balance_reward: number;
723
+ active_stats_reward: number;
724
+ extra_bouns: number;
725
+ claimed: boolean;
726
+ snapshot_at: number;
727
+ claimed_points: number;
728
+ }>;
729
+ checkRabbyPointClaimableV2: (params: {
730
+ id: string;
731
+ }) => Promise<{
732
+ claimable: boolean;
733
+ }>;
734
+ checkClaimInfoV2: (params: {
735
+ id: string;
736
+ }) => Promise<{
737
+ claimable_points: number;
738
+ claimed_points: number;
739
+ }>;
740
+ getRabbyPointsCampaignIsEndedV2: () => Promise<{
741
+ campaign_is_ended: boolean;
742
+ }>;
743
+ getSupportedChains: () => Promise<SupportedChain[]>;
744
+ searchChainList: (params?: {
745
+ limit?: number;
746
+ start?: number;
747
+ q?: string;
748
+ }) => Promise<{
749
+ page: {
750
+ start: number;
751
+ limit: number;
752
+ total: number;
753
+ };
754
+ chain_list: ChainListItem[];
755
+ }>;
756
+ getChainListByIds: (params: {
757
+ ids: string;
758
+ }) => Promise<ChainListItem[]>;
759
+ getHistoryCurve: (addr: string) => Promise<HistoryCurve>;
760
+ getHistoryCurveSupportedList: () => Promise<{
761
+ supported_chains: string[];
762
+ }>;
763
+ getHistoryCurveStatus: (params: {
764
+ id: string;
765
+ }) => Promise<{
766
+ failed_msg: Record<string, string>;
767
+ id: string;
768
+ status: 'pending' | 'running' | 'finished' | 'failed';
769
+ update_at: number;
770
+ }>;
771
+ initHistoryCurve: (params: {
772
+ id: string;
773
+ }) => Promise<{
774
+ success: boolean;
775
+ }>;
776
+ getNodeStatusList: () => Promise<NodeStatus[]>;
777
+ getNodeStatusDetail: (params: {
778
+ chain_id: string;
779
+ }) => Promise<NodeStatusDetail>;
780
+ postActionLog: (body: {
781
+ id: string;
782
+ type: 'tx' | 'typed_data' | 'text';
783
+ rules: {
784
+ id: string;
785
+ level: string | null;
786
+ }[];
787
+ }) => Promise<any>;
788
+ checkSpoofing: ({ from, to, }: {
789
+ from: string;
790
+ to: string;
791
+ }) => Promise<{
792
+ is_spoofing: boolean;
793
+ }>;
794
+ getAddressByDeBankId: (name: string) => Promise<{
795
+ addr: string;
796
+ web3_id: string;
797
+ }>;
798
+ getBridgeSupportChain: () => Promise<string[]>;
799
+ getBridgeAggregatorList: () => Promise<BridgeAggregator[]>;
800
+ getBridgePairList: (params: {
801
+ aggregator_ids: string[];
802
+ to_chain_id: string;
803
+ user_addr: string;
804
+ }) => Promise<BridgeTokenPair[]>;
805
+ getBridgeQuoteList: (params: {
806
+ aggregator_ids: string;
807
+ user_addr: string;
808
+ from_chain_id: string;
809
+ from_token_id: string;
810
+ from_token_raw_amount: string;
811
+ to_chain_id: string;
812
+ to_token_id: string;
813
+ }) => Promise<Omit<BridgeQuote, 'tx'>[]>;
814
+ getBridgeQuoteListV2: (params: {
815
+ aggregator_id: string;
816
+ user_addr: string;
817
+ from_chain_id: string;
818
+ from_token_id: string;
819
+ from_token_raw_amount: string;
820
+ to_chain_id: string;
821
+ to_token_id: string;
822
+ }) => Promise<Omit<BridgeQuote, 'tx'>[]>;
823
+ getBridgeQuote: (params: {
824
+ aggregator_id: string;
825
+ bridge_id: string;
826
+ user_addr: string;
827
+ from_chain_id: string;
828
+ from_token_id: string;
829
+ from_token_raw_amount: string;
830
+ to_chain_id: string;
831
+ to_token_id: string;
832
+ }) => Promise<BridgeQuote>;
833
+ getBridgeHistoryList: (params: {
834
+ user_addr: string;
835
+ start: number;
836
+ limit: number;
837
+ }) => Promise<{
838
+ history_list: BridgeHistory[];
839
+ total_cnt: number;
840
+ }>;
841
+ postBridgeHistory: (params: {
842
+ aggregator_id: string;
843
+ bridge_id: string;
844
+ from_chain_id: string;
845
+ from_token_id: string;
846
+ from_token_amount: string | number;
847
+ to_chain_id: string;
848
+ to_token_id: string;
849
+ to_token_amount: string | number;
850
+ tx_id: string;
851
+ tx: Tx;
852
+ rabby_fee: number;
853
+ }) => Promise<{
854
+ success: boolean;
855
+ }>;
856
+ getSupportedDEXList: () => Promise<{
857
+ dex_list: string[];
858
+ }>;
859
+ createDbkBridgeHistory: (postData: Pick<DbkBridgeHistoryItem, 'user_addr' | 'from_chain_id' | 'to_chain_id' | 'tx_id' | 'from_token_amount'>) => Promise<{
860
+ success: boolean;
861
+ }>;
862
+ getDbkBridgeHistoryList: (params: {
863
+ user_addr: string;
864
+ start?: number;
865
+ limit?: number;
866
+ }) => Promise<{
867
+ page: {
868
+ total: number;
869
+ limit: number;
870
+ start: number;
871
+ };
872
+ data: DbkBridgeHistoryItem[];
873
+ }>;
874
+ getGasAccountSignText: (account_id: string) => Promise<{
875
+ text: string;
876
+ }>;
877
+ getGasAccountInfo: (params: {
878
+ sig: string;
879
+ id: string;
880
+ }) => Promise<{
881
+ account: GasAccountInfo;
882
+ }>;
883
+ getGasAccountInfoV2: (params: {
884
+ id: string;
885
+ }) => Promise<{
886
+ account: GasAccountInfo;
887
+ }>;
888
+ createGasAccountPayInfo: (postData: {
889
+ id: string;
890
+ }) => Promise<{
891
+ account: GasAccountInfo;
892
+ }>;
893
+ confirmIapOrder: (postData: {
894
+ transaction_id: string;
895
+ device_type: 'android' | 'ios';
896
+ product_id: string;
897
+ }) => Promise<{
898
+ req: TxRequest;
899
+ }>;
900
+ loginGasAccount: (params: {
901
+ sig: string;
902
+ account_id: string;
903
+ }) => Promise<{
904
+ success: boolean;
905
+ }>;
906
+ logoutGasAccount: (params: {
907
+ sig: string;
908
+ account_id: string;
909
+ }) => Promise<{
910
+ success: boolean;
911
+ }>;
912
+ getGasAccountTokenList: (id: string) => Promise<TokenItem[]>;
913
+ rechargeGasAccount: (p: {
914
+ sig: string;
915
+ account_id: string;
916
+ tx_id: string;
917
+ chain_id: string;
918
+ amount: number;
919
+ user_addr: string;
920
+ nonce: number;
921
+ }) => Promise<{
922
+ success: boolean;
923
+ }>;
924
+ withdrawGasAccount: (p: {
925
+ sig: string;
926
+ amount: number;
927
+ account_id: string;
928
+ user_addr: string;
929
+ chain_id: string;
930
+ fee: number;
931
+ }) => Promise<{
932
+ success: boolean;
933
+ }>;
934
+ getWithdrawList: (p: {
935
+ sig: string;
936
+ id: string;
937
+ }) => Promise<WithdrawListAddressItem[]>;
938
+ getGasAccountHistory: (p: {
939
+ sig: string;
940
+ account_id: string;
941
+ start: number;
942
+ limit: number;
943
+ }) => Promise<{
944
+ recharge_list: {
945
+ amount: number;
946
+ chain_id: string;
947
+ create_at: number;
948
+ gas_account_id: string;
949
+ tx_id: string;
950
+ user_addr: string;
951
+ }[];
952
+ withdraw_list: {
953
+ amount: number;
954
+ chain_id: string;
955
+ create_at: number;
956
+ gas_account_id: string;
957
+ tx_id: string;
958
+ user_addr: string;
959
+ }[];
960
+ history_list: {
961
+ id: string;
962
+ chain_id: string;
963
+ create_at: number;
964
+ gas_cost_usd_value: number;
965
+ gas_account_id: string;
966
+ tx_id: string;
967
+ usd_value: number;
968
+ user_addr: string;
969
+ history_type: 'tx' | 'recharge' | 'withdraw';
970
+ }[];
971
+ pagination: {
972
+ limit: number;
973
+ start: number;
974
+ total: number;
975
+ };
976
+ }>;
977
+ checkGasAccountTxs: (p: {
978
+ sig?: string;
979
+ account_id: string;
980
+ tx_list: Tx[];
981
+ }) => Promise<GasAccountCheckResult>;
982
+ getGasAccountAml: (id: string) => Promise<{
983
+ is_risk: boolean;
984
+ }>;
985
+ parseCommon: (params: {
986
+ typed_data: Record<string, any>;
987
+ origin: string;
988
+ user_addr: string;
989
+ }) => Promise<ParseCommonResponse>;
990
+ getRecommendBridgeToChain: (params: {
991
+ from_chain_id: string;
992
+ }) => Promise<{
993
+ to_chain_id: string;
994
+ }>;
995
+ getRecommendFromToken: (params: {
996
+ user_addr: string;
997
+ from_chain_id: string;
998
+ from_token_id: string;
999
+ from_token_amount: string;
1000
+ to_chain_id: string;
1001
+ to_token_id: string;
1002
+ }) => Promise<{
1003
+ token_list: TokenItem[];
1004
+ }>;
1005
+ getBridgeToTokenList: (params: {
1006
+ from_chain_id: string;
1007
+ to_chain_id: string;
1008
+ from_token_id?: string;
1009
+ q?: string;
1010
+ }) => Promise<{
1011
+ token_list: (TokenItem & {
1012
+ trade_volume_24h: 'low' | 'middle' | 'high';
1013
+ })[];
1014
+ }>;
1015
+ getBridgeQuoteV2: (params: {
1016
+ aggregator_id: string;
1017
+ user_addr: string;
1018
+ from_chain_id: string;
1019
+ from_token_id: string;
1020
+ from_token_raw_amount: string;
1021
+ to_chain_id: string;
1022
+ to_token_id: string;
1023
+ slippage: string;
1024
+ }) => Promise<Omit<BridgeQuote, 'tx'>[]>;
1025
+ getBridgeQuoteTxV2: (params: {
1026
+ aggregator_id: string;
1027
+ bridge_id: string;
1028
+ user_addr: string;
1029
+ from_chain_id: string;
1030
+ from_token_id: string;
1031
+ from_token_raw_amount: string;
1032
+ to_chain_id: string;
1033
+ to_token_id: string;
1034
+ slippage: string;
1035
+ }) => Promise<BridgeQuote>;
1036
+ isSameBridgeToken: (params: {
1037
+ from_chain_id: string;
1038
+ from_token_id: string;
1039
+ to_chain_id: string;
1040
+ to_token_id: string;
1041
+ }) => Promise<{
1042
+ is_same: boolean;
1043
+ aggregator_id: string;
1044
+ }[]>;
1045
+ getBridgeSupportChainV2: () => Promise<string[]>;
1046
+ uninstalledFeedback: ({ text, }: {
1047
+ text: string;
1048
+ }) => Promise<{
1049
+ success: boolean;
1050
+ }>;
1051
+ /**
1052
+ * @deprecated
1053
+ */
1054
+ getToken24hPrice: (params: {
1055
+ chain_id: string;
1056
+ id: string;
1057
+ }) => Promise<{
1058
+ time_at: number;
1059
+ price: number;
1060
+ }[]>;
1061
+ getTokenPriceCurve: (params: {
1062
+ chain_id: string;
1063
+ id: string;
1064
+ days: number | 1 | 7;
1065
+ }) => Promise<{
1066
+ time_at: number;
1067
+ price: number;
1068
+ }[]>;
1069
+ getTokenDatePrice: (params: {
1070
+ chain_id: string;
1071
+ id: string;
1072
+ }) => Promise<{
1073
+ date_at: string;
1074
+ price: number;
1075
+ }[]>;
1076
+ searchTokens: (params: {
1077
+ q: string;
1078
+ }) => Promise<TokenItem[]>;
1079
+ searchTokensV2: (params: {
1080
+ q: string;
1081
+ }) => Promise<TokenItemWithEntity[]>;
1082
+ batchQueryTokens: (uuids: string | string[]) => Promise<TokenItem[]>;
1083
+ getBuySupportedCountryList: () => Promise<BuyCountryItem[]>;
1084
+ getBuySupportedTokenList: () => Promise<(TokenItem & {
1085
+ currency_code: string;
1086
+ })[]>;
1087
+ getBuyQuote: (params: {
1088
+ country_code: string;
1089
+ user_addr: string;
1090
+ usd_amount: string;
1091
+ currency_code: string;
1092
+ receive_token_uuid: string;
1093
+ }) => Promise<BuyQuoteItem[]>;
1094
+ getBuyWidgetUrl: (params: {
1095
+ country_code: string;
1096
+ user_addr: string;
1097
+ usd_amount: string;
1098
+ receive_token_uuid: string;
1099
+ service_provider: string;
1100
+ currency_code: string;
1101
+ redirect_url?: string;
1102
+ }) => Promise<{
1103
+ url: string;
1104
+ msg: number;
1105
+ }>;
1106
+ getBuyHistory: (params: {
1107
+ user_addr: string;
1108
+ start?: number;
1109
+ limit?: number;
1110
+ }) => Promise<BuyHistoryList>;
1111
+ getBuyPaymentMethods: (params: {
1112
+ currency_code: string;
1113
+ country_code: string;
1114
+ service_provider: string;
1115
+ }) => Promise<BuyPaymentMethod[]>;
1116
+ getBuyCurrencyList: () => Promise<{
1117
+ id: string;
1118
+ name: string;
1119
+ image_url: string;
1120
+ }[]>;
1121
+ getOfflineChainList: () => Promise<{
1122
+ id: string;
1123
+ offline_at: number;
1124
+ }[]>;
1125
+ }
1126
+ export {};