@vbyte/btc-dev 1.0.7 → 1.0.8
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 +6 -6
- package/dist/class/tx.js +10 -6
- 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 +12 -16
- package/dist/main.cjs.map +1 -1
- package/dist/module.mjs +12 -16
- 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/class.d.ts +2 -12
- package/dist/types/witness.d.ts +1 -0
- package/package.json +1 -1
- package/src/class/tx.ts +13 -7
- package/src/class/witness.ts +2 -12
- package/src/lib/witness/parse.ts +2 -1
- package/src/types/class.ts +2 -13
- package/src/types/witness.ts +1 -0
package/dist/module.mjs
CHANGED
|
@@ -9912,6 +9912,7 @@ class TransactionOutput {
|
|
|
9912
9912
|
|
|
9913
9913
|
function parse_witness(witness) {
|
|
9914
9914
|
const elems = witness.map(e => Buff.bytes(e));
|
|
9915
|
+
const stack = witness.map(e => Buff.bytes(e).hex);
|
|
9915
9916
|
const annex = parse_annex_data(elems);
|
|
9916
9917
|
if (annex !== null)
|
|
9917
9918
|
elems.pop();
|
|
@@ -9924,7 +9925,7 @@ function parse_witness(witness) {
|
|
|
9924
9925
|
if (script !== null)
|
|
9925
9926
|
elems.pop();
|
|
9926
9927
|
const params = elems.map(e => e.hex);
|
|
9927
|
-
return { annex, cblock, params, script, type, version };
|
|
9928
|
+
return { annex, cblock, params, script, stack, type, version };
|
|
9928
9929
|
}
|
|
9929
9930
|
function parse_annex_data(data) {
|
|
9930
9931
|
let elem = data.at(-1);
|
|
@@ -10020,16 +10021,7 @@ class TransactionWitness {
|
|
|
10020
10021
|
return this._data.cblock;
|
|
10021
10022
|
}
|
|
10022
10023
|
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
|
-
};
|
|
10024
|
+
return this._data;
|
|
10033
10025
|
}
|
|
10034
10026
|
get params() {
|
|
10035
10027
|
return this._data.params;
|
|
@@ -10144,7 +10136,7 @@ class TransactionInput {
|
|
|
10144
10136
|
}
|
|
10145
10137
|
|
|
10146
10138
|
let Transaction$1 = class Transaction {
|
|
10147
|
-
constructor(txdata) {
|
|
10139
|
+
constructor(txdata = {}) {
|
|
10148
10140
|
this._tx = (typeof txdata !== 'string')
|
|
10149
10141
|
? parse_tx(txdata)
|
|
10150
10142
|
: decode_tx(txdata);
|
|
@@ -10205,16 +10197,19 @@ let Transaction$1 = class Transaction {
|
|
|
10205
10197
|
get vout() {
|
|
10206
10198
|
return this._vout;
|
|
10207
10199
|
}
|
|
10208
|
-
add_vin(
|
|
10200
|
+
add_vin(tx_input) {
|
|
10201
|
+
const txin = create_tx_input(tx_input);
|
|
10209
10202
|
this._tx.vin.push(txin);
|
|
10210
10203
|
this._update_vin();
|
|
10211
10204
|
}
|
|
10212
|
-
add_vout(
|
|
10205
|
+
add_vout(tx_output) {
|
|
10206
|
+
const txout = create_tx_output(tx_output);
|
|
10213
10207
|
this._tx.vout.push(txout);
|
|
10214
10208
|
this._update_vout();
|
|
10215
10209
|
}
|
|
10216
|
-
insert_vin(index,
|
|
10210
|
+
insert_vin(index, tx_input) {
|
|
10217
10211
|
Assert.ok(index >= 0 && index <= this._tx.vin.length, 'input goes out of bounds');
|
|
10212
|
+
const txin = create_tx_input(tx_input);
|
|
10218
10213
|
if (index === this._tx.vin.length) {
|
|
10219
10214
|
this._tx.vin.push(txin);
|
|
10220
10215
|
}
|
|
@@ -10223,8 +10218,9 @@ let Transaction$1 = class Transaction {
|
|
|
10223
10218
|
}
|
|
10224
10219
|
this._update_vin();
|
|
10225
10220
|
}
|
|
10226
|
-
insert_vout(index,
|
|
10221
|
+
insert_vout(index, tx_output) {
|
|
10227
10222
|
Assert.ok(index >= 0 && index <= this._tx.vout.length, 'output goes out of bounds');
|
|
10223
|
+
const txout = create_tx_output(tx_output);
|
|
10228
10224
|
if (index === this._tx.vout.length) {
|
|
10229
10225
|
this._tx.vout.push(txout);
|
|
10230
10226
|
}
|