import { curve, BNInput } from "elliptic";
import BN from "bn.js";
export class BufferUtils {
    /**
     * Fill a buffer with a value.
     *
     * @param buffer
     * @param value
     * @return filled buffer
     *
     * @deprecated use `buffer.fill(value)`
     */
    static fill(buffer: Buffer, value: number): Buffer;
    /**
     *
     * @param original buffer
     * @return Return a copy of a buffer
     *
     * @deprecated use `Buffer.from(original) or Buffer.copyBytesFrom(original)`
     */
    static copy(original: Buffer): Buffer;
    /**
     * Tests for both node's Buffer and Uint8Array
     *
     * @param arg
     * @return Returns true if the given argument is an instance of a buffer.
     */
    static isBuffer(arg: unknown): arg is Buffer;
    /**
     * Tests for both node's Buffer and Uint8Array
     *
     * @param arg
     * @return Returns true if the given argument is an instance of a hash160 or hash256 buffer.
     */
    static isHashBuffer(arg: unknown): boolean;
    /**
     * Returns a zero-filled byte array
     *
     * @param length
     *
     * @deprecated use `Buffer.alloc(length)`
     */
    static emptyBuffer(length: number): Buffer;
    /**
     * Reverse a buffer
     * @param param
     * @return new reversed buffer
     */
    static reverse(param: Buffer): Buffer;
    /**
     * Transforms a buffer into a string with a number in hexa representation
     *
     * Shorthand for <tt>buffer.toString('hex')</tt>
     *
     * @param buffer
     * @return string
     */
    static bufferToHex(buffer: Buffer): string;
    /**
     * Transforms a number from 0 to 255 into a Buffer of size 1 with that value
     *
     * @param integer
     * @return Buffer
     */
    static integerAsSingleByteBuffer(integer: number): Buffer;
    /**
     * Transforms the first byte of an array into a number ranging from -128 to 127
     *
     * @param buffer
     * @return number
     */
    static integerFromSingleByteBuffer(buffer: Buffer): number;
    /**
     * Transform a 4-byte integer into a Buffer of length 4.
     *
     * @param integer
     * @return Buffer
     */
    static integerAsBuffer(integer: number): Buffer;
    /**
     * Transform the first 4 values of a Buffer into a number, in little endian encoding
     *
     * @param buffer
     * @return integer
     */
    static integerFromBuffer(buffer: Buffer): number;
    static getRandomBuffer(size: number): Buffer;
}
export class Hash {
    static sha1(buf: Buffer): Buffer;
    static sha256(buf: Buffer): Buffer;
    static sha512(buf: Buffer): Buffer;
    static ripemd160(buf: Buffer): Buffer;
    static sha256sha256(buf: Buffer): Buffer;
    static sha256ripemd160(buf: Buffer): Buffer;
    static sha256hmac(data: Buffer, key: Buffer): Buffer;
    static sha512hmac(data: Buffer, key: Buffer): Buffer;
}
export class CommonUtils {
    /**
     * Determines whether a string contains only hexadecimal values
     *
     * @param value
     * @returns true if the string is the hexa representation of a number
     */
    static isHexa(value: unknown): boolean;
    /**
     * Test if an argument is a valid JSON object. If it is, returns a truthy
     * value (the json object decoded), so no double JSON.parse call is necessary
     *
     * @param arg
     * @return false if the argument is not a JSON string.
     */
    static isValidJSON(arg: string): object | boolean;
    static cloneArray<T>(array: T[]): T[];
    /**
     * Checks that a value is a natural number.
     *
     * @param value
     * @return true if a positive integer or zero.
     */
    static isNaturalNumber(value: number): boolean;
    /**
     * Checks that a value is a natural number.
     *
     * @param value
     * @return true if a positive integer or zero.
     */
    static isNaturalBigInt(value: bigint): boolean;
}
export class Point {
    ecPoint: curve.short.ShortPoint;
    constructor(point: curve.short.ShortPoint, skipValidation?: boolean);
    /**
     * Will return the X coordinate of the Point
     *
     * @returns A BN instance of the X coordinate
     */
    getX(): BN;
    /**
     * Will return the Y coordinate of the Point
     *
     * @returns A BN instance of the Y coordinate
     */
    getY(): BN;
    add(p: Point): Point;
    mul(k: BN): Point;
    mulAdd(k1: BN, p2: Point, k2: BN): Point;
    eq(p: Point): boolean;
    /**
     * Will determine if the point is valid
     *
     * @see {@link https://www.iacr.org/archive/pkc2003/25670211/25670211.pdf}
     * @throws A validation error if exists
     * @returns An instance of the same Point
     */
    validate(): this;
    hasSquare(): boolean;
    /**
     * Instantiate a valid secp256k1 Point from the X and Y coordinates.
     *
     * @param x - The X coordinate
     * @param y - The Y coordinate
     * @see {@link https://github.com/indutny/elliptic}
     * @throws A validation error if exists
     */
    static ecPoint(x: BNInput, y: BNInput, isRed?: boolean): Point;
    /**
     *
     * Instantiate a valid secp256k1 Point from only the X coordinate
     *
     * @param odd - If the Y coordinate is odd
     * @param x - The X coordinate
     * @throws A validation error if exists
     */
    static ecPointFromX(odd: boolean, x: BNInput): Point;
    /**
     *
     * Will return a secp256k1 ECDSA base point.
     *
     * @see {@link https://en.bitcoin.it/wiki/Secp256k1}
     * @returns An instance of the base point.
     */
    static getG(): Point;
    /**
     *
     * Will return the max of range of valid private keys as governed by the secp256k1 ECDSA standard.
     *
     * @see {@link https://en.bitcoin.it/wiki/Private_key#Range_of_valid_ECDSA_private_keys}
     * @returns A BN instance of the number of points on the curve
     */
    static getN(): BN;
    static pointToCompressed(point: Point): Buffer;
}
export class Network {
    name: string;
    alias: string;
    prefix: string;
    pubkeyhash: number;
    privatekey: number;
    scripthash: number;
    xpubkey: number;
    xprivkey: number;
    networkMagic: Buffer;
    port: number;
    dnsSeeds: string[];
    constructor(params: NetworkParams);
    toString(): string;
}
export type EndianType = "big" | "little";
/**
 *  Any type that can be used where a numeric value is needed.
 */
export type Numeric = number | bigint;
/**
 *  Any type that can be used where a big number is needed.
 */
export type BigNumberish = string | Numeric;
/**
 *  Any type that can be used where a network is needed.
 */
export type Networkish = string | Network;
/**
 *  Any type that can be used where a Buffer is needed.
 */
export type Bufferish = Buffer | Uint8Array;
/**
 * NetworkManager is a singleton service, containing map values that correspond to version
 * numbers for each nexa network. Currently only supporting "mainnet"
 * (a.k.a. "livenet") and "testnet", with option to add custom networks.
 *
 * @remarks should be used as singletone.
 *
 * @see {@linkcode NetworkManager.getInstance}
 */
export class NetworkManager {
    get mainnet(): Network;
    /** @deprecated use mainnet */
    get livenet(): Network;
    get testnet(): Network;
    get defaultNetwork(): Network;
    set defaultNetwork(network: Network);
    /**
     * @returns the singleton instance of NetworkManager
     */
    static getInstance(): NetworkManager;
    get(arg?: Networkish | number, key?: keyof Network): Network | undefined;
    create(network: NetworkParams): Network;
    add(network: Network | NetworkParams): void;
    remove(network: Networkish | NetworkParams): void;
}
export type PublicKeyVariants = PublicKey | Point | Partial<IPrivateKey> | Partial<IPublicKey> | PublicKeyDto | Buffer | string;
/**
 * Instantiate new PublicKey.
 *
 * There are two internal properties, `network` and `compressed`, that deal with importing
 * a PublicKey from a PrivateKey in WIF format.
 *
 * @remarks Better to use {@linkcode PublicKey.from} method to init public key from various formats if the formart unknown.
 *
 * @example
 * ```ts
 * // export to as a DER hex encoded string
 * let exported = key.toString();
 *
 * // import the public key
 * let imported = PublicKey.fromString(exported);
 * //or
 * let imported = PublicKey.from(exported);
 * ```
 */
