import { Bytes } from './io/bytes.js'; import { Writer } from './io/writer.js'; import { Opcode } from './opcode.js'; /** * A single operation in Bitcoin script, either a singular non-pushop code or * a `PushOp` with an opcode and data attached. **/ export type Op = Opcode | PushOp; /** * An Op that pushes some data onto the stack, will use `opcode` to push the * data **/ export interface PushOp { opcode: Opcode; data: Uint8Array; } /** * Parse a number from a script op. * Inverse of pushNumberOp: handles OP_0 (0), OP_1NEGATE (-1), OP_1 through OP_16, * single-byte push data, and multi-byte minimal script number encoding (up to 64-bit). * Always returns bigint for type safety (matches CScriptNum::getint). * @throws Error with descriptive message if the op does not encode a number */ export declare function parseNumberFromOp(op: Op): bigint; /** Returns true if the given object is a `PushOp` */ export declare function isPushOp(op: any): op is PushOp; /** Read a single Script operation from the bytes */ export declare function readOp(bytes: Bytes): Op; /** Write a Script operation to the writer */ export declare function writeOp(op: Op, writer: Writer): void; /** Return an Op that minimally pushes the given bytes onto the stack */ export declare function pushBytesOp(data: Uint8Array): Op; /** * Returns an Op that pushes the minimally encoded byte representation of a * number to the stack. The bytes pushed to the stack can be used directly * without the need for OP_BIN2NUM. */ export declare function pushNumberOp(value: number | bigint): Op; //# sourceMappingURL=op.d.ts.map