@rabby-wallet/rabby-api 0.7.2 → 0.7.4
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/README.md +28 -28
- package/dist/const.d.ts +3 -3
- package/dist/const.js +8 -8
- package/dist/index.d.ts +508 -507
- package/dist/index.js +946 -942
- package/dist/plugins/intf.d.ts +19 -19
- package/dist/plugins/intf.js +1 -1
- package/dist/plugins/web-sign.d.ts +2 -2
- package/dist/plugins/web-sign.js +44 -44
- package/dist/types.d.ts +1142 -1125
- package/dist/types.js +1 -1
- package/dist/utils.d.ts +13 -13
- package/dist/utils.js +55 -55
- package/package.json +56 -56
package/dist/index.d.ts
CHANGED
|
@@ -1,507 +1,508 @@
|
|
|
1
|
-
import { AxiosAdapter, AxiosRequestConfig } from 'axios';
|
|
2
|
-
import { RateLimitedAxiosInstance } from 'axios-rate-limit';
|
|
3
|
-
import { AddrDescResponse, ApprovalStatus, AssetItem, BasicDappInfo, CEXQuote, Cex, ChainWithPendingCount, Collection, CollectionList, CollectionWithFloorPrice, ComplexProtocol, ContractCredit, ExplainTxResponse, ExplainTypedDataResponse, GasLevel, GetTxResponse, LatestExplainTxResponse, MempoolCheckDetail, NFTApprovalResponse, NFTItem, ParseTextResponse, ParseTxResponse, ParseTypedDataResponse, PendingTxItem, Protocol, SecurityCheckResponse, ServerChain, SlippageStatus, Summary, SwapTradeList, TokenApproval, TokenItem, TotalBalanceResponse, Tx, TxAllHistoryResult, TxHistoryResult, TxPushType, TxRequest, UsedChain } from './types';
|
|
4
|
-
import { InitOptions, RabbyApiPlugin } from './plugins/intf';
|
|
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
|
-
export declare class OpenApiService {
|
|
17
|
-
#private;
|
|
18
|
-
store: OpenApiStore;
|
|
19
|
-
request: RateLimitedAxiosInstance;
|
|
20
|
-
constructor({ store, plugin, adapter, clientName, clientVersion, }: Options);
|
|
21
|
-
setHost: (host: string) => Promise<void>;
|
|
22
|
-
setHostSync: (host: string) => void;
|
|
23
|
-
getHost: () => string;
|
|
24
|
-
setTestnetHost: (host: string) => Promise<void>;
|
|
25
|
-
getTestnetHost: () => string | undefined;
|
|
26
|
-
ethRpc: ((chainId: string, arg: {
|
|
27
|
-
method: string;
|
|
28
|
-
params: Array<any>;
|
|
29
|
-
origin?: string;
|
|
30
|
-
}) => Promise<any>) | (() => Promise<never>);
|
|
31
|
-
init: (options?: string | InitOptions) => Promise<void>;
|
|
32
|
-
initSync(options?: InitOptions): void;
|
|
33
|
-
asyncJob: <T = any>(url: string, options?: AxiosRequestConfig & {
|
|
34
|
-
retryDelay?: number;
|
|
35
|
-
}) => Promise<T>;
|
|
36
|
-
private _getRequestOptions;
|
|
37
|
-
private _mountMethods;
|
|
38
|
-
getRecommendChains: (address: string, origin: string) => Promise<ServerChain[]>;
|
|
39
|
-
getTotalBalance: (address: string) => Promise<TotalBalanceResponse>;
|
|
40
|
-
getPendingCount: (address: string) => Promise<{
|
|
41
|
-
total_count: number;
|
|
42
|
-
chains: ChainWithPendingCount[];
|
|
43
|
-
}>;
|
|
44
|
-
checkOrigin: (address: string, origin: string) => Promise<SecurityCheckResponse>;
|
|
45
|
-
checkText: (address: string, origin: string, text: string) => Promise<SecurityCheckResponse>;
|
|
46
|
-
checkTx: (tx: Tx, origin: string, address: string, update_nonce?: boolean) => Promise<SecurityCheckResponse>;
|
|
47
|
-
preExecTx: ({ tx, origin, address, updateNonce, pending_tx_list, }: {
|
|
48
|
-
tx: Tx;
|
|
49
|
-
origin: string;
|
|
50
|
-
address: string;
|
|
51
|
-
updateNonce: boolean;
|
|
52
|
-
pending_tx_list: Tx[];
|
|
53
|
-
}) => Promise<ExplainTxResponse>;
|
|
54
|
-
historyGasUsed: (params: {
|
|
55
|
-
tx: Tx;
|
|
56
|
-
user_addr: string;
|
|
57
|
-
}) => Promise<{
|
|
58
|
-
gas_used: number;
|
|
59
|
-
}>;
|
|
60
|
-
pendingTxList: (tx: Tx, origin: string, address: string, update_nonce?: boolean) => Promise<Tx[]>;
|
|
61
|
-
traceTx: (txId: string, traceId: string, chainId: string) => Promise<void>;
|
|
62
|
-
pushTx: (tx: Tx, traceId?: string) => Promise<any>;
|
|
63
|
-
explainText: (origin: string, address: string, text: string) => Promise<{
|
|
64
|
-
comment: string;
|
|
65
|
-
}>;
|
|
66
|
-
gasMarket: (chainId: string, customGas?: number) => Promise<GasLevel[]>;
|
|
67
|
-
getTx: (chainId: string, hash: string, gasPrice: number) => Promise<GetTxResponse>;
|
|
68
|
-
getEnsAddressByName: (name: string) => Promise<{
|
|
69
|
-
addr: string;
|
|
70
|
-
name: string;
|
|
71
|
-
}>;
|
|
72
|
-
searchToken: (id: string, q: string, chainId?: string, is_all?: boolean) => Promise<TokenItem[]>;
|
|
73
|
-
searchSwapToken: (id: string, chainId: string, q: string, is_all?: boolean) => Promise<any>;
|
|
74
|
-
getToken: (id: string, chainId: string, tokenId: string) => Promise<TokenItem>;
|
|
75
|
-
getCachedTokenList: (id: string) => Promise<TokenItem[]>;
|
|
76
|
-
listToken: (id: string, chainId?: string, isAll?: boolean) => Promise<TokenItem[]>;
|
|
77
|
-
getHistoryTokenList: (params: {
|
|
78
|
-
id: string;
|
|
79
|
-
chainId?: string;
|
|
80
|
-
timeAt?: number;
|
|
81
|
-
dateAt?: string;
|
|
82
|
-
}) => Promise<TokenItem[]>;
|
|
83
|
-
_customListToken: (uuids: string[], id: string, isTestnet?: boolean) => Promise<TokenItem[]>;
|
|
84
|
-
customListToken: (uuids: string[], id: string) => Promise<TokenItem[]>;
|
|
85
|
-
listChainAssets: (id: string) => Promise<AssetItem[]>;
|
|
86
|
-
listNFT: (id: string, isAll?: boolean) => Promise<NFTItem[]>;
|
|
87
|
-
listCollection: (params: {
|
|
88
|
-
collection_ids: string;
|
|
89
|
-
}) => Promise<Collection[]>;
|
|
90
|
-
listTxHisotry: (params: {
|
|
91
|
-
id?: string;
|
|
92
|
-
chain_id?: string;
|
|
93
|
-
token_id?: string;
|
|
94
|
-
coin_id?: string;
|
|
95
|
-
start_time?: number;
|
|
96
|
-
page_count?: number;
|
|
97
|
-
}) => Promise<TxHistoryResult>;
|
|
98
|
-
getAllTxHistory: (params: {
|
|
99
|
-
id: string;
|
|
100
|
-
start_time?: number;
|
|
101
|
-
}, options?: Parameters<typeof this.asyncJob>[1]) => Promise<TxAllHistoryResult>;
|
|
102
|
-
tokenPrice: (tokenName: string) => Promise<{
|
|
103
|
-
change_percent: number;
|
|
104
|
-
last_price: number;
|
|
105
|
-
}>;
|
|
106
|
-
tokenAuthorizedList: (id: string, chain_id: string) => Promise<TokenApproval[]>;
|
|
107
|
-
userNFTAuthorizedList: (id: string, chain_id: string) => Promise<NFTApprovalResponse>;
|
|
108
|
-
getDEXList: (chain_id: string) => Promise<{
|
|
109
|
-
id: string;
|
|
110
|
-
name: string;
|
|
111
|
-
logo_url: string;
|
|
112
|
-
site_url: string;
|
|
113
|
-
type: string;
|
|
114
|
-
}[]>;
|
|
115
|
-
getSwapQuote: (params: {
|
|
116
|
-
id: string;
|
|
117
|
-
chain_id: string;
|
|
118
|
-
dex_id: string;
|
|
119
|
-
pay_token_id: string;
|
|
120
|
-
pay_token_raw_amount: string;
|
|
121
|
-
receive_token_id: string;
|
|
122
|
-
slippage?: string | number;
|
|
123
|
-
}) => Promise<{
|
|
124
|
-
receive_token_raw_amount: number;
|
|
125
|
-
dex_approve_to: string;
|
|
126
|
-
dex_swap_to: string;
|
|
127
|
-
dex_swap_calldata: string;
|
|
128
|
-
is_wrapped: boolean;
|
|
129
|
-
gas: {
|
|
130
|
-
gas_used: number;
|
|
131
|
-
gas_price: number;
|
|
132
|
-
gas_cost_value: number;
|
|
133
|
-
gas_cost_usd_value: number;
|
|
134
|
-
};
|
|
135
|
-
pay_token: TokenItem;
|
|
136
|
-
receive_token: TokenItem;
|
|
137
|
-
}>;
|
|
138
|
-
getSwapTokenList: (id: string, chainId?: string) => Promise<TokenItem[]>;
|
|
139
|
-
postGasStationOrder: (params: {
|
|
140
|
-
userAddr: string;
|
|
141
|
-
fromChainId: string;
|
|
142
|
-
fromTxId: string;
|
|
143
|
-
toChainId: string;
|
|
144
|
-
toTokenAmount: string;
|
|
145
|
-
fromTokenId: string;
|
|
146
|
-
fromTokenAmount: string;
|
|
147
|
-
fromUsdValue: number;
|
|
148
|
-
}) => Promise<any>;
|
|
149
|
-
getGasStationChainBalance: (chain_id: string, addr: string) => Promise<{
|
|
150
|
-
usd_value: number;
|
|
151
|
-
}>;
|
|
152
|
-
getGasStationTokenList: () => Promise<TokenItem[]>;
|
|
153
|
-
explainTypedData: (user_addr: string, origin: string, data: any) => Promise<ExplainTypedDataResponse>;
|
|
154
|
-
checkTypedData: (user_addr: string, origin: string, data: any) => Promise<SecurityCheckResponse>;
|
|
155
|
-
approvalStatus: (id: string) => Promise<ApprovalStatus[]>;
|
|
156
|
-
usedChainList: (id: string) => Promise<UsedChain[]>;
|
|
157
|
-
getLatestVersion: () => Promise<{
|
|
158
|
-
version_tag: string;
|
|
159
|
-
}>;
|
|
160
|
-
addOriginFeedback: (params: {
|
|
161
|
-
user_addr: string;
|
|
162
|
-
origin: string;
|
|
163
|
-
is_safe: boolean;
|
|
164
|
-
}) => Promise<{
|
|
165
|
-
is_success: boolean;
|
|
166
|
-
}>;
|
|
167
|
-
getProtocolList: (addr: string) => Promise<Protocol[]>;
|
|
168
|
-
getComplexProtocolList: (addr: string) => Promise<ComplexProtocol[]>;
|
|
169
|
-
getProtocol: ({ addr, id, }: {
|
|
170
|
-
addr: string;
|
|
171
|
-
id: string;
|
|
172
|
-
}) => Promise<ComplexProtocol>;
|
|
173
|
-
getHistoryProtocol: ({ addr, id, timeAt, dateAt, }: {
|
|
174
|
-
addr: string;
|
|
175
|
-
id: string;
|
|
176
|
-
timeAt?: number | undefined;
|
|
177
|
-
dateAt?: number | undefined;
|
|
178
|
-
}) => Promise<ComplexProtocol>;
|
|
179
|
-
getTokenHistoryPrice: ({ chainId, id, timeAt, }: {
|
|
180
|
-
chainId: string;
|
|
181
|
-
id: string;
|
|
182
|
-
timeAt: number;
|
|
183
|
-
}) => Promise<{
|
|
184
|
-
price: number;
|
|
185
|
-
}>;
|
|
186
|
-
getTokenHistoryDict: ({ chainId, ids, timeAt, }: {
|
|
187
|
-
chainId: string;
|
|
188
|
-
ids: string;
|
|
189
|
-
timeAt: number;
|
|
190
|
-
}) => Promise<Record<string, number>>;
|
|
191
|
-
getNetCurve: (addr: string) => Promise<{
|
|
192
|
-
timestamp: number;
|
|
193
|
-
usd_value: number;
|
|
194
|
-
}[]>;
|
|
195
|
-
getChainList: () => Promise<ServerChain[]>;
|
|
196
|
-
getCEXSwapQuote: (params: {
|
|
197
|
-
cex_id: string;
|
|
198
|
-
pay_token_id: string;
|
|
199
|
-
pay_token_amount: string;
|
|
200
|
-
receive_token_id: string;
|
|
201
|
-
chain_id: string;
|
|
202
|
-
}) => Promise<CEXQuote>;
|
|
203
|
-
getSwapTradeList: (params: {
|
|
204
|
-
user_addr: string;
|
|
205
|
-
start: string;
|
|
206
|
-
limit: string;
|
|
207
|
-
}) => Promise<SwapTradeList>;
|
|
208
|
-
postSwap: (params: {
|
|
209
|
-
quote: {
|
|
210
|
-
pay_token_id: string;
|
|
211
|
-
pay_token_amount: number;
|
|
212
|
-
receive_token_id: string;
|
|
213
|
-
receive_token_amount: number;
|
|
214
|
-
slippage: number;
|
|
215
|
-
};
|
|
216
|
-
dex_id: string;
|
|
217
|
-
tx_id: string;
|
|
218
|
-
tx: Tx;
|
|
219
|
-
}) => Promise<any>;
|
|
220
|
-
checkSlippage: (params: {
|
|
221
|
-
chain_id: string;
|
|
222
|
-
slippage: string;
|
|
223
|
-
from_token_id: string;
|
|
224
|
-
to_token_id: string;
|
|
225
|
-
}) => Promise<SlippageStatus>;
|
|
226
|
-
getOriginPopularityLevel: (origin: string) => Promise<{
|
|
227
|
-
level: 'very_low' | 'low' | 'medium' | 'high';
|
|
228
|
-
}>;
|
|
229
|
-
getOriginIsScam: (origin: string, source: string) => Promise<{
|
|
230
|
-
is_scam: boolean;
|
|
231
|
-
}>;
|
|
232
|
-
getOriginThirdPartyCollectList: (origin: string) => Promise<{
|
|
233
|
-
collect_list: {
|
|
234
|
-
name: string;
|
|
235
|
-
logo_url: string;
|
|
236
|
-
}[];
|
|
237
|
-
}>;
|
|
238
|
-
getSummarizedAssetList: (id: string, chain_id?: string) => Promise<Summary>;
|
|
239
|
-
parseTx: ({ chainId, tx, origin, addr, }: {
|
|
240
|
-
chainId: string;
|
|
241
|
-
tx: Tx;
|
|
242
|
-
origin: string;
|
|
243
|
-
addr: string;
|
|
244
|
-
}) => Promise<ParseTxResponse>;
|
|
245
|
-
isSuspiciousToken: (id: string, chainId: string) => Promise<{
|
|
246
|
-
is_suspicious: boolean;
|
|
247
|
-
}>;
|
|
248
|
-
depositCexSupport: (id: string, chainId: string, cexId: string) => Promise<{
|
|
249
|
-
support: boolean;
|
|
250
|
-
}>;
|
|
251
|
-
depositCexList: (id: string, chainId: string) => Promise<{
|
|
252
|
-
cex_list: Cex[];
|
|
253
|
-
}>;
|
|
254
|
-
getContractCredit: (id: string, chainId: string) => Promise<ContractCredit>;
|
|
255
|
-
hasInteraction: (addr: string, chainId: string, contractId: string) => Promise<{
|
|
256
|
-
has_interaction: boolean;
|
|
257
|
-
}>;
|
|
258
|
-
tokenApproveExposure: (id: string, chainId: string) => Promise<{
|
|
259
|
-
usd_value: number;
|
|
260
|
-
}>;
|
|
261
|
-
addrDesc: (id: string) => Promise<AddrDescResponse>;
|
|
262
|
-
hasTransfer: (chainId: string, from: string, to: string) => Promise<{
|
|
263
|
-
has_transfer: boolean;
|
|
264
|
-
}>;
|
|
265
|
-
isTokenContract: (chainId: string, id: string) => Promise<{
|
|
266
|
-
is_token: boolean;
|
|
267
|
-
}>;
|
|
268
|
-
addrUsedChainList: (id: string) => Promise<UsedChain[]>;
|
|
269
|
-
getTokenNFTExposure: (chainId: string, id: string) => Promise<{
|
|
270
|
-
usd_value: number;
|
|
271
|
-
}>;
|
|
272
|
-
getCollection: (chainId: string, id: string) => Promise<{
|
|
273
|
-
collection: CollectionWithFloorPrice;
|
|
274
|
-
}>;
|
|
275
|
-
isSuspiciousCollection: (chainId: string, id: string) => Promise<{
|
|
276
|
-
is_suspicious: boolean;
|
|
277
|
-
}>;
|
|
278
|
-
isOriginVerified: (origin: string) => Promise<{
|
|
279
|
-
is_verified: boolean | null;
|
|
280
|
-
}>;
|
|
281
|
-
parseTypedData: ({ typedData, origin, address, }: {
|
|
282
|
-
typedData: Record<string, any>;
|
|
283
|
-
origin: string;
|
|
284
|
-
address: string;
|
|
285
|
-
}) => Promise<ParseTypedDataResponse>;
|
|
286
|
-
parseText: ({ text, origin, address, }: {
|
|
287
|
-
text: string;
|
|
288
|
-
origin: string;
|
|
289
|
-
address: string;
|
|
290
|
-
}) => Promise<ParseTextResponse>;
|
|
291
|
-
collectionList: ({ id, chainId, isAll, }: {
|
|
292
|
-
id: string;
|
|
293
|
-
chainId?: string | undefined;
|
|
294
|
-
isAll: boolean;
|
|
295
|
-
}) => Promise<CollectionList[]>;
|
|
296
|
-
gasPriceStats: (chainId: string) => Promise<{
|
|
297
|
-
median: number;
|
|
298
|
-
}>;
|
|
299
|
-
badgeHasClaimed: (id: string) => Promise<{
|
|
300
|
-
id: string;
|
|
301
|
-
badge_id: number;
|
|
302
|
-
user_id: string;
|
|
303
|
-
inner_id: number;
|
|
304
|
-
create_at: number;
|
|
305
|
-
update_at: number;
|
|
306
|
-
has_claimed: true;
|
|
307
|
-
} | {
|
|
308
|
-
has_claimed: false;
|
|
309
|
-
}>;
|
|
310
|
-
badgeHasMinted: (id: string) => Promise<{
|
|
311
|
-
id: string;
|
|
312
|
-
badge_id: number;
|
|
313
|
-
user_id: string;
|
|
314
|
-
inner_id: number;
|
|
315
|
-
usd_value: number;
|
|
316
|
-
tvf: number;
|
|
317
|
-
mint_at: number;
|
|
318
|
-
has_minted: true;
|
|
319
|
-
} | {
|
|
320
|
-
has_minted: false;
|
|
321
|
-
}>;
|
|
322
|
-
mintBadge: (params: {
|
|
323
|
-
code: string;
|
|
324
|
-
userAddr: string;
|
|
325
|
-
}) => Promise<{
|
|
326
|
-
is_success: boolean;
|
|
327
|
-
inner_id: number;
|
|
328
|
-
}>;
|
|
329
|
-
userHasRequestedFaucet: (params: {
|
|
330
|
-
chain_id: string;
|
|
331
|
-
user_addr: string;
|
|
332
|
-
}) => Promise<{
|
|
333
|
-
has_requested: boolean;
|
|
334
|
-
}>;
|
|
335
|
-
requestFaucet: (params: {
|
|
336
|
-
chain_id: string;
|
|
337
|
-
user_addr: string;
|
|
338
|
-
}) => Promise<{
|
|
339
|
-
is_success: boolean;
|
|
340
|
-
}>;
|
|
341
|
-
gasSupportedPushType: (chainId: string) => Promise<{
|
|
342
|
-
low_gas: boolean;
|
|
343
|
-
mev: boolean;
|
|
344
|
-
}>;
|
|
345
|
-
submitTx: (postData: {
|
|
346
|
-
req_id?: string;
|
|
347
|
-
tx: Tx;
|
|
348
|
-
push_type: TxPushType;
|
|
349
|
-
low_gas_deadline?: number;
|
|
350
|
-
origin?: string;
|
|
351
|
-
}) => Promise<{
|
|
352
|
-
req: TxRequest;
|
|
353
|
-
}>;
|
|
354
|
-
getTxRequests: (ids: string | string[]) => Promise<TxRequest[]>;
|
|
355
|
-
getTxRequest: (id: string) => Promise<TxRequest>;
|
|
356
|
-
withdrawTx: (reqId: string) => Promise<{
|
|
357
|
-
req: TxRequest;
|
|
358
|
-
}>;
|
|
359
|
-
retryPushTx: (reqId: string) => Promise<{
|
|
360
|
-
req: TxRequest;
|
|
361
|
-
}>;
|
|
362
|
-
mempoolChecks: (txId: string, chainId: string, node_info?: boolean) => Promise<MempoolCheckDetail[]>;
|
|
363
|
-
getPendingTxList: (params: {
|
|
364
|
-
chain_id: string;
|
|
365
|
-
}, options?: Parameters<typeof this.asyncJob>[1]) => Promise<{
|
|
366
|
-
pending_tx_list: PendingTxItem[];
|
|
367
|
-
token_dict: Record<string, TokenItem | NFTItem>;
|
|
368
|
-
}>;
|
|
369
|
-
getLatestPreExec: (params: {
|
|
370
|
-
id: string;
|
|
371
|
-
}) => Promise<LatestExplainTxResponse>;
|
|
372
|
-
walletSupportChain: (params: {
|
|
373
|
-
chain_id: string;
|
|
374
|
-
user_addr: string;
|
|
375
|
-
}) => Promise<{
|
|
376
|
-
is_success: boolean;
|
|
377
|
-
count: number;
|
|
378
|
-
}>;
|
|
379
|
-
walletSupportOrigin: (params: {
|
|
380
|
-
origin: string;
|
|
381
|
-
user_addr: string;
|
|
382
|
-
text: string;
|
|
383
|
-
}) => Promise<{
|
|
384
|
-
is_success: boolean;
|
|
385
|
-
count: number;
|
|
386
|
-
}>;
|
|
387
|
-
walletSupportSelector: (params: {
|
|
388
|
-
selector: string;
|
|
389
|
-
user_addr: string;
|
|
390
|
-
chain_id: string;
|
|
391
|
-
contract_id: string;
|
|
392
|
-
}) => Promise<{
|
|
393
|
-
is_success: boolean;
|
|
394
|
-
count: number;
|
|
395
|
-
}>;
|
|
396
|
-
searchDapp: (params?: {
|
|
397
|
-
q?: string;
|
|
398
|
-
chain_id?: string;
|
|
399
|
-
start?: number;
|
|
400
|
-
limit?: number;
|
|
401
|
-
}) => Promise<{
|
|
402
|
-
page: {
|
|
403
|
-
limit: number;
|
|
404
|
-
start: number;
|
|
405
|
-
total: number;
|
|
406
|
-
};
|
|
407
|
-
dapps: BasicDappInfo[];
|
|
408
|
-
}>;
|
|
409
|
-
getDappsInfo: (params: {
|
|
410
|
-
ids: string[];
|
|
411
|
-
}) => Promise<BasicDappInfo[]>;
|
|
412
|
-
getDappHotTags: (params?: {
|
|
413
|
-
limit: number;
|
|
414
|
-
}) => Promise<string[]>;
|
|
415
|
-
getHotDapps: (params?: {
|
|
416
|
-
limit: number;
|
|
417
|
-
}) => Promise<BasicDappInfo[]>;
|
|
418
|
-
getRabbyClaimText: (params: {
|
|
419
|
-
id: string;
|
|
420
|
-
invite_code?: string;
|
|
421
|
-
}) => Promise<{
|
|
422
|
-
id: string;
|
|
423
|
-
text: string;
|
|
424
|
-
}>;
|
|
425
|
-
getRabbySignatureText: (params: {
|
|
426
|
-
id: string;
|
|
427
|
-
}) => Promise<{
|
|
428
|
-
id: string;
|
|
429
|
-
text: string;
|
|
430
|
-
}>;
|
|
431
|
-
getRabbyPoints: (params: {
|
|
432
|
-
id: string;
|
|
433
|
-
}) => Promise<{
|
|
434
|
-
id: string;
|
|
435
|
-
invite_code?: string;
|
|
436
|
-
logo_url: string;
|
|
437
|
-
logo_thumbnail_url: string;
|
|
438
|
-
web3_id: string;
|
|
439
|
-
claimed_points: number;
|
|
440
|
-
total_claimed_points: number;
|
|
441
|
-
}>;
|
|
442
|
-
checkRabbyPointsInviteCode: (params: {
|
|
443
|
-
code: string;
|
|
444
|
-
}) => Promise<{
|
|
445
|
-
invite_code_exist: boolean;
|
|
446
|
-
}>;
|
|
447
|
-
setRabbyPointsInviteCode: (params: {
|
|
448
|
-
id: string;
|
|
449
|
-
signature: string;
|
|
450
|
-
invite_code: string;
|
|
451
|
-
}) => Promise<{
|
|
452
|
-
code: number;
|
|
453
|
-
}>;
|
|
454
|
-
checkRabbyPointClaimable: (params: {
|
|
455
|
-
id: string;
|
|
456
|
-
}) => Promise<{
|
|
457
|
-
claimable: boolean;
|
|
458
|
-
}>;
|
|
459
|
-
getRabbyPointsSnapshot: (params: {
|
|
460
|
-
id: string;
|
|
461
|
-
}) => Promise<{
|
|
462
|
-
id: string;
|
|
463
|
-
address_balance: number;
|
|
464
|
-
metamask_swap: number;
|
|
465
|
-
rabby_old_user: number;
|
|
466
|
-
rabby_nadge: number;
|
|
467
|
-
rabby_nft: number;
|
|
468
|
-
extra_bouns: number;
|
|
469
|
-
claimed: boolean;
|
|
470
|
-
snapshot_at: number;
|
|
471
|
-
}>;
|
|
472
|
-
claimRabbyPointsSnapshot: (params: {
|
|
473
|
-
id: string;
|
|
474
|
-
signature: string;
|
|
475
|
-
invite_code?: string;
|
|
476
|
-
}) => Promise<{
|
|
477
|
-
error_code: number;
|
|
478
|
-
error_msg?: string;
|
|
479
|
-
}>;
|
|
480
|
-
getRabbyPointsTopUsers: (params: {
|
|
481
|
-
id: string;
|
|
482
|
-
}) => Promise<{
|
|
483
|
-
id: string;
|
|
484
|
-
logo_url: string;
|
|
485
|
-
logo_thumbnail_url: string;
|
|
486
|
-
web3_id: string;
|
|
487
|
-
claimed_points: number;
|
|
488
|
-
}[]>;
|
|
489
|
-
getRabbyPointsList: (params: {
|
|
490
|
-
id: string;
|
|
491
|
-
}) => Promise<{
|
|
492
|
-
id: number;
|
|
493
|
-
title: string;
|
|
494
|
-
description: string;
|
|
495
|
-
start_at: number;
|
|
496
|
-
end_at: number;
|
|
497
|
-
claimable_points: number;
|
|
498
|
-
}[]>;
|
|
499
|
-
claimRabbyPointsById: (params: {
|
|
500
|
-
campaign_id: number;
|
|
501
|
-
user_id: string;
|
|
502
|
-
signature: string;
|
|
503
|
-
}) => Promise<{
|
|
504
|
-
error_code: number;
|
|
505
|
-
}>;
|
|
506
|
-
|
|
507
|
-
|
|
1
|
+
import { AxiosAdapter, AxiosRequestConfig } from 'axios';
|
|
2
|
+
import { RateLimitedAxiosInstance } from 'axios-rate-limit';
|
|
3
|
+
import { AddrDescResponse, ApprovalStatus, AssetItem, BasicDappInfo, CEXQuote, Cex, ChainWithPendingCount, Collection, CollectionList, CollectionWithFloorPrice, ComplexProtocol, ContractCredit, ExplainTxResponse, ExplainTypedDataResponse, GasLevel, GetTxResponse, LatestExplainTxResponse, MempoolCheckDetail, NFTApprovalResponse, NFTItem, ParseTextResponse, ParseTxResponse, ParseTypedDataResponse, PendingTxItem, Protocol, SecurityCheckResponse, ServerChain, SlippageStatus, Summary, SupportedChain, SwapTradeList, TokenApproval, TokenItem, TotalBalanceResponse, Tx, TxAllHistoryResult, TxHistoryResult, TxPushType, TxRequest, UsedChain } from './types';
|
|
4
|
+
import { InitOptions, RabbyApiPlugin } from './plugins/intf';
|
|
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
|
+
export declare class OpenApiService {
|
|
17
|
+
#private;
|
|
18
|
+
store: OpenApiStore;
|
|
19
|
+
request: RateLimitedAxiosInstance;
|
|
20
|
+
constructor({ store, plugin, adapter, clientName, clientVersion, }: Options);
|
|
21
|
+
setHost: (host: string) => Promise<void>;
|
|
22
|
+
setHostSync: (host: string) => void;
|
|
23
|
+
getHost: () => string;
|
|
24
|
+
setTestnetHost: (host: string) => Promise<void>;
|
|
25
|
+
getTestnetHost: () => string | undefined;
|
|
26
|
+
ethRpc: ((chainId: string, arg: {
|
|
27
|
+
method: string;
|
|
28
|
+
params: Array<any>;
|
|
29
|
+
origin?: string;
|
|
30
|
+
}) => Promise<any>) | (() => Promise<never>);
|
|
31
|
+
init: (options?: string | InitOptions) => Promise<void>;
|
|
32
|
+
initSync(options?: InitOptions): void;
|
|
33
|
+
asyncJob: <T = any>(url: string, options?: AxiosRequestConfig & {
|
|
34
|
+
retryDelay?: number;
|
|
35
|
+
}) => Promise<T>;
|
|
36
|
+
private _getRequestOptions;
|
|
37
|
+
private _mountMethods;
|
|
38
|
+
getRecommendChains: (address: string, origin: string) => Promise<ServerChain[]>;
|
|
39
|
+
getTotalBalance: (address: string) => Promise<TotalBalanceResponse>;
|
|
40
|
+
getPendingCount: (address: string) => Promise<{
|
|
41
|
+
total_count: number;
|
|
42
|
+
chains: ChainWithPendingCount[];
|
|
43
|
+
}>;
|
|
44
|
+
checkOrigin: (address: string, origin: string) => Promise<SecurityCheckResponse>;
|
|
45
|
+
checkText: (address: string, origin: string, text: string) => Promise<SecurityCheckResponse>;
|
|
46
|
+
checkTx: (tx: Tx, origin: string, address: string, update_nonce?: boolean) => Promise<SecurityCheckResponse>;
|
|
47
|
+
preExecTx: ({ tx, origin, address, updateNonce, pending_tx_list, }: {
|
|
48
|
+
tx: Tx;
|
|
49
|
+
origin: string;
|
|
50
|
+
address: string;
|
|
51
|
+
updateNonce: boolean;
|
|
52
|
+
pending_tx_list: Tx[];
|
|
53
|
+
}) => Promise<ExplainTxResponse>;
|
|
54
|
+
historyGasUsed: (params: {
|
|
55
|
+
tx: Tx;
|
|
56
|
+
user_addr: string;
|
|
57
|
+
}) => Promise<{
|
|
58
|
+
gas_used: number;
|
|
59
|
+
}>;
|
|
60
|
+
pendingTxList: (tx: Tx, origin: string, address: string, update_nonce?: boolean) => Promise<Tx[]>;
|
|
61
|
+
traceTx: (txId: string, traceId: string, chainId: string) => Promise<void>;
|
|
62
|
+
pushTx: (tx: Tx, traceId?: string) => Promise<any>;
|
|
63
|
+
explainText: (origin: string, address: string, text: string) => Promise<{
|
|
64
|
+
comment: string;
|
|
65
|
+
}>;
|
|
66
|
+
gasMarket: (chainId: string, customGas?: number) => Promise<GasLevel[]>;
|
|
67
|
+
getTx: (chainId: string, hash: string, gasPrice: number) => Promise<GetTxResponse>;
|
|
68
|
+
getEnsAddressByName: (name: string) => Promise<{
|
|
69
|
+
addr: string;
|
|
70
|
+
name: string;
|
|
71
|
+
}>;
|
|
72
|
+
searchToken: (id: string, q: string, chainId?: string, is_all?: boolean) => Promise<TokenItem[]>;
|
|
73
|
+
searchSwapToken: (id: string, chainId: string, q: string, is_all?: boolean) => Promise<any>;
|
|
74
|
+
getToken: (id: string, chainId: string, tokenId: string) => Promise<TokenItem>;
|
|
75
|
+
getCachedTokenList: (id: string) => Promise<TokenItem[]>;
|
|
76
|
+
listToken: (id: string, chainId?: string, isAll?: boolean) => Promise<TokenItem[]>;
|
|
77
|
+
getHistoryTokenList: (params: {
|
|
78
|
+
id: string;
|
|
79
|
+
chainId?: string;
|
|
80
|
+
timeAt?: number;
|
|
81
|
+
dateAt?: string;
|
|
82
|
+
}) => Promise<TokenItem[]>;
|
|
83
|
+
_customListToken: (uuids: string[], id: string, isTestnet?: boolean) => Promise<TokenItem[]>;
|
|
84
|
+
customListToken: (uuids: string[], id: string) => Promise<TokenItem[]>;
|
|
85
|
+
listChainAssets: (id: string) => Promise<AssetItem[]>;
|
|
86
|
+
listNFT: (id: string, isAll?: boolean) => Promise<NFTItem[]>;
|
|
87
|
+
listCollection: (params: {
|
|
88
|
+
collection_ids: string;
|
|
89
|
+
}) => Promise<Collection[]>;
|
|
90
|
+
listTxHisotry: (params: {
|
|
91
|
+
id?: string;
|
|
92
|
+
chain_id?: string;
|
|
93
|
+
token_id?: string;
|
|
94
|
+
coin_id?: string;
|
|
95
|
+
start_time?: number;
|
|
96
|
+
page_count?: number;
|
|
97
|
+
}) => Promise<TxHistoryResult>;
|
|
98
|
+
getAllTxHistory: (params: {
|
|
99
|
+
id: string;
|
|
100
|
+
start_time?: number;
|
|
101
|
+
}, options?: Parameters<typeof this.asyncJob>[1]) => Promise<TxAllHistoryResult>;
|
|
102
|
+
tokenPrice: (tokenName: string) => Promise<{
|
|
103
|
+
change_percent: number;
|
|
104
|
+
last_price: number;
|
|
105
|
+
}>;
|
|
106
|
+
tokenAuthorizedList: (id: string, chain_id: string) => Promise<TokenApproval[]>;
|
|
107
|
+
userNFTAuthorizedList: (id: string, chain_id: string) => Promise<NFTApprovalResponse>;
|
|
108
|
+
getDEXList: (chain_id: string) => Promise<{
|
|
109
|
+
id: string;
|
|
110
|
+
name: string;
|
|
111
|
+
logo_url: string;
|
|
112
|
+
site_url: string;
|
|
113
|
+
type: string;
|
|
114
|
+
}[]>;
|
|
115
|
+
getSwapQuote: (params: {
|
|
116
|
+
id: string;
|
|
117
|
+
chain_id: string;
|
|
118
|
+
dex_id: string;
|
|
119
|
+
pay_token_id: string;
|
|
120
|
+
pay_token_raw_amount: string;
|
|
121
|
+
receive_token_id: string;
|
|
122
|
+
slippage?: string | number;
|
|
123
|
+
}) => Promise<{
|
|
124
|
+
receive_token_raw_amount: number;
|
|
125
|
+
dex_approve_to: string;
|
|
126
|
+
dex_swap_to: string;
|
|
127
|
+
dex_swap_calldata: string;
|
|
128
|
+
is_wrapped: boolean;
|
|
129
|
+
gas: {
|
|
130
|
+
gas_used: number;
|
|
131
|
+
gas_price: number;
|
|
132
|
+
gas_cost_value: number;
|
|
133
|
+
gas_cost_usd_value: number;
|
|
134
|
+
};
|
|
135
|
+
pay_token: TokenItem;
|
|
136
|
+
receive_token: TokenItem;
|
|
137
|
+
}>;
|
|
138
|
+
getSwapTokenList: (id: string, chainId?: string) => Promise<TokenItem[]>;
|
|
139
|
+
postGasStationOrder: (params: {
|
|
140
|
+
userAddr: string;
|
|
141
|
+
fromChainId: string;
|
|
142
|
+
fromTxId: string;
|
|
143
|
+
toChainId: string;
|
|
144
|
+
toTokenAmount: string;
|
|
145
|
+
fromTokenId: string;
|
|
146
|
+
fromTokenAmount: string;
|
|
147
|
+
fromUsdValue: number;
|
|
148
|
+
}) => Promise<any>;
|
|
149
|
+
getGasStationChainBalance: (chain_id: string, addr: string) => Promise<{
|
|
150
|
+
usd_value: number;
|
|
151
|
+
}>;
|
|
152
|
+
getGasStationTokenList: () => Promise<TokenItem[]>;
|
|
153
|
+
explainTypedData: (user_addr: string, origin: string, data: any) => Promise<ExplainTypedDataResponse>;
|
|
154
|
+
checkTypedData: (user_addr: string, origin: string, data: any) => Promise<SecurityCheckResponse>;
|
|
155
|
+
approvalStatus: (id: string) => Promise<ApprovalStatus[]>;
|
|
156
|
+
usedChainList: (id: string) => Promise<UsedChain[]>;
|
|
157
|
+
getLatestVersion: () => Promise<{
|
|
158
|
+
version_tag: string;
|
|
159
|
+
}>;
|
|
160
|
+
addOriginFeedback: (params: {
|
|
161
|
+
user_addr: string;
|
|
162
|
+
origin: string;
|
|
163
|
+
is_safe: boolean;
|
|
164
|
+
}) => Promise<{
|
|
165
|
+
is_success: boolean;
|
|
166
|
+
}>;
|
|
167
|
+
getProtocolList: (addr: string) => Promise<Protocol[]>;
|
|
168
|
+
getComplexProtocolList: (addr: string) => Promise<ComplexProtocol[]>;
|
|
169
|
+
getProtocol: ({ addr, id, }: {
|
|
170
|
+
addr: string;
|
|
171
|
+
id: string;
|
|
172
|
+
}) => Promise<ComplexProtocol>;
|
|
173
|
+
getHistoryProtocol: ({ addr, id, timeAt, dateAt, }: {
|
|
174
|
+
addr: string;
|
|
175
|
+
id: string;
|
|
176
|
+
timeAt?: number | undefined;
|
|
177
|
+
dateAt?: number | undefined;
|
|
178
|
+
}) => Promise<ComplexProtocol>;
|
|
179
|
+
getTokenHistoryPrice: ({ chainId, id, timeAt, }: {
|
|
180
|
+
chainId: string;
|
|
181
|
+
id: string;
|
|
182
|
+
timeAt: number;
|
|
183
|
+
}) => Promise<{
|
|
184
|
+
price: number;
|
|
185
|
+
}>;
|
|
186
|
+
getTokenHistoryDict: ({ chainId, ids, timeAt, }: {
|
|
187
|
+
chainId: string;
|
|
188
|
+
ids: string;
|
|
189
|
+
timeAt: number;
|
|
190
|
+
}) => Promise<Record<string, number>>;
|
|
191
|
+
getNetCurve: (addr: string) => Promise<{
|
|
192
|
+
timestamp: number;
|
|
193
|
+
usd_value: number;
|
|
194
|
+
}[]>;
|
|
195
|
+
getChainList: () => Promise<ServerChain[]>;
|
|
196
|
+
getCEXSwapQuote: (params: {
|
|
197
|
+
cex_id: string;
|
|
198
|
+
pay_token_id: string;
|
|
199
|
+
pay_token_amount: string;
|
|
200
|
+
receive_token_id: string;
|
|
201
|
+
chain_id: string;
|
|
202
|
+
}) => Promise<CEXQuote>;
|
|
203
|
+
getSwapTradeList: (params: {
|
|
204
|
+
user_addr: string;
|
|
205
|
+
start: string;
|
|
206
|
+
limit: string;
|
|
207
|
+
}) => Promise<SwapTradeList>;
|
|
208
|
+
postSwap: (params: {
|
|
209
|
+
quote: {
|
|
210
|
+
pay_token_id: string;
|
|
211
|
+
pay_token_amount: number;
|
|
212
|
+
receive_token_id: string;
|
|
213
|
+
receive_token_amount: number;
|
|
214
|
+
slippage: number;
|
|
215
|
+
};
|
|
216
|
+
dex_id: string;
|
|
217
|
+
tx_id: string;
|
|
218
|
+
tx: Tx;
|
|
219
|
+
}) => Promise<any>;
|
|
220
|
+
checkSlippage: (params: {
|
|
221
|
+
chain_id: string;
|
|
222
|
+
slippage: string;
|
|
223
|
+
from_token_id: string;
|
|
224
|
+
to_token_id: string;
|
|
225
|
+
}) => Promise<SlippageStatus>;
|
|
226
|
+
getOriginPopularityLevel: (origin: string) => Promise<{
|
|
227
|
+
level: 'very_low' | 'low' | 'medium' | 'high';
|
|
228
|
+
}>;
|
|
229
|
+
getOriginIsScam: (origin: string, source: string) => Promise<{
|
|
230
|
+
is_scam: boolean;
|
|
231
|
+
}>;
|
|
232
|
+
getOriginThirdPartyCollectList: (origin: string) => Promise<{
|
|
233
|
+
collect_list: {
|
|
234
|
+
name: string;
|
|
235
|
+
logo_url: string;
|
|
236
|
+
}[];
|
|
237
|
+
}>;
|
|
238
|
+
getSummarizedAssetList: (id: string, chain_id?: string) => Promise<Summary>;
|
|
239
|
+
parseTx: ({ chainId, tx, origin, addr, }: {
|
|
240
|
+
chainId: string;
|
|
241
|
+
tx: Tx;
|
|
242
|
+
origin: string;
|
|
243
|
+
addr: string;
|
|
244
|
+
}) => Promise<ParseTxResponse>;
|
|
245
|
+
isSuspiciousToken: (id: string, chainId: string) => Promise<{
|
|
246
|
+
is_suspicious: boolean;
|
|
247
|
+
}>;
|
|
248
|
+
depositCexSupport: (id: string, chainId: string, cexId: string) => Promise<{
|
|
249
|
+
support: boolean;
|
|
250
|
+
}>;
|
|
251
|
+
depositCexList: (id: string, chainId: string) => Promise<{
|
|
252
|
+
cex_list: Cex[];
|
|
253
|
+
}>;
|
|
254
|
+
getContractCredit: (id: string, chainId: string) => Promise<ContractCredit>;
|
|
255
|
+
hasInteraction: (addr: string, chainId: string, contractId: string) => Promise<{
|
|
256
|
+
has_interaction: boolean;
|
|
257
|
+
}>;
|
|
258
|
+
tokenApproveExposure: (id: string, chainId: string) => Promise<{
|
|
259
|
+
usd_value: number;
|
|
260
|
+
}>;
|
|
261
|
+
addrDesc: (id: string) => Promise<AddrDescResponse>;
|
|
262
|
+
hasTransfer: (chainId: string, from: string, to: string) => Promise<{
|
|
263
|
+
has_transfer: boolean;
|
|
264
|
+
}>;
|
|
265
|
+
isTokenContract: (chainId: string, id: string) => Promise<{
|
|
266
|
+
is_token: boolean;
|
|
267
|
+
}>;
|
|
268
|
+
addrUsedChainList: (id: string) => Promise<UsedChain[]>;
|
|
269
|
+
getTokenNFTExposure: (chainId: string, id: string) => Promise<{
|
|
270
|
+
usd_value: number;
|
|
271
|
+
}>;
|
|
272
|
+
getCollection: (chainId: string, id: string) => Promise<{
|
|
273
|
+
collection: CollectionWithFloorPrice;
|
|
274
|
+
}>;
|
|
275
|
+
isSuspiciousCollection: (chainId: string, id: string) => Promise<{
|
|
276
|
+
is_suspicious: boolean;
|
|
277
|
+
}>;
|
|
278
|
+
isOriginVerified: (origin: string) => Promise<{
|
|
279
|
+
is_verified: boolean | null;
|
|
280
|
+
}>;
|
|
281
|
+
parseTypedData: ({ typedData, origin, address, }: {
|
|
282
|
+
typedData: Record<string, any>;
|
|
283
|
+
origin: string;
|
|
284
|
+
address: string;
|
|
285
|
+
}) => Promise<ParseTypedDataResponse>;
|
|
286
|
+
parseText: ({ text, origin, address, }: {
|
|
287
|
+
text: string;
|
|
288
|
+
origin: string;
|
|
289
|
+
address: string;
|
|
290
|
+
}) => Promise<ParseTextResponse>;
|
|
291
|
+
collectionList: ({ id, chainId, isAll, }: {
|
|
292
|
+
id: string;
|
|
293
|
+
chainId?: string | undefined;
|
|
294
|
+
isAll: boolean;
|
|
295
|
+
}) => Promise<CollectionList[]>;
|
|
296
|
+
gasPriceStats: (chainId: string) => Promise<{
|
|
297
|
+
median: number;
|
|
298
|
+
}>;
|
|
299
|
+
badgeHasClaimed: (id: string) => Promise<{
|
|
300
|
+
id: string;
|
|
301
|
+
badge_id: number;
|
|
302
|
+
user_id: string;
|
|
303
|
+
inner_id: number;
|
|
304
|
+
create_at: number;
|
|
305
|
+
update_at: number;
|
|
306
|
+
has_claimed: true;
|
|
307
|
+
} | {
|
|
308
|
+
has_claimed: false;
|
|
309
|
+
}>;
|
|
310
|
+
badgeHasMinted: (id: string) => Promise<{
|
|
311
|
+
id: string;
|
|
312
|
+
badge_id: number;
|
|
313
|
+
user_id: string;
|
|
314
|
+
inner_id: number;
|
|
315
|
+
usd_value: number;
|
|
316
|
+
tvf: number;
|
|
317
|
+
mint_at: number;
|
|
318
|
+
has_minted: true;
|
|
319
|
+
} | {
|
|
320
|
+
has_minted: false;
|
|
321
|
+
}>;
|
|
322
|
+
mintBadge: (params: {
|
|
323
|
+
code: string;
|
|
324
|
+
userAddr: string;
|
|
325
|
+
}) => Promise<{
|
|
326
|
+
is_success: boolean;
|
|
327
|
+
inner_id: number;
|
|
328
|
+
}>;
|
|
329
|
+
userHasRequestedFaucet: (params: {
|
|
330
|
+
chain_id: string;
|
|
331
|
+
user_addr: string;
|
|
332
|
+
}) => Promise<{
|
|
333
|
+
has_requested: boolean;
|
|
334
|
+
}>;
|
|
335
|
+
requestFaucet: (params: {
|
|
336
|
+
chain_id: string;
|
|
337
|
+
user_addr: string;
|
|
338
|
+
}) => Promise<{
|
|
339
|
+
is_success: boolean;
|
|
340
|
+
}>;
|
|
341
|
+
gasSupportedPushType: (chainId: string) => Promise<{
|
|
342
|
+
low_gas: boolean;
|
|
343
|
+
mev: boolean;
|
|
344
|
+
}>;
|
|
345
|
+
submitTx: (postData: {
|
|
346
|
+
req_id?: string;
|
|
347
|
+
tx: Tx;
|
|
348
|
+
push_type: TxPushType;
|
|
349
|
+
low_gas_deadline?: number;
|
|
350
|
+
origin?: string;
|
|
351
|
+
}) => Promise<{
|
|
352
|
+
req: TxRequest;
|
|
353
|
+
}>;
|
|
354
|
+
getTxRequests: (ids: string | string[]) => Promise<TxRequest[]>;
|
|
355
|
+
getTxRequest: (id: string) => Promise<TxRequest>;
|
|
356
|
+
withdrawTx: (reqId: string) => Promise<{
|
|
357
|
+
req: TxRequest;
|
|
358
|
+
}>;
|
|
359
|
+
retryPushTx: (reqId: string) => Promise<{
|
|
360
|
+
req: TxRequest;
|
|
361
|
+
}>;
|
|
362
|
+
mempoolChecks: (txId: string, chainId: string, node_info?: boolean) => Promise<MempoolCheckDetail[]>;
|
|
363
|
+
getPendingTxList: (params: {
|
|
364
|
+
chain_id: string;
|
|
365
|
+
}, options?: Parameters<typeof this.asyncJob>[1]) => Promise<{
|
|
366
|
+
pending_tx_list: PendingTxItem[];
|
|
367
|
+
token_dict: Record<string, TokenItem | NFTItem>;
|
|
368
|
+
}>;
|
|
369
|
+
getLatestPreExec: (params: {
|
|
370
|
+
id: string;
|
|
371
|
+
}) => Promise<LatestExplainTxResponse>;
|
|
372
|
+
walletSupportChain: (params: {
|
|
373
|
+
chain_id: string;
|
|
374
|
+
user_addr: string;
|
|
375
|
+
}) => Promise<{
|
|
376
|
+
is_success: boolean;
|
|
377
|
+
count: number;
|
|
378
|
+
}>;
|
|
379
|
+
walletSupportOrigin: (params: {
|
|
380
|
+
origin: string;
|
|
381
|
+
user_addr: string;
|
|
382
|
+
text: string;
|
|
383
|
+
}) => Promise<{
|
|
384
|
+
is_success: boolean;
|
|
385
|
+
count: number;
|
|
386
|
+
}>;
|
|
387
|
+
walletSupportSelector: (params: {
|
|
388
|
+
selector: string;
|
|
389
|
+
user_addr: string;
|
|
390
|
+
chain_id: string;
|
|
391
|
+
contract_id: string;
|
|
392
|
+
}) => Promise<{
|
|
393
|
+
is_success: boolean;
|
|
394
|
+
count: number;
|
|
395
|
+
}>;
|
|
396
|
+
searchDapp: (params?: {
|
|
397
|
+
q?: string;
|
|
398
|
+
chain_id?: string;
|
|
399
|
+
start?: number;
|
|
400
|
+
limit?: number;
|
|
401
|
+
}) => Promise<{
|
|
402
|
+
page: {
|
|
403
|
+
limit: number;
|
|
404
|
+
start: number;
|
|
405
|
+
total: number;
|
|
406
|
+
};
|
|
407
|
+
dapps: BasicDappInfo[];
|
|
408
|
+
}>;
|
|
409
|
+
getDappsInfo: (params: {
|
|
410
|
+
ids: string[];
|
|
411
|
+
}) => Promise<BasicDappInfo[]>;
|
|
412
|
+
getDappHotTags: (params?: {
|
|
413
|
+
limit: number;
|
|
414
|
+
}) => Promise<string[]>;
|
|
415
|
+
getHotDapps: (params?: {
|
|
416
|
+
limit: number;
|
|
417
|
+
}) => Promise<BasicDappInfo[]>;
|
|
418
|
+
getRabbyClaimText: (params: {
|
|
419
|
+
id: string;
|
|
420
|
+
invite_code?: string;
|
|
421
|
+
}) => Promise<{
|
|
422
|
+
id: string;
|
|
423
|
+
text: string;
|
|
424
|
+
}>;
|
|
425
|
+
getRabbySignatureText: (params: {
|
|
426
|
+
id: string;
|
|
427
|
+
}) => Promise<{
|
|
428
|
+
id: string;
|
|
429
|
+
text: string;
|
|
430
|
+
}>;
|
|
431
|
+
getRabbyPoints: (params: {
|
|
432
|
+
id: string;
|
|
433
|
+
}) => Promise<{
|
|
434
|
+
id: string;
|
|
435
|
+
invite_code?: string;
|
|
436
|
+
logo_url: string;
|
|
437
|
+
logo_thumbnail_url: string;
|
|
438
|
+
web3_id: string;
|
|
439
|
+
claimed_points: number;
|
|
440
|
+
total_claimed_points: number;
|
|
441
|
+
}>;
|
|
442
|
+
checkRabbyPointsInviteCode: (params: {
|
|
443
|
+
code: string;
|
|
444
|
+
}) => Promise<{
|
|
445
|
+
invite_code_exist: boolean;
|
|
446
|
+
}>;
|
|
447
|
+
setRabbyPointsInviteCode: (params: {
|
|
448
|
+
id: string;
|
|
449
|
+
signature: string;
|
|
450
|
+
invite_code: string;
|
|
451
|
+
}) => Promise<{
|
|
452
|
+
code: number;
|
|
453
|
+
}>;
|
|
454
|
+
checkRabbyPointClaimable: (params: {
|
|
455
|
+
id: string;
|
|
456
|
+
}) => Promise<{
|
|
457
|
+
claimable: boolean;
|
|
458
|
+
}>;
|
|
459
|
+
getRabbyPointsSnapshot: (params: {
|
|
460
|
+
id: string;
|
|
461
|
+
}) => Promise<{
|
|
462
|
+
id: string;
|
|
463
|
+
address_balance: number;
|
|
464
|
+
metamask_swap: number;
|
|
465
|
+
rabby_old_user: number;
|
|
466
|
+
rabby_nadge: number;
|
|
467
|
+
rabby_nft: number;
|
|
468
|
+
extra_bouns: number;
|
|
469
|
+
claimed: boolean;
|
|
470
|
+
snapshot_at: number;
|
|
471
|
+
}>;
|
|
472
|
+
claimRabbyPointsSnapshot: (params: {
|
|
473
|
+
id: string;
|
|
474
|
+
signature: string;
|
|
475
|
+
invite_code?: string;
|
|
476
|
+
}) => Promise<{
|
|
477
|
+
error_code: number;
|
|
478
|
+
error_msg?: string;
|
|
479
|
+
}>;
|
|
480
|
+
getRabbyPointsTopUsers: (params: {
|
|
481
|
+
id: string;
|
|
482
|
+
}) => Promise<{
|
|
483
|
+
id: string;
|
|
484
|
+
logo_url: string;
|
|
485
|
+
logo_thumbnail_url: string;
|
|
486
|
+
web3_id: string;
|
|
487
|
+
claimed_points: number;
|
|
488
|
+
}[]>;
|
|
489
|
+
getRabbyPointsList: (params: {
|
|
490
|
+
id: string;
|
|
491
|
+
}) => Promise<{
|
|
492
|
+
id: number;
|
|
493
|
+
title: string;
|
|
494
|
+
description: string;
|
|
495
|
+
start_at: number;
|
|
496
|
+
end_at: number;
|
|
497
|
+
claimable_points: number;
|
|
498
|
+
}[]>;
|
|
499
|
+
claimRabbyPointsById: (params: {
|
|
500
|
+
campaign_id: number;
|
|
501
|
+
user_id: string;
|
|
502
|
+
signature: string;
|
|
503
|
+
}) => Promise<{
|
|
504
|
+
error_code: number;
|
|
505
|
+
}>;
|
|
506
|
+
getSupportedChains: () => Promise<SupportedChain[]>;
|
|
507
|
+
}
|
|
508
|
+
export {};
|