export class PublicKey implements IPublicKey {
    point: Point;
    compressed: boolean;
    network: Network;
    /**
     * @param data - The pubkey data
     */
    constructor(data: Partial<IPublicKey>);
    toObject: () => PublicKeyDto;
    toDER: () => Buffer;
    /**
     * @returns A plain object of the PublicKey
     */
    toJSON(): PublicKeyDto;
    /**
     * Will output the PublicKey to a DER Buffer
     *
     * @returns  A DER hex encoded buffer
     */
    toBuffer(): Buffer;
    /**
     * Will output the PublicKey to a DER encoded hex string
     *
     * @returns A DER hex encoded string
     */
    toString(): string;
    /**
     * Will return a string formatted for the console
     *
     * @returns Public key string inspection
     */
    inspect(): string;
    /**
     * Instantiate a PublicKey from various formats
     *
     * @param data The encoded data in various formats
     * @param compressed If the public key is compressed
     * @param network The key network
     * @returns New PublicKey instance
     */
    static from(data: PublicKeyVariants, compressed?: boolean, network?: Network): PublicKey;
    static fromDER: typeof PublicKey.fromBuffer;
    static fromObject: typeof PublicKey.fromJSON;
    /**
     * Instantiate a PublicKey from a Buffer
     *
     * @param buf - A DER hex buffer
     * @param strict - if set to false, will loosen some conditions
     * @param network - the network of the key
     * @returns A new valid instance of PublicKey
     */
    static fromBuffer(buf: Buffer, strict?: boolean, network?: Network): PublicKey;
    /**
     * Instantiate a PublicKey from a Point
     *
     * @param point - A Point instance
     * @param compressed - whether to store this public key as compressed format
     * @param network - the network of the key
     * @returns A new valid instance of PublicKey
     */
    static fromPoint(point: Point, compressed?: boolean, network?: Network): PublicKey;
    /**
     * Instantiate a PublicKey from a DER hex encoded string
     *
     * @param str - A DER hex string
     * @param encoding - The type of string encoding
     * @param network - the network of the key
     * @returns A new valid instance of PublicKey
     */
    static fromString(str: string, encoding?: BufferEncoding, network?: Network): PublicKey;
    /**
     * Instantiate a PublicKey from PrivateKey data
     *
     * @param data - Object contains data of PrivateKey
     * @returns A new valid instance of PublicKey
     */
    static fromPrivateKey(data: IPrivateKey): PublicKey;
    static fromJSON(data: PublicKeyDto): PublicKey;
    /**
     * Check if there would be any errors when initializing a PublicKey
     *
     * @param data - The encoded data in various formats
     * @returns An error if exists
     */
    static getValidationError(data: PublicKeyVariants): Error | undefined;
    /**
     * Check if the parameters are valid
     *
     * @param data - The encoded data in various formats
     * @returns true If the public key would be valid
     */
    static isValid(data: PublicKeyVariants): boolean;
}
export enum AddressType {
    PayToPublicKeyHash = "P2PKH",
    PayToScriptTemplate = "P2ST",
    GroupIdAddress = "GROUP"
}
export class BufferReader {
    buf: Buffer;
    pos: number;
    constructor(buf?: Buffer | string | BufferParams);
    set(obj: BufferParams): this;
    eof(): boolean;
    finished: () => boolean;
    read(len: number): Buffer;
    readAll(): Buffer;
    readUInt8(): number;
    readUInt16BE(): number;
    readUInt16LE(): number;
    readUInt32BE(): number;
    readUInt32LE(): number;
    readInt32LE(): number;
    readUInt64BEBN(): BN;
    readUInt64LEBN(): BN;
    readVarintNum(): number;
    /**
     * reads a length prepended buffer
     */
    readVarLengthBuffer(): Buffer;
    readVarintBuf(): Buffer;
    readVarintBN(): BN;
    reverse(): this;
    readReverse(len?: number): Buffer;
    readCoreVarintNum(): number;
}
export class BufferWriter {
    constructor(obj?: BufferWriterOptions);
    set(obj: BufferWriterOptions): this;
    toBuffer(): Buffer;
    concat(): Buffer;
    write(buf: Buffer): this;
    writeReverse(buf: Buffer): this;
    writeUInt8(n: number): this;
    writeUInt16BE(n: number): this;
    writeUInt16LE(n: number): this;
    writeUInt32BE(n: number): this;
    writeInt32LE(n: number): this;
    writeUInt32LE(n: number): this;
    writeUInt64BEBN(bn: BN): this;
    writeUInt64LEBN(bn: BN): this;
    writeVarintNum(n: number): this;
    writeVarintBN(bn: BN): this;
    writeVarLengthBuf(buf: Buffer): this;
    writeCoreVarintNum(n: number): this;
    static varintBufNum(n: number): Buffer;
    static varintBufBN(bn: BN): Buffer;
}
export enum Opcode {
    OP_FALSE = 0,
    OP_0 = 0,
    OP_PUSHDATA1 = 76,
    OP_PUSHDATA2 = 77,
    OP_PUSHDATA4 = 78,
    OP_1NEGATE = 79,
    OP_RESERVED = 80,
    OP_TRUE = 81,
    OP_1 = 81,
    OP_2 = 82,
    OP_3 = 83,
    OP_4 = 84,
    OP_5 = 85,
    OP_6 = 86,
    OP_7 = 87,
    OP_8 = 88,
    OP_9 = 89,
    OP_10 = 90,
    OP_11 = 91,
    OP_12 = 92,
    OP_13 = 93,
    OP_14 = 94,
    OP_15 = 95,
    OP_16 = 96,
    OP_NOP = 97,
    OP_INVALID_CONTROL1 = 98,
    OP_IF = 99,
    OP_NOTIF = 100,
    OP_JUMP = 101,
    OP_INVALID_CONTROL2 = 102,
    OP_ELSE = 103,
    OP_ENDIF = 104,
    OP_VERIFY = 105,
    OP_RETURN = 106,
    OP_TOALTSTACK = 107,
    OP_FROMALTSTACK = 108,
    OP_2DROP = 109,
    OP_2DUP = 110,
    OP_3DUP = 111,
    OP_2OVER = 112,
    OP_2ROT = 113,
    OP_2SWAP = 114,
    OP_IFDUP = 115,
    OP_DEPTH = 116,
    OP_DROP = 117,
    OP_DUP = 118,
    OP_NIP = 119,
    OP_OVER = 120,
    OP_PICK = 121,
    OP_ROLL = 122,
    OP_ROT = 123,
    OP_SWAP = 124,
    OP_TUCK = 125,
    OP_CAT = 126,
    OP_SPLIT = 127,
    OP_NUM2BIN = 128,
    OP_BIN2NUM = 129,
    OP_SIZE = 130,
    OP_INVERT = 131,
    OP_AND = 132,
    OP_OR = 133,
    OP_XOR = 134,
    OP_EQUAL = 135,
    OP_EQUALVERIFY = 136,
    OP_RESERVED1 = 137,
    OP_RESERVED2 = 138,
    OP_1ADD = 139,
    OP_1SUB = 140,
    OP_2MUL = 141,
    OP_2DIV = 142,
    OP_NEGATE = 143,
    OP_ABS = 144,
    OP_NOT = 145,
    OP_0NOTEQUAL = 146,
    OP_ADD = 147,
    OP_SUB = 148,
    OP_MUL = 149,
    OP_DIV = 150,
    OP_MOD = 151,
    OP_LSHIFT = 152,
    OP_RSHIFT = 153,
    OP_BOOLAND = 154,
    OP_BOOLOR = 155,
    OP_NUMEQUAL = 156,
    OP_NUMEQUALVERIFY = 157,
    OP_NUMNOTEQUAL = 158,
    OP_LESSTHAN = 159,
    OP_GREATERTHAN = 160,
    OP_LESSTHANOREQUAL = 161,
    OP_GREATERTHANOREQUAL = 162,
    OP_MIN = 163,
    OP_MAX = 164,
    OP_WITHIN = 165,
    OP_RIPEMD160 = 166,
    OP_SHA1 = 167,
    OP_SHA256 = 168,
    OP_HASH160 = 169,
    OP_HASH256 = 170,
    OP_CODESEPARATOR = 171,
    OP_CHECKSIG = 172,
    OP_CHECKSIGVERIFY = 173,
    OP_CHECKMULTISIG = 174,
    OP_CHECKMULTISIGVERIFY = 175,
    OP_NOP2 = 177,
    OP_CHECKLOCKTIMEVERIFY = 177,
    OP_NOP3 = 178,
    OP_CHECKSEQUENCEVERIFY = 178,
    OP_NOP1 = 176,
    OP_NOP4 = 179,
    OP_NOP5 = 180,
    OP_NOP6 = 181,
    OP_NOP7 = 182,
    OP_NOP8 = 183,
    OP_NOP9 = 184,
    OP_NOP10 = 185,
    OP_CHECKDATASIG = 186,
    OP_CHECKDATASIGVERIFY = 187,
    OP_REVERSEBYTES = 188,
    OP_INPUTINDEX = 192,
    OP_ACTIVEBYTECODE = 193,
    OP_TXVERSION = 194,
    OP_TXINPUTCOUNT = 195,
    OP_TXOUTPUTCOUNT = 196,
    OP_TXLOCKTIME = 197,
    OP_UTXOVALUE = 198,
    OP_UTXOBYTECODE = 199,
    OP_OUTPOINTHASH = 200,
    OP_INPUTBYTECODE = 202,
    OP_INPUTSEQUENCENUMBER = 203,
    OP_OUTPUTVALUE = 204,
    OP_OUTPUTBYTECODE = 205,
    OP_INPUTTYPE = 206,
    OP_OUTPUTTYPE = 207,
    OP_INPUTVALUE = 208,
    OP_PARSE = 230,
    OP_STORE = 231,
    OP_LOAD = 232,
    OP_PLACE = 233,
    OP_PUSH_TX_STATE = 234,
    OP_SETBMD = 235,
    OP_BIN2BIGNUM = 236,
    OP_EXEC = 237,
    FIRST_UNDEFINED_OP_VALUE = 238,
    OP_INVALIDOPCODE = 255
}
export class ScriptOpcode {
    num: number;
    constructor(val: number | string);
    static fromBuffer(buf: Buffer): ScriptOpcode;
    static fromNumber(num: number): ScriptOpcode;
    static fromString(str: string): ScriptOpcode;
    static smallInt(n: number): ScriptOpcode;
    /**
     * @returns true if opcode is one of OP_0, OP_1, ..., OP_16
     */
    static isSmallIntOp(opcode: ScriptOpcode | number): boolean;
    toHex(): string;
    toBuffer(): Buffer;
    toNumber(): number;
    toString(): string;
    /**
     * Will return a string formatted for the console
     *
     * @returns Script opcode
     */
    inspect(): string;
    /**
     * Comes from nexad's script DecodeOP_N function
     * @param opcode
     * @returns numeric value in range of 0 to 16
     */
    static decodeOP_N(opcode: number): number;
}
export type ScriptElement = string | number | bigint | boolean | Buffer | ScriptOpcode | ScriptChunk | Script;
/**
 * A nexa transaction script. Each transaction's inputs and outputs
 * has a script that is evaluated to validate it's spending.
 *
 * @see {@link https://spec.nexa.org/script/1script/}
 */
