bsv-sdk 0.6.1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c0fdbd1bc0a1b9c7cb675618e0bf4c53bdbaaeb90c95313ddbdcf033e7155297
4
- data.tar.gz: 1f3086221b1de1fae836d0012230f78660b24ac9bf3db48d13a086246ab63286
3
+ metadata.gz: b3a34503ada1c79e20bfafede1357f26715000394c5b286e21bc40374c040729
4
+ data.tar.gz: 594a0b52441b9a7c0e1dc8590174f06f27e196ce573a4244d722d1c5381636d3
5
5
  SHA512:
6
- metadata.gz: 4d29ed638d0c13091c5b3f52ece97ea1bbbe70a8f67b4a407c914f2f6e0250104fc258b58b6b0a7beb1357794abe053a102565dbe0ef8011cd76b9d5df8010e6
7
- data.tar.gz: 7052ec60f715e6a44997c1f1489a1eb43675a7e8a9ca7b5d30aa6a7a31b946430d973216e07bc8b1cf792d495e0fd73cb73252a6308c0017c83a8cfc13234e5a
6
+ metadata.gz: 87b8c8198f8f6a29f783364a83d4983b77ea7119b316f1b4cce77b4bb60333cc3fb8134aecb9cc58327558fac3368803811f77dab6ec2a91a8f9cfabbb19418e
7
+ data.tar.gz: ebaead0b459cc6fda02b8d6b233de420505dd4aa5f173f314d04cc24a2dc501744dfa3a62aab046ce2571ed3dba044cef5a1534ed33cf85fc4584357c52d9c50
data/CHANGELOG.md CHANGED
@@ -5,6 +5,15 @@ 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
+
8
17
  ## [0.6.1] - 2026-04-05
9
18
 
10
19
  ### Fixed
data/lib/bsv/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BSV
4
- VERSION = '0.6.1'
4
+ VERSION = '0.6.2'
5
5
  end
@@ -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
- input.unlocking_script = BSV::Script::Script.from_hex(spec[:unlocking_script]) if spec[:unlocking_script]
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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bsv-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Bettison