bsv-sdk 0.6.0 → 0.6.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/lib/bsv/transaction/beef.rb +6 -2
- data/lib/bsv/version.rb +1 -1
- data/lib/bsv/wallet_interface/memory_store.rb +1 -0
- data/lib/bsv/wallet_interface/wallet_client.rb +21 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b3a34503ada1c79e20bfafede1357f26715000394c5b286e21bc40374c040729
|
|
4
|
+
data.tar.gz: 594a0b52441b9a7c0e1dc8590174f06f27e196ce573a4244d722d1c5381636d3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 87b8c8198f8f6a29f783364a83d4983b77ea7119b316f1b4cce77b4bb60333cc3fb8134aecb9cc58327558fac3368803811f77dab6ec2a91a8f9cfabbb19418e
|
|
7
|
+
data.tar.gz: ebaead0b459cc6fda02b8d6b233de420505dd4aa5f173f314d04cc24a2dc501744dfa3a62aab046ce2571ed3dba044cef5a1534ed33cf85fc4584357c52d9c50
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.6.2] - 2026-04-06
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **Wallet** — `WalletClient#create_action` now accepts `UnlockingScriptTemplate` objects (e.g. `P2PKH`) as input unlocking scripts, enabling template-based signing without BEEF.
|
|
13
|
+
- **Wallet** — `wire_source_from_storage` fallback populates `source_satoshis` and `source_locking_script` from wallet storage when BEEF is absent or incomplete, enabling BIP-143 sighash computation for wallet-tracked outputs.
|
|
14
|
+
- **Wallet** — `finalize_action` resolves template inputs via `sign_all` before serialisation.
|
|
15
|
+
- **Storage** — `MemoryStore#filter_outputs` supports outpoint filtering for efficient single-output lookups.
|
|
16
|
+
|
|
17
|
+
## [0.6.1] - 2026-04-05
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- **Transaction** — use internal byte order for Atomic BEEF subject txid lookup, fixing serialisation of transactions loaded from Atomic BEEF format.
|
|
22
|
+
|
|
8
23
|
## [0.6.0] - 2026-04-04
|
|
9
24
|
|
|
10
25
|
### Added
|
data/lib/bsv/transaction/beef.rb
CHANGED
|
@@ -121,7 +121,9 @@ module BSV
|
|
|
121
121
|
raise ArgumentError, "truncated Atomic BEEF: need 36 bytes at offset #{offset}, got #{remaining}"
|
|
122
122
|
end
|
|
123
123
|
|
|
124
|
-
|
|
124
|
+
# Atomic BEEF stores the subject txid in internal byte order (little-endian
|
|
125
|
+
# hash order), matching JS and Go SDKs. Reverse to display order for internal use.
|
|
126
|
+
beef.instance_variable_set(:@subject_txid, data.byteslice(offset, 32).reverse)
|
|
125
127
|
offset += 32
|
|
126
128
|
inner_version = data.byteslice(offset, 4).unpack1('V')
|
|
127
129
|
offset += 4
|
|
@@ -198,7 +200,9 @@ module BSV
|
|
|
198
200
|
# @return [String] raw Atomic BEEF binary
|
|
199
201
|
def to_atomic_binary(subject_txid)
|
|
200
202
|
buf = [ATOMIC_BEEF].pack('V')
|
|
201
|
-
|
|
203
|
+
# Write subject txid in internal byte order (reverse of display order),
|
|
204
|
+
# matching JS and Go SDK conventions for Bitcoin binary formats.
|
|
205
|
+
buf << subject_txid.b.reverse
|
|
202
206
|
buf << to_binary
|
|
203
207
|
buf
|
|
204
208
|
end
|
data/lib/bsv/version.rb
CHANGED
|
@@ -91,6 +91,7 @@ module BSV
|
|
|
91
91
|
|
|
92
92
|
def filter_outputs(query)
|
|
93
93
|
results = @outputs
|
|
94
|
+
results = results.select { |o| o[:outpoint] == query[:outpoint] } if query[:outpoint]
|
|
94
95
|
results = results.select { |o| o[:basket] == query[:basket] } if query[:basket]
|
|
95
96
|
if query[:tags]
|
|
96
97
|
mode = query[:tag_query_mode] || 'any'
|
|
@@ -483,8 +483,17 @@ module BSV
|
|
|
483
483
|
)
|
|
484
484
|
|
|
485
485
|
wire_source(input, txid_hex, output_index, beef) if beef
|
|
486
|
-
|
|
487
|
-
|
|
486
|
+
wire_source_from_storage(input, spec[:outpoint]) if input.source_satoshis.nil? || input.source_locking_script.nil?
|
|
487
|
+
|
|
488
|
+
case spec[:unlocking_script]
|
|
489
|
+
when BSV::Transaction::UnlockingScriptTemplate
|
|
490
|
+
input.unlocking_script_template = spec[:unlocking_script]
|
|
491
|
+
when String
|
|
492
|
+
input.unlocking_script = BSV::Script::Script.from_hex(spec[:unlocking_script])
|
|
493
|
+
when nil then nil
|
|
494
|
+
else
|
|
495
|
+
raise InvalidParameterError.new('unlocking_script', 'a hex String or UnlockingScriptTemplate')
|
|
496
|
+
end
|
|
488
497
|
|
|
489
498
|
tx.add_input(input)
|
|
490
499
|
end
|
|
@@ -504,6 +513,15 @@ module BSV
|
|
|
504
513
|
input.source_locking_script = source_tx.outputs[output_index].locking_script
|
|
505
514
|
end
|
|
506
515
|
|
|
516
|
+
def wire_source_from_storage(input, outpoint)
|
|
517
|
+
results = @storage.find_outputs({ outpoint: outpoint, limit: 1 })
|
|
518
|
+
stored = results.first
|
|
519
|
+
return unless stored
|
|
520
|
+
|
|
521
|
+
input.source_satoshis = stored[:satoshis]
|
|
522
|
+
input.source_locking_script = BSV::Script::Script.from_hex(stored[:locking_script])
|
|
523
|
+
end
|
|
524
|
+
|
|
507
525
|
def build_outputs(tx, outputs)
|
|
508
526
|
outputs.each do |spec|
|
|
509
527
|
output = BSV::Transaction::TransactionOutput.new(
|
|
@@ -540,6 +558,7 @@ module BSV
|
|
|
540
558
|
end
|
|
541
559
|
|
|
542
560
|
def finalize_action(tx, args)
|
|
561
|
+
tx.sign_all if tx.inputs.any?(&:unlocking_script_template)
|
|
543
562
|
txid = tx.txid_hex
|
|
544
563
|
status = args.dig(:options, :no_send) ? 'nosend' : 'completed'
|
|
545
564
|
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bsv-sdk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Simon Bettison
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-04-
|
|
10
|
+
date: 2026-04-05 00:00:00.000000000 Z
|
|
11
11
|
dependencies: []
|
|
12
12
|
description: A Ruby library for interacting with the BSV Blockchain — keys, scripts,
|
|
13
13
|
transactions, and more.
|