export class Script implements IScript {
    chunks: ScriptChunk[];
    constructor(from?: Buffer | string | IScript);
    set(obj: IScript): this;
    /**
    * @returns a new empty script
    */
    static empty(): Script;
    static fromBuffer(buffer: Buffer): Script;
    toBuffer(): Buffer;
    static fromHex(str: string): Script;
    static fromString(str: string): Script;
    static fromASM(str: string): Script;
    toASM(): string;
    toString(): string;
    toHex(): string;
    inspect(): string;
    /**
     * Adds a script element to the end of the script.
     *
     * @param param a script element to add
     * @returns this script instance
     *
     */
    add(param: ScriptElement): this;
    append: (param: ScriptElement) => this;
    /**
     * Adds a script element at the start of the script.
     * @param param a script element to add
     * @returns this script instance
     */
    prepend(param: ScriptElement): this;
    /**
     * Compares a script with another script
     */
    equals(script: Script): boolean;
    /**
     * Analogous to nexad's FindAndDelete. Find and delete equivalent chunks,
     * typically used with push data chunks. Note that this will find and delete
     * not just the same data, but the same data with the same push data op as
     * produced by default. i.e., if a pushdata in a tx does not use the minimal
     * pushdata op, then when you try to remove the data it is pushing, it will not
     * be removed, because they do not use the same pushdata op.
     */
    findAndDelete(script: Script): this;
    /**
     * Comes from nexad's script interpreter CheckMinimalPush function
     * @returns true if the chunk {i} is the smallest way to push that particular data.
     */
    checkMinimalPush(i: number): boolean;
    /**
     * Comes from bitcoind's script GetSigOpCount(boolean) function
     * @param accurate default true
     * @returns number of signature operations required by this script
     */
    getSignatureOperationsCount(accurate?: boolean): number;
    /**
     * @returns true if the script is only composed of data pushing
     * opcodes or small int opcodes (OP_0, OP_1, ..., OP_16)
     */
    isPushOnly(): boolean;
    /**
     * @returns true if this is a pay to script template output script
     * @remarks for well-known-1 template use {@link isPublicKeyTemplateOut}
     */
    isScriptTemplateOut(): boolean;
    /**
     * Checks if this script is a valid pay to script template input script
     *
     * @returns true if this is a pay to script template form input script
     * @remarks for well-known-1 template use {@link isPublicKeyTemplateIn}
     */
    isScriptTemplateIn(): boolean;
    /**
     * @returns true if this is a pay to pubkey template output script (well-known-1, p2pkt)
     */
    isPublicKeyTemplateOut(): boolean;
    /**
     * @returns true if this is a pay to public key template input script
     */
    isPublicKeyTemplateIn(): boolean;
    /**
     * @returns true if this is a pay to pubkey hash output script
     */
    isPublicKeyHashOut(): boolean;
    /**
     * @returns {boolean} if this is a pay to public key hash input script
     */
    isPublicKeyHashIn(): boolean;
    /**
     * @returns true if this is a valid standard OP_RETURN output
     */
    isDataOut(): boolean;
    /**
     * @returns true if this is a valid Token Description OP_RETURN output
     */
    isTokenDescriptionOut(): boolean;
    /**
     * Will retrieve the Public Key buffer from p2pkt/p2pkh input scriptSig
     */
    getPublicKey(): Buffer;
    /**
     * Will retrieve the Public Key Hash buffer from p2pkh output scriptPubKey
     */
    getPublicKeyHash(): Buffer;
    /**
     * Will retrieve the Template Hash from p2pkt/p2st output scriptPubKey
     *
     * @returns OP_1 if its p2pkt, otherwise the template hash buffer
     */
    getTemplateHash(): Buffer | Opcode.OP_1;
    /**
     * Will retrieve the Constraint Hash from p2pkt/p2st output scriptPubKey
     *
     * @returns The constraint hash buffer, or OP_FALSE if not included
     */
    getConstraintHash(): Buffer | Opcode.OP_FALSE;
    /**
     * Will retrieve the Group Identifier number from Token Description OP_RETURN output
     *
     * @remarks This method doesn't check if the group id number is fit to NRC1/NRC2 etc.
     */
    getGroupIdType(): number;
}
export class Address {
    readonly data: Buffer;
    readonly network: Network;
    readonly type: AddressType;
    /** @deprecated use data */
    get hashBuffer(): Buffer;
    /**
     * Instantiate an address from an address String or Buffer, a public key or script hash Buffer,
     * or an instance of {@link PublicKey} or {@link Script}.
     *
     * This is an immutable class, and if the first parameter provided to this constructor is an
     * `Address` instance, the same argument will be returned.
     *
     * An address has two key properties: `network` and `type`. The type is either
     * `AddressType.PayToPublicKeyHash` (value is the `'P2PKH'` string)
     * or `AddressType.PayToScriptTemplate` (the string `'P2ST'`). The network is an instance of {@link Network} or network name.
     * You can quickly check whether an address is of a given kind by using the methods
     * `isPayToPublicKeyHash` and `isPayToScriptTemplate`
     *
     * @example
     * ```javascript
     * // validate that an input field is valid
     * let error = Address.getValidationError(input, 'testnet');
     * if (!error) {
     *   let address = new Address(input, 'testnet');
     * } else {
     *   // invalid network or checksum (typo?)
     *   let message = error.messsage;
     * }
     *
     * // get an address from a public key
     * let address = Address.fromPublicKey(publicKey, 'testnet').toString();
     * ```
     *
     * @param data The encoded data in various formats
     * @param network The network: 'mainnet' (default) or 'testnet'
     * @param type The type of address: 'P2ST' (default) or 'P2PKH' or 'GROUP'
     * @returns A new valid and frozen instance of an Address
     */
    constructor(data: Address | string | Buffer, network?: Networkish, type?: AddressType);
    static validateParams(network?: Networkish, type?: AddressType): void;
    /**
     * @param address string
     *
     * @returns A new valid and frozen instance of an Address
     */
    static fromString(address: string): Address;
    /** @deprecated use fromString */
    static decodeNexaAddress: typeof Address.fromString;
    /**
     * Will return a cashaddr representation of the address. Always return lower case
     * Can be converted by the caller to uppercase is needed (still valid).
     *
     * @returns Nexa address
     */
    toString(): string;
    /** @deprecated use toString */
    toNexaAddress: () => string;
    /**
     * Will return a string formatted for the console
     *
     * @returns {string} Bitcoin address
     */
    inspect(): string;
    /**
     * Instantiate an address from an Object
     *
     * @param obj - A JSON object with keys: data, network and type
     * @returns A new valid instance of an Address
     */
    static fromObject(obj: AddressDto): Address;
    /**
     * @returns A plain object with the address information
     */
    toJSON(): AddressDto;
    toObject: () => AddressDto;
    /**
     * @return true if an address is of pay to public key hash type
     */
    isPayToPublicKeyHash(): boolean;
    /**
     * @return true if an address is of pay to script template type
     */
    isPayToScriptTemplate(): boolean;
    /**
     * @return true if an address is a group token address
     */
    isGroupIdentifierAddress(): boolean;
    /**
     * Will return a validation error if exists
     *
     * @example
     * ```javascript
     * // a network mismatch error
     * let error = Address.getValidationError('nexatest:nqtsq5g567x44x5g54t2wsxz60zwqmyks63rkrddl4stwnzu', 'testnet');
     * ```
     *
     * @param data The encoded data
     * @param network either a Network instance, 'mainnet', or 'testnet'
     * @param type The type of address: 'P2ST' or 'GROUP' or 'P2PKH'
     * @returns The corresponding error message
     */
    static getValidationError(data: string | Buffer, network?: Networkish, type?: AddressType): Error | undefined;
    /**
     * Will return a boolean if an address is valid
     *
     * @example
     * ```javascript
     * assert(Address.isValid('nexa:nqtsq5g567x44x5g54t2wsxz60zwqmyks63rkrddsfq94pd2', 'mainned'));
     * ```
     *
     * @param data The encoded data
     * @param network either a Network instance, 'mainnet', or 'testnet'
     * @param type The type of address: 'P2ST' or 'GROUP' or 'P2PKH'
     * @returns true if valid
     */
    static isValid(data: string | Buffer, network?: Networkish, type?: AddressType): boolean;
    /**
     * Instantiate an address from a PublicKey instance
     *
     * @param pubkey the public key instance
     * @param network either a Network instance, 'mainnet' or 'testnet'
     * @param type address encoding type
     * @returns A new valid and frozen instance of an Address
     */
    static fromPublicKey(pubkey: PublicKey, network?: Networkish, type?: AddressType): Address;
    /**
     * Instantiate an address from a non grouped script template
     *
     * @param templateHash An instance of a template hash Buffer
     * @param constraintHash An instance of a constraint hash Buffer
     * @param visibleArgs An array of push-only args, or hex string represent script buffer, or Script with push args
     * @param network either a Network instance, 'mainnet' or 'testnet'
     * @returns A new valid and frozen instance of an Address
     */
    static fromScriptTemplate(templateHash: Buffer | Opcode, constraintHash: Buffer | Opcode, visibleArgs?: string | Script | ScriptElement[], network?: Networkish): Address;
    /**
     * Will return the transaction output type by the address type
     *
     * @param address as string
     * @returns 1 - Template, 0 - otherwise
     */
    static getOutputType(address: string): number;
    /**
     * Will return the transaction output type by the address type
     *
     * @returns 1 - Template, 0 - otherwise
     */
    getOutputType(): number;
}
export interface UTXO {
    outpoint: string;
    satoshis?: bigint | string | number;
    amount?: string | number;
    scriptPubKey?: string | Script;
    address?: string | Address;
    groupId?: string | Address;
    groupAmount?: bigint;
    templateData?: ScriptTemplateObject;
}
export interface IOutput {
    type?: number;
    scriptPubKey: Script | string;
    value: bigint | number | string;
}
export interface IInput {
    type?: number;
    outpoint: string | Buffer;
    scriptSig: string | Script;
    amount: string | bigint;
    sequenceNumber?: number;
    output?: IOutput;
    templateData?: ScriptTemplateObject;
}
export interface ScriptTemplateObject {
    templateScript: Script | string;
    constraintScript: Script | string | number;
    publicKey?: PublicKey | string;
}
export interface ITransaction {
    id: string;
    idem: string;
    version: number;
    inputs: IInput[];
    outputs: IOutput[];
    nLockTime: number;
    fee?: number;
    feePerByte?: number;
    changeIndex?: number;
    changeScript?: string;
}
/**
 * Contain a set of flags to skip certain tests:
 *
 * * `disableAll`: disable all checks
 * * `disableIsFullySigned`: disable checking if all inputs are fully signed
 * * `disableDustOutputs`: disable checking if there are no outputs that are dust amounts
 * * `disableMoreOutputThanInput`: disable checking if the transaction spends more nexas than the sum of the input amounts
 */
