@tomo-inc/chains-service 0.0.7 → 0.0.8
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/CHANGELOG.md +4 -0
- package/dist/index.cjs +602 -95
- package/dist/index.d.cts +117 -43
- package/dist/index.d.ts +117 -43
- package/dist/index.js +608 -102
- package/package.json +2 -2
- package/src/api/network-data.ts +19 -5
- package/src/api/token.ts +11 -6
- package/src/base/service.ts +4 -4
- package/src/base/token.ts +8 -9
- package/src/dogecoin/service.ts +46 -252
- package/src/dogecoin/type.ts +12 -0
- package/src/dogecoin/utils-doge.ts +75 -2
- package/src/dogecoin/utils.ts +3 -380
- package/src/evm/service.ts +57 -73
- package/src/index.ts +5 -4
- package/src/solana/service.ts +6 -6
- package/src/types/account.ts +4 -3
- package/src/types/index.ts +3 -3
- package/src/utils/index.ts +7 -0
package/dist/index.d.cts
CHANGED
|
@@ -16,9 +16,9 @@ interface ChainAddress {
|
|
|
16
16
|
interface IAccount {
|
|
17
17
|
readonly id: string;
|
|
18
18
|
readonly userId?: string | number;
|
|
19
|
-
readonly name
|
|
19
|
+
readonly name?: string;
|
|
20
20
|
readonly type: AccountType;
|
|
21
|
-
readonly lastUsedTime
|
|
21
|
+
readonly lastUsedTime?: number;
|
|
22
22
|
readonly sortIndex?: number;
|
|
23
23
|
readonly addresses: Record<ChainTypes, ChainAddress[]>;
|
|
24
24
|
readonly mnemonic: string | null;
|
|
@@ -30,11 +30,12 @@ interface IAccount {
|
|
|
30
30
|
readonly externalId?: string | number;
|
|
31
31
|
readonly totalAssets?: string;
|
|
32
32
|
}
|
|
33
|
-
interface
|
|
33
|
+
interface IAccountInfo {
|
|
34
34
|
getCurrent: () => Promise<any[]>;
|
|
35
35
|
signMessage: (message: string) => Promise<string>;
|
|
36
36
|
signTypedData: (message: any) => Promise<string>;
|
|
37
37
|
signTransaction: (transaction: any) => Promise<string>;
|
|
38
|
+
decryptedMessage?: (message: string) => Promise<any>;
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
interface QueryGasParams {
|
|
@@ -128,7 +129,7 @@ interface ITypedData {
|
|
|
128
129
|
domain: any;
|
|
129
130
|
message: any;
|
|
130
131
|
}
|
|
131
|
-
type TransactionParams = Omit<any, "rpcUrl">;
|
|
132
|
+
type TransactionParams$1 = Omit<any, "rpcUrl">;
|
|
132
133
|
|
|
133
134
|
declare enum TxTypes {
|
|
134
135
|
swap = 1,
|
|
@@ -178,9 +179,9 @@ interface TransactionsResponse {
|
|
|
178
179
|
interface TomoAppInfo {
|
|
179
180
|
tomoStage: TomoStage;
|
|
180
181
|
tomoClientId: string;
|
|
181
|
-
apiKey
|
|
182
|
-
apiSecret
|
|
183
|
-
salt
|
|
182
|
+
apiKey?: string;
|
|
183
|
+
apiSecret?: string;
|
|
184
|
+
salt?: string;
|
|
184
185
|
jwtToken?: string;
|
|
185
186
|
}
|
|
186
187
|
type TokenInfo = any;
|
|
@@ -330,20 +331,14 @@ declare class TokenAPIs extends BasePublicService {
|
|
|
330
331
|
private constructor();
|
|
331
332
|
static getInstance(apiBase: IPublicApiBaseConfig, tomoAppInfo: TomoAppInfo): TokenAPIs;
|
|
332
333
|
getTokenInfo(params: GetTokenInfoParams): Promise<RemoteResponse<RemoteTokenInfo>>;
|
|
333
|
-
getTokenRisk(params:
|
|
334
|
-
chainIndex: number;
|
|
335
|
-
tokenAddress: string;
|
|
336
|
-
}): Promise<RemoteResponse<any>>;
|
|
334
|
+
getTokenRisk(params: GetTokenInfoParams): Promise<RemoteResponse<any>>;
|
|
337
335
|
addCustomToken(params: AddCustomTokenParams): Promise<RemoteResponse<any>>;
|
|
338
336
|
deleteCustomToken(params: DeleteCustomTokenParams): Promise<RemoteResponse<any>>;
|
|
339
337
|
addMultiToken(params: AddCustomTokenParams): Promise<RemoteResponse<any>>;
|
|
340
338
|
removeMultiToken(params: DeleteCustomTokenParams): Promise<RemoteResponse<any>>;
|
|
341
339
|
syncCustomToken(params: SyncCustomTokenParams): Promise<RemoteResponse<any>>;
|
|
342
340
|
getTokenBalance(params: GetTokenBalanceParams): Promise<RemoteResponse<GetTokenBalanceResponse>>;
|
|
343
|
-
getTokenDetail(params:
|
|
344
|
-
chainIndex: number;
|
|
345
|
-
tokenAddress: string;
|
|
346
|
-
}): Promise<RemoteResponse<any>>;
|
|
341
|
+
getTokenDetail(params: GetTokenInfoParams): Promise<RemoteResponse<any>>;
|
|
347
342
|
queryRemoteTokens(params: {
|
|
348
343
|
keyword: string;
|
|
349
344
|
chainIndex?: number;
|
|
@@ -353,23 +348,13 @@ declare class TokenAPIs extends BasePublicService {
|
|
|
353
348
|
declare class Tokens {
|
|
354
349
|
tokenAPIs: TokenAPIs;
|
|
355
350
|
constructor(tokenService: TokenAPIs);
|
|
356
|
-
searchTokens({ chainIndex,
|
|
351
|
+
searchTokens({ chainIndex, keyword }: {
|
|
357
352
|
chainIndex?: number;
|
|
358
|
-
|
|
353
|
+
keyword: string;
|
|
359
354
|
}): Promise<TokenInfo[]>;
|
|
360
|
-
getTokenInfo({ address, chainIndex }:
|
|
361
|
-
|
|
362
|
-
|
|
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>;
|
|
355
|
+
getTokenInfo({ address, chainIndex }: GetTokenInfoParams): Promise<TokenInfo>;
|
|
356
|
+
getTokenRiskInfo(_params: GetTokenInfoParams): Promise<any>;
|
|
357
|
+
getTokenDetail(_params: GetTokenInfoParams): Promise<any>;
|
|
373
358
|
}
|
|
374
359
|
|
|
375
360
|
declare class TransactionAPIs extends BasePublicService {
|
|
@@ -407,19 +392,19 @@ declare class Transactions {
|
|
|
407
392
|
declare class BaseService {
|
|
408
393
|
isDappConnected: boolean;
|
|
409
394
|
approveParams: any;
|
|
410
|
-
accountInfo:
|
|
395
|
+
accountInfo: IAccountInfo;
|
|
411
396
|
networks: Networks;
|
|
412
397
|
tokens: Tokens;
|
|
413
398
|
transactions: Transactions;
|
|
414
|
-
constructor(tomoAppInfo: TomoAppInfo, accountInfo?:
|
|
399
|
+
constructor(tomoAppInfo: TomoAppInfo, accountInfo?: IAccountInfo);
|
|
415
400
|
setApproveParams(params: any): Promise<void>;
|
|
416
401
|
}
|
|
417
402
|
|
|
418
403
|
declare class EvmService extends BaseService {
|
|
419
404
|
private static instance;
|
|
420
405
|
chainType: ChainTypes | "";
|
|
421
|
-
constructor(chainType: ChainTypes, accountInfo:
|
|
422
|
-
static getInstance(chainType: ChainTypes, accountInfo:
|
|
406
|
+
constructor(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo);
|
|
407
|
+
static getInstance(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo): EvmService;
|
|
423
408
|
eth_requestAccounts(): Promise<string[]>;
|
|
424
409
|
eth_accounts(): Promise<string[]>;
|
|
425
410
|
eth_chainId(): Promise<`0x${string}`>;
|
|
@@ -429,19 +414,21 @@ declare class EvmService extends BaseService {
|
|
|
429
414
|
personal_sign([message, address]: [`0x${string}`, `0x${string}`]): Promise<`0x${string}`>;
|
|
430
415
|
eth_signTypedData_v4([address, typedData]: [`0x${string}`, ITypedData]): Promise<`0x${string}`>;
|
|
431
416
|
eth_getBalance([address, type]: [`0x${string}`, "latest"]): Promise<string>;
|
|
432
|
-
_queryGasInfo(txData: TransactionParams): Promise<QueryGasResponse>;
|
|
433
|
-
eth_estimateGas(txs: Transaction[]): Promise<`0x${string}`>;
|
|
417
|
+
_queryGasInfo(txData: TransactionParams$1): Promise<QueryGasResponse>;
|
|
434
418
|
private createPublicClient;
|
|
419
|
+
eth_estimateGas(txs: Transaction[]): Promise<`0x${string}`>;
|
|
435
420
|
eth_getTransactionCount([address, type]: [`0x${string}`, "latest" | "pending"]): Promise<number>;
|
|
436
421
|
eth_signTransaction(txParams: {
|
|
437
|
-
type?:
|
|
422
|
+
type?: "eip1559" | "legacy";
|
|
438
423
|
from: `0x${string}`;
|
|
439
424
|
to: `0x${string}`;
|
|
440
425
|
value: `0x${string}`;
|
|
441
426
|
data?: `0x${string}`;
|
|
442
427
|
chainId: `0x${string}`;
|
|
443
428
|
nonce: `0x${string}`;
|
|
444
|
-
gasLimit
|
|
429
|
+
gasLimit?: `0x${string}`;
|
|
430
|
+
gas?: `0x${string}`;
|
|
431
|
+
gasPrice?: `0x${string}`;
|
|
445
432
|
maxFeePerGas?: `0x${string}`;
|
|
446
433
|
maxPriorityFeePerGas?: `0x${string}`;
|
|
447
434
|
accessList?: any[];
|
|
@@ -464,9 +451,9 @@ declare class SolanaService extends BaseService {
|
|
|
464
451
|
chainType: ChainTypes | "";
|
|
465
452
|
rpcUrl: string;
|
|
466
453
|
private connection;
|
|
467
|
-
constructor(chainType: ChainTypes, accountInfo:
|
|
468
|
-
static getInstance(chainType: ChainTypes, accountInfo:
|
|
469
|
-
getCurrentWalletAccount(): Promise<any>;
|
|
454
|
+
constructor(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo);
|
|
455
|
+
static getInstance(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo): SolanaService;
|
|
456
|
+
getCurrentWalletAccount(): Promise<any[]>;
|
|
470
457
|
getAccount(): Promise<{
|
|
471
458
|
publicKey: string;
|
|
472
459
|
address: string;
|
|
@@ -486,7 +473,7 @@ declare class SolanaService extends BaseService {
|
|
|
486
473
|
method: string;
|
|
487
474
|
params: any;
|
|
488
475
|
}): Promise<any>;
|
|
489
|
-
_queryGasInfo(txData: TransactionParams): Promise<QueryGasResponse>;
|
|
476
|
+
_queryGasInfo(txData: TransactionParams$1): Promise<QueryGasResponse>;
|
|
490
477
|
sendSignedTx(signedTx: string): Promise<string>;
|
|
491
478
|
signTransaction({ rawTransaction }: {
|
|
492
479
|
rawTransaction: string;
|
|
@@ -505,6 +492,92 @@ declare class SolanaService extends BaseService {
|
|
|
505
492
|
private checkTokenAccount;
|
|
506
493
|
}
|
|
507
494
|
|
|
495
|
+
type DogeSpendableUtxos = {
|
|
496
|
+
txid: string;
|
|
497
|
+
vout: number;
|
|
498
|
+
outputValue: number;
|
|
499
|
+
script: string;
|
|
500
|
+
tx?: {
|
|
501
|
+
txid: string;
|
|
502
|
+
vout: number;
|
|
503
|
+
};
|
|
504
|
+
};
|
|
505
|
+
interface TransactionParams {
|
|
506
|
+
accountId?: string;
|
|
507
|
+
from: string;
|
|
508
|
+
to: string;
|
|
509
|
+
fee?: string;
|
|
510
|
+
amount: number;
|
|
511
|
+
decimals?: number;
|
|
512
|
+
chainId?: number | string;
|
|
513
|
+
tokenAddress?: string;
|
|
514
|
+
}
|
|
515
|
+
interface DogeTxData {
|
|
516
|
+
amountMismatch?: boolean;
|
|
517
|
+
amount: number;
|
|
518
|
+
fee: number;
|
|
519
|
+
to: string;
|
|
520
|
+
from: string;
|
|
521
|
+
senderAddress?: string;
|
|
522
|
+
sender?: string;
|
|
523
|
+
fromAddress?: string;
|
|
524
|
+
spendableUtxos?: DogeSpendableUtxos[];
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
declare class DogecoinService extends BaseService {
|
|
528
|
+
private static instance;
|
|
529
|
+
chainType: ChainTypes | "";
|
|
530
|
+
constructor(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo);
|
|
531
|
+
static getInstance(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo): DogecoinService;
|
|
532
|
+
requestAccounts(): Promise<{
|
|
533
|
+
address: string;
|
|
534
|
+
balance: number;
|
|
535
|
+
approved: boolean;
|
|
536
|
+
publicKey: string;
|
|
537
|
+
}>;
|
|
538
|
+
getAccounts(): Promise<string[]>;
|
|
539
|
+
getConnectionStatus(): Promise<{
|
|
540
|
+
connected: boolean;
|
|
541
|
+
address: string;
|
|
542
|
+
selectedWalletAddress: string;
|
|
543
|
+
}>;
|
|
544
|
+
getBalance(): Promise<{
|
|
545
|
+
address: string;
|
|
546
|
+
balance: number;
|
|
547
|
+
}>;
|
|
548
|
+
signMessage({ message, type }: {
|
|
549
|
+
message: string;
|
|
550
|
+
type?: string;
|
|
551
|
+
}): Promise<{
|
|
552
|
+
signedMessage: string;
|
|
553
|
+
}>;
|
|
554
|
+
requestSignedMessage({ message, type, }: {
|
|
555
|
+
message: string;
|
|
556
|
+
type?: string;
|
|
557
|
+
}): Promise<{
|
|
558
|
+
signedMessage: string;
|
|
559
|
+
}>;
|
|
560
|
+
requestDecryptedMessage({ message }: {
|
|
561
|
+
message: string;
|
|
562
|
+
}): Promise<{
|
|
563
|
+
decryptedMessage: string;
|
|
564
|
+
}>;
|
|
565
|
+
_queryGasInfo(txData: TransactionParams): Promise<QueryGasResponse>;
|
|
566
|
+
requestPsbt({ rawTx, signOnly, }: {
|
|
567
|
+
rawTx: string;
|
|
568
|
+
signOnly?: boolean;
|
|
569
|
+
}): Promise<{
|
|
570
|
+
signedRawTx: string;
|
|
571
|
+
txId?: string;
|
|
572
|
+
} | null>;
|
|
573
|
+
requestTransaction(txData: DogeTxData): Promise<{
|
|
574
|
+
txId: string;
|
|
575
|
+
} | null>;
|
|
576
|
+
getTransactionStatus({ txId }: {
|
|
577
|
+
txId: string;
|
|
578
|
+
}): Promise<any>;
|
|
579
|
+
}
|
|
580
|
+
|
|
508
581
|
declare class TomoWallet extends BaseService {
|
|
509
582
|
private static instance;
|
|
510
583
|
private walletId;
|
|
@@ -519,6 +592,7 @@ declare class TomoWallet extends BaseService {
|
|
|
519
592
|
declare const ChainTypeServices: {
|
|
520
593
|
evm: typeof EvmService;
|
|
521
594
|
sol: typeof SolanaService;
|
|
595
|
+
doge: typeof DogecoinService;
|
|
522
596
|
};
|
|
523
597
|
|
|
524
|
-
export { AccountType, type ChainAddress, ChainTypeServices, EvmService, type IAccount, SolanaService, type TomoAppInfo, TomoWallet, type TransactionItem, type TransactionsParams, type TransactionsResponse, TxTypes };
|
|
598
|
+
export { AccountType, type ChainAddress, ChainTypeServices, DogecoinService, EvmService, type IAccount, type IAccountInfo, SolanaService, type TomoAppInfo, TomoWallet, type TransactionItem, type TransactionsParams, type TransactionsResponse, TxTypes };
|
package/dist/index.d.ts
CHANGED
|
@@ -16,9 +16,9 @@ interface ChainAddress {
|
|
|
16
16
|
interface IAccount {
|
|
17
17
|
readonly id: string;
|
|
18
18
|
readonly userId?: string | number;
|
|
19
|
-
readonly name
|
|
19
|
+
readonly name?: string;
|
|
20
20
|
readonly type: AccountType;
|
|
21
|
-
readonly lastUsedTime
|
|
21
|
+
readonly lastUsedTime?: number;
|
|
22
22
|
readonly sortIndex?: number;
|
|
23
23
|
readonly addresses: Record<ChainTypes, ChainAddress[]>;
|
|
24
24
|
readonly mnemonic: string | null;
|
|
@@ -30,11 +30,12 @@ interface IAccount {
|
|
|
30
30
|
readonly externalId?: string | number;
|
|
31
31
|
readonly totalAssets?: string;
|
|
32
32
|
}
|
|
33
|
-
interface
|
|
33
|
+
interface IAccountInfo {
|
|
34
34
|
getCurrent: () => Promise<any[]>;
|
|
35
35
|
signMessage: (message: string) => Promise<string>;
|
|
36
36
|
signTypedData: (message: any) => Promise<string>;
|
|
37
37
|
signTransaction: (transaction: any) => Promise<string>;
|
|
38
|
+
decryptedMessage?: (message: string) => Promise<any>;
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
interface QueryGasParams {
|
|
@@ -128,7 +129,7 @@ interface ITypedData {
|
|
|
128
129
|
domain: any;
|
|
129
130
|
message: any;
|
|
130
131
|
}
|
|
131
|
-
type TransactionParams = Omit<any, "rpcUrl">;
|
|
132
|
+
type TransactionParams$1 = Omit<any, "rpcUrl">;
|
|
132
133
|
|
|
133
134
|
declare enum TxTypes {
|
|
134
135
|
swap = 1,
|
|
@@ -178,9 +179,9 @@ interface TransactionsResponse {
|
|
|
178
179
|
interface TomoAppInfo {
|
|
179
180
|
tomoStage: TomoStage;
|
|
180
181
|
tomoClientId: string;
|
|
181
|
-
apiKey
|
|
182
|
-
apiSecret
|
|
183
|
-
salt
|
|
182
|
+
apiKey?: string;
|
|
183
|
+
apiSecret?: string;
|
|
184
|
+
salt?: string;
|
|
184
185
|
jwtToken?: string;
|
|
185
186
|
}
|
|
186
187
|
type TokenInfo = any;
|
|
@@ -330,20 +331,14 @@ declare class TokenAPIs extends BasePublicService {
|
|
|
330
331
|
private constructor();
|
|
331
332
|
static getInstance(apiBase: IPublicApiBaseConfig, tomoAppInfo: TomoAppInfo): TokenAPIs;
|
|
332
333
|
getTokenInfo(params: GetTokenInfoParams): Promise<RemoteResponse<RemoteTokenInfo>>;
|
|
333
|
-
getTokenRisk(params:
|
|
334
|
-
chainIndex: number;
|
|
335
|
-
tokenAddress: string;
|
|
336
|
-
}): Promise<RemoteResponse<any>>;
|
|
334
|
+
getTokenRisk(params: GetTokenInfoParams): Promise<RemoteResponse<any>>;
|
|
337
335
|
addCustomToken(params: AddCustomTokenParams): Promise<RemoteResponse<any>>;
|
|
338
336
|
deleteCustomToken(params: DeleteCustomTokenParams): Promise<RemoteResponse<any>>;
|
|
339
337
|
addMultiToken(params: AddCustomTokenParams): Promise<RemoteResponse<any>>;
|
|
340
338
|
removeMultiToken(params: DeleteCustomTokenParams): Promise<RemoteResponse<any>>;
|
|
341
339
|
syncCustomToken(params: SyncCustomTokenParams): Promise<RemoteResponse<any>>;
|
|
342
340
|
getTokenBalance(params: GetTokenBalanceParams): Promise<RemoteResponse<GetTokenBalanceResponse>>;
|
|
343
|
-
getTokenDetail(params:
|
|
344
|
-
chainIndex: number;
|
|
345
|
-
tokenAddress: string;
|
|
346
|
-
}): Promise<RemoteResponse<any>>;
|
|
341
|
+
getTokenDetail(params: GetTokenInfoParams): Promise<RemoteResponse<any>>;
|
|
347
342
|
queryRemoteTokens(params: {
|
|
348
343
|
keyword: string;
|
|
349
344
|
chainIndex?: number;
|
|
@@ -353,23 +348,13 @@ declare class TokenAPIs extends BasePublicService {
|
|
|
353
348
|
declare class Tokens {
|
|
354
349
|
tokenAPIs: TokenAPIs;
|
|
355
350
|
constructor(tokenService: TokenAPIs);
|
|
356
|
-
searchTokens({ chainIndex,
|
|
351
|
+
searchTokens({ chainIndex, keyword }: {
|
|
357
352
|
chainIndex?: number;
|
|
358
|
-
|
|
353
|
+
keyword: string;
|
|
359
354
|
}): Promise<TokenInfo[]>;
|
|
360
|
-
getTokenInfo({ address, chainIndex }:
|
|
361
|
-
|
|
362
|
-
|
|
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>;
|
|
355
|
+
getTokenInfo({ address, chainIndex }: GetTokenInfoParams): Promise<TokenInfo>;
|
|
356
|
+
getTokenRiskInfo(_params: GetTokenInfoParams): Promise<any>;
|
|
357
|
+
getTokenDetail(_params: GetTokenInfoParams): Promise<any>;
|
|
373
358
|
}
|
|
374
359
|
|
|
375
360
|
declare class TransactionAPIs extends BasePublicService {
|
|
@@ -407,19 +392,19 @@ declare class Transactions {
|
|
|
407
392
|
declare class BaseService {
|
|
408
393
|
isDappConnected: boolean;
|
|
409
394
|
approveParams: any;
|
|
410
|
-
accountInfo:
|
|
395
|
+
accountInfo: IAccountInfo;
|
|
411
396
|
networks: Networks;
|
|
412
397
|
tokens: Tokens;
|
|
413
398
|
transactions: Transactions;
|
|
414
|
-
constructor(tomoAppInfo: TomoAppInfo, accountInfo?:
|
|
399
|
+
constructor(tomoAppInfo: TomoAppInfo, accountInfo?: IAccountInfo);
|
|
415
400
|
setApproveParams(params: any): Promise<void>;
|
|
416
401
|
}
|
|
417
402
|
|
|
418
403
|
declare class EvmService extends BaseService {
|
|
419
404
|
private static instance;
|
|
420
405
|
chainType: ChainTypes | "";
|
|
421
|
-
constructor(chainType: ChainTypes, accountInfo:
|
|
422
|
-
static getInstance(chainType: ChainTypes, accountInfo:
|
|
406
|
+
constructor(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo);
|
|
407
|
+
static getInstance(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo): EvmService;
|
|
423
408
|
eth_requestAccounts(): Promise<string[]>;
|
|
424
409
|
eth_accounts(): Promise<string[]>;
|
|
425
410
|
eth_chainId(): Promise<`0x${string}`>;
|
|
@@ -429,19 +414,21 @@ declare class EvmService extends BaseService {
|
|
|
429
414
|
personal_sign([message, address]: [`0x${string}`, `0x${string}`]): Promise<`0x${string}`>;
|
|
430
415
|
eth_signTypedData_v4([address, typedData]: [`0x${string}`, ITypedData]): Promise<`0x${string}`>;
|
|
431
416
|
eth_getBalance([address, type]: [`0x${string}`, "latest"]): Promise<string>;
|
|
432
|
-
_queryGasInfo(txData: TransactionParams): Promise<QueryGasResponse>;
|
|
433
|
-
eth_estimateGas(txs: Transaction[]): Promise<`0x${string}`>;
|
|
417
|
+
_queryGasInfo(txData: TransactionParams$1): Promise<QueryGasResponse>;
|
|
434
418
|
private createPublicClient;
|
|
419
|
+
eth_estimateGas(txs: Transaction[]): Promise<`0x${string}`>;
|
|
435
420
|
eth_getTransactionCount([address, type]: [`0x${string}`, "latest" | "pending"]): Promise<number>;
|
|
436
421
|
eth_signTransaction(txParams: {
|
|
437
|
-
type?:
|
|
422
|
+
type?: "eip1559" | "legacy";
|
|
438
423
|
from: `0x${string}`;
|
|
439
424
|
to: `0x${string}`;
|
|
440
425
|
value: `0x${string}`;
|
|
441
426
|
data?: `0x${string}`;
|
|
442
427
|
chainId: `0x${string}`;
|
|
443
428
|
nonce: `0x${string}`;
|
|
444
|
-
gasLimit
|
|
429
|
+
gasLimit?: `0x${string}`;
|
|
430
|
+
gas?: `0x${string}`;
|
|
431
|
+
gasPrice?: `0x${string}`;
|
|
445
432
|
maxFeePerGas?: `0x${string}`;
|
|
446
433
|
maxPriorityFeePerGas?: `0x${string}`;
|
|
447
434
|
accessList?: any[];
|
|
@@ -464,9 +451,9 @@ declare class SolanaService extends BaseService {
|
|
|
464
451
|
chainType: ChainTypes | "";
|
|
465
452
|
rpcUrl: string;
|
|
466
453
|
private connection;
|
|
467
|
-
constructor(chainType: ChainTypes, accountInfo:
|
|
468
|
-
static getInstance(chainType: ChainTypes, accountInfo:
|
|
469
|
-
getCurrentWalletAccount(): Promise<any>;
|
|
454
|
+
constructor(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo);
|
|
455
|
+
static getInstance(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo): SolanaService;
|
|
456
|
+
getCurrentWalletAccount(): Promise<any[]>;
|
|
470
457
|
getAccount(): Promise<{
|
|
471
458
|
publicKey: string;
|
|
472
459
|
address: string;
|
|
@@ -486,7 +473,7 @@ declare class SolanaService extends BaseService {
|
|
|
486
473
|
method: string;
|
|
487
474
|
params: any;
|
|
488
475
|
}): Promise<any>;
|
|
489
|
-
_queryGasInfo(txData: TransactionParams): Promise<QueryGasResponse>;
|
|
476
|
+
_queryGasInfo(txData: TransactionParams$1): Promise<QueryGasResponse>;
|
|
490
477
|
sendSignedTx(signedTx: string): Promise<string>;
|
|
491
478
|
signTransaction({ rawTransaction }: {
|
|
492
479
|
rawTransaction: string;
|
|
@@ -505,6 +492,92 @@ declare class SolanaService extends BaseService {
|
|
|
505
492
|
private checkTokenAccount;
|
|
506
493
|
}
|
|
507
494
|
|
|
495
|
+
type DogeSpendableUtxos = {
|
|
496
|
+
txid: string;
|
|
497
|
+
vout: number;
|
|
498
|
+
outputValue: number;
|
|
499
|
+
script: string;
|
|
500
|
+
tx?: {
|
|
501
|
+
txid: string;
|
|
502
|
+
vout: number;
|
|
503
|
+
};
|
|
504
|
+
};
|
|
505
|
+
interface TransactionParams {
|
|
506
|
+
accountId?: string;
|
|
507
|
+
from: string;
|
|
508
|
+
to: string;
|
|
509
|
+
fee?: string;
|
|
510
|
+
amount: number;
|
|
511
|
+
decimals?: number;
|
|
512
|
+
chainId?: number | string;
|
|
513
|
+
tokenAddress?: string;
|
|
514
|
+
}
|
|
515
|
+
interface DogeTxData {
|
|
516
|
+
amountMismatch?: boolean;
|
|
517
|
+
amount: number;
|
|
518
|
+
fee: number;
|
|
519
|
+
to: string;
|
|
520
|
+
from: string;
|
|
521
|
+
senderAddress?: string;
|
|
522
|
+
sender?: string;
|
|
523
|
+
fromAddress?: string;
|
|
524
|
+
spendableUtxos?: DogeSpendableUtxos[];
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
declare class DogecoinService extends BaseService {
|
|
528
|
+
private static instance;
|
|
529
|
+
chainType: ChainTypes | "";
|
|
530
|
+
constructor(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo);
|
|
531
|
+
static getInstance(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo): DogecoinService;
|
|
532
|
+
requestAccounts(): Promise<{
|
|
533
|
+
address: string;
|
|
534
|
+
balance: number;
|
|
535
|
+
approved: boolean;
|
|
536
|
+
publicKey: string;
|
|
537
|
+
}>;
|
|
538
|
+
getAccounts(): Promise<string[]>;
|
|
539
|
+
getConnectionStatus(): Promise<{
|
|
540
|
+
connected: boolean;
|
|
541
|
+
address: string;
|
|
542
|
+
selectedWalletAddress: string;
|
|
543
|
+
}>;
|
|
544
|
+
getBalance(): Promise<{
|
|
545
|
+
address: string;
|
|
546
|
+
balance: number;
|
|
547
|
+
}>;
|
|
548
|
+
signMessage({ message, type }: {
|
|
549
|
+
message: string;
|
|
550
|
+
type?: string;
|
|
551
|
+
}): Promise<{
|
|
552
|
+
signedMessage: string;
|
|
553
|
+
}>;
|
|
554
|
+
requestSignedMessage({ message, type, }: {
|
|
555
|
+
message: string;
|
|
556
|
+
type?: string;
|
|
557
|
+
}): Promise<{
|
|
558
|
+
signedMessage: string;
|
|
559
|
+
}>;
|
|
560
|
+
requestDecryptedMessage({ message }: {
|
|
561
|
+
message: string;
|
|
562
|
+
}): Promise<{
|
|
563
|
+
decryptedMessage: string;
|
|
564
|
+
}>;
|
|
565
|
+
_queryGasInfo(txData: TransactionParams): Promise<QueryGasResponse>;
|
|
566
|
+
requestPsbt({ rawTx, signOnly, }: {
|
|
567
|
+
rawTx: string;
|
|
568
|
+
signOnly?: boolean;
|
|
569
|
+
}): Promise<{
|
|
570
|
+
signedRawTx: string;
|
|
571
|
+
txId?: string;
|
|
572
|
+
} | null>;
|
|
573
|
+
requestTransaction(txData: DogeTxData): Promise<{
|
|
574
|
+
txId: string;
|
|
575
|
+
} | null>;
|
|
576
|
+
getTransactionStatus({ txId }: {
|
|
577
|
+
txId: string;
|
|
578
|
+
}): Promise<any>;
|
|
579
|
+
}
|
|
580
|
+
|
|
508
581
|
declare class TomoWallet extends BaseService {
|
|
509
582
|
private static instance;
|
|
510
583
|
private walletId;
|
|
@@ -519,6 +592,7 @@ declare class TomoWallet extends BaseService {
|
|
|
519
592
|
declare const ChainTypeServices: {
|
|
520
593
|
evm: typeof EvmService;
|
|
521
594
|
sol: typeof SolanaService;
|
|
595
|
+
doge: typeof DogecoinService;
|
|
522
596
|
};
|
|
523
597
|
|
|
524
|
-
export { AccountType, type ChainAddress, ChainTypeServices, EvmService, type IAccount, SolanaService, type TomoAppInfo, TomoWallet, type TransactionItem, type TransactionsParams, type TransactionsResponse, TxTypes };
|
|
598
|
+
export { AccountType, type ChainAddress, ChainTypeServices, DogecoinService, EvmService, type IAccount, type IAccountInfo, SolanaService, type TomoAppInfo, TomoWallet, type TransactionItem, type TransactionsParams, type TransactionsResponse, TxTypes };
|