tetsuo-blockchain-wallet 1.2.2 → 1.2.3

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.
@@ -87,7 +87,7 @@ function createTransactionHex(inputs, outputs, scriptPubKeys) {
87
87
  // Previous transaction ID (little endian)
88
88
  hex += reverseTxid(input.txid);
89
89
  // Previous output index (4 bytes, little endian)
90
- hex += input.vout.toString(16).padStart(8, '0');
90
+ hex += reverseBytesInPairs(input.vout.toString(16).padStart(8, '0'));
91
91
  // Script length and script
92
92
  // If scriptPubKeys provided (for signing), use them; otherwise empty
93
93
  if (scriptPubKeys && scriptPubKeys[i]) {
@@ -99,7 +99,7 @@ function createTransactionHex(inputs, outputs, scriptPubKeys) {
99
99
  hex += '00'; // 0 length script (unsigned)
100
100
  }
101
101
  // Sequence
102
- hex += (input.sequence ?? 0xffffffff).toString(16).padStart(8, '0');
102
+ hex += reverseBytesInPairs((input.sequence ?? 0xffffffff).toString(16).padStart(8, '0'));
103
103
  }
104
104
  // Output count
105
105
  hex += encodeVarInt(outputs.length);
@@ -172,7 +172,7 @@ function signTransaction(transactionHex, privateKey, inputs, utxos) {
172
172
  for (let j = 0; j < inputs.length; j++) {
173
173
  const input = inputs[j];
174
174
  preimageHex += reverseTxid(input.txid);
175
- preimageHex += input.vout.toString(16).padStart(8, '0');
175
+ preimageHex += reverseBytesInPairs(input.vout.toString(16).padStart(8, '0'));
176
176
  if (j === i) {
177
177
  // This is the input we're signing - use scriptPubKey
178
178
  preimageHex += encodeVarInt(scriptPubKey.length / 2);
@@ -182,7 +182,7 @@ function signTransaction(transactionHex, privateKey, inputs, utxos) {
182
182
  // Other inputs - empty script
183
183
  preimageHex += '00';
184
184
  }
185
- preimageHex += (input.sequence ?? 0xffffffff).toString(16).padStart(8, '0');
185
+ preimageHex += reverseBytesInPairs((input.sequence ?? 0xffffffff).toString(16).padStart(8, '0'));
186
186
  }
187
187
  // Add outputs (from original unsigned tx)
188
188
  const outputPos = findOutputsPositionInHex(transactionHex, inputs.length);
@@ -208,9 +208,9 @@ function signTransaction(transactionHex, privateKey, inputs, utxos) {
208
208
  for (let i = 0; i < inputs.length; i++) {
209
209
  const input = inputs[i];
210
210
  signedHex += reverseTxid(input.txid);
211
- signedHex += input.vout.toString(16).padStart(8, '0');
211
+ signedHex += reverseBytesInPairs(input.vout.toString(16).padStart(8, '0'));
212
212
  signedHex += encodeVarInt(scriptSigs[i].length / 2) + scriptSigs[i];
213
- signedHex += (input.sequence ?? 0xffffffff).toString(16).padStart(8, '0');
213
+ signedHex += reverseBytesInPairs((input.sequence ?? 0xffffffff).toString(16).padStart(8, '0'));
214
214
  }
215
215
  // Add outputs from original
216
216
  const outputPos = findOutputsPositionInHex(transactionHex, inputs.length);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tetsuo-blockchain-wallet",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "TypeScript SDK for TETSUO blockchain wallet operations",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -112,7 +112,7 @@ export function createTransactionHex(
112
112
  hex += reverseTxid(input.txid);
113
113
 
114
114
  // Previous output index (4 bytes, little endian)
115
- hex += input.vout.toString(16).padStart(8, '0');
115
+ hex += reverseBytesInPairs(input.vout.toString(16).padStart(8, '0'));
116
116
 
117
117
  // Script length and script
118
118
  // If scriptPubKeys provided (for signing), use them; otherwise empty
@@ -125,7 +125,7 @@ export function createTransactionHex(
125
125
  }
126
126
 
127
127
  // Sequence
128
- hex += (input.sequence ?? 0xffffffff).toString(16).padStart(8, '0');
128
+ hex += reverseBytesInPairs((input.sequence ?? 0xffffffff).toString(16).padStart(8, '0'));
129
129
  }
130
130
 
131
131
  // Output count
@@ -217,7 +217,7 @@ export function signTransaction(
217
217
  for (let j = 0; j < inputs.length; j++) {
218
218
  const input = inputs[j];
219
219
  preimageHex += reverseTxid(input.txid);
220
- preimageHex += input.vout.toString(16).padStart(8, '0');
220
+ preimageHex += reverseBytesInPairs(input.vout.toString(16).padStart(8, '0'));
221
221
 
222
222
  if (j === i) {
223
223
  // This is the input we're signing - use scriptPubKey
@@ -228,7 +228,7 @@ export function signTransaction(
228
228
  preimageHex += '00';
229
229
  }
230
230
 
231
- preimageHex += (input.sequence ?? 0xffffffff).toString(16).padStart(8, '0');
231
+ preimageHex += reverseBytesInPairs((input.sequence ?? 0xffffffff).toString(16).padStart(8, '0'));
232
232
  }
233
233
 
234
234
  // Add outputs (from original unsigned tx)
@@ -264,9 +264,9 @@ export function signTransaction(
264
264
  for (let i = 0; i < inputs.length; i++) {
265
265
  const input = inputs[i];
266
266
  signedHex += reverseTxid(input.txid);
267
- signedHex += input.vout.toString(16).padStart(8, '0');
267
+ signedHex += reverseBytesInPairs(input.vout.toString(16).padStart(8, '0'));
268
268
  signedHex += encodeVarInt(scriptSigs[i].length / 2) + scriptSigs[i];
269
- signedHex += (input.sequence ?? 0xffffffff).toString(16).padStart(8, '0');
269
+ signedHex += reverseBytesInPairs((input.sequence ?? 0xffffffff).toString(16).padStart(8, '0'));
270
270
  }
271
271
 
272
272
  // Add outputs from original