export interface TxVerifyOptions {
    disableAll?: boolean;
    disableDustOutputs?: boolean;
    disableIsFullySigned?: boolean;
    disableMoreOutputThanInput?: boolean;
}
export interface BufferParams {
    buf?: Buffer;
    pos?: number;
}
export interface BufferWriterOptions {
    bufs?: Buffer[];
}
export interface NetworkParams {
    name: string;
    alias: string;
    prefix: string;
    pubkeyhash: number;
    privatekey: number;
    scripthash: number;
    xpubkey: number;
    xprivkey: number;
    networkMagic: number;
    port: number;
    dnsSeeds: string[];
}
export interface BNOptions {
    endian?: "little" | "big";
    size?: number;
    bignum?: boolean;
}
export interface GroupIdData {
    hashBuffer: Buffer;
    nonce: bigint;
}
export interface ISignature {
    r: BN;
    s: BN;
    i?: number;
    compressed?: boolean;
    toBuffer(isSchnorr: boolean): Buffer;
}
export interface IDigitalSignature {
    hashbuf: Buffer;
    endian?: "big" | "little";
    privkey: IPrivateKey;
    pubkey: IPublicKey;
    sig?: ISignature;
    verified?: boolean;
    sign(): this;
    verify(): this;
}
export interface IPrivateKey {
    compressed: boolean;
    network: Network;
    bn: BN;
    get publicKey(): IPublicKey;
    toString(): string;
    toWIF(): string;
    toBigNumber(): BN;
    toBuffer(): Buffer;
    toBufferNoPadding(): Buffer;
    toPublicKey(): IPublicKey;
    toJSON(): PrivateKeyDto;
    toObject(): PrivateKeyDto;
    inspect(): string;
}
export interface IPublicKey {
    point: Point;
    compressed?: boolean;
    network?: Network;
    toString(): string;
    toJSON(): PublicKeyDto;
    toObject(): PublicKeyDto;
    toDER(): Buffer;
    toBuffer(): Buffer;
    inspect(): string;
}
export interface PrivateKeyDto {
    compressed: boolean;
    network: string;
    bn: string;
}
export interface PublicKeyDto {
    x: string;
    y: string;
    compressed: boolean;
    network: string;
}
interface IHDKey {
    network: Network;
    depth: number;
    parentFingerPrint: Buffer;
    fingerPrint: Buffer;
    chainCode: Buffer;
    childIndex: number;
    checksum: Buffer;
}
export interface IHDPrivateKey extends IHDKey {
    privateKey: IPrivateKey;
    publicKey?: IPublicKey;
    xprivkey: string;
}
export interface IHDPublicKey extends IHDKey {
    publicKey: IPublicKey;
    xpubkey: string;
}
interface HDKeyBuffers {
    version: Buffer;
    depth: Buffer;
    parentFingerPrint: Buffer;
    childIndex: Buffer;
    chainCode: Buffer;
    checksum?: Buffer;
}
export interface HDPublicKeyBuffers extends HDKeyBuffers {
    publicKey: Buffer;
}
export interface HDPrivateKeyBuffers extends HDKeyBuffers {
    privateKey: Buffer;
}
interface HDKeyDto {
    network: string;
    depth: number;
    fingerPrint: number;
    parentFingerPrint: number;
    childIndex: number;
    chainCode: string;
    checksum: number;
}
export interface HDPrivateKeyDto extends HDKeyDto {
    privateKey: string;
    xprivkey: string;
}
export interface HDPublicKeyDto extends HDKeyDto {
    publicKey: string;
    xpubkey: string;
}
export type HDPrivateKeyMinimalDto = Omit<HDPrivateKeyDto, 'xprivkey' | 'checksum' | 'fingerPrint'>;
export type HDPublicKeyMinimalDto = Omit<HDPublicKeyDto, 'xpubkey' | 'checksum' | 'fingerPrint'>;
export interface ScriptChunk {
    buf?: Buffer;
    len?: number;
    opcodenum: number;
}
export interface IScript {
    chunks: ScriptChunk[];
}
export interface AddressDto {
    data: string;
    network: string;
    type: string;
}
export interface IMessage {
    message: string;
}
export interface IBlockHeader {
    hash?: string;
    prevHash: string | Buffer;
    bits: number;
    ancestorHash: string | Buffer;
    merkleRoot: string | Buffer;
    txFilter: string | Buffer;
    time: number;
    height: number;
    chainWork: string | Buffer;
    size: number;
    txCount: number;
    poolFee: number;
    utxoCommitment: string | Buffer;
    minerData: string | Buffer;
    nonce: string | Buffer;
}
export interface IBlock {
    header: IBlockHeader;
    transactions: ITransaction[];
}
export class BNExtended extends BN {
    static Zero: BNExtended;
    static One: BNExtended;
    static Minus1: BNExtended;
    static fromNumber(num: number): BNExtended;
    static fromBigInt(num: bigint): BNExtended;
    static fromString(str: string, base?: number | "hex"): BNExtended;
    static fromBuffer(buf: Buffer, opts?: BNOptions): BNExtended;
    /**
     * Create a BN from a "ScriptNum":
     * This is analogous to the constructor for CScriptNum in nexad. Many ops in
     * nexad's script interpreter use CScriptNum, which is not really a proper
     * bignum. Instead, an error is thrown if trying to input a number bigger than
     * 4 bytes. We copy that behavior here. A third argument, `size`, is provided to
     * extend the hard limit of 4 bytes, as some usages require more than 4 bytes.
     */
    static fromScriptNumBuffer(buf: Buffer, fRequireMinimal?: boolean, size?: number): BNExtended;
    add(b: BN): BNExtended;
    sub(b: BN): BNExtended;
    mul(b: BN): BNExtended;
    mod(b: BN): BNExtended;
    umod(b: BN): BNExtended;
    toNumber(): number;
    toBigInt(): bigint;
    toBuffer(opts?: BN.Endianness | BNOptions, length?: number): Buffer;
    /**
     * The corollary to the above, with the notable exception that we do not throw
     * an error if the output is larger than four bytes. (Which can happen if
     * performing a numerical operation that results in an overflow to more than 4
     * bytes).
     */
    toScriptNumBuffer(): Buffer;
    toScriptBigNumBuffer(): Buffer;
    getSize(): number;
    safeAdd(bigNumToAdd: BNExtended, maxSize: number): BNExtended;
    safeSub(bigNumToSubtract: BNExtended, maxSize: number): BNExtended;
    safeMul(bigNumToMultiply: BNExtended, maxSize: number): BNExtended;
}
export enum UnitType {
    MEX = 8,
    KEX = 5,
    NEXA = 2
}
/**
 * Utility for handling and converting nexa units.
 * You can consult for different representation of a unit using it's
 * {format} method or the fixed unit methods like {parse}.
 *
 * @example
 * ```ts
 * let nex = UnitUtils.formatNEXA(546); // "5.46"
 * let sats = UnitUtils.parseNEXA("5.46"); // 546n
 * let mex = UnitUtils.formatUnits(100000000, UnitType.MEX) // "1.00000000";
 * let units = UnitUtils.parseUnits('1.0', 5); // 100000n
 * ```
 */
export class UnitUtils {
    /**
     *  Converts `value` into a decimal string, assuming `unit` decimal
     *  places. The `unit` may be the number of decimal places or the enum of
     *  a unit (e.g. ``UnitType.MEX`` for 8 decimal places).
     *
     */
    static formatUnits(value: BigNumberish, unit?: UnitType | number): string;
    /**
    *  Converts the decimal string `value` to a BigInt, assuming
    *  `unit` decimal places. The `unit` may the number of decimal places
    *  or the name of a unit (e.g. ``UnitType.KEX`` for 5 decimal places).
    */
    static parseUnits(value: string, unit?: UnitType | number): bigint;
    /**
    *  Converts `value` into a decimal string using 2 decimal places.
    */
    static formatNEXA(sats: BigNumberish): string;
    /**
    *  Converts the decimal string `NEXA` to a BigInt, using 2 decimal places.
    */
    static parseNEXA(nexa: string): bigint;
}
export class Signature implements ISignature {
    r: BN;
    s: BN;
    i?: number;
    compressed?: boolean;
    constructor(params: Partial<ISignature>);
    toBuffer(isSchnorr?: boolean): Buffer;
    toTxFormat(sighashBuf?: Buffer): Buffer;
    toString(): string;
    /**
     * Schnorr signatures are 64 bytes: r [len] 32 || s [len] 32.
     *
     * There can be a few more bytes that is the sighashtype. It needs to be trimmed before calling this.
     */
    static fromBuffer(buf: Buffer, strict?: boolean): Signature;
    /**
     * The format used in a tx.
     * schnorr is 64 bytes, the rest are sighashtype bytes
     *
     * @param buf
     */
    static fromTxFormat(buf: Buffer): Signature;
    /**
     * This assumes the str is a raw signature and does not have sighashtype.
     * Use {@link Signature.fromTxString} when decoding a tx
     *
     * @param str the signature hex string
     * @see fromTxString
     */
    static fromString(str: string): Signature;
    /**
     * This assumes the str might have sighashtype bytes and will trim it if needed.
     * Use this when decoding a tx signature string
     *
     * @param str the tx signature hex string
     */
    static fromTxString(str: string, encoding?: BufferEncoding): Signature;
    /**
     * For ECDSA. In order to mimic the non-strict DER encoding of OpenSSL, set strict = false.
     */
    static parseDER(buf: Buffer, strict?: boolean): Record<string, unknown>;
    /**
     * ECDSA format. used for sign messages
     */
    toCompact(i?: number, compressed?: boolean): Buffer;
    static fromCompact(buf: Buffer): Signature;
}
export abstract class DigitalSignature implements IDigitalSignature {
    hashbuf: Buffer;
    endian?: EndianType;
    privkey: IPrivateKey;
    pubkey: IPublicKey;
    sig?: ISignature;
    verified?: boolean;
    constructor(obj?: Partial<IDigitalSignature>);
    protected set(obj: Partial<IDigitalSignature>): this;
    protected abstract _findSignature(d: BN, e: BN): Partial<ISignature>;
    abstract sigError(): boolean | string;
    sign(): this;
    verify(): this;
    toPublicKey(): IPublicKey;
    privkey2pubkey(): void;
}
/**
 * IMPORTANT: ECDSA only used for compact message signing.
 * for transactions signing, use Schnorr.
 */
