@xchainjs/xchain-doge
Version:
Custom Doge client and utilities used by XChain clients
55 lines (54 loc) • 2.38 kB
TypeScript
import { FeeRate, TxHash } from '@xchainjs/xchain-client';
import { Address } from '@xchainjs/xchain-util';
import { TxParams } from '@xchainjs/xchain-utxo';
import { Client } from './client';
/**
* Custom Doge client extended to support keystore functionality
*/
declare class ClientKeystore extends Client {
/**
* Get the Dogecoin address.
*
* Generates a Dogecoin address using the provided phrase and index.
* @param {number} index The index of the address to retrieve. Default is 0.
* @returns {Address} The Dogecoin address.
* @throws {"index must be greater than zero"} Thrown if the index is less than zero.
* @throws {"Phrase must be provided"} Thrown if the phrase is not provided.
* @throws {"Address not defined"} Thrown if failed to create the address from the phrase.
*/
getAddress(index?: number): Address;
/**
* @private
* Get private key.
*
* Private function to get keyPair from the this.phrase
*
* @param {string} phrase The phrase to be used for generating privkey
* @returns {ECPairInterface} The privkey generated from the given phrase
*
* @throws {"Could not get private key from phrase"} Throws an error if failed creating Doge keys from the given phrase
* */
private getDogeKeys;
/**
* Get the current address.
* Asynchronous version of getAddress method.
* Generates a network-specific key-pair by first converting the buffer to a Wallet-Import-Format (WIF)
* The address is then decoded into type P2WPKH and returned.
* @returns {Address} The current address.
*
* @throws {"Phrase must be provided"} Thrown if phrase has not been set before.
* @throws {"Address not defined"} Thrown if failed creating account from phrase.
*/
getAddressAsync(index?: number): Promise<string>;
/**
* Asynchronously transfers Dogecoin.
*
* Builds, signs, and broadcasts a Dogecoin transaction with the specified parameters.
* @param {TxParams & { feeRate?: FeeRate }} params The transfer parameters including transaction details and optional fee rate.
* @returns {TxHash} A promise that resolves to the transaction hash once the transfer is completed.
*/
transfer(params: TxParams & {
feeRate?: FeeRate;
}): Promise<TxHash>;
}
export { ClientKeystore };