forked from vulpemventures/liquidjs-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtransaction.d.ts
80 lines (80 loc) · 3.31 KB
/
transaction.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/// <reference types="node" />
import { Issuance } from './issuance';
import { GenesisBlockHash } from './networks';
export declare const ZERO: Buffer;
export interface Output {
script: Buffer;
value: Buffer;
asset: Buffer;
nonce: Buffer;
rangeProof?: Buffer;
surjectionProof?: Buffer;
}
export interface Input {
hash: Buffer;
index: number;
script: Buffer;
sequence: number;
witness: Buffer[];
isPegin?: boolean;
issuance?: Issuance;
peginWitness?: Buffer[];
issuanceRangeProof?: Buffer;
inflationRangeProof?: Buffer;
}
export declare class Transaction {
static readonly DEFAULT_SEQUENCE = 4294967295;
static readonly SIGHASH_DEFAULT = 0;
static readonly SIGHASH_ALL = 1;
static readonly SIGHASH_NONE = 2;
static readonly SIGHASH_SINGLE = 3;
static readonly SIGHASH_ANYONECANPAY = 128;
static readonly SIGHASH_OUTPUT_MASK = 3;
static readonly SIGHASH_INPUT_MASK = 128;
static readonly ADVANCED_TRANSACTION_FLAG = 1;
static fromBuffer(buffer: Buffer, _NO_STRICT?: boolean): Transaction;
static fromHex(hex: string): Transaction;
static isCoinbaseHash(buffer: Buffer): boolean;
version: number;
locktime: number;
flag: number;
ins: Input[];
outs: Output[];
isCoinbase(): boolean;
validateIssuance(assetBlindingNonce: Buffer, assetEntropy: Buffer, assetAmount: Buffer, tokenAmount: Buffer): boolean;
addInput(hash: Buffer, index: number, sequence?: number, scriptSig?: Buffer, issuance?: Issuance): number;
addOutput(scriptPubKey: Buffer, value: Buffer, asset: Buffer, nonce: Buffer, rangeProof?: Buffer, surjectionProof?: Buffer): number;
hasWitnesses(): boolean;
weight(discountCT?: boolean): number;
virtualSize(discountCT?: boolean): number;
byteLength(_ALLOW_WITNESS?: boolean): 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;
hashForWitnessV1(inIndex: number, prevOutScripts: Buffer[], prevoutAssetsValues: {
asset: Buffer;
value: Buffer;
}[], hashType: number, genesisBlockHash: GenesisBlockHash, leafHash?: Buffer, annex?: Buffer): Buffer;
hashForWitnessV0(inIndex: number, prevOutScript: Buffer, value: Buffer, hashType: number): Buffer;
getHash(forWitness?: boolean): Buffer;
getId(): string;
toBuffer(buffer?: Buffer, initialOffset?: number): Buffer;
toHex(): string;
setInputScript(index: number, scriptSig: Buffer): void;
setWitness(index: number, witness: Buffer[]): void;
setPeginWitness(index: number, peginWitness: Buffer[]): void;
setInputIssuanceRangeProof(index: number, issuanceRangeProof: Buffer): void;
setInputInflationRangeProof(index: number, inflationRangeProof: Buffer): void;
setOutputNonce(index: number, nonce: Buffer): void;
setOutputRangeProof(index: number, proof: Buffer): void;
setOutputSurjectionProof(index: number, proof: Buffer): void;
private __byteLength;
private __toBuffer;
}