export class ECDSA extends DigitalSignature {
    k?: BN;
    set(obj: Partial<ECDSA>): this;
    sigError(): boolean | string;
    protected _findSignature(d: BN, e: BN): Partial<ISignature>;
    calcI(): this;
    randomK(): this;
    deterministicK(badrs?: number): this;
    signRandomK(): this;
    toString(): string;
    toPublicKey(): PublicKey;
    static fromString(str: string): ECDSA;
    static sign(hashbuf: Buffer, privkey: IPrivateKey, endian?: EndianType): ISignature;
    static verify(hashbuf: Buffer, sig: ISignature, pubkey: IPublicKey, endian?: EndianType): boolean;
}
export class Schnorr extends DigitalSignature {
    sigError(): boolean | string;
    /**
     * RFC6979 deterministic nonce generation used from https://reviews.bitcoinabc.org/D2501
     *
     * @param privkeybuf
     * @param msgbuf
     * @return BN nonce
     */
    nonceFunctionRFC6979(privkeybuf: Buffer, msgbuf: Buffer): BN;
    /**
     * @remarks
     * Important references for schnorr implementation {@link https://spec.nexa.org/forks/2019-05-15-schnorr/}
     *
     * @param d the private key
     * @param e the message to be signed
     */
    protected _findSignature(d: BN, e: BN): Partial<ISignature>;
    static sign(hashbuf: Buffer, privkey: IPrivateKey, endian: EndianType): ISignature;
    static verify(hashbuf: Buffer, sig: ISignature, pubkey: IPublicKey, endian: EndianType): boolean;
}
export type PrivateKeyVariants = BN | string | Bufferish | PrivateKey | IPrivateKey | PrivateKeyDto | null;
export class PrivateKey implements IPrivateKey {
    bn: BN;
    compressed: boolean;
    network: Network;
    /**
     * Instantiate a PrivateKey.
     *
     * @param data The private key data
     *
     * @remarks Better to use {@linkcode PrivateKey.from} method to init private key from various formats if the formart unknown.
     *
     * @example
     * ```ts
     * // generate a new random key
     * let key = new PrivateKey();
     *
     * // encode into wallet import format
     * let exported = key.toWIF();
     *
     * // instantiate from the exported (and saved) private key
     * let imported = PrivateKey.fromWIF(exported);
     * ```
     */
    constructor(data?: Partial<IPrivateKey>);
    get publicKey(): PublicKey;
    /**
     * Will return an address for the private key with its defined network
     *
     * @param type - optional parameter specifying the desired type of the address.
     *  default {@link AddressType.PayToScriptTemplate}
     *
     * @returns An address generated from the private key
     */
    toAddress(type?: AddressType): Address;
    /**
     * Will output the PrivateKey encoded as hex string
     */
    toString(): string;
    /**
     * Will encode the PrivateKey to a WIF string
     *
     * @returns A WIF representation of the private key
     */
    toWIF(): string;
    /**
     * Will return the private key as a BN instance
     *
     * @returns A BN instance of the private key
     */
    toBigNumber(): BN;
    /**
     * Will return the private key as a BN buffer
     *
     * @returns A buffer of the private key
     */
    toBuffer(): Buffer;
    /**
     * Will return the private key as a BN buffer without leading zero padding
     *
     * @returns A buffer of the private key
     */
    toBufferNoPadding(): Buffer;
    /**
     * Will return the corresponding public key
     *
     * @returns A public key generated from the private key
     */
    toPublicKey(): PublicKey;
    toObject: () => PrivateKeyDto;
    /**
     * @returns A plain object representation
     */
    toJSON(): PrivateKeyDto;
    /**
     * Will return a string formatted for the console
     *
     * @returns Private key details
     */
    inspect(): string;
    /**
     * Instantiate a PrivateKey from a Buffer with the DER or WIF representation
     */
    static fromBuffer(buf: Buffer, network?: Networkish): PrivateKey;
    static fromString: typeof PrivateKey.fromWIF;
    /**
     * Instantiate a PrivateKey from a WIF string
     *
     * @param str - The WIF encoded private key string
     * @returns A new valid instance of PrivateKey
     */
    static fromWIF(str: string, network?: Networkish): PrivateKey;
    static fromObject: typeof PrivateKey.fromJSON;
    /**
     * Instantiate a PrivateKey from a plain JavaScript object
     *
     * @param obj - The output from privateKey.toObject()
     */
    static fromJSON(obj: PrivateKeyDto): PrivateKey;
    /**
     * Instantiate a PrivateKey from random bytes
     *
     * @param network - Either "mainnet" or "testnet"
     * @returns A new valid instance of PrivateKey
     */
    static fromRandom(network?: Networkish): PrivateKey;
    /**
     * Check if there would be any errors when initializing a PrivateKey
     *
     * @param data - The encoded data in various formats
     * @param network - Either "mainnet" or "testnet"
     * @returns An error if exists
     */
    static getValidationError(data: PrivateKeyVariants, network?: Networkish): Error | undefined;
    /**
     * Check if the parameters are valid
     *
     * @param data - The encoded data in various formats
     * @param network - Either "mainnet" or "testnet"
     * @returns true If the private key would be valid
     */
    static isValid(data?: PrivateKeyVariants, network?: Networkish): boolean;
    /**
     * Helper to instantiate PrivateKey from different kinds of arguments.
     */
    static from(data?: PrivateKeyVariants, network?: Networkish): PrivateKey;
}
export class HDPublicKey implements IHDPublicKey {
    readonly publicKey: PublicKey;
    readonly network: Network;
    readonly depth: number;
    readonly parentFingerPrint: Buffer;
    readonly fingerPrint: Buffer;
    readonly chainCode: Buffer;
    readonly childIndex: number;
    readonly checksum: Buffer;
    readonly xpubkey: string;
    /**
     * The representation of an hierarchically derived public key.
     *
     * See https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki
     *
     * @param arg
     */
    constructor(arg: string | Buffer | HDPublicKeyDto | HDPublicKeyMinimalDto | IHDPublicKey | IHDPrivateKey);
    /**
     * Verifies that a given path is valid.
     *
     * @param arg
     * @return {boolean}
     */
    static isValidPath(arg: string | number): boolean;
    /**
     * Create a HDPublicKey from a buffer argument
     *
     * @param buf
     */
    static fromBuffer(buf: Buffer): HDPublicKey;
    /**
     * Return a buffer representation of the xpubkey
     */
    toBuffer(): Buffer;
    static fromString(xpubkey: string): HDPublicKey;
    /**
     * Returns the base58 checked representation of the public key
     * @return a string starting with "xpub..." in livenet
     */
    toString(): string;
    /**
     * Returns the console representation of this extended public key.
     */
    inspect(): string;
    static fromObject(arg: HDPublicKeyDto): HDPublicKey;
    static fromMinimalObject(arg: HDPublicKeyMinimalDto): HDPublicKey;
    toJSON: () => HDPublicKeyDto;
    /**
     * Returns a plain JavaScript object with information to reconstruct a key.
     */
    toObject(): HDPublicKeyDto;
    /**
     * Will return an address for the hdpubkey with its defined network
     *
     * @param type - optional parameter specifying the desired type of the address.
     *  default {@link AddressType.PayToScriptTemplate}
     *
     * @returns An address generated from the hd public key
     */
    toAddress(type?: AddressType): Address;
    /**
     * Get a derivated child based on a string or number.
     *
     * If the first argument is a string, it's parsed as the full path of
     * derivation. Valid values for this argument include "m" (which returns the
     * same public key), "m/0/1/40/2/1000".
     *
     * Note that hardened keys can't be derived from a public extended key.
     *
     * If the first argument is a number, the child with that index will be
     * derived. See the example usage for clarification.
     *
     * @example
     * ```javascript
     * let parent = new HDPublicKey('xpub...');
     * let child_0_1_2 = parent.deriveChild(0).deriveChild(1).deriveChild(2);
     * let copy_of_child_0_1_2 = parent.deriveChild("m/0/1/2");
     * assert(child_0_1_2.xpubkey === copy_of_child_0_1_2.xpubkey);
     * ```
     *
     * @param {string|number} arg
     */
    deriveChild(arg: string | number, hardened?: boolean): HDPublicKey;
}
export class HDPrivateKey implements IHDPrivateKey {
    readonly privateKey: PrivateKey;
    readonly publicKey: PublicKey;
    readonly network: Network;
    readonly depth: number;
    readonly parentFingerPrint: Buffer;
    readonly fingerPrint: Buffer;
    readonly chainCode: Buffer;
    readonly childIndex: number;
    readonly checksum: Buffer;
    readonly xprivkey: string;
    /**
     * Represents an instance of an hierarchically derived private key.
     *
     * More info on https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki
     */
    constructor(arg?: string | Buffer | IHDPrivateKey | HDPrivateKeyDto | HDPrivateKeyMinimalDto | Networkish);
    get hdPublicKey(): HDPublicKey;
    get xpubkey(): string;
    /**
     * Verifies that a given path is valid.
     *
     * @param arg
     * @param hardened
     */
    static isValidPath(arg: string | number, hardened?: boolean): boolean;
    static fromString(xprivkey: string): HDPrivateKey;
    /**
     * Returns the string representation of this private key (ext privkey).
     */
    toString(): string;
    /**
     * Build a HDPrivateKey from a buffer
     *
     * @param {Buffer} buf
     */
    static fromBuffer(buf: Buffer): HDPrivateKey;
    /**
     * Returns a buffer representation of the HDPrivateKey
     */
    toBuffer(): Buffer;
    toJSON: () => HDPrivateKeyDto;
    /**
     * Returns a plain object with a representation of this private key.
     */
    toObject(): HDPrivateKeyDto;
    static fromObject(arg: HDPrivateKeyDto): HDPrivateKey;
    static fromMinimalObject(arg: HDPrivateKeyMinimalDto): HDPrivateKey;
    /**
     * Generate a private key from a seed, as described in BIP32
     *
     * @param seed
     * @param network
     * @return HDPrivateKey
     */
    static fromSeed(seed: string | Buffer, network?: Networkish): HDPrivateKey;
    /**
     * Get a derived child based on a string or number.
     *
     * If the first argument is a string, it's parsed as the full path of
     * derivation. Valid values for this argument include "m" (which returns the
     * same private key), "m/0/1/40/2'/1000", where the ' quote means a hardened
     * derivation.
     *
     * If the first argument is a number, the child with that index will be
     * derived. If the second argument is truthy, the hardened version will be
     * derived. See the example usage for clarification.
     *
     * @example
     * ```javascript
     * let parent = new HDPrivateKey('xprv...');
     * let child_0_1_2h = parent.deriveChild(0).deriveChild(1).deriveChild(2, true);
     * let copy_of_child_0_1_2h = parent.deriveChild("m/0/1/2'");
     * assert(child_0_1_2h.xprivkey === copy_of_child_0_1_2h.xprivkey);
     * ```
     *
     * @param arg
     * @param hardened
     * @return HDPrivateKey
     */
    deriveChild(arg: string | number, hardened?: boolean): HDPrivateKey;
    /**
     * Will return the corresponding hd public key
     *
     * @returns An extended public key generated from the hd private key
     */
    getHDPublicKey(): HDPublicKey;
    /**
     * Returns the console representation of this extended private key.
     */
    inspect(): string;
}
export class Message implements IMessage {
    static readonly MAGIC_BYTES: Buffer<ArrayBuffer>;
    message: string;
    error?: string;
    constructor(message: string);
    /**
     * Will sign a message with a given private key.
     *
     * @param privateKey An instance of PrivateKey
     * @returns A base64 encoded compact signature
     */
    sign(privateKey: PrivateKey): string;
    /**
     * Will return a boolean of the signature is valid for a given nexa address.
     * If it isn't valid, the specific reason is accessible via the "error" member.
     *
     * @param nexaAddress A nexa address
     * @param signatureString A base64 encoded compact signature
     */
    verify(nexaAddress: Address | string, signatureString: string): boolean;
    /**
     * Instantiate a message from a message string
     *
     * @param str A string of the message
     * @returns A new instance of a Message
     */
    static fromString(str: string): Message;
    /**
     * Instantiate a message from JSON
     *
     * @param json An JSON string or Object with keys: message
     * @returns A new instance of a Message
     */
    static fromJSON(json: string | IMessage): Message;
    /**
     * @returns A plain object with the message information
     */
    toObject(): IMessage;
    /**
     * @returns A JSON representation as string of the message information
     */
    toJSON(): string;
    /**
     * Will return a the string representation of the message
     */
    toString(): string;
    /**
     * Will return a string formatted for the console
     */
    inspect(): string;
}
export enum GroupIdFlag {
    NONE = 0,
    COVENANT = 1,// covenants/encumberances -- output script template must match input
    HOLDS_NEX = 2,// group inputs and outputs must balance NEX, token quantity MUST be 0
    GROUP_RESERVED_BITS = 65532,
    DEFAULT = 0
}
/**
 * Represent Group creation id type in OP_RETURN script
 */
export enum GroupIdType {
    /** Legacy token */
    LEGACY = 88888888,
    /** Token */
    NRC1 = 88888890,
    /** NFT Collection */
    NRC2 = 88888891,
    /** NFT that belongs to a collection */
    NRC3 = 88888892
}
/**
 * A util class with methods for group tokenization.
 */
