onchain 1.0.8 → 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/onchain/payments.rb +7 -1
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ac00d4d3a245245d267862ddbc98a1d0f8fae9b0
4
- data.tar.gz: 4f58b1f6bb4de71324ca25c4810936bbaaee8456
3
+ metadata.gz: 429a0f9abce6c457a94880105930acd85f3cc951
4
+ data.tar.gz: 1e703f989156b93816b8f50e320ddcf7578b47c1
5
5
  SHA512:
6
- metadata.gz: 9d65581de5d4be5c99e799803fb9b39cdbf91951c59d4160a6a216d50fa56c7fe58f736da9dd9d2b35d1f7c7b42f5bef4206b86c9c229fd245d56da42d8424b4
7
- data.tar.gz: 99087ad0f4ade166f22019f90b1c463741b5171c604b2ae8c86de810f258833c35d0129d708a6cff4b65ca3f743b165d43b8cbf5b1bf36f5cc16d2893389fd1f
6
+ metadata.gz: 5357381557a5d0f4fddc909ea61f1122abec7bfde506a39a0b4a6dd02cd122ad38cd6a6a798652052d4af32c076b5f0c9c512013fcce713ec0d8f2f4ee5533fe
7
+ data.tar.gz: 929bb1c704c84282d559fcc2efe0085db922cfdcc83551ab4f085729415cdc3ea4a61dbecfec122c3aeca7756d21d646af8d29642fa05ed19ea766b9c30b4a01
@@ -3,13 +3,18 @@ class OnChain
3
3
 
4
4
  def get_address_from_redemption_script(redemption_script)
5
5
 
6
- sbin = sbin = redemption_script.scan(/../).map { |x| x.hex }.pack('c*')
6
+ sbin = redemption_script.scan(/../).map { |x| x.hex }.pack('c*')
7
7
  hex = sbin.unpack("H*")[0]
8
8
  fund_address = Bitcoin.hash160_to_p2sh_address(Bitcoin.hash160(hex))
9
9
 
10
10
  return fund_address
11
11
  end
12
12
 
13
+ def hex_to_script(hex)
14
+ sbin = hex.scan(/../).map { |x| x.hex }.pack('c*')
15
+ return Bitcoin::Script.new(sbin)
16
+ end
17
+
13
18
  # With a bunch of HD wallet paths, build a transaction
14
19
  # That pays all the coins to a certain address
15
20
  def create_payment_tx(redemption_script, payments)
@@ -45,6 +50,7 @@ class OnChain
45
50
 
46
51
  txin.prev_out = spent[0]
47
52
  txin.prev_out_index = spent[1]
53
+ txin.script = hex_to_script(redemption_script).to_payload
48
54
 
49
55
  tx.add_in(txin)
50
56
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onchain
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Purton