/**
* @license
* https://reviews.bitcoinabc.org
* Copyright (c) 2017-2020 Emilio Almansi
* Copyright (c) 2023-2024 Bitcoin ABC
* Distributed under the MIT software license, see the accompanying
* file LICENSE or http://www.opensource.org/licenses/mit-license.php.
*/
import { AddressType, DecodedAddress, TypeAndHash } from './types';
/**
* Encoding and decoding of the new Cash Address format for eCash.
* Compliant with the original cashaddr specification:
* {@link https://github.com/bitcoincashorg/bitcoincash.org/blob/master/spec/cashaddr.md}
* @module cashaddr
*/
/**
* Encodes a hash from a given type into an eCash address with the given prefix.
*
* @param prefix Cash address prefix. E.g.: 'ecash'.
* @param type Type of address to generate
* @param hash Hash to encode represented as an array of 8-bit integers.
* @throws {ValidationError}
*/
export declare function encodeCashAddress(prefix: string, type: AddressType, hash: Uint8Array | string): string;
/**
* Decodes the given address into its constituting prefix, type and hash. See [#encode()]{@link encode}.
*
* @param address Address to decode. E.g.: 'ecash:qpm2qsznhks23z7629mms6s4cwef74vcwva87rkuu2'.
* @throws {ValidationError}
*/
export declare function decodeCashAddress(address: string): DecodedAddress;
/**
* All valid address prefixes
* Note that as of 2.0.0 we do not validate against these prefixes
* However we do use them to guess prefix for prefixless addrs
*
* @private
*/
export declare const VALID_PREFIXES: string[];
/**
* Returns a uint8array for a given string input
*
* @private
* @param uint8Array Input string.
*/
export declare function uint8arrayToHexString(uint8Array: Uint8Array): string;
/**
* Get type and hash from an outputScript
*
* Supported outputScripts:
*
* P2PKH: 76a91488ac
* P2SH: a91487
*
* Validates for supported outputScript and hash length *
*
* @param outputScript an ecash tx outputScript
* @throws {ValidationError}
*/
export declare function getTypeAndHashFromOutputScript(outputScript: string): TypeAndHash;
export declare const getOutputScriptFromTypeAndHash: (type: AddressType, hash: string) => string;
/**
* Encodes a given outputScript into an eCash address using the optionally specified prefix.
*
* @static
* @param outputScript an ecash tx outputScript
* @param prefix Cash address prefix. E.g.: 'ecash'.
* @throws {ValidationError}
*/
export declare function encodeOutputScript(outputScript: string, prefix?: string): string;
/**
* Return true for a valid cashaddress
* Prefixless addresses with valid checksum are also valid
*
* @static
* @param testedAddress a string tested for cashaddress validity
* @param optionalPrefix cashaddr prefix
* @throws {ValidationError}
*/
export declare function isValidCashAddress(cashaddress: string, optionalPrefix?: boolean | string): boolean;
/**
* Return true for a valid cashaddress
* Prefixless addresses with valid checksum are also valid
*
* @static
* @param address a valid p2pkh or p2sh cash address
* @returns the outputScript associated with this address and type
* @throws {ValidationError} if decode fails
*/
export declare function getOutputScriptFromAddress(address: string): string;