export class GroupToken {
    static readonly PARENT_GROUP_ID_SIZE = 32;
    static readonly authFlags: {
        /** Has all permissions */
        ACTIVE_FLAG_BITS: bigint;
        RESERVED_FLAG_BITS: bigint;
        /** Is this a controller utxo (forces negative number in amount) */
        AUTHORITY: bigint;
        /** Can mint tokens */
        MINT: bigint;
        /** Can melt tokens */
        MELT: bigint;
        /** Can create authorities */
        BATON: bigint;
        /** Can change the redeem script */
        RESCRIPT: bigint;
        /** Can create subgroups */
        SUBGROUP: bigint;
        NONE: bigint;
        ALL_FLAG_BITS: bigint;
    };
    /**
     * Calculate a group ID based on the provided inputs. Pass 'null' to opReturnScript if there is not
     * going to be an OP_RETURN output in the transaction.
     *
     * @param outpoint The input outpoint hash hex or buffer
     * @param opReturnScript opReturn output script
     * @param authFlag group authority flag (use {@link GroupToken.authFlags})
     * @param idFlag group id flag
     *
     * @returns Object with group id hash buffer and the nonce bigint
     */
    static findGroupId(outpoint: string | Buffer, opReturnScript: Script | Buffer | null, authFlag: bigint, idFlag?: GroupIdFlag): GroupIdData;
    /**
     * Translates a group and additional data into a subgroup identifier
     *
     * @param group the group/token address or data buffer
     * @param data the additional data
     *
     * @returns the subgroup id buffer
     */
    static generateSubgroupId(group: Address | string | Buffer, data: number | string | Buffer): Buffer;
    /**
     * Extract the parent group from the provided subgroup.
     *
     * @remarks
     * If the input is a group but not subgroup, the group itself return.
     *
     * @param subgroup the subgroup address or data buffer
     * @returns the GroupId buffer
     */
    static getParentGroupId(subgroup: Address | string | Buffer): Buffer;
    /**
     * Get group amount buffer from BigInt to include in output script
     *
     * @param amount
     */
    static getAmountBuffer(amount: bigint): Buffer;
    /**
     * Get group amount value from Buffer
     *
     * @param amountBuf the amount buffer
     * @param unsigned return value as unsigned bigint, default to false
     */
    static getAmountValue(amountBuf: Buffer, unsigned?: boolean): bigint;
    /**
     * @param authFlag the utxo group quantity/authority
     * @returns the nonce
     */
    static getNonce(authFlag: bigint): bigint;
    /**
     * Check if the group id has the flag
     *
     * @param groupId the group id address or data buffer
     * @param groupIdFlag the group id flag
     * @returns true if this group id has the flag
     */
    static hasIdFlag(groupId: Address | string | Buffer, groupIdFlag: GroupIdFlag): boolean;
    /**
     * Check if this authority and flag fit to this group creation
     *
     * @param groupId the group id address or data buffer
     * @param authFlag the output group quantity/authority
     * @param groupIdFlag optional. the group id flag
     * @returns true if this is group creation data
     */
    static isGroupCreation(groupId: Address | string | Buffer, authFlag: bigint, groupIdFlag?: GroupIdFlag): boolean;
    /**
     * Check if this group is is subgroup
     *
     * @param groupId the group id address or data buffer
     * @returns true if this group id is subgroup
     */
    static isSubgroup(groupId: Address | string | Buffer): boolean;
    /**
     * Check if the group quantity/authority is Authority flag
     *
     * @param authFlag the output group quantity/authority
     * @returns true if this is authority flag
     */
    static isAuthority(authFlag: bigint): boolean;
    /**
     * Check if the group quantity/authority allows minting
     *
     * @param authFlag the output group quantity/authority
     * @returns true if this flag allows minting.
     */
    static allowsMint(authFlag: bigint): boolean;
    /**
     * Check if the group quantity/authority allows melting
     *
     * @param authFlag the output group quantity/authority
     * @returns true if this flag allows melting.
     */
    static allowsMelt(authFlag: bigint): boolean;
    /**
     * Check if the group quantity/authority allows creation of new authorities
     *
     * @param authFlag the output group quantity/authority
     * @returns true if this flag allows creation of authorities.
     */
    static allowsRenew(authFlag: bigint): boolean;
    /**
     * Check if the group quantity/authority allows rescript
     *
     * @param authFlag the output group quantity/authority
     * @returns true if this flag allows rescripting.
     */
    static allowsRescript(authFlag: bigint): boolean;
    /**
     * Check if the group quantity/authority allows creation of subgroups
     *
     * @param authFlag the output group quantity/authority
     * @returns true if this flag allows subgroups
     */
    static allowsSubgroup(authFlag: bigint): boolean;
    /**
    * Verify token description document json signature
    *
    * @param jsonDoc the json TDD as string
    * @param address nexa address that signed the doc
    * @param signature the signature string. optional - if empty, extract from jsonDoc
    *
    * @returns true if signature match
    */
    static verifyJsonDoc(jsonDoc: string, address: Address | string, signature?: string): boolean;
    /**
     * Sign token description document json
     *
     * @param jsonDoc the json TDD as string
     * @param privKey private key to sign on the doc
     *
     * @returns the signature string
     */
    static signJsonDoc(jsonDoc: string, privKey: PrivateKey): string;
}
/**
 * A factory class for creating scripts with predefined configurations and flags.
 */
export class ScriptFactory {
    /**
     * @param to destination address or public key
     * @param groupId group id buffer or group address or hex id - only if its token output script
     * @param groupAmount optional. quantity amount buffer or bigint - only if its token output script
     *
     * @returns a new pay to public key / script template output for the given address or public key
     */
    static buildScriptTemplateOut(to: string | Address | PublicKey, groupId?: string | Address | Buffer, groupAmount?: Buffer | bigint): Script;
    /**
     * @param data the data to embed in the output
     * @param encoding the type of encoding of the string
     *
     * @returns a new OP_RETURN script with data
     */
    static buildDataOut(data?: string | Buffer | Script, encoding?: BufferEncoding): Script;
    /**
     * @param address the pay to address
     * @param groupId optional. only for p2st addresses
     * @param groupAmount optional. only for p2st addresses
     *
     * @return an output script built from the address
     */
    static buildOutFromAddress(address: Address | string, groupId?: string | Address | Buffer, groupAmount?: Buffer | bigint): Script;
    /**
     * Builds a scriptSig (a script for an input) that signs a script template
     * output script.
     *
     * @param template the template script or OP_1 for well-known
     * @param constraint the constraint script or OP_FALSE
     * @param satisfier the satisfier script or buffer
     */
    static buildScriptTemplateIn(template: Script | Opcode, constraint: Script | Opcode, satisfier: Buffer | Script): Script;
    /**
     * @param to - destination address or public key
     *
     * @returns a new pay to public key hash output for the given
     * address or public key
     */
    static buildPublicKeyHashOut(to: string | Address | PublicKey): Script;
    /**
     * Builds a scriptSig (a script for an input) that signs a public key hash
     * output script. (SIGHASH_ALL only)
     *
     * @param publicKey
     * @param signature a Signature object, or the signature in DER canonical encoding
     */
    static buildPublicKeyHashIn(publicKey: PublicKey, signature: Signature | Buffer): Script;
    /**
     * Build OP_RETURN output script for Legacy Token Description
     *
     * @param ticker the ticker as utf8.
     * @param name the ticker as utf8.
     * @param docUrl optional. the description document url
     * @param docHash optional. the document hash hex.
     * @param decimals optional. the decimals for the token amount.
     *
     * @throws Error if docUrl provided and is invalid
     *
     * @returns the output OP_RETURN script
     */
    static buildTokenDescriptionLegacy(ticker: string, name: string, docUrl?: string, docHash?: string, decimals?: number): Script;
    /**
     * Build OP_RETURN output script for NRC1 Token Description
     *
     * @param ticker the ticker as utf8.
     * @param name the ticker as utf8.
     * @param zipURL the zip file url.
     * @param zipHash the zip file hash hex.
     * @param decimals the decimals for the token amount.
     *
     * @throws Error if zipURL invalid
     *
     * @returns the output OP_RETURN script
     */
    static buildTokenDescription(ticker: string, name: string, zipURL: string, zipHash: string, decimals: number): Script;
    /**
     * Build OP_RETURN output script for an NFT Collection Description (NRC2)
     *
     * @param ticker the ticker as utf8.
     * @param name the ticker as utf8.
     * @param zipURL the zip file url.
     * @param zipHash the zip file hash hex.
     *
     * @throws Error if zipURL invalid
     *
     * @returns the output OP_RETURN script
     */
    static buildNFTCollectionDescription(ticker: string, name: string, zipURL: string, zipHash: string): Script;
    /**
     * Build OP_RETURN output script for an NFT that belongs to an NFT Collection (NRC3)
     *
     * @param zipURL the zip file url.
     * @param zipHash the zip file hash hex.
     *
     * @throws Error if zipURL invalid
     *
     * @returns the output OP_RETURN script
     */
    static buildNFTDescription(zipURL: string, zipHash: string): Script;
}
export enum InputSighashType {
    ALL = 0,
    FIRSTN = 1,
    THISIN = 2,
    LAST_VALID = 2
}
export enum OutputSighashType {
    ALL = 0,
    FIRSTN = 1,
    TWO = 2,
    LAST_VALID = 2
}
export class SighashType {
    /**
     * the longest sighashtype in bytes
     * (for use in calculating tx fees by tx length estimation)
     */
    static readonly MAX_SIZE = 4;
    inType: InputSighashType;
    outType: OutputSighashType;
    inData: number[];
    outData: number[];
    constructor();
    /**
     * creates a sighash that is the most restrictive -- it signs all inputs and outputs
     */
    static get ALL(): SighashType;
    hasAll(): boolean;
    isInvalid(): boolean;
    /**
     * Anyone can pay signs only the current input, so other entities can add addtl inputs to complete the partial tx
     */
    setAnyoneCanPay(): this;
    /**
     * Include only the n first inputs in the preimage sighash
     *
     * @param n The first inputs to include
     */
    setFirstNIn(n: number): this;
    /**
     * Include only the n first outputs in the preimage sighash
     *
     * @param n The first outputs to include
     */
    setFirstNOut(n: number): this;
    /**
     * Include specific 2 outputs in the preimage sighash
     *
     * @param a The 1st output to include
     * @param b The 2nd output to include
     */
    set2Out(a: number, b: number): this;
    toBuffer(): Buffer;
    static fromBuffer(buf: Buffer): SighashType;
    /**
     * Convert to a hex representation of the sighash
     */
    toHex(): string;
    /**
     * Create sighash for hex represantation
     * @see toHex
     */
    static fromHex(hex: string): SighashType;
    /**
     * Convert to a human readable representation of the sighash
     */
    toString(): string;
    /**
     * Create sighash from human readable represantation
     * @see toString
     */
    static fromString(str: string): SighashType;
}
export enum OutputType {
    SATOSCRIPT = 0,
    TEMPLATE = 1,
    INFER = 32768
}
export class Output implements IOutput {
    type: OutputType;
    constructor(value: bigint | number | string, scriptPubKey: Script | string, type?: OutputType);
    get value(): bigint;
    set value(sats: bigint | number | string);
    get scriptPubKey(): Script;
    set scriptPubKey(script: Script | string);
    invalidValue(): string | false;
    toObject(): IOutput;
    toJSON: () => IOutput;
    static fromObject(data: IOutput): Output;
    inspect(): string;
    static fromBufferReader(br: BufferReader): Output;
    toBufferWriter(writer?: BufferWriter): BufferWriter;
}
export interface ITxSignature {
    inputIndex: number;
    publicKey: PublicKey | string;
    subscript: Script | string;
    signature: Signature | string;
    sigType: SighashType | string;
}
export class TxSignature implements ITxSignature {
    inputIndex: number;
    publicKey: PublicKey;
    subscript: Script;
    signature: Signature;
    sigType: SighashType;
    /**
     * Wrapper around Signature with fields related to signing a transaction specifically
     */
    constructor(arg: ITxSignature);
    toJSON: () => ITxSignature;
    toObject(): ITxSignature;
    static fromObject(arg: ITxSignature): TxSignature;
    toTxSatisfier(): Buffer;
}
export enum InputType {
    UTXO = 0,
    READ_ONLY = 1
}
export class Input implements IInput {
    static readonly SEQUENCE_FINAL = 4294967295;
    type: InputType;
    outpoint: Buffer;
    amount: bigint;
    sequenceNumber: number;
    output?: Output;
    constructor(params?: IInput);
    get scriptSig(): Script;
    set scriptSig(script: string | Script);
    static fromObject(obj: IInput): Input;
    toJSON: () => IInput;
    toObject(): IInput;
    static fromBufferReader(br: BufferReader): Input;
    toBufferWriter(writer?: BufferWriter, includeScript?: boolean): BufferWriter;
    estimateSize(): number;
    isFinal(): boolean;
    clearSignatures(): this;
    getSubscript(): Script;
    /**
     * @returns true if the provided private key can sign this input
     */
    canSign(_privateKey: PrivateKey): boolean;
    isFullySigned(): boolean;
    addSignature(_signature: TxSignature): this;
}
/**
 * Represents a special kind of input of PayToPublicKeyHash kind.
 */
