@vbyte/btc-dev 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/class/tx.d.ts +1 -1
- package/dist/class/txin.d.ts +4 -4
- package/dist/class/txout.d.ts +3 -3
- package/dist/lib/meta/locktime.d.ts +3 -3
- package/dist/lib/meta/sequence.d.ts +2 -2
- package/dist/lib/witness/parse.d.ts +2 -2
- package/dist/main.cjs.map +1 -1
- package/dist/module.mjs.map +1 -1
- package/dist/package.json +3 -3
- package/dist/script.js.map +1 -1
- package/dist/types/{transaction.d.ts → class.d.ts} +10 -34
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/meta.d.ts +3 -3
- package/dist/types/txdata.d.ts +21 -0
- package/dist/types/witness.d.ts +10 -6
- package/package.json +3 -3
- package/src/class/txin.ts +2 -2
- package/src/class/txout.ts +2 -2
- package/src/class/witness.ts +2 -2
- package/src/lib/meta/locktime.ts +3 -3
- package/src/lib/meta/sequence.ts +2 -2
- package/src/lib/witness/parse.ts +2 -2
- package/src/types/class.ts +64 -0
- package/src/types/index.ts +1 -1
- package/src/types/meta.ts +3 -3
- package/src/types/txdata.ts +27 -1
- package/src/types/witness.ts +11 -6
- package/src/types/transaction.ts +0 -98
- /package/dist/types/{transaction.js → class.js} +0 -0
|
@@ -1,55 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { TxOutput } from './txdata.js';
|
|
1
|
+
import type { LocktimeData, SequenceData } from './meta.js';
|
|
2
|
+
import type { TxOutput, TxOutputType, TxSize, TxValue } from './txdata.js';
|
|
3
3
|
import type { WitnessType, WitnessVersion } from './witness.js';
|
|
4
|
-
export type TxOutputType = WitnessType | 'p2pkh' | 'p2sh' | 'opreturn';
|
|
5
|
-
export interface TxOutputInfo {
|
|
6
|
-
type: TxOutputType;
|
|
7
|
-
version: WitnessVersion;
|
|
8
|
-
}
|
|
9
|
-
export interface TxInputInfo {
|
|
10
|
-
type: WitnessType;
|
|
11
|
-
version: WitnessVersion;
|
|
12
|
-
}
|
|
13
4
|
export interface LocktimeField {
|
|
14
5
|
hex: string;
|
|
15
|
-
data:
|
|
6
|
+
data: LocktimeData | null;
|
|
16
7
|
value: number;
|
|
17
8
|
}
|
|
18
9
|
export interface SequenceField {
|
|
19
10
|
hex: string;
|
|
20
|
-
data:
|
|
11
|
+
data: SequenceData | null;
|
|
21
12
|
value: number;
|
|
22
13
|
}
|
|
23
14
|
export interface ScriptField {
|
|
24
15
|
asm: string[];
|
|
25
16
|
hex: string;
|
|
26
17
|
}
|
|
27
|
-
export interface TxSize {
|
|
28
|
-
base: number;
|
|
29
|
-
real: number;
|
|
30
|
-
weight: number;
|
|
31
|
-
vsize: number;
|
|
32
|
-
}
|
|
33
|
-
export interface TxValue {
|
|
34
|
-
fees: bigint;
|
|
35
|
-
vin: bigint;
|
|
36
|
-
vout: bigint;
|
|
37
|
-
}
|
|
38
|
-
export interface WitnessSize {
|
|
39
|
-
size: number;
|
|
40
|
-
vsize: number;
|
|
41
|
-
}
|
|
42
18
|
export interface TransactionData {
|
|
43
19
|
hash: string;
|
|
44
20
|
locktime: LocktimeField;
|
|
45
21
|
return: TxOutput | null;
|
|
46
22
|
size: TxSize;
|
|
47
|
-
spends:
|
|
23
|
+
spends: TransactionOutputData[];
|
|
48
24
|
txid: string;
|
|
49
25
|
value: TxValue;
|
|
50
26
|
version: number;
|
|
51
|
-
vin:
|
|
52
|
-
vout:
|
|
27
|
+
vin: TransactionInputData[];
|
|
28
|
+
vout: TransactionOutputData[];
|
|
53
29
|
}
|
|
54
30
|
export interface WitnessField {
|
|
55
31
|
annex: string | null;
|
|
@@ -62,9 +38,9 @@ export interface WitnessField {
|
|
|
62
38
|
version: WitnessVersion;
|
|
63
39
|
vsize: number;
|
|
64
40
|
}
|
|
65
|
-
export interface
|
|
41
|
+
export interface TransactionInputData {
|
|
66
42
|
coinbase?: string | null;
|
|
67
|
-
prevout?:
|
|
43
|
+
prevout?: TransactionOutputData | null;
|
|
68
44
|
script_sig?: ScriptField | null;
|
|
69
45
|
sequence: SequenceField;
|
|
70
46
|
size: number;
|
|
@@ -72,7 +48,7 @@ export interface TxInputField {
|
|
|
72
48
|
vout: number;
|
|
73
49
|
witness?: WitnessField | null;
|
|
74
50
|
}
|
|
75
|
-
export interface
|
|
51
|
+
export interface TransactionOutputData {
|
|
76
52
|
script_pk: ScriptField;
|
|
77
53
|
size: number;
|
|
78
54
|
type: TxOutputType;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * from './address.js';
|
|
2
|
+
export * from './class.js';
|
|
2
3
|
export * from './meta.js';
|
|
3
4
|
export * from './psbt.js';
|
|
4
5
|
export * from './sighash.js';
|
|
5
6
|
export * from './taproot.js';
|
|
6
|
-
export * from './transaction.js';
|
|
7
7
|
export * from './txdata.js';
|
|
8
8
|
export * from './witness.js';
|
package/dist/types/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * from './address.js';
|
|
2
|
+
export * from './class.js';
|
|
2
3
|
export * from './meta.js';
|
|
3
4
|
export * from './psbt.js';
|
|
4
5
|
export * from './sighash.js';
|
|
5
6
|
export * from './taproot.js';
|
|
6
|
-
export * from './transaction.js';
|
|
7
7
|
export * from './txdata.js';
|
|
8
8
|
export * from './witness.js';
|
package/dist/types/meta.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export type
|
|
2
|
-
export type SequenceConfig = Partial<
|
|
3
|
-
export type
|
|
1
|
+
export type LocktimeData = LocktimeStamp | LocktimeHeight;
|
|
2
|
+
export type SequenceConfig = Partial<SequenceData>;
|
|
3
|
+
export type SequenceData = SequenceHeightLock | SequenceStampLock;
|
|
4
4
|
export interface LocktimeStamp {
|
|
5
5
|
type: 'timelock';
|
|
6
6
|
stamp: number;
|
package/dist/types/txdata.d.ts
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
|
+
import type { WitnessType, WitnessVersion } from './witness.js';
|
|
1
2
|
export type TxInput = TxCoinbaseInput | TxSpendInput | TxVirtualInput;
|
|
3
|
+
export type TxOutputType = WitnessType | 'p2pkh' | 'p2sh' | 'opreturn';
|
|
4
|
+
export interface TxOutputInfo {
|
|
5
|
+
type: TxOutputType;
|
|
6
|
+
version: WitnessVersion;
|
|
7
|
+
}
|
|
8
|
+
export interface TxInputInfo {
|
|
9
|
+
type: WitnessType;
|
|
10
|
+
version: WitnessVersion;
|
|
11
|
+
}
|
|
2
12
|
export interface TxOutpoint {
|
|
3
13
|
txid: string;
|
|
4
14
|
vout: number;
|
|
@@ -43,3 +53,14 @@ export interface TxData {
|
|
|
43
53
|
vout: TxOutput[];
|
|
44
54
|
version: number;
|
|
45
55
|
}
|
|
56
|
+
export interface TxSize {
|
|
57
|
+
base: number;
|
|
58
|
+
real: number;
|
|
59
|
+
weight: number;
|
|
60
|
+
vsize: number;
|
|
61
|
+
}
|
|
62
|
+
export interface TxValue {
|
|
63
|
+
fees: bigint;
|
|
64
|
+
vin: bigint;
|
|
65
|
+
vout: bigint;
|
|
66
|
+
}
|
package/dist/types/witness.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
export type WitnessContext =
|
|
1
|
+
export type WitnessContext = WitnessData | TaprootScript | SegwitScript | TaprootSpend | SegwitSpend;
|
|
2
2
|
export type WitnessVersion = number | null;
|
|
3
3
|
export type WitnessType = 'p2w-pkh' | 'p2w-sh' | 'p2tr-pk' | 'p2tr-ts' | 'unknown';
|
|
4
|
-
export interface
|
|
4
|
+
export interface WitnessSize {
|
|
5
|
+
size: number;
|
|
6
|
+
vsize: number;
|
|
7
|
+
}
|
|
8
|
+
export interface WitnessData {
|
|
5
9
|
annex: string | null;
|
|
6
10
|
cblock: string | null;
|
|
7
11
|
params: string[];
|
|
@@ -9,22 +13,22 @@ export interface WitnessInfo {
|
|
|
9
13
|
type: WitnessType;
|
|
10
14
|
version: WitnessVersion;
|
|
11
15
|
}
|
|
12
|
-
export interface TaprootScript extends
|
|
16
|
+
export interface TaprootScript extends WitnessData {
|
|
13
17
|
cblock: string;
|
|
14
18
|
script: string;
|
|
15
19
|
type: 'p2tr-ts';
|
|
16
20
|
version: 1;
|
|
17
21
|
}
|
|
18
|
-
export interface SegwitScript extends
|
|
22
|
+
export interface SegwitScript extends WitnessData {
|
|
19
23
|
script: string;
|
|
20
24
|
type: 'p2w-sh';
|
|
21
25
|
version: 0;
|
|
22
26
|
}
|
|
23
|
-
export interface TaprootSpend extends
|
|
27
|
+
export interface TaprootSpend extends WitnessData {
|
|
24
28
|
type: 'p2tr-pk';
|
|
25
29
|
version: 1;
|
|
26
30
|
}
|
|
27
|
-
export interface SegwitSpend extends
|
|
31
|
+
export interface SegwitSpend extends WitnessData {
|
|
28
32
|
type: 'p2w-pkh';
|
|
29
33
|
version: 0;
|
|
30
34
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vbyte/btc-dev",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Batteries-included toolset for plebian bitcoin development",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"import": "./dist/lib/address/index.js"
|
|
43
43
|
},
|
|
44
44
|
"./meta": {
|
|
45
|
-
"types": "./dist/lib/meta.d.ts",
|
|
46
|
-
"import": "./dist/lib/meta.js"
|
|
45
|
+
"types": "./dist/lib/meta/index.d.ts",
|
|
46
|
+
"import": "./dist/lib/meta/index.js"
|
|
47
47
|
},
|
|
48
48
|
"./psbt": {
|
|
49
49
|
"types": "./dist/lib/psbt/index.d.ts",
|
package/src/class/txin.ts
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
|
|
11
11
|
import type {
|
|
12
12
|
TxInput,
|
|
13
|
-
|
|
13
|
+
TransactionInputData
|
|
14
14
|
} from '@/types/index.js'
|
|
15
15
|
|
|
16
16
|
export class TransactionInput {
|
|
@@ -31,7 +31,7 @@ export class TransactionInput {
|
|
|
31
31
|
return this._txin.coinbase
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
get data () :
|
|
34
|
+
get data () : TransactionInputData {
|
|
35
35
|
return {
|
|
36
36
|
coinbase : this.coinbase,
|
|
37
37
|
prevout : this.prevout?.data ?? null,
|
package/src/class/txout.ts
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
get_vout_info
|
|
6
6
|
} from '@/lib/tx/index.js'
|
|
7
7
|
|
|
8
|
-
import type { TxOutput,
|
|
8
|
+
import type { TxOutput, TransactionOutputData, TxOutputInfo } from '@/types/index.js'
|
|
9
9
|
|
|
10
10
|
export class TransactionOutput {
|
|
11
11
|
|
|
@@ -19,7 +19,7 @@ export class TransactionOutput {
|
|
|
19
19
|
this._txout = txout
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
get data () :
|
|
22
|
+
get data () : TransactionOutputData {
|
|
23
23
|
return {
|
|
24
24
|
script_pk : this.script_pk,
|
|
25
25
|
size : this.size,
|
package/src/class/witness.ts
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import type {
|
|
10
10
|
ScriptField,
|
|
11
11
|
WitnessField,
|
|
12
|
-
|
|
12
|
+
WitnessData,
|
|
13
13
|
WitnessSize,
|
|
14
14
|
WitnessType
|
|
15
15
|
} from '@/types/index.js'
|
|
@@ -17,7 +17,7 @@ import type {
|
|
|
17
17
|
export class TransactionWitness {
|
|
18
18
|
|
|
19
19
|
private readonly _data : Buff[]
|
|
20
|
-
private readonly _meta :
|
|
20
|
+
private readonly _meta : WitnessData
|
|
21
21
|
private readonly _size : WitnessSize
|
|
22
22
|
|
|
23
23
|
constructor (witness : Bytes[]) {
|
package/src/lib/meta/locktime.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Assert } from '@vbyte/micro-lib'
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type { LocktimeData } from '@/types/index.js'
|
|
4
4
|
|
|
5
5
|
// The threshold between block height and timestamp.
|
|
6
6
|
const LOCKTIME_THRESHOLD = 500000000
|
|
@@ -15,7 +15,7 @@ export namespace LocktimeUtil {
|
|
|
15
15
|
* According to BIP-65, the value is simply the numeric value as a string.
|
|
16
16
|
*/
|
|
17
17
|
export function encode_locktime (
|
|
18
|
-
locktime :
|
|
18
|
+
locktime : LocktimeData
|
|
19
19
|
) : number {
|
|
20
20
|
switch (locktime.type) {
|
|
21
21
|
case 'timelock':
|
|
@@ -37,7 +37,7 @@ export function encode_locktime (
|
|
|
37
37
|
*/
|
|
38
38
|
export function decode_locktime (
|
|
39
39
|
locktime : number
|
|
40
|
-
) :
|
|
40
|
+
) : LocktimeData | null {
|
|
41
41
|
// Check if the value is valid (non-negative)
|
|
42
42
|
if (isNaN(locktime) || locktime <= 0) {
|
|
43
43
|
return null
|
package/src/lib/meta/sequence.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* that allows additional metadata to be encoded in the sequence field (to be used by on-chain indexers).
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import type { SequenceConfig,
|
|
14
|
+
import type { SequenceConfig, SequenceData } from '@/types/index.js'
|
|
15
15
|
|
|
16
16
|
/* ===== [ Constants ] ===================================================== */
|
|
17
17
|
|
|
@@ -65,7 +65,7 @@ export function encode_sequence (data : SequenceConfig): number {
|
|
|
65
65
|
* @returns A SequenceData object or null if the sequence doesn't represent special data
|
|
66
66
|
* @throws Error if the sequence value is invalid or exceeds maximum values
|
|
67
67
|
*/
|
|
68
|
-
export function decode_sequence (sequence: number | string) :
|
|
68
|
+
export function decode_sequence (sequence: number | string) : SequenceData | null {
|
|
69
69
|
// Parse and validate the sequence value.
|
|
70
70
|
const seq = parse_sequence(sequence)
|
|
71
71
|
// If the sequence is disabled, return null.
|
package/src/lib/witness/parse.ts
CHANGED
|
@@ -3,13 +3,13 @@ import { is_valid_script } from '@/lib/script/decode.js'
|
|
|
3
3
|
import { TAPLEAF_VERSIONS } from '@/const.js'
|
|
4
4
|
|
|
5
5
|
import type {
|
|
6
|
-
|
|
6
|
+
WitnessData,
|
|
7
7
|
WitnessType
|
|
8
8
|
} from '@/types/index.js'
|
|
9
9
|
|
|
10
10
|
export function parse_witness_data (
|
|
11
11
|
witness : Bytes[]
|
|
12
|
-
) :
|
|
12
|
+
) : WitnessData {
|
|
13
13
|
// Parse the witness data.
|
|
14
14
|
const elems = witness.map(e => Buff.bytes(e))
|
|
15
15
|
const annex = parse_annex_data(elems)
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { LocktimeData, SequenceData } from './meta.js'
|
|
2
|
+
import type { TxOutput, TxOutputType, TxSize, TxValue } from './txdata.js'
|
|
3
|
+
import type { WitnessType, WitnessVersion } from './witness.js'
|
|
4
|
+
|
|
5
|
+
export interface LocktimeField {
|
|
6
|
+
hex : string
|
|
7
|
+
data : LocktimeData | null
|
|
8
|
+
value : number
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface SequenceField {
|
|
12
|
+
hex : string
|
|
13
|
+
data : SequenceData | null
|
|
14
|
+
value : number
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface ScriptField {
|
|
18
|
+
asm : string[]
|
|
19
|
+
hex : string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface TransactionData {
|
|
23
|
+
hash : string
|
|
24
|
+
locktime : LocktimeField
|
|
25
|
+
return : TxOutput | null
|
|
26
|
+
size : TxSize
|
|
27
|
+
spends : TransactionOutputData[]
|
|
28
|
+
txid : string
|
|
29
|
+
value : TxValue
|
|
30
|
+
version : number
|
|
31
|
+
vin : TransactionInputData[]
|
|
32
|
+
vout : TransactionOutputData[]
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface WitnessField {
|
|
36
|
+
annex : string | null
|
|
37
|
+
cblock : string | null
|
|
38
|
+
params : string[]
|
|
39
|
+
script : ScriptField | null
|
|
40
|
+
size : number
|
|
41
|
+
stack : string[]
|
|
42
|
+
type : WitnessType
|
|
43
|
+
version : WitnessVersion
|
|
44
|
+
vsize : number
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface TransactionInputData {
|
|
48
|
+
coinbase? : string | null
|
|
49
|
+
prevout? : TransactionOutputData | null
|
|
50
|
+
script_sig? : ScriptField | null
|
|
51
|
+
sequence : SequenceField
|
|
52
|
+
size : number
|
|
53
|
+
txid : string
|
|
54
|
+
vout : number
|
|
55
|
+
witness? : WitnessField | null
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface TransactionOutputData {
|
|
59
|
+
script_pk : ScriptField
|
|
60
|
+
size : number
|
|
61
|
+
type : TxOutputType
|
|
62
|
+
value : bigint
|
|
63
|
+
version : WitnessVersion | null
|
|
64
|
+
}
|
package/src/types/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * from './address.js'
|
|
2
|
+
export * from './class.js'
|
|
2
3
|
export * from './meta.js'
|
|
3
4
|
export * from './psbt.js'
|
|
4
5
|
export * from './sighash.js'
|
|
5
6
|
export * from './taproot.js'
|
|
6
|
-
export * from './transaction.js'
|
|
7
7
|
export * from './txdata.js'
|
|
8
8
|
export * from './witness.js'
|
package/src/types/meta.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export type
|
|
2
|
-
export type SequenceConfig = Partial<
|
|
3
|
-
export type
|
|
1
|
+
export type LocktimeData = LocktimeStamp | LocktimeHeight
|
|
2
|
+
export type SequenceConfig = Partial<SequenceData>
|
|
3
|
+
export type SequenceData = SequenceHeightLock | SequenceStampLock
|
|
4
4
|
|
|
5
5
|
export interface LocktimeStamp {
|
|
6
6
|
type : 'timelock' // Discriminator for timelock type
|
package/src/types/txdata.ts
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
import type { WitnessType, WitnessVersion } from './witness.js'
|
|
2
|
+
|
|
3
|
+
export type TxInput = TxCoinbaseInput | TxSpendInput | TxVirtualInput
|
|
4
|
+
export type TxOutputType = WitnessType | 'p2pkh' | 'p2sh' | 'opreturn'
|
|
5
|
+
|
|
6
|
+
export interface TxOutputInfo {
|
|
7
|
+
type : TxOutputType
|
|
8
|
+
version : WitnessVersion
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface TxInputInfo {
|
|
12
|
+
type : WitnessType
|
|
13
|
+
version : WitnessVersion
|
|
14
|
+
}
|
|
2
15
|
|
|
3
16
|
export interface TxOutpoint {
|
|
4
17
|
txid : string
|
|
@@ -51,3 +64,16 @@ export interface TxData {
|
|
|
51
64
|
vout : TxOutput[]
|
|
52
65
|
version : number
|
|
53
66
|
}
|
|
67
|
+
|
|
68
|
+
export interface TxSize {
|
|
69
|
+
base : number
|
|
70
|
+
real : number
|
|
71
|
+
weight : number
|
|
72
|
+
vsize : number
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface TxValue {
|
|
76
|
+
fees : bigint
|
|
77
|
+
vin : bigint
|
|
78
|
+
vout : bigint
|
|
79
|
+
}
|
package/src/types/witness.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
export type WitnessContext =
|
|
1
|
+
export type WitnessContext = WitnessData | TaprootScript | SegwitScript | TaprootSpend | SegwitSpend
|
|
2
2
|
export type WitnessVersion = number | null
|
|
3
3
|
export type WitnessType = 'p2w-pkh' | 'p2w-sh' | 'p2tr-pk' | 'p2tr-ts' | 'unknown'
|
|
4
4
|
|
|
5
|
-
export interface
|
|
5
|
+
export interface WitnessSize {
|
|
6
|
+
size : number
|
|
7
|
+
vsize : number
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface WitnessData {
|
|
6
11
|
annex : string | null
|
|
7
12
|
cblock : string | null
|
|
8
13
|
params : string[]
|
|
@@ -11,25 +16,25 @@ export interface WitnessInfo {
|
|
|
11
16
|
version : WitnessVersion
|
|
12
17
|
}
|
|
13
18
|
|
|
14
|
-
export interface TaprootScript extends
|
|
19
|
+
export interface TaprootScript extends WitnessData {
|
|
15
20
|
cblock : string
|
|
16
21
|
script : string
|
|
17
22
|
type : 'p2tr-ts'
|
|
18
23
|
version : 1
|
|
19
24
|
}
|
|
20
25
|
|
|
21
|
-
export interface SegwitScript extends
|
|
26
|
+
export interface SegwitScript extends WitnessData {
|
|
22
27
|
script : string
|
|
23
28
|
type : 'p2w-sh'
|
|
24
29
|
version : 0
|
|
25
30
|
}
|
|
26
31
|
|
|
27
|
-
export interface TaprootSpend extends
|
|
32
|
+
export interface TaprootSpend extends WitnessData {
|
|
28
33
|
type : 'p2tr-pk'
|
|
29
34
|
version : 1
|
|
30
35
|
}
|
|
31
36
|
|
|
32
|
-
export interface SegwitSpend extends
|
|
37
|
+
export interface SegwitSpend extends WitnessData {
|
|
33
38
|
type : 'p2w-pkh'
|
|
34
39
|
version : 0
|
|
35
40
|
}
|
package/src/types/transaction.ts
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { LocktimeInfo, SequenceInfo } from './meta.js'
|
|
2
|
-
import { TxOutput } from './txdata.js'
|
|
3
|
-
|
|
4
|
-
import type {
|
|
5
|
-
WitnessType,
|
|
6
|
-
WitnessVersion
|
|
7
|
-
} from './witness.js'
|
|
8
|
-
|
|
9
|
-
export type TxOutputType = WitnessType | 'p2pkh' | 'p2sh' | 'opreturn'
|
|
10
|
-
|
|
11
|
-
export interface TxOutputInfo {
|
|
12
|
-
type : TxOutputType
|
|
13
|
-
version : WitnessVersion
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface TxInputInfo {
|
|
17
|
-
type : WitnessType
|
|
18
|
-
version : WitnessVersion
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface LocktimeField {
|
|
22
|
-
hex : string
|
|
23
|
-
data : LocktimeInfo | null
|
|
24
|
-
value : number
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface SequenceField {
|
|
28
|
-
hex : string
|
|
29
|
-
data : SequenceInfo | null
|
|
30
|
-
value : number
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface ScriptField {
|
|
34
|
-
asm : string[]
|
|
35
|
-
hex : string
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export interface TxSize {
|
|
39
|
-
base : number
|
|
40
|
-
real : number
|
|
41
|
-
weight : number
|
|
42
|
-
vsize : number
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export interface TxValue {
|
|
46
|
-
fees : bigint
|
|
47
|
-
vin : bigint
|
|
48
|
-
vout : bigint
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export interface WitnessSize {
|
|
52
|
-
size : number
|
|
53
|
-
vsize : number
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export interface TransactionData {
|
|
57
|
-
hash : string
|
|
58
|
-
locktime : LocktimeField
|
|
59
|
-
return : TxOutput | null
|
|
60
|
-
size : TxSize
|
|
61
|
-
spends : TxOutputField[]
|
|
62
|
-
txid : string
|
|
63
|
-
value : TxValue
|
|
64
|
-
version : number
|
|
65
|
-
vin : TxInputField[]
|
|
66
|
-
vout : TxOutputField[]
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export interface WitnessField {
|
|
70
|
-
annex : string | null
|
|
71
|
-
cblock : string | null
|
|
72
|
-
params : string[]
|
|
73
|
-
script : ScriptField | null
|
|
74
|
-
size : number
|
|
75
|
-
stack : string[]
|
|
76
|
-
type : WitnessType
|
|
77
|
-
version : WitnessVersion
|
|
78
|
-
vsize : number
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export interface TxInputField {
|
|
82
|
-
coinbase? : string | null
|
|
83
|
-
prevout? : TxOutputField | null
|
|
84
|
-
script_sig? : ScriptField | null
|
|
85
|
-
sequence : SequenceField
|
|
86
|
-
size : number
|
|
87
|
-
txid : string
|
|
88
|
-
vout : number
|
|
89
|
-
witness? : WitnessField | null
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export interface TxOutputField {
|
|
93
|
-
script_pk : ScriptField
|
|
94
|
-
size : number
|
|
95
|
-
type : TxOutputType
|
|
96
|
-
value : bigint
|
|
97
|
-
version : WitnessVersion | null
|
|
98
|
-
}
|
|
File without changes
|