/// <reference types="node" />
import { StreamReader } from '@node-dlc/bufio';
import { ICloneable } from './ICloneable';
import { ScriptCmd } from './ScriptCmd';
/**
 * Bitcoin Script
 */
export declare class Script implements ICloneable<Script> {
    /**
     *
     * @param val
     */
    static number(val: number | bigint): ScriptCmd;
    /**
     * Creates a standard (though no longer used) pay-to-pubkey
     * scriptPubKey using the provided pubkey.
     *
     * P2PK format:
     *      <pubkey> OP_CHECKSIG
     *
     * @param pubkey 33-byte compressed or 65-byte uncompressed SEC
     * encoded pubkey
     */
    static p2pkLock(pubkey: Buffer): Script;
    /**
     * Creates a standard (though no longer used) pay-to-pubkey
     * scriptSig using the provided signature.
     *
     * P2PK format:
     *      <sig>
     *
     * @param sig DER encoded signature + 1-byte sighash type
     */
    static p2pkUnlock(sig: Buffer): Script;
    /**
     * Creates a standard Pay-to-Public-Key-Hash scriptPubKey by accepting a
     * hash of a public key as input and generating the script in the standard
     * P2PKH script format:
     *   OP_DUP OP_HASH160 <hash160pubkey> OP_EQUALVERIFY OP_CHECKSIG
     *
     * @param value either the 20-byte hash160 of a pubkey or an SEC
     * encoded compressed or uncompressed pubkey
     */
    static p2pkhLock(value: Buffer): Script;
    /**
     * Creates a standard Pay-to-Public-Key-Hash scriptSig
     * @param sig BIP66 compliant DER encoded signuture + hash byte
     * @param pubkey SEC encoded public key
     */
    static p2pkhUnlock(sig: Buffer, pubkey: Buffer): Script;
    /**
     * Creates a standard Pay-to-MultiSig scriptPubKey by accepting m of n
     * public keys as inputs in the format:
     *   OP_<m> <pubkey1> <pubkey2> <pubkey..m> OP_<n> OP_CHECKMULTISIG
     */
    static p2msLock(m: number, ...pubkeys: Buffer[]): Script;
    /**
     * Creates a standard Pay-to-MultiSig scripSig using the provided
     * signatures. The signatures must be in the order of the pub keys
     * used in the lock script. This function also correctly adds OP_0
     * as the first element on the stack to ensure the p2ms off-by-one
     * error is correctly accounted for.
     *
     * Each signature must be DER encoded using BIP66 and
     * include a 1-byte sighash type at the end. The builder validates
     * the signatures. As such they will be 10 to 74 bytes.
     *
     * @param pubkeys
     */
    static p2msUnlock(...sigs: Buffer[]): Script;
    /**
     * Creates a standard Pay-to-Script-Hash scriptPubKey by accepting a hash of
     * the redeem script as input and generating the P2SH script:
     *   OP_HASH160 <hashScript> OP_EQUAL
     *
     * Accepts the redeem script either as a Script object or as the
     * hash160 of the redeem script. When the hash160 Buffer is provided
     * it will throw if the Buffer is not 20-bytes.
     *
     * @param value can be either the redeem script as a Script type or
     * the hash160 as a 20-byte buffer
     */
    static p2shLock(value: Script | Buffer): Script;
    /**
     * Creates a p2sh unlock script for use in a transaction input
     * scriptSig value. The redeem script, which is the preimage of the
     * of the script hash used to lock the p2sh output, must be provided
     * along with any additional data required to unlock the script.
     *
     * @param redeemScript preimage of the script hash
     * @param data script commands will be added as unlock data
     */
    static p2shUnlock(redeemScript: Script, data: Script): Script;
    /**
     * Creates a p2sh unlock script for use in a transaction input
     * scriptSig value. The redeem script, which is the preimage of the
     * of the script hash used to lock the p2sh output, must be provided
     * along with any additional data required to unlock the script.
     *
     * @param redeemScript preimage of the script hash
     * @param data ScriptCmd data used to unlock the script
     */
    static p2shUnlock(redeemScript: Script, ...data: ScriptCmd[]): Script;
    /**
     * Create a standard Pay-to-Witness-PubKey-Hash scriptPubKey by accepting
     * the hash160 of a compressed public key point as input. It is of the
     * format:
     *   OP_0 <hash160_pubkey>
     *
     * @param value either a 20-byte pubkeyhash or a valid pubkey
     */
    static p2wpkhLock(value: Buffer): Script;
    /**
     * Create a standard Pay-to-Witness-Script-Hash scriptPubKey by accepting
     * the sha256 of the witness script as input. It is of the format:
     *   OP_0 <sha256_redeem_script>
     */
    static p2wshLock(value: Buffer | Script): Script;
    /**
     * Parses a stream of bytes representing a Script. The stream must start
     * with a Varint length of Script data. The Script data is then parsed into
     * data blocks or op_codes depending on the meaning of the bytes
     * @param stream
     */
    static parse(reader: StreamReader): Script;
    /**
     * When supplied with a Buffer of cmds this method will parse the commands
     * into data blocks or op_codes depending on the meaning of the bytes
     * @param buf
     */
    static parseCmds(buf: Buffer): ScriptCmd[];
    /**
     * Commands belonging to the script
     */
    readonly cmds: ScriptCmd[];
    /**
     * Constructs a Script with the supplied ScriptCmd values
     * @param cmds
     */
    constructor(...cmds: ScriptCmd[]);
    /**
     * Returns true if other script is an exact match of the current script.
     * This requires all data element sto be exact matches and all operations
     * to be exact matches.
     * @param other
     */
    equals(other: Script): boolean;
    /**
     * Returns a string with the friendly name of the opcode. For data,
     * it returns the value in hexadecimal format.
     */
    toString(): string;
    /**
     * Returns a JSON serialization of the Script.
     */
    toJSON(): string;
    /**
     * Serializes the Script to a Buffer by serializing the cmds prefixed with
     * the overall length as a varint. Therefore the format of this method is
     * the format used when encoding a Script and is:
     *
     * [varint]: length
     * [length]: script_cmds
     */
    serialize(): Buffer;
    /**
     * Serializes the commands to a buffer. This information is the raw
     * serialization and can be directly parsed with the `parseCmds` method.
     */
    serializeCmds(): Buffer;
    /**
     * Clone via deep copy
     */
    clone(): Script;
    /**
     * Performs a hash160 on the serialized commands. This is useful for
     * turning a script into a P2SH redeem script.
     */
    hash160(): Buffer;
    /**
     * Performs a sha256 hash on the serialized commands. This is useful
     * fro turning a script into a P2WSH lock script.
     */
    sha256(): Buffer;
}
