@ecash/lib
Version:
Library for eCash transaction building
31 lines • 1.2 kB
TypeScript
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;
}
/** 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