@rabby-wallet/rabby-api 0.9.14 → 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,1119 +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
- 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
+ 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 {};