onchain 1.0.7 → 1.0.8

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 +11 -1
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 629b71f135f95cd791eb7417c36112af9bc496fb
4
- data.tar.gz: 90de470917841e0b0fe67aa35c7803833f8e0ce9
3
+ metadata.gz: ac00d4d3a245245d267862ddbc98a1d0f8fae9b0
4
+ data.tar.gz: 4f58b1f6bb4de71324ca25c4810936bbaaee8456
5
5
  SHA512:
6
- metadata.gz: b97b5063e7cc8981d97c8d2dadd08de067851ee091d083baaa17cd502075b68ac1a752163d55acd01f0a3d91d8bf248b01a6d54b2281a4acfab82bf4a7e6abe2
7
- data.tar.gz: e20f39a38806722413e59959035fbe8b8c6a2236f826dcf1f52787a96f7a2047746aee1e1e184caa8de02b14d791b338e4741518616b2ec4e18fd2389523b26a
6
+ metadata.gz: 9d65581de5d4be5c99e799803fb9b39cdbf91951c59d4160a6a216d50fa56c7fe58f736da9dd9d2b35d1f7c7b42f5bef4206b86c9c229fd245d56da42d8424b4
7
+ data.tar.gz: 99087ad0f4ade166f22019f90b1c463741b5171c604b2ae8c86de810f258833c35d0129d708a6cff4b65ca3f743b165d43b8cbf5b1bf36f5cc16d2893389fd1f
@@ -1,13 +1,23 @@
1
1
  class OnChain
2
2
  class << self
3
3
 
4
+ def get_address_from_redemption_script(redemption_script)
5
+
6
+ sbin = sbin = redemption_script.scan(/../).map { |x| x.hex }.pack('c*')
7
+ hex = sbin.unpack("H*")[0]
8
+ fund_address = Bitcoin.hash160_to_p2sh_address(Bitcoin.hash160(hex))
9
+
10
+ return fund_address
11
+ end
4
12
 
5
13
  # With a bunch of HD wallet paths, build a transaction
6
14
  # That pays all the coins to a certain address
7
- def create_payment_tx(fund_address, payments)
15
+ def create_payment_tx(redemption_script, payments)
8
16
 
9
17
  begin
10
18
 
19
+ fund_address = get_address_from_redemption_script(redemption_script)
20
+
11
21
  tx = Bitcoin::Protocol::Tx.new
12
22
 
13
23
  total_amount = 0
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.7
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Purton