@rabby-wallet/rabby-api 0.6.13 → 0.6.14
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 +25 -25
- package/dist/index.d.ts +278 -278
- package/dist/index.js +722 -722
- package/dist/types.d.ts +969 -964
- package/dist/types.js +1 -1
- package/dist/utils.d.ts +11 -11
- package/dist/utils.js +35 -35
- package/package.json +53 -53
package/README.md
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
# rabby-api
|
|
2
|
-
|
|
3
|
-
## Install
|
|
4
|
-
|
|
5
|
-
```bash
|
|
6
|
-
npm install rabby-api @debank/common
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
## Usage
|
|
10
|
-
|
|
11
|
-
```ts
|
|
12
|
-
import { OpenApiService } from 'rabby-api';
|
|
13
|
-
|
|
14
|
-
const service = new OpenApiService({
|
|
15
|
-
store: {
|
|
16
|
-
host: 'https://api.rabby.io'
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
// init service
|
|
21
|
-
await service.init();
|
|
22
|
-
|
|
23
|
-
// call api
|
|
24
|
-
await service.getTotalBalance('0x1234');
|
|
25
|
-
```
|
|
1
|
+
# rabby-api
|
|
2
|
+
|
|
3
|
+
## Install
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install rabby-api @debank/common
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { OpenApiService } from 'rabby-api';
|
|
13
|
+
|
|
14
|
+
const service = new OpenApiService({
|
|
15
|
+
store: {
|
|
16
|
+
host: 'https://api.rabby.io'
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// init service
|
|
21
|
+
await service.init();
|
|
22
|
+
|
|
23
|
+
// call api
|
|
24
|
+
await service.getTotalBalance('0x1234');
|
|
25
|
+
```
|
package/dist/index.d.ts
CHANGED
|
@@ -1,278 +1,278 @@
|
|
|
1
|
-
import { AxiosAdapter } from 'axios';
|
|
2
|
-
import { RateLimitedAxiosInstance } from 'axios-rate-limit';
|
|
3
|
-
import { ServerChain, TotalBalanceResponse, ChainWithPendingCount, SecurityCheckResponse, Tx, ExplainTxResponse, GasLevel, GetTxResponse, TokenItem, AssetItem, NFTItem, Collection, TxHistoryResult, TokenApproval, NFTApprovalResponse, ApprovalStatus, UsedChain, Protocol, ComplexProtocol, ExplainTypedDataResponse, SwapTradeList, SlippageStatus, CEXQuote, Summary, Cex, ContractCredit, AddrDescResponse, ParseTxResponse, CollectionWithFloorPrice, ParseTypedDataResponse, ParseTextResponse, CollectionList } from './types';
|
|
4
|
-
interface OpenApiStore {
|
|
5
|
-
host: string;
|
|
6
|
-
}
|
|
7
|
-
interface Options {
|
|
8
|
-
store: OpenApiStore;
|
|
9
|
-
adapter?: AxiosAdapter;
|
|
10
|
-
}
|
|
11
|
-
export declare class OpenApiService {
|
|
12
|
-
store: OpenApiStore;
|
|
13
|
-
request: RateLimitedAxiosInstance;
|
|
14
|
-
setHost: (host: string) => Promise<void>;
|
|
15
|
-
getHost: () => string;
|
|
16
|
-
ethRpc: ((chainId: string, arg: {
|
|
17
|
-
method: string;
|
|
18
|
-
params: Array<any>;
|
|
19
|
-
origin?: string;
|
|
20
|
-
}) => Promise<any>) | (() => Promise<never>);
|
|
21
|
-
adapter?: AxiosAdapter;
|
|
22
|
-
constructor({ store, adapter }: Options);
|
|
23
|
-
init: (hf?: string) => Promise<void>;
|
|
24
|
-
private _mountMethods;
|
|
25
|
-
getRecommendChains: (address: string, origin: string) => Promise<ServerChain[]>;
|
|
26
|
-
getTotalBalance: (address: string) => Promise<TotalBalanceResponse>;
|
|
27
|
-
getPendingCount: (address: string) => Promise<{
|
|
28
|
-
total_count: number;
|
|
29
|
-
chains: ChainWithPendingCount[];
|
|
30
|
-
}>;
|
|
31
|
-
checkOrigin: (address: string, origin: string) => Promise<SecurityCheckResponse>;
|
|
32
|
-
checkText: (address: string, origin: string, text: string) => Promise<SecurityCheckResponse>;
|
|
33
|
-
checkTx: (tx: Tx, origin: string, address: string, update_nonce?: boolean) => Promise<SecurityCheckResponse>;
|
|
34
|
-
preExecTx: ({ tx, origin, address, updateNonce, pending_tx_list, }: {
|
|
35
|
-
tx: Tx;
|
|
36
|
-
origin: string;
|
|
37
|
-
address: string;
|
|
38
|
-
updateNonce: boolean;
|
|
39
|
-
pending_tx_list: Tx[];
|
|
40
|
-
}) => Promise<ExplainTxResponse>;
|
|
41
|
-
historyGasUsed: (params: {
|
|
42
|
-
tx: Tx;
|
|
43
|
-
user_addr: string;
|
|
44
|
-
}) => Promise<{
|
|
45
|
-
gas_used: number;
|
|
46
|
-
}>;
|
|
47
|
-
pendingTxList: (tx: Tx, origin: string, address: string, update_nonce?: boolean) => Promise<Tx[]>;
|
|
48
|
-
traceTx: (txId: string, traceId: string, chainId: string) => Promise<void>;
|
|
49
|
-
pushTx: (tx: Tx, traceId?: string) => Promise<any>;
|
|
50
|
-
explainText: (origin: string, address: string, text: string) => Promise<{
|
|
51
|
-
comment: string;
|
|
52
|
-
}>;
|
|
53
|
-
gasMarket: (chainId: string, customGas?: number) => Promise<GasLevel[]>;
|
|
54
|
-
getTx: (chainId: string, hash: string, gasPrice: number) => Promise<GetTxResponse>;
|
|
55
|
-
getEnsAddressByName: (name: string) => Promise<{
|
|
56
|
-
addr: string;
|
|
57
|
-
name: string;
|
|
58
|
-
}>;
|
|
59
|
-
searchToken: (id: string, q: string, chainId?: string, is_all?: boolean) => Promise<TokenItem[]>;
|
|
60
|
-
searchSwapToken: (id: string, chainId: string, q: string, is_all?: boolean) => Promise<any>;
|
|
61
|
-
getToken: (id: string, chainId: string, tokenId: string) => Promise<TokenItem>;
|
|
62
|
-
getCachedTokenList: (id: string) => Promise<TokenItem[]>;
|
|
63
|
-
listToken: (id: string, chainId?: string, isAll?: boolean) => Promise<TokenItem[]>;
|
|
64
|
-
getHistoryTokenList: (params: {
|
|
65
|
-
id: string;
|
|
66
|
-
chainId?: string;
|
|
67
|
-
timeAt?: number;
|
|
68
|
-
dateAt?: string;
|
|
69
|
-
}) => Promise<TokenItem[]>;
|
|
70
|
-
customListToken: (uuids: string[], id: string) => Promise<TokenItem[]>;
|
|
71
|
-
listChainAssets: (id: string) => Promise<AssetItem[]>;
|
|
72
|
-
listNFT: (id: string, isAll?: boolean) => Promise<NFTItem[]>;
|
|
73
|
-
listCollection: (params: {
|
|
74
|
-
collection_ids: string;
|
|
75
|
-
}) => Promise<Collection[]>;
|
|
76
|
-
listTxHisotry: (params: {
|
|
77
|
-
id?: string;
|
|
78
|
-
chain_id?: string;
|
|
79
|
-
token_id?: string;
|
|
80
|
-
coin_id?: string;
|
|
81
|
-
start_time?: number;
|
|
82
|
-
page_count?: number;
|
|
83
|
-
}) => Promise<TxHistoryResult>;
|
|
84
|
-
tokenPrice: (tokenName: string) => Promise<{
|
|
85
|
-
change_percent: number;
|
|
86
|
-
last_price: number;
|
|
87
|
-
}>;
|
|
88
|
-
tokenAuthorizedList: (id: string, chain_id: string) => Promise<TokenApproval[]>;
|
|
89
|
-
userNFTAuthorizedList: (id: string, chain_id: string) => Promise<NFTApprovalResponse>;
|
|
90
|
-
getDEXList: (chain_id: string) => Promise<{
|
|
91
|
-
id: string;
|
|
92
|
-
name: string;
|
|
93
|
-
logo_url: string;
|
|
94
|
-
site_url: string;
|
|
95
|
-
type: string;
|
|
96
|
-
}[]>;
|
|
97
|
-
getSwapQuote: (params: {
|
|
98
|
-
id: string;
|
|
99
|
-
chain_id: string;
|
|
100
|
-
dex_id: string;
|
|
101
|
-
pay_token_id: string;
|
|
102
|
-
pay_token_raw_amount: string;
|
|
103
|
-
receive_token_id: string;
|
|
104
|
-
}) => Promise<{
|
|
105
|
-
receive_token_raw_amount: number;
|
|
106
|
-
dex_approve_to: string;
|
|
107
|
-
dex_swap_to: string;
|
|
108
|
-
dex_swap_calldata: string;
|
|
109
|
-
is_wrapped: boolean;
|
|
110
|
-
gas: {
|
|
111
|
-
gas_used: number;
|
|
112
|
-
gas_price: number;
|
|
113
|
-
gas_cost_value: number;
|
|
114
|
-
gas_cost_usd_value: number;
|
|
115
|
-
};
|
|
116
|
-
pay_token: TokenItem;
|
|
117
|
-
receive_token: TokenItem;
|
|
118
|
-
}>;
|
|
119
|
-
getSwapTokenList: (id: string, chainId?: string) => Promise<TokenItem[]>;
|
|
120
|
-
postGasStationOrder: (params: {
|
|
121
|
-
userAddr: string;
|
|
122
|
-
fromChainId: string;
|
|
123
|
-
fromTxId: string;
|
|
124
|
-
toChainId: string;
|
|
125
|
-
toTokenAmount: string;
|
|
126
|
-
fromTokenId: string;
|
|
127
|
-
fromTokenAmount: string;
|
|
128
|
-
fromUsdValue: number;
|
|
129
|
-
}) => Promise<any>;
|
|
130
|
-
getGasStationChainBalance: (chain_id: string, addr: string) => Promise<{
|
|
131
|
-
usd_value: number;
|
|
132
|
-
}>;
|
|
133
|
-
getGasStationTokenList: () => Promise<TokenItem[]>;
|
|
134
|
-
explainTypedData: (user_addr: string, origin: string, data: any) => Promise<ExplainTypedDataResponse>;
|
|
135
|
-
checkTypedData: (user_addr: string, origin: string, data: any) => Promise<SecurityCheckResponse>;
|
|
136
|
-
approvalStatus: (id: string) => Promise<ApprovalStatus[]>;
|
|
137
|
-
usedChainList: (id: string) => Promise<UsedChain[]>;
|
|
138
|
-
getLatestVersion: () => Promise<{
|
|
139
|
-
version_tag: string;
|
|
140
|
-
}>;
|
|
141
|
-
addOriginFeedback: (params: {
|
|
142
|
-
user_addr: string;
|
|
143
|
-
origin: string;
|
|
144
|
-
is_safe: boolean;
|
|
145
|
-
}) => Promise<{
|
|
146
|
-
is_success: boolean;
|
|
147
|
-
}>;
|
|
148
|
-
getProtocolList: (addr: string) => Promise<Protocol[]>;
|
|
149
|
-
getComplexProtocolList: (addr: string) => Promise<ComplexProtocol[]>;
|
|
150
|
-
getProtocol: ({ addr, id, }: {
|
|
151
|
-
addr: string;
|
|
152
|
-
id: string;
|
|
153
|
-
}) => Promise<ComplexProtocol>;
|
|
154
|
-
getHistoryProtocol: ({ addr, id, timeAt, dateAt, }: {
|
|
155
|
-
addr: string;
|
|
156
|
-
id: string;
|
|
157
|
-
timeAt?: number | undefined;
|
|
158
|
-
dateAt?: number | undefined;
|
|
159
|
-
}) => Promise<ComplexProtocol>;
|
|
160
|
-
getTokenHistoryPrice: ({ chainId, id, timeAt, }: {
|
|
161
|
-
chainId: string;
|
|
162
|
-
id: string;
|
|
163
|
-
timeAt: number;
|
|
164
|
-
}) => Promise<{
|
|
165
|
-
price: number;
|
|
166
|
-
}>;
|
|
167
|
-
getTokenHistoryDict: ({ chainId, ids, timeAt, }: {
|
|
168
|
-
chainId: string;
|
|
169
|
-
ids: string;
|
|
170
|
-
timeAt: number;
|
|
171
|
-
}) => Promise<Record<string, number>>;
|
|
172
|
-
getNetCurve: (addr: string) => Promise<{
|
|
173
|
-
timestamp: number;
|
|
174
|
-
usd_value: number;
|
|
175
|
-
}[]>;
|
|
176
|
-
getChainList: () => Promise<ServerChain[]>;
|
|
177
|
-
getCEXSwapQuote: (params: {
|
|
178
|
-
cex_id: string;
|
|
179
|
-
pay_token_id: string;
|
|
180
|
-
pay_token_amount: string;
|
|
181
|
-
receive_token_id: string;
|
|
182
|
-
chain_id: string;
|
|
183
|
-
}) => Promise<CEXQuote>;
|
|
184
|
-
getSwapTradeList: (params: {
|
|
185
|
-
user_addr: string;
|
|
186
|
-
start: string;
|
|
187
|
-
limit: string;
|
|
188
|
-
}) => Promise<SwapTradeList>;
|
|
189
|
-
postSwap: (params: {
|
|
190
|
-
quote: {
|
|
191
|
-
pay_token_id: string;
|
|
192
|
-
pay_token_amount: number;
|
|
193
|
-
receive_token_id: string;
|
|
194
|
-
receive_token_amount: number;
|
|
195
|
-
slippage: number;
|
|
196
|
-
};
|
|
197
|
-
dex_id: string;
|
|
198
|
-
tx_id: string;
|
|
199
|
-
tx: Tx;
|
|
200
|
-
}) => Promise<any>;
|
|
201
|
-
checkSlippage: (params: {
|
|
202
|
-
chain_id: string;
|
|
203
|
-
slippage: string;
|
|
204
|
-
from_token_id: string;
|
|
205
|
-
to_token_id: string;
|
|
206
|
-
}) => Promise<SlippageStatus>;
|
|
207
|
-
getOriginPopularityLevel: (origin: string) => Promise<{
|
|
208
|
-
level: 'very_low' | 'low' | 'medium' | 'high';
|
|
209
|
-
}>;
|
|
210
|
-
getOriginIsScam: (origin: string, source: string) => Promise<{
|
|
211
|
-
is_scam: boolean;
|
|
212
|
-
}>;
|
|
213
|
-
getOriginThirdPartyCollectList: (origin: string) => Promise<{
|
|
214
|
-
collect_list: {
|
|
215
|
-
name: string;
|
|
216
|
-
logo_url: string;
|
|
217
|
-
}[];
|
|
218
|
-
}>;
|
|
219
|
-
getSummarizedAssetList: (id: string, chain_id?: string) => Promise<Summary>;
|
|
220
|
-
parseTx: ({ chainId, tx, origin, addr, }: {
|
|
221
|
-
chainId: string;
|
|
222
|
-
tx: Tx;
|
|
223
|
-
origin: string;
|
|
224
|
-
addr: string;
|
|
225
|
-
}) => Promise<ParseTxResponse>;
|
|
226
|
-
isSuspiciousToken: (id: string, chainId: string) => Promise<{
|
|
227
|
-
is_suspicious: boolean;
|
|
228
|
-
}>;
|
|
229
|
-
depositCexSupport: (id: string, chainId: string, cexId: string) => Promise<{
|
|
230
|
-
support: boolean;
|
|
231
|
-
}>;
|
|
232
|
-
depositCexList: (id: string, chainId: string) => Promise<{
|
|
233
|
-
cex_list: Cex[];
|
|
234
|
-
}>;
|
|
235
|
-
getContractCredit: (id: string, chainId: string) => Promise<ContractCredit>;
|
|
236
|
-
hasInteraction: (addr: string, chainId: string, contractId: string) => Promise<{
|
|
237
|
-
has_interaction: boolean;
|
|
238
|
-
}>;
|
|
239
|
-
tokenApproveExposure: (id: string, chainId: string) => Promise<{
|
|
240
|
-
usd_value: number;
|
|
241
|
-
}>;
|
|
242
|
-
addrDesc: (id: string) => Promise<AddrDescResponse>;
|
|
243
|
-
hasTransfer: (chainId: string, from: string, to: string) => Promise<{
|
|
244
|
-
has_transfer: boolean;
|
|
245
|
-
}>;
|
|
246
|
-
isTokenContract: (chainId: string, id: string) => Promise<{
|
|
247
|
-
is_token: boolean;
|
|
248
|
-
}>;
|
|
249
|
-
addrUsedChainList: (id: string) => Promise<UsedChain[]>;
|
|
250
|
-
getTokenNFTExposure: (chainId: string, id: string) => Promise<{
|
|
251
|
-
usd_value: number;
|
|
252
|
-
}>;
|
|
253
|
-
getCollection: (chainId: string, id: string) => Promise<{
|
|
254
|
-
collection: CollectionWithFloorPrice;
|
|
255
|
-
}>;
|
|
256
|
-
isSuspiciousCollection: (chainId: string, id: string) => Promise<{
|
|
257
|
-
is_suspicious: boolean;
|
|
258
|
-
}>;
|
|
259
|
-
isOriginVerified: (origin: string) => Promise<{
|
|
260
|
-
is_verified: boolean | null;
|
|
261
|
-
}>;
|
|
262
|
-
parseTypedData: ({ typedData, origin, address, }: {
|
|
263
|
-
typedData: Record<string, any>;
|
|
264
|
-
origin: string;
|
|
265
|
-
address: string;
|
|
266
|
-
}) => Promise<ParseTypedDataResponse>;
|
|
267
|
-
parseText: ({ text, origin, address, }: {
|
|
268
|
-
text: string;
|
|
269
|
-
origin: string;
|
|
270
|
-
address: string;
|
|
271
|
-
}) => Promise<ParseTextResponse>;
|
|
272
|
-
collectionList: ({ id, chainId, isAll, }: {
|
|
273
|
-
id: string;
|
|
274
|
-
chainId?: string | undefined;
|
|
275
|
-
isAll: boolean;
|
|
276
|
-
}) => Promise<CollectionList[]>;
|
|
277
|
-
}
|
|
278
|
-
export {};
|
|
1
|
+
import { AxiosAdapter } from 'axios';
|
|
2
|
+
import { RateLimitedAxiosInstance } from 'axios-rate-limit';
|
|
3
|
+
import { ServerChain, TotalBalanceResponse, ChainWithPendingCount, SecurityCheckResponse, Tx, ExplainTxResponse, GasLevel, GetTxResponse, TokenItem, AssetItem, NFTItem, Collection, TxHistoryResult, TokenApproval, NFTApprovalResponse, ApprovalStatus, UsedChain, Protocol, ComplexProtocol, ExplainTypedDataResponse, SwapTradeList, SlippageStatus, CEXQuote, Summary, Cex, ContractCredit, AddrDescResponse, ParseTxResponse, CollectionWithFloorPrice, ParseTypedDataResponse, ParseTextResponse, CollectionList } from './types';
|
|
4
|
+
interface OpenApiStore {
|
|
5
|
+
host: string;
|
|
6
|
+
}
|
|
7
|
+
interface Options {
|
|
8
|
+
store: OpenApiStore;
|
|
9
|
+
adapter?: AxiosAdapter;
|
|
10
|
+
}
|
|
11
|
+
export declare class OpenApiService {
|
|
12
|
+
store: OpenApiStore;
|
|
13
|
+
request: RateLimitedAxiosInstance;
|
|
14
|
+
setHost: (host: string) => Promise<void>;
|
|
15
|
+
getHost: () => string;
|
|
16
|
+
ethRpc: ((chainId: string, arg: {
|
|
17
|
+
method: string;
|
|
18
|
+
params: Array<any>;
|
|
19
|
+
origin?: string;
|
|
20
|
+
}) => Promise<any>) | (() => Promise<never>);
|
|
21
|
+
adapter?: AxiosAdapter;
|
|
22
|
+
constructor({ store, adapter }: Options);
|
|
23
|
+
init: (hf?: string) => Promise<void>;
|
|
24
|
+
private _mountMethods;
|
|
25
|
+
getRecommendChains: (address: string, origin: string) => Promise<ServerChain[]>;
|
|
26
|
+
getTotalBalance: (address: string) => Promise<TotalBalanceResponse>;
|
|
27
|
+
getPendingCount: (address: string) => Promise<{
|
|
28
|
+
total_count: number;
|
|
29
|
+
chains: ChainWithPendingCount[];
|
|
30
|
+
}>;
|
|
31
|
+
checkOrigin: (address: string, origin: string) => Promise<SecurityCheckResponse>;
|
|
32
|
+
checkText: (address: string, origin: string, text: string) => Promise<SecurityCheckResponse>;
|
|
33
|
+
checkTx: (tx: Tx, origin: string, address: string, update_nonce?: boolean) => Promise<SecurityCheckResponse>;
|
|
34
|
+
preExecTx: ({ tx, origin, address, updateNonce, pending_tx_list, }: {
|
|
35
|
+
tx: Tx;
|
|
36
|
+
origin: string;
|
|
37
|
+
address: string;
|
|
38
|
+
updateNonce: boolean;
|
|
39
|
+
pending_tx_list: Tx[];
|
|
40
|
+
}) => Promise<ExplainTxResponse>;
|
|
41
|
+
historyGasUsed: (params: {
|
|
42
|
+
tx: Tx;
|
|
43
|
+
user_addr: string;
|
|
44
|
+
}) => Promise<{
|
|
45
|
+
gas_used: number;
|
|
46
|
+
}>;
|
|
47
|
+
pendingTxList: (tx: Tx, origin: string, address: string, update_nonce?: boolean) => Promise<Tx[]>;
|
|
48
|
+
traceTx: (txId: string, traceId: string, chainId: string) => Promise<void>;
|
|
49
|
+
pushTx: (tx: Tx, traceId?: string) => Promise<any>;
|
|
50
|
+
explainText: (origin: string, address: string, text: string) => Promise<{
|
|
51
|
+
comment: string;
|
|
52
|
+
}>;
|
|
53
|
+
gasMarket: (chainId: string, customGas?: number) => Promise<GasLevel[]>;
|
|
54
|
+
getTx: (chainId: string, hash: string, gasPrice: number) => Promise<GetTxResponse>;
|
|
55
|
+
getEnsAddressByName: (name: string) => Promise<{
|
|
56
|
+
addr: string;
|
|
57
|
+
name: string;
|
|
58
|
+
}>;
|
|
59
|
+
searchToken: (id: string, q: string, chainId?: string, is_all?: boolean) => Promise<TokenItem[]>;
|
|
60
|
+
searchSwapToken: (id: string, chainId: string, q: string, is_all?: boolean) => Promise<any>;
|
|
61
|
+
getToken: (id: string, chainId: string, tokenId: string) => Promise<TokenItem>;
|
|
62
|
+
getCachedTokenList: (id: string) => Promise<TokenItem[]>;
|
|
63
|
+
listToken: (id: string, chainId?: string, isAll?: boolean) => Promise<TokenItem[]>;
|
|
64
|
+
getHistoryTokenList: (params: {
|
|
65
|
+
id: string;
|
|
66
|
+
chainId?: string;
|
|
67
|
+
timeAt?: number;
|
|
68
|
+
dateAt?: string;
|
|
69
|
+
}) => Promise<TokenItem[]>;
|
|
70
|
+
customListToken: (uuids: string[], id: string) => Promise<TokenItem[]>;
|
|
71
|
+
listChainAssets: (id: string) => Promise<AssetItem[]>;
|
|
72
|
+
listNFT: (id: string, isAll?: boolean) => Promise<NFTItem[]>;
|
|
73
|
+
listCollection: (params: {
|
|
74
|
+
collection_ids: string;
|
|
75
|
+
}) => Promise<Collection[]>;
|
|
76
|
+
listTxHisotry: (params: {
|
|
77
|
+
id?: string;
|
|
78
|
+
chain_id?: string;
|
|
79
|
+
token_id?: string;
|
|
80
|
+
coin_id?: string;
|
|
81
|
+
start_time?: number;
|
|
82
|
+
page_count?: number;
|
|
83
|
+
}) => Promise<TxHistoryResult>;
|
|
84
|
+
tokenPrice: (tokenName: string) => Promise<{
|
|
85
|
+
change_percent: number;
|
|
86
|
+
last_price: number;
|
|
87
|
+
}>;
|
|
88
|
+
tokenAuthorizedList: (id: string, chain_id: string) => Promise<TokenApproval[]>;
|
|
89
|
+
userNFTAuthorizedList: (id: string, chain_id: string) => Promise<NFTApprovalResponse>;
|
|
90
|
+
getDEXList: (chain_id: string) => Promise<{
|
|
91
|
+
id: string;
|
|
92
|
+
name: string;
|
|
93
|
+
logo_url: string;
|
|
94
|
+
site_url: string;
|
|
95
|
+
type: string;
|
|
96
|
+
}[]>;
|
|
97
|
+
getSwapQuote: (params: {
|
|
98
|
+
id: string;
|
|
99
|
+
chain_id: string;
|
|
100
|
+
dex_id: string;
|
|
101
|
+
pay_token_id: string;
|
|
102
|
+
pay_token_raw_amount: string;
|
|
103
|
+
receive_token_id: string;
|
|
104
|
+
}) => Promise<{
|
|
105
|
+
receive_token_raw_amount: number;
|
|
106
|
+
dex_approve_to: string;
|
|
107
|
+
dex_swap_to: string;
|
|
108
|
+
dex_swap_calldata: string;
|
|
109
|
+
is_wrapped: boolean;
|
|
110
|
+
gas: {
|
|
111
|
+
gas_used: number;
|
|
112
|
+
gas_price: number;
|
|
113
|
+
gas_cost_value: number;
|
|
114
|
+
gas_cost_usd_value: number;
|
|
115
|
+
};
|
|
116
|
+
pay_token: TokenItem;
|
|
117
|
+
receive_token: TokenItem;
|
|
118
|
+
}>;
|
|
119
|
+
getSwapTokenList: (id: string, chainId?: string) => Promise<TokenItem[]>;
|
|
120
|
+
postGasStationOrder: (params: {
|
|
121
|
+
userAddr: string;
|
|
122
|
+
fromChainId: string;
|
|
123
|
+
fromTxId: string;
|
|
124
|
+
toChainId: string;
|
|
125
|
+
toTokenAmount: string;
|
|
126
|
+
fromTokenId: string;
|
|
127
|
+
fromTokenAmount: string;
|
|
128
|
+
fromUsdValue: number;
|
|
129
|
+
}) => Promise<any>;
|
|
130
|
+
getGasStationChainBalance: (chain_id: string, addr: string) => Promise<{
|
|
131
|
+
usd_value: number;
|
|
132
|
+
}>;
|
|
133
|
+
getGasStationTokenList: () => Promise<TokenItem[]>;
|
|
134
|
+
explainTypedData: (user_addr: string, origin: string, data: any) => Promise<ExplainTypedDataResponse>;
|
|
135
|
+
checkTypedData: (user_addr: string, origin: string, data: any) => Promise<SecurityCheckResponse>;
|
|
136
|
+
approvalStatus: (id: string) => Promise<ApprovalStatus[]>;
|
|
137
|
+
usedChainList: (id: string) => Promise<UsedChain[]>;
|
|
138
|
+
getLatestVersion: () => Promise<{
|
|
139
|
+
version_tag: string;
|
|
140
|
+
}>;
|
|
141
|
+
addOriginFeedback: (params: {
|
|
142
|
+
user_addr: string;
|
|
143
|
+
origin: string;
|
|
144
|
+
is_safe: boolean;
|
|
145
|
+
}) => Promise<{
|
|
146
|
+
is_success: boolean;
|
|
147
|
+
}>;
|
|
148
|
+
getProtocolList: (addr: string) => Promise<Protocol[]>;
|
|
149
|
+
getComplexProtocolList: (addr: string) => Promise<ComplexProtocol[]>;
|
|
150
|
+
getProtocol: ({ addr, id, }: {
|
|
151
|
+
addr: string;
|
|
152
|
+
id: string;
|
|
153
|
+
}) => Promise<ComplexProtocol>;
|
|
154
|
+
getHistoryProtocol: ({ addr, id, timeAt, dateAt, }: {
|
|
155
|
+
addr: string;
|
|
156
|
+
id: string;
|
|
157
|
+
timeAt?: number | undefined;
|
|
158
|
+
dateAt?: number | undefined;
|
|
159
|
+
}) => Promise<ComplexProtocol>;
|
|
160
|
+
getTokenHistoryPrice: ({ chainId, id, timeAt, }: {
|
|
161
|
+
chainId: string;
|
|
162
|
+
id: string;
|
|
163
|
+
timeAt: number;
|
|
164
|
+
}) => Promise<{
|
|
165
|
+
price: number;
|
|
166
|
+
}>;
|
|
167
|
+
getTokenHistoryDict: ({ chainId, ids, timeAt, }: {
|
|
168
|
+
chainId: string;
|
|
169
|
+
ids: string;
|
|
170
|
+
timeAt: number;
|
|
171
|
+
}) => Promise<Record<string, number>>;
|
|
172
|
+
getNetCurve: (addr: string) => Promise<{
|
|
173
|
+
timestamp: number;
|
|
174
|
+
usd_value: number;
|
|
175
|
+
}[]>;
|
|
176
|
+
getChainList: () => Promise<ServerChain[]>;
|
|
177
|
+
getCEXSwapQuote: (params: {
|
|
178
|
+
cex_id: string;
|
|
179
|
+
pay_token_id: string;
|
|
180
|
+
pay_token_amount: string;
|
|
181
|
+
receive_token_id: string;
|
|
182
|
+
chain_id: string;
|
|
183
|
+
}) => Promise<CEXQuote>;
|
|
184
|
+
getSwapTradeList: (params: {
|
|
185
|
+
user_addr: string;
|
|
186
|
+
start: string;
|
|
187
|
+
limit: string;
|
|
188
|
+
}) => Promise<SwapTradeList>;
|
|
189
|
+
postSwap: (params: {
|
|
190
|
+
quote: {
|
|
191
|
+
pay_token_id: string;
|
|
192
|
+
pay_token_amount: number;
|
|
193
|
+
receive_token_id: string;
|
|
194
|
+
receive_token_amount: number;
|
|
195
|
+
slippage: number;
|
|
196
|
+
};
|
|
197
|
+
dex_id: string;
|
|
198
|
+
tx_id: string;
|
|
199
|
+
tx: Tx;
|
|
200
|
+
}) => Promise<any>;
|
|
201
|
+
checkSlippage: (params: {
|
|
202
|
+
chain_id: string;
|
|
203
|
+
slippage: string;
|
|
204
|
+
from_token_id: string;
|
|
205
|
+
to_token_id: string;
|
|
206
|
+
}) => Promise<SlippageStatus>;
|
|
207
|
+
getOriginPopularityLevel: (origin: string) => Promise<{
|
|
208
|
+
level: 'very_low' | 'low' | 'medium' | 'high';
|
|
209
|
+
}>;
|
|
210
|
+
getOriginIsScam: (origin: string, source: string) => Promise<{
|
|
211
|
+
is_scam: boolean;
|
|
212
|
+
}>;
|
|
213
|
+
getOriginThirdPartyCollectList: (origin: string) => Promise<{
|
|
214
|
+
collect_list: {
|
|
215
|
+
name: string;
|
|
216
|
+
logo_url: string;
|
|
217
|
+
}[];
|
|
218
|
+
}>;
|
|
219
|
+
getSummarizedAssetList: (id: string, chain_id?: string) => Promise<Summary>;
|
|
220
|
+
parseTx: ({ chainId, tx, origin, addr, }: {
|
|
221
|
+
chainId: string;
|
|
222
|
+
tx: Tx;
|
|
223
|
+
origin: string;
|
|
224
|
+
addr: string;
|
|
225
|
+
}) => Promise<ParseTxResponse>;
|
|
226
|
+
isSuspiciousToken: (id: string, chainId: string) => Promise<{
|
|
227
|
+
is_suspicious: boolean;
|
|
228
|
+
}>;
|
|
229
|
+
depositCexSupport: (id: string, chainId: string, cexId: string) => Promise<{
|
|
230
|
+
support: boolean;
|
|
231
|
+
}>;
|
|
232
|
+
depositCexList: (id: string, chainId: string) => Promise<{
|
|
233
|
+
cex_list: Cex[];
|
|
234
|
+
}>;
|
|
235
|
+
getContractCredit: (id: string, chainId: string) => Promise<ContractCredit>;
|
|
236
|
+
hasInteraction: (addr: string, chainId: string, contractId: string) => Promise<{
|
|
237
|
+
has_interaction: boolean;
|
|
238
|
+
}>;
|
|
239
|
+
tokenApproveExposure: (id: string, chainId: string) => Promise<{
|
|
240
|
+
usd_value: number;
|
|
241
|
+
}>;
|
|
242
|
+
addrDesc: (id: string) => Promise<AddrDescResponse>;
|
|
243
|
+
hasTransfer: (chainId: string, from: string, to: string) => Promise<{
|
|
244
|
+
has_transfer: boolean;
|
|
245
|
+
}>;
|
|
246
|
+
isTokenContract: (chainId: string, id: string) => Promise<{
|
|
247
|
+
is_token: boolean;
|
|
248
|
+
}>;
|
|
249
|
+
addrUsedChainList: (id: string) => Promise<UsedChain[]>;
|
|
250
|
+
getTokenNFTExposure: (chainId: string, id: string) => Promise<{
|
|
251
|
+
usd_value: number;
|
|
252
|
+
}>;
|
|
253
|
+
getCollection: (chainId: string, id: string) => Promise<{
|
|
254
|
+
collection: CollectionWithFloorPrice;
|
|
255
|
+
}>;
|
|
256
|
+
isSuspiciousCollection: (chainId: string, id: string) => Promise<{
|
|
257
|
+
is_suspicious: boolean;
|
|
258
|
+
}>;
|
|
259
|
+
isOriginVerified: (origin: string) => Promise<{
|
|
260
|
+
is_verified: boolean | null;
|
|
261
|
+
}>;
|
|
262
|
+
parseTypedData: ({ typedData, origin, address, }: {
|
|
263
|
+
typedData: Record<string, any>;
|
|
264
|
+
origin: string;
|
|
265
|
+
address: string;
|
|
266
|
+
}) => Promise<ParseTypedDataResponse>;
|
|
267
|
+
parseText: ({ text, origin, address, }: {
|
|
268
|
+
text: string;
|
|
269
|
+
origin: string;
|
|
270
|
+
address: string;
|
|
271
|
+
}) => Promise<ParseTextResponse>;
|
|
272
|
+
collectionList: ({ id, chainId, isAll, }: {
|
|
273
|
+
id: string;
|
|
274
|
+
chainId?: string | undefined;
|
|
275
|
+
isAll: boolean;
|
|
276
|
+
}) => Promise<CollectionList[]>;
|
|
277
|
+
}
|
|
278
|
+
export {};
|