@vbyte/btc-dev 1.0.7 → 1.0.9
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 +9 -9
- package/dist/class/tx.js +11 -18
- package/dist/class/txin.d.ts +3 -3
- package/dist/class/txin.js +1 -10
- package/dist/class/txout.d.ts +3 -3
- package/dist/class/txout.js +1 -7
- package/dist/class/witness.d.ts +3 -3
- package/dist/class/witness.js +1 -10
- package/dist/lib/witness/parse.js +2 -1
- package/dist/main.cjs +15 -45
- package/dist/main.cjs.map +1 -1
- package/dist/module.mjs +15 -45
- package/dist/module.mjs.map +1 -1
- package/dist/package.json +1 -1
- package/dist/script.js +1 -1
- package/dist/script.js.map +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.js +0 -1
- package/dist/types/meta.d.ts +24 -0
- package/dist/types/txdata.d.ts +1 -11
- package/dist/types/witness.d.ts +1 -0
- package/package.json +1 -1
- package/src/class/tx.ts +15 -21
- package/src/class/txin.ts +3 -15
- package/src/class/txout.ts +3 -9
- package/src/class/witness.ts +2 -12
- package/src/lib/witness/parse.ts +2 -1
- package/src/types/index.ts +0 -1
- package/src/types/meta.ts +30 -0
- package/src/types/txdata.ts +2 -15
- package/src/types/witness.ts +1 -0
- package/dist/types/class.d.ts +0 -56
- package/dist/types/class.js +0 -1
- package/src/types/class.ts +0 -63
package/dist/module.mjs
CHANGED
|
@@ -9880,13 +9880,7 @@ class TransactionOutput {
|
|
|
9880
9880
|
this._txout = txout;
|
|
9881
9881
|
}
|
|
9882
9882
|
get data() {
|
|
9883
|
-
return
|
|
9884
|
-
script_pk: this.script_pk,
|
|
9885
|
-
size: this.size,
|
|
9886
|
-
type: this.type,
|
|
9887
|
-
value: this.value,
|
|
9888
|
-
version: this.version
|
|
9889
|
-
};
|
|
9883
|
+
return this._txout;
|
|
9890
9884
|
}
|
|
9891
9885
|
get script_pk() {
|
|
9892
9886
|
return {
|
|
@@ -9912,6 +9906,7 @@ class TransactionOutput {
|
|
|
9912
9906
|
|
|
9913
9907
|
function parse_witness(witness) {
|
|
9914
9908
|
const elems = witness.map(e => Buff.bytes(e));
|
|
9909
|
+
const stack = witness.map(e => Buff.bytes(e).hex);
|
|
9915
9910
|
const annex = parse_annex_data(elems);
|
|
9916
9911
|
if (annex !== null)
|
|
9917
9912
|
elems.pop();
|
|
@@ -9924,7 +9919,7 @@ function parse_witness(witness) {
|
|
|
9924
9919
|
if (script !== null)
|
|
9925
9920
|
elems.pop();
|
|
9926
9921
|
const params = elems.map(e => e.hex);
|
|
9927
|
-
return { annex, cblock, params, script, type, version };
|
|
9922
|
+
return { annex, cblock, params, script, stack, type, version };
|
|
9928
9923
|
}
|
|
9929
9924
|
function parse_annex_data(data) {
|
|
9930
9925
|
let elem = data.at(-1);
|
|
@@ -10020,16 +10015,7 @@ class TransactionWitness {
|
|
|
10020
10015
|
return this._data.cblock;
|
|
10021
10016
|
}
|
|
10022
10017
|
get data() {
|
|
10023
|
-
return
|
|
10024
|
-
annex: this.annex,
|
|
10025
|
-
cblock: this.cblock,
|
|
10026
|
-
params: this.params,
|
|
10027
|
-
script: this.script,
|
|
10028
|
-
size: this.size,
|
|
10029
|
-
stack: this.stack,
|
|
10030
|
-
type: this.type,
|
|
10031
|
-
version: this.version
|
|
10032
|
-
};
|
|
10018
|
+
return this._data;
|
|
10033
10019
|
}
|
|
10034
10020
|
get params() {
|
|
10035
10021
|
return this._data.params;
|
|
@@ -10088,16 +10074,7 @@ class TransactionInput {
|
|
|
10088
10074
|
return this._txin.coinbase;
|
|
10089
10075
|
}
|
|
10090
10076
|
get data() {
|
|
10091
|
-
return
|
|
10092
|
-
coinbase: this.coinbase,
|
|
10093
|
-
prevout: this.prevout?.data ?? null,
|
|
10094
|
-
script_sig: this.script_sig,
|
|
10095
|
-
sequence: this.sequence,
|
|
10096
|
-
size: this.size,
|
|
10097
|
-
txid: this.txid,
|
|
10098
|
-
vout: this.vout,
|
|
10099
|
-
witness: this.witness?.data ?? null
|
|
10100
|
-
};
|
|
10077
|
+
return this._txin;
|
|
10101
10078
|
}
|
|
10102
10079
|
get has_prevout() {
|
|
10103
10080
|
return this._txin.prevout !== null;
|
|
@@ -10144,7 +10121,7 @@ class TransactionInput {
|
|
|
10144
10121
|
}
|
|
10145
10122
|
|
|
10146
10123
|
let Transaction$1 = class Transaction {
|
|
10147
|
-
constructor(txdata) {
|
|
10124
|
+
constructor(txdata = {}) {
|
|
10148
10125
|
this._tx = (typeof txdata !== 'string')
|
|
10149
10126
|
? parse_tx(txdata)
|
|
10150
10127
|
: decode_tx(txdata);
|
|
@@ -10156,18 +10133,7 @@ let Transaction$1 = class Transaction {
|
|
|
10156
10133
|
this._vout = this._tx.vout.map(txout => new TransactionOutput(txout));
|
|
10157
10134
|
}
|
|
10158
10135
|
get data() {
|
|
10159
|
-
return
|
|
10160
|
-
hash: this.hash,
|
|
10161
|
-
locktime: this.locktime,
|
|
10162
|
-
return: this.return,
|
|
10163
|
-
size: this.size,
|
|
10164
|
-
spends: this.spends,
|
|
10165
|
-
txid: this.txid,
|
|
10166
|
-
value: this.value,
|
|
10167
|
-
version: this.version,
|
|
10168
|
-
vin: this.vin.map(txin => txin.data),
|
|
10169
|
-
vout: this.vout.map(txout => txout.data)
|
|
10170
|
-
};
|
|
10136
|
+
return this._tx;
|
|
10171
10137
|
}
|
|
10172
10138
|
get hash() {
|
|
10173
10139
|
return this._hash;
|
|
@@ -10205,16 +10171,19 @@ let Transaction$1 = class Transaction {
|
|
|
10205
10171
|
get vout() {
|
|
10206
10172
|
return this._vout;
|
|
10207
10173
|
}
|
|
10208
|
-
add_vin(
|
|
10174
|
+
add_vin(tx_input) {
|
|
10175
|
+
const txin = create_tx_input(tx_input);
|
|
10209
10176
|
this._tx.vin.push(txin);
|
|
10210
10177
|
this._update_vin();
|
|
10211
10178
|
}
|
|
10212
|
-
add_vout(
|
|
10179
|
+
add_vout(tx_output) {
|
|
10180
|
+
const txout = create_tx_output(tx_output);
|
|
10213
10181
|
this._tx.vout.push(txout);
|
|
10214
10182
|
this._update_vout();
|
|
10215
10183
|
}
|
|
10216
|
-
insert_vin(index,
|
|
10184
|
+
insert_vin(index, tx_input) {
|
|
10217
10185
|
Assert.ok(index >= 0 && index <= this._tx.vin.length, 'input goes out of bounds');
|
|
10186
|
+
const txin = create_tx_input(tx_input);
|
|
10218
10187
|
if (index === this._tx.vin.length) {
|
|
10219
10188
|
this._tx.vin.push(txin);
|
|
10220
10189
|
}
|
|
@@ -10223,8 +10192,9 @@ let Transaction$1 = class Transaction {
|
|
|
10223
10192
|
}
|
|
10224
10193
|
this._update_vin();
|
|
10225
10194
|
}
|
|
10226
|
-
insert_vout(index,
|
|
10195
|
+
insert_vout(index, tx_output) {
|
|
10227
10196
|
Assert.ok(index >= 0 && index <= this._tx.vout.length, 'output goes out of bounds');
|
|
10197
|
+
const txout = create_tx_output(tx_output);
|
|
10228
10198
|
if (index === this._tx.vout.length) {
|
|
10229
10199
|
this._tx.vout.push(txout);
|
|
10230
10200
|
}
|