export class PublicKeyHashInput extends Input {
    static readonly SCRIPT_SIZE = 99;
    getSubscript(): Script;
    canSign(privateKey: PrivateKey): boolean;
    isFullySigned(): boolean;
    addSignature(signature: TxSignature): this;
    estimateSize(): number;
}
/**
 * Represents a special kind of input of PayToPublicKeyTemplate kind.
 */
export class PublicKeyTemplateInput extends Input {
    static readonly SCRIPT_SIZE = 100;
    getSubscript(): Script;
    canSign(privateKey: PrivateKey): boolean;
    isFullySigned(): boolean;
    addSignature(signature: TxSignature): this;
    estimateSize(): number;
}
export class ScriptTemplateInput extends Input {
    templateScript: Script;
    constraintScript: Script | Opcode.OP_FALSE;
    publicKey?: PublicKey;
    /**
     * Represents a special kind of input of generic ScriptTemplate kind.
     *
     * WARNING: this is a general case where the signature is similar to p2pkt and added to scriptSig as push signature data.
     * If you have complex smart contract, consider extending this class (or Input class) and implement the necessary logic,
     * or sign it manually.
     */
    constructor(arg: IInput);
    toJSON: () => IInput;
    toObject(): IInput;
    static fromObject(obj: IInput): ScriptTemplateInput;
    getSubscript(): Script;
    canSign(privateKey: PrivateKey): boolean;
    isFullySigned(): boolean;
    addSignature(signature: TxSignature): this;
    estimateSize(): number;
    protected _estimateScriptSize(): number;
}
/**
 * Represents a transaction, a set of inputs and outputs to change ownership of tokens
 */
