@tatumio/utxo-wallet-provider
Version:
UTXO provider with local wallet operations
91 lines (90 loc) • 4.04 kB
TypeScript
import { ITatumSdkContainer, Network, TatumSdkWalletProvider } from '@tatumio/tatum';
import { UtxoTxPayload, UtxoWallet, XpubWithMnemonic } from './types';
export declare class UtxoWalletProvider extends TatumSdkWalletProvider<UtxoWallet, UtxoTxPayload> {
private readonly config;
private readonly sdkConfig;
private readonly connector;
private readonly utxoRpc;
constructor(tatumSdkContainer: ITatumSdkContainer, config: {
skipAllChecks: boolean;
});
/**
* Generates a mnemonic seed phrase.
* @returns {string} A mnemonic seed phrase.
*/
generateMnemonic(): string;
/**
* Generates an extended public key (xpub) based on a mnemonic and a derivation path.
* If no mnemonic is provided, it is generated.
* If no derivation path is provided, default is used.
* @param {string} [mnemonic] - The mnemonic seed phrase.
* @param {string} [path] - The derivation path.
* @returns {XpubWithMnemonic} An object containing xpub, mnemonic, and derivation path.
*/
generateXpub(mnemonic?: string, path?: string): Promise<XpubWithMnemonic>;
/**
* Generates a private key based on a mnemonic, index, and a derivation path.
* If no derivation path is provided, default is used.
* @param {string} mnemonic - The mnemonic seed phrase.
* @param {number} index - The index to derive the private key from.
* @param {string} [path] - The derivation path.
* @returns {string} A private key in string format.
*/
generatePrivateKeyFromMnemonic(mnemonic: string, index: number, path?: string): Promise<string>;
/**
* Generates an address based on a mnemonic, index, and a derivation path.
* If no derivation path is provided, default is used.
* @param {string} mnemonic - The mnemonic seed phrase.
* @param {number} index - The index to derive the address from.
* @param {string} [path] - The derivation path.
* @returns {string} An address in string format.
*/
generateAddressFromMnemonic(mnemonic: string, index: number, path?: string): Promise<string>;
/**
* Generates an address from an extended public key (xpub) and an index.
* @param {string} xpub - The extended public key.
* @param {number} index - The index to derive the address from.
* @returns {string} An address in string format.
*/
generateAddressFromXpub(xpub: string, index: number): string;
/**
* Generates an address from a given private key.
* @param {string} privateKey - The private key in string format.
* @returns {string} An UTXO address in string format.
*/
generateAddressFromPrivateKey(privateKey: string): string;
/**
* Generates an UTXO-compatible wallet, which includes an address, private key, and a mnemonic.
* @returns {UtxoWallet} An object containing address, private key, and mnemonic.
*/
getWallet(): Promise<UtxoWallet>;
/**
* Signs and broadcasts an UTXO transaction payload.
* @param {UtxoTxPayload} payload - The UTXO transaction payload, which includes private keys and transaction details.
* @returns {Promise<string>} A promise that resolves to the transaction hash.
*/
signAndBroadcast(payload: UtxoTxPayload): Promise<string>;
private getRawTransaction;
private setToAddress;
private setChangeAddress;
private setFee;
private getRawTransactionLtc;
private getRawTransactionDoge;
supportedNetworks: Network[];
/**
* In case if change amount is dust, its amount will be appended to fee.
* We need to check it to prevent implicit amounts change
*/
private checkDustAmountInChange;
private validateUtxoBody;
private privateKeysFromAddress;
private getUtxos;
private privateKeysFromUTXO;
private getDogeUtxoBatch;
private getUtxoBatch;
private getUtxoSilent;
private validateBalanceFromUTXO;
private getEstimateFeeFromUtxo;
private getChainForFee;
private getChainForUtxo;
}