@tomo-inc/chains-service 0.0.7 → 0.0.9
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 +837 -107
- package/dist/index.d.cts +293 -46
- package/dist/index.d.ts +293 -46
- package/dist/index.js +834 -115
- package/package.json +2 -2
- package/src/api/network-data.ts +33 -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/rpc.ts +10 -191
- package/src/dogecoin/service.ts +44 -264
- package/src/dogecoin/type.ts +12 -0
- package/src/dogecoin/utils-doge.ts +88 -2
- package/src/dogecoin/utils.ts +3 -380
- package/src/evm/service.ts +57 -73
- package/src/index.ts +10 -5
- 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.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ChainTypes, TomoStage } from '@tomo-inc/wallet-utils';
|
|
2
|
-
import
|
|
2
|
+
import * as axios from 'axios';
|
|
3
3
|
import { AxiosInstance } from 'axios';
|
|
4
|
+
import { Transaction as Transaction$1 } from 'viem';
|
|
5
|
+
import { Psbt } from 'bitcoinjs-lib';
|
|
4
6
|
|
|
5
7
|
declare enum AccountType {
|
|
6
8
|
EOA = "EOA",
|
|
@@ -16,9 +18,9 @@ interface ChainAddress {
|
|
|
16
18
|
interface IAccount {
|
|
17
19
|
readonly id: string;
|
|
18
20
|
readonly userId?: string | number;
|
|
19
|
-
readonly name
|
|
21
|
+
readonly name?: string;
|
|
20
22
|
readonly type: AccountType;
|
|
21
|
-
readonly lastUsedTime
|
|
23
|
+
readonly lastUsedTime?: number;
|
|
22
24
|
readonly sortIndex?: number;
|
|
23
25
|
readonly addresses: Record<ChainTypes, ChainAddress[]>;
|
|
24
26
|
readonly mnemonic: string | null;
|
|
@@ -30,11 +32,12 @@ interface IAccount {
|
|
|
30
32
|
readonly externalId?: string | number;
|
|
31
33
|
readonly totalAssets?: string;
|
|
32
34
|
}
|
|
33
|
-
interface
|
|
35
|
+
interface IAccountInfo {
|
|
34
36
|
getCurrent: () => Promise<any[]>;
|
|
35
37
|
signMessage: (message: string) => Promise<string>;
|
|
36
38
|
signTypedData: (message: any) => Promise<string>;
|
|
37
39
|
signTransaction: (transaction: any) => Promise<string>;
|
|
40
|
+
decryptedMessage?: (message: string) => Promise<any>;
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
interface QueryGasParams {
|
|
@@ -128,7 +131,7 @@ interface ITypedData {
|
|
|
128
131
|
domain: any;
|
|
129
132
|
message: any;
|
|
130
133
|
}
|
|
131
|
-
type TransactionParams = Omit<any, "rpcUrl">;
|
|
134
|
+
type TransactionParams$1 = Omit<any, "rpcUrl">;
|
|
132
135
|
|
|
133
136
|
declare enum TxTypes {
|
|
134
137
|
swap = 1,
|
|
@@ -178,9 +181,9 @@ interface TransactionsResponse {
|
|
|
178
181
|
interface TomoAppInfo {
|
|
179
182
|
tomoStage: TomoStage;
|
|
180
183
|
tomoClientId: string;
|
|
181
|
-
apiKey
|
|
182
|
-
apiSecret
|
|
183
|
-
salt
|
|
184
|
+
apiKey?: string;
|
|
185
|
+
apiSecret?: string;
|
|
186
|
+
salt?: string;
|
|
184
187
|
jwtToken?: string;
|
|
185
188
|
}
|
|
186
189
|
type TokenInfo = any;
|
|
@@ -330,20 +333,14 @@ declare class TokenAPIs extends BasePublicService {
|
|
|
330
333
|
private constructor();
|
|
331
334
|
static getInstance(apiBase: IPublicApiBaseConfig, tomoAppInfo: TomoAppInfo): TokenAPIs;
|
|
332
335
|
getTokenInfo(params: GetTokenInfoParams): Promise<RemoteResponse<RemoteTokenInfo>>;
|
|
333
|
-
getTokenRisk(params:
|
|
334
|
-
chainIndex: number;
|
|
335
|
-
tokenAddress: string;
|
|
336
|
-
}): Promise<RemoteResponse<any>>;
|
|
336
|
+
getTokenRisk(params: GetTokenInfoParams): Promise<RemoteResponse<any>>;
|
|
337
337
|
addCustomToken(params: AddCustomTokenParams): Promise<RemoteResponse<any>>;
|
|
338
338
|
deleteCustomToken(params: DeleteCustomTokenParams): Promise<RemoteResponse<any>>;
|
|
339
339
|
addMultiToken(params: AddCustomTokenParams): Promise<RemoteResponse<any>>;
|
|
340
340
|
removeMultiToken(params: DeleteCustomTokenParams): Promise<RemoteResponse<any>>;
|
|
341
341
|
syncCustomToken(params: SyncCustomTokenParams): Promise<RemoteResponse<any>>;
|
|
342
342
|
getTokenBalance(params: GetTokenBalanceParams): Promise<RemoteResponse<GetTokenBalanceResponse>>;
|
|
343
|
-
getTokenDetail(params:
|
|
344
|
-
chainIndex: number;
|
|
345
|
-
tokenAddress: string;
|
|
346
|
-
}): Promise<RemoteResponse<any>>;
|
|
343
|
+
getTokenDetail(params: GetTokenInfoParams): Promise<RemoteResponse<any>>;
|
|
347
344
|
queryRemoteTokens(params: {
|
|
348
345
|
keyword: string;
|
|
349
346
|
chainIndex?: number;
|
|
@@ -353,23 +350,13 @@ declare class TokenAPIs extends BasePublicService {
|
|
|
353
350
|
declare class Tokens {
|
|
354
351
|
tokenAPIs: TokenAPIs;
|
|
355
352
|
constructor(tokenService: TokenAPIs);
|
|
356
|
-
searchTokens({ chainIndex,
|
|
353
|
+
searchTokens({ chainIndex, keyword }: {
|
|
357
354
|
chainIndex?: number;
|
|
358
|
-
|
|
355
|
+
keyword: string;
|
|
359
356
|
}): 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>;
|
|
357
|
+
getTokenInfo({ address, chainIndex }: GetTokenInfoParams): Promise<TokenInfo>;
|
|
358
|
+
getTokenRiskInfo(_params: GetTokenInfoParams): Promise<any>;
|
|
359
|
+
getTokenDetail(_params: GetTokenInfoParams): Promise<any>;
|
|
373
360
|
}
|
|
374
361
|
|
|
375
362
|
declare class TransactionAPIs extends BasePublicService {
|
|
@@ -407,19 +394,179 @@ declare class Transactions {
|
|
|
407
394
|
declare class BaseService {
|
|
408
395
|
isDappConnected: boolean;
|
|
409
396
|
approveParams: any;
|
|
410
|
-
accountInfo:
|
|
397
|
+
accountInfo: IAccountInfo;
|
|
411
398
|
networks: Networks;
|
|
412
399
|
tokens: Tokens;
|
|
413
400
|
transactions: Transactions;
|
|
414
|
-
constructor(tomoAppInfo: TomoAppInfo, accountInfo?:
|
|
401
|
+
constructor(tomoAppInfo: TomoAppInfo, accountInfo?: IAccountInfo);
|
|
415
402
|
setApproveParams(params: any): Promise<void>;
|
|
416
403
|
}
|
|
417
404
|
|
|
405
|
+
type DogeSpendableUtxos = {
|
|
406
|
+
txid: string;
|
|
407
|
+
vout: number;
|
|
408
|
+
outputValue: number;
|
|
409
|
+
script: string;
|
|
410
|
+
tx?: {
|
|
411
|
+
txid: string;
|
|
412
|
+
vout: number;
|
|
413
|
+
};
|
|
414
|
+
};
|
|
415
|
+
interface TransactionParams {
|
|
416
|
+
accountId?: string;
|
|
417
|
+
from: string;
|
|
418
|
+
to: string;
|
|
419
|
+
fee?: string;
|
|
420
|
+
amount: number;
|
|
421
|
+
decimals?: number;
|
|
422
|
+
chainId?: number | string;
|
|
423
|
+
tokenAddress?: string;
|
|
424
|
+
}
|
|
425
|
+
interface DogeTxData {
|
|
426
|
+
amountMismatch?: boolean;
|
|
427
|
+
amount: number;
|
|
428
|
+
fee: number;
|
|
429
|
+
to: string;
|
|
430
|
+
from: string;
|
|
431
|
+
senderAddress?: string;
|
|
432
|
+
sender?: string;
|
|
433
|
+
fromAddress?: string;
|
|
434
|
+
spendableUtxos?: DogeSpendableUtxos[];
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
declare const mydoge: axios.AxiosInstance;
|
|
438
|
+
declare function getBalance(address?: string): Promise<any>;
|
|
439
|
+
type Transaction = {
|
|
440
|
+
blockHash: string;
|
|
441
|
+
blockHeight: number;
|
|
442
|
+
blockTime: number;
|
|
443
|
+
confirmations: number;
|
|
444
|
+
fees: string;
|
|
445
|
+
hex: string;
|
|
446
|
+
size: number;
|
|
447
|
+
txid: string;
|
|
448
|
+
value: string;
|
|
449
|
+
valueIn: string;
|
|
450
|
+
version: number;
|
|
451
|
+
vin: {
|
|
452
|
+
addresses: string[];
|
|
453
|
+
hex: string;
|
|
454
|
+
isAddress: boolean;
|
|
455
|
+
n: number;
|
|
456
|
+
sequence: number;
|
|
457
|
+
txid: string;
|
|
458
|
+
value: string;
|
|
459
|
+
}[];
|
|
460
|
+
vout: {
|
|
461
|
+
addresses: string[];
|
|
462
|
+
value: string;
|
|
463
|
+
n: number;
|
|
464
|
+
hex: string;
|
|
465
|
+
isAddress: boolean;
|
|
466
|
+
}[];
|
|
467
|
+
};
|
|
468
|
+
declare function getTxDetail(txId: string): Promise<Transaction>;
|
|
469
|
+
declare function getInscriptionsUtxos(address: string): Promise<any[]>;
|
|
470
|
+
declare function getSpendableUtxos(address: string): Promise<any[]>;
|
|
471
|
+
declare function getUnSpentUtxos(address: string): Promise<any>;
|
|
472
|
+
declare function getInscriptionsUtxo(address: string, tx: any): Promise<any>;
|
|
473
|
+
declare function sendTransaction({ signed, senderAddress }: any): Promise<any>;
|
|
474
|
+
declare function estimateSmartFee({ senderAddress }: {
|
|
475
|
+
senderAddress: string;
|
|
476
|
+
}): Promise<{
|
|
477
|
+
feePerKB: number;
|
|
478
|
+
}>;
|
|
479
|
+
declare function onCreateTransaction({ data, sendResponse }: {
|
|
480
|
+
data: any;
|
|
481
|
+
sendResponse: any;
|
|
482
|
+
}): Promise<void>;
|
|
483
|
+
type TransactionResponse = {
|
|
484
|
+
transactions: Transaction[];
|
|
485
|
+
txIds: string[];
|
|
486
|
+
totalPages: number;
|
|
487
|
+
page: number;
|
|
488
|
+
};
|
|
489
|
+
declare function getTransactions(address: string, config?: {
|
|
490
|
+
pageSize: number;
|
|
491
|
+
pageNumber: number;
|
|
492
|
+
}): Promise<TransactionResponse>;
|
|
493
|
+
declare const getDogeFeeByBlock: (address?: string, n?: number) => Promise<number>;
|
|
494
|
+
declare const sendDogeTx: (rawTx: string) => Promise<any>;
|
|
495
|
+
|
|
496
|
+
type API_Transaction = Transaction;
|
|
497
|
+
type API_TransactionResponse = TransactionResponse;
|
|
498
|
+
declare const API_estimateSmartFee: typeof estimateSmartFee;
|
|
499
|
+
declare const API_getBalance: typeof getBalance;
|
|
500
|
+
declare const API_getDogeFeeByBlock: typeof getDogeFeeByBlock;
|
|
501
|
+
declare const API_getInscriptionsUtxo: typeof getInscriptionsUtxo;
|
|
502
|
+
declare const API_getInscriptionsUtxos: typeof getInscriptionsUtxos;
|
|
503
|
+
declare const API_getSpendableUtxos: typeof getSpendableUtxos;
|
|
504
|
+
declare const API_getTransactions: typeof getTransactions;
|
|
505
|
+
declare const API_getTxDetail: typeof getTxDetail;
|
|
506
|
+
declare const API_getUnSpentUtxos: typeof getUnSpentUtxos;
|
|
507
|
+
declare const API_mydoge: typeof mydoge;
|
|
508
|
+
declare const API_onCreateTransaction: typeof onCreateTransaction;
|
|
509
|
+
declare const API_sendDogeTx: typeof sendDogeTx;
|
|
510
|
+
declare const API_sendTransaction: typeof sendTransaction;
|
|
511
|
+
declare namespace API {
|
|
512
|
+
export { type API_Transaction as Transaction, type API_TransactionResponse as TransactionResponse, API_estimateSmartFee as estimateSmartFee, API_getBalance as getBalance, API_getDogeFeeByBlock as getDogeFeeByBlock, API_getInscriptionsUtxo as getInscriptionsUtxo, API_getInscriptionsUtxos as getInscriptionsUtxos, API_getSpendableUtxos as getSpendableUtxos, API_getTransactions as getTransactions, API_getTxDetail as getTxDetail, API_getUnSpentUtxos as getUnSpentUtxos, API_mydoge as mydoge, API_onCreateTransaction as onCreateTransaction, API_sendDogeTx as sendDogeTx, API_sendTransaction as sendTransaction };
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
declare class DogecoinService extends BaseService {
|
|
516
|
+
private static instance;
|
|
517
|
+
chainType: ChainTypes | "";
|
|
518
|
+
rpcService: typeof API;
|
|
519
|
+
constructor(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo);
|
|
520
|
+
static getInstance(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo): DogecoinService;
|
|
521
|
+
requestAccounts(): Promise<{
|
|
522
|
+
address: string;
|
|
523
|
+
balance: number;
|
|
524
|
+
approved: boolean;
|
|
525
|
+
publicKey: string;
|
|
526
|
+
}>;
|
|
527
|
+
getAccounts(): Promise<string[]>;
|
|
528
|
+
getConnectionStatus(): Promise<{
|
|
529
|
+
connected: boolean;
|
|
530
|
+
address: string;
|
|
531
|
+
selectedWalletAddress: string;
|
|
532
|
+
}>;
|
|
533
|
+
getBalance(): Promise<{
|
|
534
|
+
address: string;
|
|
535
|
+
balance: number;
|
|
536
|
+
}>;
|
|
537
|
+
signMessage({ message, type }: {
|
|
538
|
+
message: string;
|
|
539
|
+
type?: string;
|
|
540
|
+
}): Promise<{
|
|
541
|
+
signedMessage: string;
|
|
542
|
+
}>;
|
|
543
|
+
requestSignedMessage({ message, type, }: {
|
|
544
|
+
message: string;
|
|
545
|
+
type?: string;
|
|
546
|
+
}): Promise<{
|
|
547
|
+
signedMessage: string;
|
|
548
|
+
}>;
|
|
549
|
+
_queryGasInfo(txData: TransactionParams): Promise<QueryGasResponse>;
|
|
550
|
+
requestPsbt({ rawTx, signOnly, }: {
|
|
551
|
+
rawTx: string;
|
|
552
|
+
signOnly?: boolean;
|
|
553
|
+
}): Promise<{
|
|
554
|
+
signedRawTx: string;
|
|
555
|
+
txId?: string;
|
|
556
|
+
} | null>;
|
|
557
|
+
requestTransaction(txData: DogeTxData): Promise<{
|
|
558
|
+
txId: string;
|
|
559
|
+
} | null>;
|
|
560
|
+
getTransactionStatus({ txId }: {
|
|
561
|
+
txId: string;
|
|
562
|
+
}): Promise<any>;
|
|
563
|
+
}
|
|
564
|
+
|
|
418
565
|
declare class EvmService extends BaseService {
|
|
419
566
|
private static instance;
|
|
420
567
|
chainType: ChainTypes | "";
|
|
421
|
-
constructor(chainType: ChainTypes, accountInfo:
|
|
422
|
-
static getInstance(chainType: ChainTypes, accountInfo:
|
|
568
|
+
constructor(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo);
|
|
569
|
+
static getInstance(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo): EvmService;
|
|
423
570
|
eth_requestAccounts(): Promise<string[]>;
|
|
424
571
|
eth_accounts(): Promise<string[]>;
|
|
425
572
|
eth_chainId(): Promise<`0x${string}`>;
|
|
@@ -429,25 +576,27 @@ declare class EvmService extends BaseService {
|
|
|
429
576
|
personal_sign([message, address]: [`0x${string}`, `0x${string}`]): Promise<`0x${string}`>;
|
|
430
577
|
eth_signTypedData_v4([address, typedData]: [`0x${string}`, ITypedData]): Promise<`0x${string}`>;
|
|
431
578
|
eth_getBalance([address, type]: [`0x${string}`, "latest"]): Promise<string>;
|
|
432
|
-
_queryGasInfo(txData: TransactionParams): Promise<QueryGasResponse>;
|
|
433
|
-
eth_estimateGas(txs: Transaction[]): Promise<`0x${string}`>;
|
|
579
|
+
_queryGasInfo(txData: TransactionParams$1): Promise<QueryGasResponse>;
|
|
434
580
|
private createPublicClient;
|
|
581
|
+
eth_estimateGas(txs: Transaction$1[]): Promise<`0x${string}`>;
|
|
435
582
|
eth_getTransactionCount([address, type]: [`0x${string}`, "latest" | "pending"]): Promise<number>;
|
|
436
583
|
eth_signTransaction(txParams: {
|
|
437
|
-
type?:
|
|
584
|
+
type?: "eip1559" | "legacy";
|
|
438
585
|
from: `0x${string}`;
|
|
439
586
|
to: `0x${string}`;
|
|
440
587
|
value: `0x${string}`;
|
|
441
588
|
data?: `0x${string}`;
|
|
442
589
|
chainId: `0x${string}`;
|
|
443
590
|
nonce: `0x${string}`;
|
|
444
|
-
gasLimit
|
|
591
|
+
gasLimit?: `0x${string}`;
|
|
592
|
+
gas?: `0x${string}`;
|
|
593
|
+
gasPrice?: `0x${string}`;
|
|
445
594
|
maxFeePerGas?: `0x${string}`;
|
|
446
595
|
maxPriorityFeePerGas?: `0x${string}`;
|
|
447
596
|
accessList?: any[];
|
|
448
|
-
}[]): Promise<Transaction>;
|
|
597
|
+
}[]): Promise<Transaction$1>;
|
|
449
598
|
eth_sendRawTransaction([serializedTransaction]: [`0x${string}`], rpcUrl?: `https://${string}`): Promise<`0x${string}`>;
|
|
450
|
-
getTransaction(hash: `0x${string}`): Promise<Transaction>;
|
|
599
|
+
getTransaction(hash: `0x${string}`): Promise<Transaction$1>;
|
|
451
600
|
}
|
|
452
601
|
|
|
453
602
|
interface SolanaRentInfo {
|
|
@@ -464,9 +613,9 @@ declare class SolanaService extends BaseService {
|
|
|
464
613
|
chainType: ChainTypes | "";
|
|
465
614
|
rpcUrl: string;
|
|
466
615
|
private connection;
|
|
467
|
-
constructor(chainType: ChainTypes, accountInfo:
|
|
468
|
-
static getInstance(chainType: ChainTypes, accountInfo:
|
|
469
|
-
getCurrentWalletAccount(): Promise<any>;
|
|
616
|
+
constructor(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo);
|
|
617
|
+
static getInstance(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo): SolanaService;
|
|
618
|
+
getCurrentWalletAccount(): Promise<any[]>;
|
|
470
619
|
getAccount(): Promise<{
|
|
471
620
|
publicKey: string;
|
|
472
621
|
address: string;
|
|
@@ -486,7 +635,7 @@ declare class SolanaService extends BaseService {
|
|
|
486
635
|
method: string;
|
|
487
636
|
params: any;
|
|
488
637
|
}): Promise<any>;
|
|
489
|
-
_queryGasInfo(txData: TransactionParams): Promise<QueryGasResponse>;
|
|
638
|
+
_queryGasInfo(txData: TransactionParams$1): Promise<QueryGasResponse>;
|
|
490
639
|
sendSignedTx(signedTx: string): Promise<string>;
|
|
491
640
|
signTransaction({ rawTransaction }: {
|
|
492
641
|
rawTransaction: string;
|
|
@@ -516,9 +665,107 @@ declare class TomoWallet extends BaseService {
|
|
|
516
665
|
getTransactions({ tokenAddress, chainId, typeList, pageLimit, cursor, }: TransactionsParams): Promise<TransactionsResponse>;
|
|
517
666
|
}
|
|
518
667
|
|
|
668
|
+
declare function toSatoshi(bitcion: number | string): number;
|
|
669
|
+
declare function toBitcoin(satoshis: number | string): number;
|
|
670
|
+
declare function addUsedUtxos(newUsedUtxos: object): void;
|
|
671
|
+
declare function getUsedUtxos(): any;
|
|
672
|
+
declare function createPsbt({ from, to, amount, fee, spendableUtxos, }: {
|
|
673
|
+
from: string;
|
|
674
|
+
to: string;
|
|
675
|
+
amount: number;
|
|
676
|
+
fee: number;
|
|
677
|
+
spendableUtxos: DogeSpendableUtxos[];
|
|
678
|
+
}): Promise<{
|
|
679
|
+
psbtBase64: string;
|
|
680
|
+
usingUtxos: any;
|
|
681
|
+
}>;
|
|
682
|
+
declare function decodePsbt(psbt: string, type?: string): Psbt;
|
|
683
|
+
declare class TransactionParser {
|
|
684
|
+
rawTx: string;
|
|
685
|
+
constructor(rawTx: string);
|
|
686
|
+
hexToText(hex: string): string;
|
|
687
|
+
extractOPReturnData(): any;
|
|
688
|
+
parseScript(): {
|
|
689
|
+
version: string;
|
|
690
|
+
inputCount: number;
|
|
691
|
+
inputs: {
|
|
692
|
+
txid: string;
|
|
693
|
+
vout: string;
|
|
694
|
+
scriptData: any;
|
|
695
|
+
}[];
|
|
696
|
+
opReturnData: any;
|
|
697
|
+
};
|
|
698
|
+
parseInputs(): {
|
|
699
|
+
txid: string;
|
|
700
|
+
vout: string;
|
|
701
|
+
scriptData: any;
|
|
702
|
+
}[];
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
/**
|
|
706
|
+
* UTXO Transaction type definition
|
|
707
|
+
* Replaces the utxoTx type from @okxweb3/coin-bitcoin
|
|
708
|
+
*/
|
|
709
|
+
interface utxoTx {
|
|
710
|
+
address: string;
|
|
711
|
+
inputs: Array<{
|
|
712
|
+
txId: string;
|
|
713
|
+
vOut: number;
|
|
714
|
+
amount: number;
|
|
715
|
+
nonWitnessUtxo?: string;
|
|
716
|
+
address?: string;
|
|
717
|
+
}>;
|
|
718
|
+
outputs: Array<{
|
|
719
|
+
address: string;
|
|
720
|
+
amount: number;
|
|
721
|
+
}>;
|
|
722
|
+
}
|
|
723
|
+
declare class DogecoinAddress {
|
|
724
|
+
static network: {
|
|
725
|
+
messagePrefix: string;
|
|
726
|
+
bech32: string;
|
|
727
|
+
bip44: number;
|
|
728
|
+
bip32: {
|
|
729
|
+
public: number;
|
|
730
|
+
private: number;
|
|
731
|
+
};
|
|
732
|
+
pubKeyHash: number;
|
|
733
|
+
scriptHash: number;
|
|
734
|
+
wif: number;
|
|
735
|
+
};
|
|
736
|
+
static generatePath(addressIndex: number): string;
|
|
737
|
+
static verifyAddress(address: string): boolean;
|
|
738
|
+
}
|
|
739
|
+
declare class DogecoinUtils {
|
|
740
|
+
/**
|
|
741
|
+
* Build the PSBT from the transaction
|
|
742
|
+
* @param tx utxoTx
|
|
743
|
+
* @param _maximumFeeRate number (optional, currently unused)
|
|
744
|
+
* @returns base64
|
|
745
|
+
*/
|
|
746
|
+
static buildPsbtToBase64(tx: utxoTx, _maximumFeeRate?: number): string;
|
|
747
|
+
/**
|
|
748
|
+
* Extract the transaction from the signed PSBT
|
|
749
|
+
* @param signedPsbt base64
|
|
750
|
+
* @param _maximumFeeRate number (optional, currently unused)
|
|
751
|
+
* @returns transaction hex
|
|
752
|
+
*/
|
|
753
|
+
static extractPsbtTransaction(signedPsbt: string, _maximumFeeRate?: number): string;
|
|
754
|
+
/**
|
|
755
|
+
* Convert raw transaction hex to PSBT base64
|
|
756
|
+
* This method converts an unsigned raw transaction to PSBT format.
|
|
757
|
+
* Note: The rawTx should be an unsigned transaction, and the nonWitnessUtxo
|
|
758
|
+
* for each input will need to be fetched separately from the blockchain.
|
|
759
|
+
* @param rawTx hex string of the raw transaction
|
|
760
|
+
* @returns base64 string of the PSBT
|
|
761
|
+
*/
|
|
762
|
+
static rawTxToPsbtBase64(rawTx: string): Promise<string>;
|
|
763
|
+
}
|
|
764
|
+
|
|
519
765
|
declare const ChainTypeServices: {
|
|
520
766
|
evm: typeof EvmService;
|
|
521
767
|
sol: typeof SolanaService;
|
|
768
|
+
doge: typeof DogecoinService;
|
|
522
769
|
};
|
|
523
770
|
|
|
524
|
-
export { AccountType, type ChainAddress, ChainTypeServices, EvmService, type IAccount, SolanaService, type TomoAppInfo, TomoWallet, type TransactionItem, type TransactionsParams, type TransactionsResponse, TxTypes };
|
|
771
|
+
export { AccountType, type ChainAddress, ChainTypeServices, API as DogecoinAPI, DogecoinAddress, DogecoinService, DogecoinUtils, EvmService, type IAccount, type IAccountInfo, SolanaService, type TomoAppInfo, TomoWallet, type TransactionItem, TransactionParser, type TransactionsParams, type TransactionsResponse, TxTypes, addUsedUtxos, createPsbt, decodePsbt, getUsedUtxos, toBitcoin, toSatoshi, type utxoTx };
|