@bsv/sdk 1.3.19 → 1.3.21

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bsv/sdk",
3
- "version": "1.3.19",
3
+ "version": "1.3.21",
4
4
  "type": "module",
5
5
  "description": "BSV Blockchain Software Development Kit",
6
6
  "main": "dist/cjs/mod.js",
@@ -1087,7 +1087,7 @@ export class SHA512 extends BaseHash {
1087
1087
  return split32(this.h, 'big')
1088
1088
  }
1089
1089
 
1090
- _digestHex (): number[] {
1090
+ _digestHex (): string {
1091
1091
  return toHex32(this.h, 'big')
1092
1092
  }
1093
1093
  }
@@ -504,7 +504,7 @@ export class Beef {
504
504
 
505
505
  const writer = new Writer()
506
506
  writer.writeUInt32LE(ATOMIC_BEEF)
507
- writer.write(toArray(txid, 'hex'))
507
+ writer.writeReverse(toArray(txid, 'hex'))
508
508
  beef.toWriter(writer)
509
509
 
510
510
  return writer.toArray()
@@ -523,7 +523,7 @@ export class Beef {
523
523
  let atomicTxid: string | undefined
524
524
  if (version === ATOMIC_BEEF) {
525
525
  // Skip the txid and re-read the BEEF version
526
- atomicTxid = toHex(br.read(32))
526
+ atomicTxid = toHex(br.readReverse(32))
527
527
  version = br.readUInt32LE()
528
528
  }
529
529
  if (version !== BEEF_V1 && version !== BEEF_V2) {
@@ -986,7 +986,7 @@ export default class Transaction {
986
986
  // Write the Atomic BEEF prefix
987
987
  writer.writeUInt32LE(0x01010101)
988
988
  // Write the subject TXID (big-endian)
989
- writer.write(this.id())
989
+ writer.write(this.hash())
990
990
  // Append the BEEF data
991
991
  const beefData = this.toBEEF(allowPartial)
992
992
  writer.write(beefData)
@@ -1034,7 +1034,7 @@ describe('Transaction', () => {
1034
1034
  // Verify that the Atomic BEEF starts with the correct prefix and TXID
1035
1035
  const expectedPrefix = [0x01, 0x01, 0x01, 0x01]
1036
1036
  expect(atomicBEEF.slice(0, 4)).toEqual(expectedPrefix)
1037
- const txid = spendTx.id()
1037
+ const txid = spendTx.hash()
1038
1038
  expect(atomicBEEF.slice(4, 36)).toEqual(txid)
1039
1039
 
1040
1040
  // Deserialize from Atomic BEEF
@@ -1049,7 +1049,7 @@ describe('Transaction', () => {
1049
1049
  writer.writeUInt32LE(0x01010101)
1050
1050
  // Write subject TXID
1051
1051
  const fakeTXID = toArray('00'.repeat(32), 'hex')
1052
- writer.write(fakeTXID)
1052
+ writer.writeReverse(fakeTXID)
1053
1053
  // Write empty BEEF data
1054
1054
  writer.writeUInt32LE(BEEF_V1) // BEEF version
1055
1055
  writer.writeVarIntNum(0) // No BUMPs
@@ -1198,7 +1198,7 @@ describe('Transaction', () => {
1198
1198
  // Verify that the Atomic BEEF starts with the correct prefix and TXID
1199
1199
  const expectedPrefix = [0x01, 0x01, 0x01, 0x01]
1200
1200
  expect(atomicBEEF.slice(0, 4)).toEqual(expectedPrefix)
1201
- const txid = spendTx.id()
1201
+ const txid = spendTx.hash()
1202
1202
  expect(atomicBEEF.slice(4, 36)).toEqual(txid)
1203
1203
 
1204
1204
  // Deserialize from Atomic BEEF
@@ -1213,7 +1213,7 @@ describe('Transaction', () => {
1213
1213
  writer.writeUInt32LE(0x01010101)
1214
1214
  // Write subject TXID
1215
1215
  const fakeTXID = toArray('00'.repeat(32), 'hex')
1216
- writer.write(fakeTXID)
1216
+ writer.writeReverse(fakeTXID)
1217
1217
  // Write empty BEEF data
1218
1218
  writer.writeUInt32LE(BEEF_V1) // BEEF version
1219
1219
  writer.writeVarIntNum(0) // No BUMPs