-
Notifications
You must be signed in to change notification settings - Fork 302
Expand file tree
/
Copy pathunspent.ts
More file actions
50 lines (47 loc) · 1.51 KB
/
unspent.ts
File metadata and controls
50 lines (47 loc) · 1.51 KB
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
import * as utxolib from '@bitgo/utxo-lib';
/**
* Unspent transaction output (UTXO) type definition
*
* This type represents an unspent transaction output, independent from utxo-lib.
* The structure matches utxolib.bitgo.Unspent but is defined locally.
*
* @property id - Format: ${txid}:${vout}. Use `parseOutputId(id)` to parse.
* @property address - The network-specific encoded address. Use `toOutputScript(address, network)` to obtain scriptPubKey.
* @property value - The amount in satoshi.
*/
export interface Unspent<TNumber extends number | bigint = number> {
/**
* Format: ${txid}:${vout}.
* Use `parseOutputId(id)` to parse.
*/
id: string;
/**
* The network-specific encoded address.
* Use `toOutputScript(address, network)` to obtain scriptPubKey.
*/
address: string;
/**
* The amount in satoshi.
*/
value: TNumber;
}
/**
* Wallet unspent type - extends Unspent with wallet-specific fields
*
* This type includes all fields from Unspent plus:
* - chain: ChainCode (chain code for wallet derivation)
* - index: number (index for wallet derivation)
*/
export interface WalletUnspent<TNumber extends number | bigint = number> extends Unspent<TNumber> {
chain: utxolib.bitgo.ChainCode;
index: number;
}
/**
* Unspent with previous transaction data
*
* Extends Unspent with:
* - prevTx: Buffer (previous transaction data for legacy transactions)
*/
export interface UnspentWithPrevTx<TNumber extends number | bigint = number> extends Unspent<TNumber> {
prevTx: Buffer;
}