@bsv/sdk
Version:
BSV Blockchain Software Development Kit
43 lines • 1.78 kB
TypeScript
import { Reader, Writer } from '../primitives/utils.js';
import Transaction from './Transaction.js';
/**
* A single bitcoin transaction associated with a `Beef` validity proof set.
*
* Simple case is transaction data included directly, either as raw bytes or fully parsed data, or both.
*
* Supports 'known' transactions which are represented by just their txid.
* It is assumed that intended consumer of this beef already has validity proof for such a transaction,
* which they can merge if necessary to create a valid beef.
*/
export default class BeefTx {
_bumpIndex?: number;
_tx?: Transaction;
_rawTx?: number[];
_txid?: string;
inputTxids: string[];
/**
* true if `hasProof` or all inputs chain to `hasProof`.
*
* Typically set by sorting transactions by proven dependency chains.
*/
isValid?: boolean;
get bumpIndex(): number | undefined;
set bumpIndex(v: number | undefined);
get hasProof(): boolean;
get isTxidOnly(): boolean;
get txid(): string;
get tx(): Transaction | undefined;
get rawTx(): number[] | undefined;
/**
* @param tx If string, must be a valid txid. If `number[]` must be a valid serialized transaction.
* @param bumpIndex If transaction already has a proof in the beef to which it will be added.
*/
constructor(tx: Transaction | number[] | string, bumpIndex?: number);
static fromTx(tx: Transaction, bumpIndex?: number): BeefTx;
static fromRawTx(rawTx: number[], bumpIndex?: number): BeefTx;
static fromTxid(txid: string, bumpIndex?: number): BeefTx;
private updateInputTxids;
toWriter(writer: Writer, version: number): void;
static fromReader(br: Reader, version: number): BeefTx;
}
//# sourceMappingURL=BeefTx.d.ts.map