export class Transaction implements ITransaction {
    static readonly CURRENT_VERSION = 0;
    static readonly FEE_PER_BYTE = 3;
    static readonly DUST_AMOUNT = 546;
    static readonly MAX_MONEY: number;
    static readonly NLOCKTIME_BLOCKHEIGHT_LIMIT = 500000000;
    static readonly NLOCKTIME_MAX_VALUE = 4294967295;
    version: number;
    inputs: Input[];
    outputs: Output[];
    nLockTime: number;
    constructor(serializedTx?: ITransaction | string | Buffer);
    get id(): string;
    get idem(): string;
    get outputAmount(): bigint;
    get inputAmount(): bigint;
    /**
     * Create a 'shallow' copy of the transaction, by serializing and deserializing.
     * it dropping any additional information that inputs and outputs may have hold
     *
     * @param transaction
     */
    static shallowCopy(transaction: Transaction): Transaction;
    /**
     * Analogous to nexad's IsCoinBase function in transaction.h
     */
    isCoinbase(): boolean;
    /**
     * Retrieve a possible error that could appear when trying to serialize and
     * broadcast this transaction.
     *
     * @param opts allows to skip certain tests.
     */
    getSerializationError(opts?: TxVerifyOptions): Error | undefined;
    isFullySigned(): boolean;
    /**
     * @returns true if the transaction has enough info on all inputs to be correctly validated
     */
    hasAllUtxoInfo(): boolean;
    getUnspentValue(): bigint;
    /**
     * Calculates the fee of the transaction.
     *
     * If there's a fixed fee set, return that.
     *
     * If there is no change output set, the fee is the
     * total value of the outputs minus inputs. Note that
     * a serialized transaction only specifies the value
     * of its outputs. (The value of inputs are recorded
     * in the previous transaction outputs being spent.)
     * This method therefore raises a "MissingPreviousOutput"
     * error when called on a serialized transaction.
     *
     * If there's no fee set and no change address,
     * estimate the fee based on size.
     *
     * @return fee of this transaction in satoshis
     */
    getFee(): number;
    /**
     * Calculates the required fee of the transaction.
     *
     * @remarks this method is different than getFee.
     *  while getFee return the current fee estimation, this method return how much fee is required according to the fee rate.
     *
     * @returns the required fees of this transaction in satoshis
     */
    estimateRequiredFee(): number;
    clearSignatures(): void;
    /**
     * Retrieve a hexa string that can be used with nexad's CLI interface
     * (decoderawtransaction, sendrawtransaction)
     *
     * @param opts allows to skip certain tests.
     */
    checkedSerialize(opts?: TxVerifyOptions): string;
    uncheckedSerialize: () => string;
    toString(): string;
    inspect(): string;
    fromString(string: string): this;
    /**
     * Retrieve a hexa string that can be used with nexad's CLI interface
     * (decoderawtransaction, sendrawtransaction)
     *
     * @param unsafe if true, skip all tests. if it's an object,
     * it's expected to contain a set of flags to skip certain tests.
     *
     * @see {@link TxVerifyOptions}
     */
    serialize(unsafe?: boolean | TxVerifyOptions): string;
    /**
     * Manually set the fee for this transaction. Beware that this resets all the signatures
     * for inputs.
     *
     * @param amount satoshis to be set as fees
     * @return this, for chaining
     */
    setFee(amount: number): this;
    /**
     * Manually set the fee per Byte for this transaction. Beware that this resets all the signatures
     * for inputs.
     * fee per Byte will be ignored if fee property was set manually
     *
     * @param amount satoshis per Byte to be used as fee rate
     * @return this, for chaining
     */
    setFeePerByte(amount: number): this;
    /**
     * Add an output to the transaction.
     *
     * @param output the output to add.
     * @return this, for chaining
     */
    addOutput(output: Output): this;
    removeOutput(index: number): this;
    /**
     * Remove all outputs from the transaction.
     *
     * @return this, for chaining
     */
    clearOutputs(): this;
    updateOutputAmount(index: number, sats: bigint | number): void;
    /**
     * Set the change address for this transaction
     *
     * Beware that this resets all the signatures for inputs.
     *
     * @param address An address for change to be sent to.
     * @return this, for chaining
     */
    setChangeOutput(address: string | Address): this;
    /**
     * @returns change output, if it exists
     */
    getChangeOutput(): Output | undefined;
    /**
     * Add an input to this transaction, without checking that the input has information about
     * the output that it's spending.
     *
     * @param input the input to add
     * @return this, for chaining
     */
    uncheckedAddInput(input: Input): this;
    /**
     * Add an input to this transaction. The input must be an instance of the `Input` class.
     * It should have information about the Output that it's spending, but if it's not already
     * set, two additional parameters, `outputScript` and `amount` can be provided.
     *
     * @param input
     * @param outputScript
     * @param amount
     * @return this, for chaining
     */
    addInput(input: Input, outputScript?: IScript | Buffer | string, amount?: bigint | number): this;
    removeInput(outpoint: string): this;
    /**
     * Sets nLockTime so that transaction is not valid until the desired date or height.
     * Beware that this method will also set the inputs sequence number to max_int - 1
     *
     * @remarks nLockTime considered as height if the value is between 0 - 499,999,999.
     *  above that considered as date (unix timestamp).
     *
     * @see {@link NLOCKTIME_BLOCKHEIGHT_LIMIT}
     *
     * @param locktime
     * @returns
     */
    setLockTime(locktime: number): this;
    /**
     *  Returns a semantic version of the transaction's nLockTime.
     *  If nLockTime is 0, it returns null,
     *  if it is < 500000000, it returns a block height (number)
     *  else it returns a Date object.
     */
    getLockTime(): number | Date | null;
    toBuffer(): Buffer;
    toBufferWriter(writer?: BufferWriter, withInputsScripts?: boolean): BufferWriter;
    fromBuffer(buffer: Buffer): this;
    fromBufferReader(reader: BufferReader): this;
    toJSON: () => ITransaction;
    toObject(): ITransaction;
    fromObject(transaction: ITransaction): this;
}
export class UnspentOutput {
    outpoint: string;
    scriptPubKey: Script;
    satoshis: bigint;
    /**
     * Represents an unspent output information: its outpoint hash, associated amount/sats,
     * associated script or address with optional group info,
     *
     * @param utxo the utxo object
     * @param utxo.outpoint the outpoint hash
     * @param utxo.amount amount of nexa associated as string or number
     * @param utxo.satoshis alias for `amount`, but expressed in satoshis (1 NEXA = 100 satoshis) as bigint, string or number
     * @param utxo.scriptPubKey the script that must be resolved to release the funds
     * @param utxo.address optional. can be used instead of the full script
     * @param utxo.groupId optional. can be used instead of the full script
     * @param utxo.groupAmount optional. can be used instead of the full script
     */
    constructor(utxo: UTXO);
    /**
     * String representation: just the outpoint hash
     */
    toString(): string;
    /**
     * Provide an informative output when displaying this object in the console
     */
    inspect(): string;
    /**
     * Deserialize an UnspentOutput from an object
     * @param data
     */
    static fromObject(data: UTXO): UnspentOutput;
    /**
     * Returns a plain object (no prototype or methods) with the associated info for this utxo
     */
    toObject(): UTXO;
    toJSON: () => UTXO;
}
export class TxSigner {
    /**
     * Create a signature
     *
     * @param transaction the transaction to sign
     * @param inputNumber the input index for the signature
     * @param sighashType the sighash type
     * @param subscript the script that will be signed
     * @param privateKey the privkey to sign with
     * @returns The signature
     */
    static sign(transaction: Transaction, inputNumber: number, sighashType: SighashType, subscript: Script, privateKey: PrivateKey): Signature;
    /**
     * Verify a signature
     *
     * @param transaction the transaction to verify
     * @param inputNumber the input index for the signature
     * @param signature the signature to verify
     * @param sighashType the sighash type
     * @param subscript the script that will be verified
     * @param publicKey the pubkey that correspond to the signing privkey
     * @returns true if signature is valid
     */
    static verify(transaction: Transaction, inputNumber: number, signature: Signature, sighashType: SighashType, subscript: Script, publicKey: PublicKey): boolean;
    /**
     * Returns a buffer of length 32 bytes with the hash that needs to be signed for OP_CHECKSIG(VERIFY).
     *
     * @param transaction the transaction to sign
     * @param inputNumber the input index for the signature
     * @param sighashType the sighash type
     * @param subscript the script that will be signed
     */
    static buildSighash(transaction: Transaction, inputNumber: number, sighashType: SighashType, subscript: Script): Buffer;
}
export class TransactionBuilder {
    transaction: Transaction;
    constructor(tx?: ITransaction | string | Buffer);
    build(): Transaction;
    /**
     * Add an input to this transaction. This is a high level interface
     * to add an input, for more control, use {@link Transaction.addInput}.
     *
     * Can receive, as output information, the output of nexad's `listunspent` command,
     * with a slightly fancier format recognized by this sdk:
     *
     * ```json
     * {
     *  outpoint: "fcf7d303d67f19568cf4ab72d36d583baac461e0f62f289b3dff68da96c2117c"
     *  scriptPubKey: "005114891c4b19cbcaefc31770a938ebd6b1fafabb1be6",
     *  satoshis: 181998351
     * }
     * // or alternative:
     * {
     *  outpoint: "fcf7d303d67f19568cf4ab72d36d583baac461e0f62f289b3dff68da96c2117c"
     *  address: "nexa:nqtsq5g53ywykxwtethux9ms4yuwh443ltatkxlx3s5pnvwh",
     *  amount: 1819983.51
     *  groupId: <token address if relevant>
     *  groupAmount: <token amount if relevant>
     * }
     * ```
     * Where `address` can be either a string or a nexcore Address object. The
     * same is true for `script`, which can be a string or a nexcore Script.
     *
     * @see {@link UTXO}
     *
     * Beware that this resets all the signatures for inputs.
     *
     * @example
     * ```javascript
     * let builder = new TransactionBuilder();
     *
     * // From a pay to public key template output from nexad's listunspent
     * builder.from({'outpoint': '0000...', amount: 123.23, scriptPubKey: 'OP_0 OP_1 ...'});
     *
     * // From a pay to public key template output (with optional group data)
     * builder.from({'outpoint': '0000...', satoshis: 12323, address: 'nexa:nqtsq5g...', groupId? 'nexa:tnq...', groupAmount: 56446n });
     *
     * // From a script template output
     * builder.from({'outpoint': '0000...', satoshis: 1000, scriptPubKey: '...', templateData: { templateScript: '...', constraintScript: '...' }};
     *
     * let transaction = builder.build();
     * ```
     *
     * @param utxo details on the utxo
     * @returns this, for chaining
     */
    from(utxo: UTXO | UTXO[]): this;
    /**
     * Add an output to the transaction.
     *
     * Beware that this resets all the signatures for inputs.
     *
     * @param address the destination address
     * @param amount in satoshis, the nexa amount
     * @param groupId optional. the token address if sending tokens
     * @param groupAmount optional. the token amount if sending tokens
     *
     * @remarks if sending token, the nexa amount is usually {@link Transaction.DUST_AMOUNT}
     *
     * @returns this, for chaining
     */
    to(address: string | Address, amount: number | string | bigint, groupId?: string | Address, groupAmount?: bigint): this;
    /**
     * Add an OP_RETURN output to the transaction.
     *
     * Beware that this resets all the signatures for inputs.
     *
     * @param data the data to be stored in the OP_RETURN output.
     *    In case of a string, the UTF-8 representation will be stored
     * @param isFullScript if the provided data is already an op_return script. default false.
     * @returns this, for chaining
     */
    addData(data: Buffer | string | Script, isFullScript?: boolean): this;
    /**
     * Set the change address for this transaction
     *
     * Beware that this resets all the signatures for inputs.
     *
     * @param address An address for change to be sent to.
     * @returns this, for chaining
     */
    change(address: Address | string): this;
    /**
     * Manually set the fee for this transaction.
     *
     * Beware that this resets all the signatures for inputs.
     *
     * @param amount satoshis to be used as fee
     * @returns this, for chaining
     */
    fee(amount: number): this;
    /**
     * Manually set the fee per Byte rate for this transaction.
     *
     * Beware that this resets all the signatures for inputs.
     *
     * @remarks fee per Byte will be ignored if fee property was set manually
     *
     * @param amount satoshis per Byte to be used as fee rate
     * @returns this, for chaining
     */
    feePerByte(amount: number): this;
    /**
     * Sets nLockTime so that transaction is not valid until the desired date
     *
     * (a timestamp in seconds since UNIX epoch is also accepted)
     *
     * @param datetime Date object or unix timestamp number
     * @returns this, for chaining
     */
    lockUntilDate(datetime: number | Date): this;
    /**
     * Sets nLockTime so that transaction is not valid until the desired block height.
     *
     * @param height the block height
     * @returns this, for chaining
     */
    lockUntilBlockHeight(height: number): this;
    /**
     * Sign the transaction using one or more private keys.
     *
     * It tries to sign each input, verifying that the signature will be valid
     * (matches a public key). Usually this is the last step that should be used with the builder.
     *
     * @remarks this method sign all inputs and outputs (sighash type ALL).
     *
     * if you need to sign a specific input or partial transaction
     *  (create new or complete existing one), use {@link signInput} method.
     *
     * @param privateKey private key(s) that be used to sign
     * @returns this, for chaining
     */
    sign(privateKey: PrivateKey | PrivateKey[]): this;
    /**
     * Sign specific input using private key and sighash type.
     *
     * Use sigtype to determine which parts of the transaction to sign.
     *
     * @param input The input to sign. can be input index (number) or input outpoint hash (string)
     * @param privateKey private key that be used to sign
     * @param sigtype the sighash type to define which parts to include in the sighash
     * @returns this, for chaining
     */
    signInput(input: number | string, privateKey: PrivateKey, sigtype: SighashType): this;
}
export class BlockHeader implements IBlockHeader {
    static readonly MAX_TIME_OFFSET: number;
    prevHash: Buffer;
    bits: number;
    ancestorHash: Buffer;
    merkleRoot: Buffer;
    txFilter: Buffer;
    time: number;
    height: number;
    chainWork: Buffer;
    size: number;
    txCount: number;
    poolFee: number;
    utxoCommitment: Buffer;
    minerData: Buffer;
    nonce: Buffer;
    constructor(data: Buffer | IBlockHeader);
    get hash(): string;
    /**
     * This method is useful for hex that represent concatination of multiple headers
     * so it able to serve in a loop.
     *
     * @param br A BufferReader of the block header
     * @returns An instance of block header
     */
    static fromBufferReader(br: BufferReader): BlockHeader;
    /**
     * @param header A plain JavaScript block header object
     * @returns An instance of block header
     */
    static fromObject(header: IBlockHeader): BlockHeader;
    /**
     * @param buf A buffer of the block header
     * @returns An instance of block header
     */
    static fromBuffer(buf: Buffer): BlockHeader;
    /**
     * @param hex A hex encoded buffer of the block header
     * @returns An instance of block header
     */
    static fromString(hex: string): BlockHeader;
    toJSON: () => IBlockHeader;
    /**
     * @returns A plain object of the BlockHeader
     */
    toObject(): IBlockHeader;
    /**
     * @param bw - An existing instance BufferWriter
     * @returns An instance of BufferWriter representation of the BlockHeader
     */
    toBufferWriter(bw?: BufferWriter): BufferWriter;
    /**
     * @returns A Buffer of the BlockHeader
     */
    toBuffer(): Buffer;
    /**
     * @returns A hex encoded string of the BlockHeader
     */
    toString(): string;
    /**
     * @returns A string formatted for the console
     */
    inspect(): string;
    /**
     * Returns the target difficulty for this block
     *
     * @param bits the bits number
     * @returns An instance of BN with the decoded difficulty bits
     */
    getTargetDifficulty(bits?: number): BN;
    /**
     * @returns the target difficulty for this block
     */
    getDifficulty(): number;
    /**
     * @returns true If timestamp is not too far in the future
     */
    validTimestamp(): boolean;
    /**
     * @returns true If the proof-of-work hash satisfies the target difficulty
     */
    validProofOfWork(): boolean;
}
export class Block implements IBlock {
    header: BlockHeader;
    transactions: Transaction[];
    constructor(data: Buffer | IBlock);
    get hash(): string;
    /**
     * @param obj A plain JavaScript object
     * @returns An instance of block
     */
    static fromObject(obj: IBlock): Block;
    /**
     * @param br A buffer reader of the block
     * @returns An instance of block
     */
    static fromBufferReader(br: BufferReader): Block;
    /**
     * @param buf A buffer of the block
     * @returns An instance of block
     */
    static fromBuffer(buf: Buffer): Block;
    /**
     * @param str A hex encoded string of the block
     * @returns A hex encoded string of the block
     */
    static fromString(str: string): Block;
    toJSON: () => IBlock;
    /**
     * @returns A plain object with the block properties
     */
    toObject(): IBlock;
    /**
     * @param bw An existing instance of BufferWriter (optional)
     * @returns An instance of BufferWriter representation of the Block
     */
    toBufferWriter(bw?: BufferWriter): BufferWriter;
    /**
     * @returns A buffer of the block
     */
    toBuffer(): Buffer;
    /**
     * @returns A hex encoded string of the block
     */
    toString(): string;
    /**
     * @returns A string formatted for the console
     */
    inspect(): string;
    /**
     * Will iterate through each transaction and return an array of hashes
     * @returns An array with transaction hashes
     */
    getTransactionHashes(): Buffer[];
    /**
     * Will build a merkle tree of all the transactions, ultimately arriving at
     * a single point, the merkle root.
     *
     * @see {@link https://spec.nexa.org/blocks/merkle-tree/}
     * @returns An array with each level of the tree after the other.
     */
    getMerkleTree(): Buffer[];
    /**
     * Calculates the merkleRoot from the transactions.
     *
     * @returns A buffer of the merkle root hash
     */
    getMerkleRoot(): Buffer;
    /**
     * Verifies that the transactions in the block match the header merkle root
     *
     * @returns true If the merkle roots match
     */
    validMerkleRoot(): boolean;
}
declare function versionGuard(version: string): void;
/**
 * Singleton instance of {@link NetworkManager}
 */
export const Networks: NetworkManager;
declare const libnexa: {
    versionGuard: typeof versionGuard;
    version: string;
    crypto: {
        BN: typeof BNExtended;
        Hash: typeof Hash;
        ECDSA: typeof ECDSA;
        Schnorr: typeof Schnorr;
        Signature: typeof Signature;
    };
    encoding: {
        BufferReader: typeof BufferReader;
        BufferWriter: typeof BufferWriter;
    };
    utils: {
        BufferUtils: typeof BufferUtils;
        CommonUtils: typeof CommonUtils;
        UnitUtils: typeof UnitUtils;
    };
    keys: {
        PrivateKey: typeof PrivateKey;
        PublicKey: typeof PublicKey;
        HDPrivateKey: typeof HDPrivateKey;
        HDPublicKey: typeof HDPublicKey;
    };
    tx: {
        Transaction: typeof Transaction;
        Input: typeof Input;
        PublicKeyHashInput: typeof PublicKeyHashInput;
        PublicKeyTemplateInput: typeof PublicKeyTemplateInput;
        ScriptTemplateInput: typeof ScriptTemplateInput;
        Output: typeof Output;
        UnspentOutput: typeof UnspentOutput;
        TxSignature: typeof TxSignature;
        TxSigner: typeof TxSigner;
        SighashType: typeof SighashType;
    };
    Networks: NetworkManager;
    Opcode: typeof Opcode;
    Script: typeof Script;
    ScriptFactory: typeof ScriptFactory;
    ScriptOpcode: typeof ScriptOpcode;
    Address: typeof Address;
    Message: typeof Message;
    TransactionBuilder: typeof TransactionBuilder;
    Block: typeof Block;
    BlockHeader: typeof BlockHeader;
    GroupToken: typeof GroupToken;
};
export default libnexa;

//# sourceMappingURL=index.d.ts.map
