2019-03-07 05:40:23 +01:00
|
|
|
export interface BlankOutput {
|
2019-01-04 10:33:02 +01:00
|
|
|
script: Buffer;
|
|
|
|
valueBuffer: Buffer;
|
2019-03-07 05:40:23 +01:00
|
|
|
}
|
|
|
|
export interface Output {
|
2019-01-04 10:33:02 +01:00
|
|
|
script: Buffer;
|
|
|
|
value: number;
|
2019-03-07 05:40:23 +01:00
|
|
|
}
|
|
|
|
declare type OpenOutput = Output | BlankOutput;
|
|
|
|
export interface Input {
|
2019-01-04 10:33:02 +01:00
|
|
|
hash: Buffer;
|
|
|
|
index: number;
|
|
|
|
script: Buffer;
|
|
|
|
sequence: number;
|
2019-03-07 05:40:23 +01:00
|
|
|
witness: Buffer[];
|
|
|
|
}
|
2019-01-04 10:33:02 +01:00
|
|
|
export declare class Transaction {
|
|
|
|
static readonly DEFAULT_SEQUENCE = 4294967295;
|
|
|
|
static readonly SIGHASH_ALL = 1;
|
|
|
|
static readonly SIGHASH_NONE = 2;
|
|
|
|
static readonly SIGHASH_SINGLE = 3;
|
|
|
|
static readonly SIGHASH_ANYONECANPAY = 128;
|
|
|
|
static readonly ADVANCED_TRANSACTION_MARKER = 0;
|
|
|
|
static readonly ADVANCED_TRANSACTION_FLAG = 1;
|
2019-03-07 05:40:23 +01:00
|
|
|
static fromBuffer(buffer: Buffer, _NO_STRICT?: boolean): Transaction;
|
2019-01-04 10:33:02 +01:00
|
|
|
static fromHex(hex: string): Transaction;
|
|
|
|
static isCoinbaseHash(buffer: Buffer): boolean;
|
2019-03-07 05:40:23 +01:00
|
|
|
version: number;
|
|
|
|
locktime: number;
|
|
|
|
ins: Input[];
|
|
|
|
outs: OpenOutput[];
|
2019-01-04 10:33:02 +01:00
|
|
|
isCoinbase(): boolean;
|
|
|
|
addInput(hash: Buffer, index: number, sequence?: number, scriptSig?: Buffer): number;
|
|
|
|
addOutput(scriptPubKey: Buffer, value: number): number;
|
|
|
|
hasWitnesses(): boolean;
|
|
|
|
weight(): number;
|
|
|
|
virtualSize(): number;
|
|
|
|
byteLength(): number;
|
|
|
|
clone(): Transaction;
|
|
|
|
/**
|
|
|
|
* Hash transaction for signing a specific input.
|
|
|
|
*
|
|
|
|
* Bitcoin uses a different hash for each signed transaction input.
|
|
|
|
* This method copies the transaction, makes the necessary changes based on the
|
|
|
|
* hashType, and then hashes the result.
|
|
|
|
* This hash can then be used to sign the provided transaction input.
|
|
|
|
*/
|
|
|
|
hashForSignature(inIndex: number, prevOutScript: Buffer, hashType: number): Buffer;
|
|
|
|
hashForWitnessV0(inIndex: number, prevOutScript: Buffer, value: number, hashType: number): Buffer;
|
|
|
|
getHash(forWitness?: boolean): Buffer;
|
|
|
|
getId(): string;
|
|
|
|
toBuffer(buffer?: Buffer, initialOffset?: number): Buffer;
|
|
|
|
toHex(): string;
|
|
|
|
setInputScript(index: number, scriptSig: Buffer): void;
|
2019-03-07 05:40:23 +01:00
|
|
|
setWitness(index: number, witness: Buffer[]): void;
|
|
|
|
private __byteLength;
|
|
|
|
private __toBuffer;
|
2019-01-04 10:33:02 +01:00
|
|
|
}
|
2019-03-07 05:40:23 +01:00
|
|
|
export {};
|