@tomo-inc/chains-service 0.0.5 → 0.0.6
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.cjs +4726 -0
- package/dist/index.d.cts +524 -0
- package/dist/index.d.ts +524 -0
- package/dist/index.js +4713 -0
- package/package.json +3 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,524 @@
|
|
|
1
|
+
import { ChainTypes, TomoStage } from '@tomo-inc/wallet-utils';
|
|
2
|
+
import { Transaction } from 'viem';
|
|
3
|
+
import { AxiosInstance } from 'axios';
|
|
4
|
+
|
|
5
|
+
declare enum AccountType {
|
|
6
|
+
EOA = "EOA",
|
|
7
|
+
SOCIAL = "SOCIAL"
|
|
8
|
+
}
|
|
9
|
+
interface ChainAddress {
|
|
10
|
+
subType: string;
|
|
11
|
+
address: string;
|
|
12
|
+
path: string;
|
|
13
|
+
publicKey?: string;
|
|
14
|
+
privateKey?: string;
|
|
15
|
+
}
|
|
16
|
+
interface IAccount {
|
|
17
|
+
readonly id: string;
|
|
18
|
+
readonly userId?: string | number;
|
|
19
|
+
readonly name: string;
|
|
20
|
+
readonly type: AccountType;
|
|
21
|
+
readonly lastUsedTime: number;
|
|
22
|
+
readonly sortIndex?: number;
|
|
23
|
+
readonly addresses: Record<ChainTypes, ChainAddress[]>;
|
|
24
|
+
readonly mnemonic: string | null;
|
|
25
|
+
readonly addressIndex: number;
|
|
26
|
+
readonly isImported: boolean;
|
|
27
|
+
readonly isBackedUp: boolean;
|
|
28
|
+
readonly isLocked: boolean;
|
|
29
|
+
readonly isFrozen: boolean;
|
|
30
|
+
readonly externalId?: string | number;
|
|
31
|
+
readonly totalAssets?: string;
|
|
32
|
+
}
|
|
33
|
+
interface IaccountInfo {
|
|
34
|
+
getCurrent: () => Promise<any[]>;
|
|
35
|
+
signMessage: (message: string) => Promise<string>;
|
|
36
|
+
signTypedData: (message: any) => Promise<string>;
|
|
37
|
+
signTransaction: (transaction: any) => Promise<string>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface QueryGasParams {
|
|
41
|
+
chainIndex: number | string;
|
|
42
|
+
callData: string;
|
|
43
|
+
gasLimitParam: {
|
|
44
|
+
from: string;
|
|
45
|
+
to: string;
|
|
46
|
+
value: `0x${string}`;
|
|
47
|
+
};
|
|
48
|
+
addressList?: string[];
|
|
49
|
+
}
|
|
50
|
+
interface QueryGasResponse {
|
|
51
|
+
success: boolean;
|
|
52
|
+
message?: string;
|
|
53
|
+
fees?: {
|
|
54
|
+
low: string | number;
|
|
55
|
+
medium: string | number;
|
|
56
|
+
high: string | number;
|
|
57
|
+
};
|
|
58
|
+
gasFee?: string | number;
|
|
59
|
+
rentInfo?: {
|
|
60
|
+
result?: {
|
|
61
|
+
minTransferAmount: string;
|
|
62
|
+
createSplTokenFee?: string;
|
|
63
|
+
};
|
|
64
|
+
} | null;
|
|
65
|
+
baseFee?: string;
|
|
66
|
+
gasLimit?: string;
|
|
67
|
+
priorityFee?: {
|
|
68
|
+
low: string;
|
|
69
|
+
medium: string;
|
|
70
|
+
high: string;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
type NativeCurrency = {
|
|
75
|
+
symbol: string;
|
|
76
|
+
decimals: number;
|
|
77
|
+
name: string;
|
|
78
|
+
logoURI?: string;
|
|
79
|
+
};
|
|
80
|
+
type RpcInfo = {
|
|
81
|
+
name: string;
|
|
82
|
+
url: string;
|
|
83
|
+
};
|
|
84
|
+
type EVMNetwork = `${number}`;
|
|
85
|
+
type BTCNetwork = "mainnet" | "testnet" | "signet" | "regtest";
|
|
86
|
+
type SolNetwork = "mainnet" | "testnet" | "devnet";
|
|
87
|
+
type SuiNetwork = "mainnet" | "testnet" | "devnet";
|
|
88
|
+
type DogeNetwork = "mainnet" | "testnet" | "devnet";
|
|
89
|
+
type TonNetwork = "mainnet" | "testnet" | "devnet";
|
|
90
|
+
type TronNetwork = "mainnet" | "testnet" | "devnet";
|
|
91
|
+
type ChainTypeIds = `${ChainTypes.EVM}:${EVMNetwork}` | `${ChainTypes.BTC}:${BTCNetwork}` | `${ChainTypes.SOL}:${SolNetwork}` | `${ChainTypes.SUI}:${SuiNetwork}` | `${ChainTypes.DOGE}:${DogeNetwork}` | `${ChainTypes.TON}:${TonNetwork}` | `${ChainTypes.TRON}:${TronNetwork}`;
|
|
92
|
+
interface RemoteChainInfo2 {
|
|
93
|
+
chainId: number;
|
|
94
|
+
chainIndex: number;
|
|
95
|
+
name: string;
|
|
96
|
+
chainName: string;
|
|
97
|
+
nativeCurrencyName: string;
|
|
98
|
+
nativeCurrencySymbol: string;
|
|
99
|
+
nativeCurrencyDecimals: number;
|
|
100
|
+
rpcUrls?: string[];
|
|
101
|
+
blockExplorerUrl?: string;
|
|
102
|
+
platformType: string;
|
|
103
|
+
isTestnet: boolean;
|
|
104
|
+
icon: string;
|
|
105
|
+
supportSwap: boolean;
|
|
106
|
+
supportGift: boolean;
|
|
107
|
+
supportHistory: boolean;
|
|
108
|
+
}
|
|
109
|
+
interface INetwork {
|
|
110
|
+
id?: string;
|
|
111
|
+
type?: ChainTypeIds;
|
|
112
|
+
rpcInfos?: RpcInfo[];
|
|
113
|
+
rpcUrls?: string[];
|
|
114
|
+
explorerUrls?: string[];
|
|
115
|
+
platformType: string;
|
|
116
|
+
chainId: string | number;
|
|
117
|
+
sortIndex?: number;
|
|
118
|
+
nativeCurrency?: NativeCurrency;
|
|
119
|
+
name: string;
|
|
120
|
+
icon: string;
|
|
121
|
+
chainIndex?: number;
|
|
122
|
+
info?: Partial<RemoteChainInfo2>;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
interface ITypedData {
|
|
126
|
+
types: any;
|
|
127
|
+
primaryType: string;
|
|
128
|
+
domain: any;
|
|
129
|
+
message: any;
|
|
130
|
+
}
|
|
131
|
+
type TransactionParams = Omit<any, "rpcUrl">;
|
|
132
|
+
|
|
133
|
+
declare enum TxTypes {
|
|
134
|
+
swap = 1,
|
|
135
|
+
bridge = 2,
|
|
136
|
+
receive = 31,
|
|
137
|
+
send = 32,
|
|
138
|
+
approve = 4,
|
|
139
|
+
contractInteraction = 5,
|
|
140
|
+
redPocket = 6
|
|
141
|
+
}
|
|
142
|
+
interface TransactionsParams {
|
|
143
|
+
walletId?: string;
|
|
144
|
+
tokenAddress?: string;
|
|
145
|
+
chainId?: string;
|
|
146
|
+
typeList?: TxTypes[];
|
|
147
|
+
cursor?: string;
|
|
148
|
+
pageLimit?: number;
|
|
149
|
+
}
|
|
150
|
+
interface TransactionItem {
|
|
151
|
+
chainType: ChainTypes;
|
|
152
|
+
chainInfo: {
|
|
153
|
+
chainId: string;
|
|
154
|
+
name: string;
|
|
155
|
+
icon: string;
|
|
156
|
+
};
|
|
157
|
+
nativeCurrency: {
|
|
158
|
+
symbol: string;
|
|
159
|
+
decimals: number;
|
|
160
|
+
name: string;
|
|
161
|
+
};
|
|
162
|
+
tokenInfo: {
|
|
163
|
+
tokenAddress: string;
|
|
164
|
+
symbol: string;
|
|
165
|
+
logo: string;
|
|
166
|
+
riskLevel: number;
|
|
167
|
+
};
|
|
168
|
+
txHash: `0x${string}`;
|
|
169
|
+
txDetail: any;
|
|
170
|
+
txDetailLink: `https://${string}`;
|
|
171
|
+
txTime: number;
|
|
172
|
+
}
|
|
173
|
+
interface TransactionsResponse {
|
|
174
|
+
cursor: string;
|
|
175
|
+
transactionList: TransactionItem[];
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
interface TomoAppInfo {
|
|
179
|
+
tomoStage: TomoStage;
|
|
180
|
+
tomoClientId: string;
|
|
181
|
+
apiKey: string;
|
|
182
|
+
apiSecret: string;
|
|
183
|
+
salt: string;
|
|
184
|
+
jwtToken?: string;
|
|
185
|
+
}
|
|
186
|
+
type TokenInfo = any;
|
|
187
|
+
|
|
188
|
+
type RemoteTokenInfo = {
|
|
189
|
+
chainIndex: number;
|
|
190
|
+
address: string;
|
|
191
|
+
isNative: boolean;
|
|
192
|
+
name: string;
|
|
193
|
+
displayName: string | null;
|
|
194
|
+
symbol: string;
|
|
195
|
+
logo: string;
|
|
196
|
+
decimals: number;
|
|
197
|
+
};
|
|
198
|
+
type RemoteResponse<TData> = {
|
|
199
|
+
success: boolean;
|
|
200
|
+
message?: string;
|
|
201
|
+
data?: TData;
|
|
202
|
+
};
|
|
203
|
+
type GetTokenInfoParams = {
|
|
204
|
+
chainIndex: number;
|
|
205
|
+
address: string;
|
|
206
|
+
};
|
|
207
|
+
type AddCustomTokenParams = {
|
|
208
|
+
walletId: string;
|
|
209
|
+
chainIndex: number;
|
|
210
|
+
address: string;
|
|
211
|
+
};
|
|
212
|
+
type DeleteCustomTokenParams = {
|
|
213
|
+
walletId: string;
|
|
214
|
+
chainIndex: number;
|
|
215
|
+
address: string;
|
|
216
|
+
};
|
|
217
|
+
type SyncCustomTokenParams = {
|
|
218
|
+
walletId: string;
|
|
219
|
+
chainId: string;
|
|
220
|
+
address: string;
|
|
221
|
+
name: string;
|
|
222
|
+
symbol: string;
|
|
223
|
+
decimals: number;
|
|
224
|
+
logo: string;
|
|
225
|
+
};
|
|
226
|
+
type GetTokenBalanceParams = {
|
|
227
|
+
walletId: string;
|
|
228
|
+
chains?: string;
|
|
229
|
+
assetsType: "single" | "multi";
|
|
230
|
+
};
|
|
231
|
+
type GetTransactionsParams = {
|
|
232
|
+
walletId: string;
|
|
233
|
+
chainIndex: number;
|
|
234
|
+
tokenAddress?: string;
|
|
235
|
+
typeList?: number;
|
|
236
|
+
cursor?: string;
|
|
237
|
+
pageLimit?: number;
|
|
238
|
+
};
|
|
239
|
+
type GetTransactionParams = {
|
|
240
|
+
walletId: string;
|
|
241
|
+
chainIndex: number;
|
|
242
|
+
txHash: string;
|
|
243
|
+
};
|
|
244
|
+
type TokenBalance = {
|
|
245
|
+
chainIndex: string;
|
|
246
|
+
tokenAddress: string;
|
|
247
|
+
symbol: string;
|
|
248
|
+
balance: string;
|
|
249
|
+
isRiskToken: boolean;
|
|
250
|
+
riskLevel?: number;
|
|
251
|
+
address: string;
|
|
252
|
+
tokenPrice: string;
|
|
253
|
+
priceChangeH24: string;
|
|
254
|
+
imgUrl: string;
|
|
255
|
+
decimals: number;
|
|
256
|
+
name: string;
|
|
257
|
+
isHidden?: boolean;
|
|
258
|
+
isMultiChain?: boolean;
|
|
259
|
+
chainDetails?: [];
|
|
260
|
+
fourMemeToken?: any;
|
|
261
|
+
};
|
|
262
|
+
type GetTokenBalanceResponse = {
|
|
263
|
+
total: string;
|
|
264
|
+
balance: TokenBalance[];
|
|
265
|
+
};
|
|
266
|
+
type GasLimitParams = {
|
|
267
|
+
from: string;
|
|
268
|
+
to: string;
|
|
269
|
+
value: string;
|
|
270
|
+
};
|
|
271
|
+
type GetGasInfoParams = {
|
|
272
|
+
chainIndex: number;
|
|
273
|
+
callData: string;
|
|
274
|
+
gasLimitParam: GasLimitParams;
|
|
275
|
+
addressList?: string[];
|
|
276
|
+
};
|
|
277
|
+
type GetGasInfoResponse = {
|
|
278
|
+
gasLimit: string;
|
|
279
|
+
baseFee: string;
|
|
280
|
+
priorityFeeLow: string;
|
|
281
|
+
priorityFeeMedium: string;
|
|
282
|
+
priorityFeeHigh: string;
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
interface IPublicApiBaseConfig {
|
|
286
|
+
rpcBaseUrl: string;
|
|
287
|
+
walletBaseUrl: string;
|
|
288
|
+
txBaseUrl: string;
|
|
289
|
+
tokenBaseUrl: string;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
declare class BasePublicService {
|
|
293
|
+
tokenApi: AxiosInstance;
|
|
294
|
+
txApi: AxiosInstance;
|
|
295
|
+
walletApi: AxiosInstance;
|
|
296
|
+
private apiBase;
|
|
297
|
+
private tomoAppInfo;
|
|
298
|
+
constructor(publicApiBase: IPublicApiBaseConfig, tomoAppInfo: TomoAppInfo);
|
|
299
|
+
private getSignConfig;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
declare class NetworkAPIs extends BasePublicService {
|
|
303
|
+
private static instance;
|
|
304
|
+
chains: INetwork[];
|
|
305
|
+
currentChainId: string;
|
|
306
|
+
private constructor();
|
|
307
|
+
static getInstance(apiBase: IPublicApiBaseConfig, tomoAppInfo: TomoAppInfo): NetworkAPIs;
|
|
308
|
+
getCacheId(chainType: ChainTypes | ""): string;
|
|
309
|
+
getAllNetworks(chainType: ChainTypes | ""): any[];
|
|
310
|
+
getCurrentNetwork(chainType: ChainTypes): Promise<string>;
|
|
311
|
+
setCurrentNetwork(chainType: ChainTypes | "", chainId: string): Promise<void>;
|
|
312
|
+
getNetworkByChainId(chainId: string): INetwork | undefined;
|
|
313
|
+
getNetworkByChainIndex(chainIndex: number): INetwork | undefined;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
declare class Networks {
|
|
317
|
+
private chainType;
|
|
318
|
+
networkAPIs: NetworkAPIs;
|
|
319
|
+
constructor(networkAPIs: NetworkAPIs, chainType?: ChainTypes);
|
|
320
|
+
setChainType(chainType: ChainTypes): void;
|
|
321
|
+
getNetworks(chainType?: ChainTypes | ""): Promise<INetwork[]>;
|
|
322
|
+
getNetworkByChainId(chainId: string): Promise<INetwork>;
|
|
323
|
+
getNetworkByChainIndex(chainIndex: number): Promise<INetwork>;
|
|
324
|
+
getCurrentNetwork(): Promise<INetwork>;
|
|
325
|
+
setCurrentNetwork(chainId: string): Promise<boolean>;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
declare class TokenAPIs extends BasePublicService {
|
|
329
|
+
private static instance;
|
|
330
|
+
private constructor();
|
|
331
|
+
static getInstance(apiBase: IPublicApiBaseConfig, tomoAppInfo: TomoAppInfo): TokenAPIs;
|
|
332
|
+
getTokenInfo(params: GetTokenInfoParams): Promise<RemoteResponse<RemoteTokenInfo>>;
|
|
333
|
+
getTokenRisk(params: {
|
|
334
|
+
chainIndex: number;
|
|
335
|
+
tokenAddress: string;
|
|
336
|
+
}): Promise<RemoteResponse<any>>;
|
|
337
|
+
addCustomToken(params: AddCustomTokenParams): Promise<RemoteResponse<any>>;
|
|
338
|
+
deleteCustomToken(params: DeleteCustomTokenParams): Promise<RemoteResponse<any>>;
|
|
339
|
+
addMultiToken(params: AddCustomTokenParams): Promise<RemoteResponse<any>>;
|
|
340
|
+
removeMultiToken(params: DeleteCustomTokenParams): Promise<RemoteResponse<any>>;
|
|
341
|
+
syncCustomToken(params: SyncCustomTokenParams): Promise<RemoteResponse<any>>;
|
|
342
|
+
getTokenBalance(params: GetTokenBalanceParams): Promise<RemoteResponse<GetTokenBalanceResponse>>;
|
|
343
|
+
getTokenDetail(params: {
|
|
344
|
+
chainIndex: number;
|
|
345
|
+
tokenAddress: string;
|
|
346
|
+
}): Promise<RemoteResponse<any>>;
|
|
347
|
+
queryRemoteTokens(params: {
|
|
348
|
+
keyword: string;
|
|
349
|
+
chainIndex?: number;
|
|
350
|
+
}): Promise<RemoteResponse<any[]>>;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
declare class Tokens {
|
|
354
|
+
tokenAPIs: TokenAPIs;
|
|
355
|
+
constructor(tokenService: TokenAPIs);
|
|
356
|
+
searchTokens({ chainIndex, query }: {
|
|
357
|
+
chainIndex?: number;
|
|
358
|
+
query?: string;
|
|
359
|
+
}): Promise<TokenInfo[]>;
|
|
360
|
+
getTokenInfo({ address, chainIndex }: {
|
|
361
|
+
address: string;
|
|
362
|
+
chainIndex: number;
|
|
363
|
+
}): Promise<TokenInfo>;
|
|
364
|
+
getTokenRiskInfo(_params: {
|
|
365
|
+
chainIndex: number;
|
|
366
|
+
tokenAddress: string;
|
|
367
|
+
}): Promise<any>;
|
|
368
|
+
getTokenDetail(_params: {
|
|
369
|
+
chainName: string;
|
|
370
|
+
chainIndex: number;
|
|
371
|
+
tokenAddress: string;
|
|
372
|
+
}): Promise<any>;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
declare class TransactionAPIs extends BasePublicService {
|
|
376
|
+
private static instance;
|
|
377
|
+
private constructor();
|
|
378
|
+
static getInstance(apiBase: IPublicApiBaseConfig, tomoAppInfo: TomoAppInfo): TransactionAPIs;
|
|
379
|
+
queryGasInfo(chainType: any, params: GetGasInfoParams): Promise<RemoteResponse<GetGasInfoResponse>>;
|
|
380
|
+
getTransactions(params: GetTransactionsParams): Promise<RemoteResponse<any>>;
|
|
381
|
+
getTransaction(params: GetTransactionParams): Promise<RemoteResponse<any>>;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
declare class Transactions {
|
|
385
|
+
transactionAPIs: TransactionAPIs;
|
|
386
|
+
constructor(transactionAPIs: TransactionAPIs);
|
|
387
|
+
queryGasInfo({ chainType, params }: {
|
|
388
|
+
chainType: string;
|
|
389
|
+
params: QueryGasParams;
|
|
390
|
+
}): Promise<any>;
|
|
391
|
+
getTransactions(params: {
|
|
392
|
+
walletId: string;
|
|
393
|
+
chainIndex: number;
|
|
394
|
+
pageLimit?: number;
|
|
395
|
+
cursor?: string;
|
|
396
|
+
}): Promise<{
|
|
397
|
+
cursor: string;
|
|
398
|
+
transactionList: any[];
|
|
399
|
+
}>;
|
|
400
|
+
getTransaction(params: {
|
|
401
|
+
walletId: string;
|
|
402
|
+
txHash: string;
|
|
403
|
+
chainIndex: number;
|
|
404
|
+
}): Promise<any>;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
declare class BaseService {
|
|
408
|
+
isDappConnected: boolean;
|
|
409
|
+
approveParams: any;
|
|
410
|
+
accountInfo: any;
|
|
411
|
+
networks: Networks;
|
|
412
|
+
tokens: Tokens;
|
|
413
|
+
transactions: Transactions;
|
|
414
|
+
constructor(tomoAppInfo: TomoAppInfo, accountInfo?: any);
|
|
415
|
+
setApproveParams(params: any): Promise<void>;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
declare class EvmService extends BaseService {
|
|
419
|
+
private static instance;
|
|
420
|
+
chainType: ChainTypes | "";
|
|
421
|
+
constructor(chainType: ChainTypes, accountInfo: IaccountInfo, tomoAppInfo: TomoAppInfo);
|
|
422
|
+
static getInstance(chainType: ChainTypes, accountInfo: any, tomoAppInfo: TomoAppInfo): EvmService;
|
|
423
|
+
eth_requestAccounts(): Promise<string[]>;
|
|
424
|
+
eth_accounts(): Promise<string[]>;
|
|
425
|
+
eth_chainId(): Promise<`0x${string}`>;
|
|
426
|
+
private getCurrentChain;
|
|
427
|
+
wallet_switchEthereumChain(networks: any[]): Promise<boolean>;
|
|
428
|
+
private isChainSupported;
|
|
429
|
+
personal_sign([message, address]: [`0x${string}`, `0x${string}`]): Promise<`0x${string}`>;
|
|
430
|
+
eth_signTypedData_v4([address, typedData]: [`0x${string}`, ITypedData]): Promise<`0x${string}`>;
|
|
431
|
+
eth_getBalance([address, type]: [`0x${string}`, "latest"]): Promise<string>;
|
|
432
|
+
_queryGasInfo(txData: TransactionParams): Promise<QueryGasResponse>;
|
|
433
|
+
eth_estimateGas(txs: Transaction[]): Promise<`0x${string}`>;
|
|
434
|
+
private createPublicClient;
|
|
435
|
+
eth_getTransactionCount([address, type]: [`0x${string}`, "latest" | "pending"]): Promise<number>;
|
|
436
|
+
eth_signTransaction(txParams: {
|
|
437
|
+
type?: number;
|
|
438
|
+
from: `0x${string}`;
|
|
439
|
+
to: `0x${string}`;
|
|
440
|
+
value: `0x${string}`;
|
|
441
|
+
data?: `0x${string}`;
|
|
442
|
+
chainId: `0x${string}`;
|
|
443
|
+
nonce: `0x${string}`;
|
|
444
|
+
gasLimit: `0x${string}`;
|
|
445
|
+
maxFeePerGas?: `0x${string}`;
|
|
446
|
+
maxPriorityFeePerGas?: `0x${string}`;
|
|
447
|
+
accessList?: any[];
|
|
448
|
+
}[]): Promise<Transaction>;
|
|
449
|
+
eth_sendRawTransaction([serializedTransaction]: [`0x${string}`], rpcUrl?: `https://${string}`): Promise<`0x${string}`>;
|
|
450
|
+
getTransaction(hash: `0x${string}`): Promise<Transaction>;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
interface SolanaRentInfo {
|
|
454
|
+
minTransferAmount: string;
|
|
455
|
+
createSplTokenFee: string | null;
|
|
456
|
+
}
|
|
457
|
+
interface QueryRentParams {
|
|
458
|
+
toAddress: string;
|
|
459
|
+
tokenAddress?: string;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
declare class SolanaService extends BaseService {
|
|
463
|
+
private static instance;
|
|
464
|
+
chainType: ChainTypes | "";
|
|
465
|
+
rpcUrl: string;
|
|
466
|
+
private connection;
|
|
467
|
+
constructor(chainType: ChainTypes, accountInfo: IaccountInfo, tomoAppInfo: TomoAppInfo);
|
|
468
|
+
static getInstance(chainType: ChainTypes, accountInfo: any, tomoAppInfo: TomoAppInfo): SolanaService;
|
|
469
|
+
getCurrentWalletAccount(): Promise<any>;
|
|
470
|
+
getAccount(): Promise<{
|
|
471
|
+
publicKey: string;
|
|
472
|
+
address: string;
|
|
473
|
+
}>;
|
|
474
|
+
signMessage(params: any): Promise<{
|
|
475
|
+
message: string;
|
|
476
|
+
signature: string;
|
|
477
|
+
publicKey: string;
|
|
478
|
+
}>;
|
|
479
|
+
signIn(params: any): Promise<{
|
|
480
|
+
address: string;
|
|
481
|
+
publicKey: string;
|
|
482
|
+
signature: string;
|
|
483
|
+
signedMessage: string;
|
|
484
|
+
}>;
|
|
485
|
+
request({ method, params }: {
|
|
486
|
+
method: string;
|
|
487
|
+
params: any;
|
|
488
|
+
}): Promise<any>;
|
|
489
|
+
_queryGasInfo(txData: TransactionParams): Promise<QueryGasResponse>;
|
|
490
|
+
sendSignedTx(signedTx: string): Promise<string>;
|
|
491
|
+
signTransaction({ rawTransaction }: {
|
|
492
|
+
rawTransaction: string;
|
|
493
|
+
}): Promise<string>;
|
|
494
|
+
signAndSendTransaction({ rawTransaction }: {
|
|
495
|
+
rawTransaction: string;
|
|
496
|
+
}): Promise<string>;
|
|
497
|
+
signAllTransactions({ rawTransactions }: {
|
|
498
|
+
rawTransactions: string[];
|
|
499
|
+
}): Promise<void>;
|
|
500
|
+
signAndSendAllTransactions({ rawTransactions }: {
|
|
501
|
+
rawTransactions: string[];
|
|
502
|
+
}): Promise<void>;
|
|
503
|
+
queryRent(params: QueryRentParams): Promise<SolanaRentInfo>;
|
|
504
|
+
private checkAccountExists;
|
|
505
|
+
private checkTokenAccount;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
declare class TomoWallet extends BaseService {
|
|
509
|
+
private static instance;
|
|
510
|
+
private walletId;
|
|
511
|
+
constructor(walletId: string, tomoAppInfo: TomoAppInfo);
|
|
512
|
+
getInstance(walletId: string, tomoAppInfo: TomoAppInfo): TomoWallet;
|
|
513
|
+
supportedChains(chainType?: ChainTypes | ""): Promise<INetwork[]>;
|
|
514
|
+
getChainInfo(chainType: ChainTypes, chainId: string): Promise<INetwork>;
|
|
515
|
+
isChainSupported(chainType: ChainTypes, chainId: string): Promise<boolean>;
|
|
516
|
+
getTransactions({ tokenAddress, chainId, typeList, pageLimit, cursor, }: TransactionsParams): Promise<TransactionsResponse>;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
declare const ChainTypeServices: {
|
|
520
|
+
evm: typeof EvmService;
|
|
521
|
+
sol: typeof SolanaService;
|
|
522
|
+
};
|
|
523
|
+
|
|
524
|
+
export { AccountType, type ChainAddress, ChainTypeServices, EvmService, type IAccount, SolanaService, type TomoAppInfo, TomoWallet, type TransactionItem, type TransactionsParams, type TransactionsResponse, TxTypes };
|