onchain 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/onchain/payments.rb +11 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac00d4d3a245245d267862ddbc98a1d0f8fae9b0
|
4
|
+
data.tar.gz: 4f58b1f6bb4de71324ca25c4810936bbaaee8456
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d65581de5d4be5c99e799803fb9b39cdbf91951c59d4160a6a216d50fa56c7fe58f736da9dd9d2b35d1f7c7b42f5bef4206b86c9c229fd245d56da42d8424b4
|
7
|
+
data.tar.gz: 99087ad0f4ade166f22019f90b1c463741b5171c604b2ae8c86de810f258833c35d0129d708a6cff4b65ca3f743b165d43b8cbf5b1bf36f5cc16d2893389fd1f
|
data/lib/onchain/payments.rb
CHANGED
@@ -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(
|
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
|