blockchain-wallet 0.0.2 → 0.0.3
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/lib/blockchain/wallet.rb +16 -10
- data/lib/blockchain/wallet/version.rb +1 -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: 019b1f67802cfea67ad6ddfa2471cdfa4c16ecd5
|
4
|
+
data.tar.gz: 1b8f25e8f06291ed538c14b5989802eb62df5850
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ff525a972e556a21d709bb2373bc36ea54491dee21da4ce35d897527b4c221b40d53a93805965e14fc74ac6c2e325d7a7f732d2b8d9d5bc7c110a63ccc57196
|
7
|
+
data.tar.gz: 23948e25b1d802f9fa07c1fcfc83d1f2f54898f87b5807c233e9fcd4f7e1a0e6a67ce2222a818674e4f2f4c365b507b2fa0a9f9d0198067a71d9489812e0f37d
|
data/lib/blockchain/wallet.rb
CHANGED
@@ -14,6 +14,15 @@ module BlockchainWallet
|
|
14
14
|
@second_password = second_password
|
15
15
|
end
|
16
16
|
|
17
|
+
|
18
|
+
def self.satoshi_to_bitcoins(satoshi)
|
19
|
+
satoshi / (10 ** 8)
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.bitcoins_to_satoshi(bitcoins)
|
23
|
+
satoshi * (10 ** 8)
|
24
|
+
end
|
25
|
+
|
17
26
|
def addresses
|
18
27
|
url = build_url("list", {:password => @password})
|
19
28
|
handle(url) { |answer| answer.addresses }
|
@@ -24,7 +33,7 @@ module BlockchainWallet
|
|
24
33
|
handle(url) { |answer| answer }
|
25
34
|
end
|
26
35
|
|
27
|
-
def new_address(label=
|
36
|
+
def new_address(label = nil)
|
28
37
|
url = build_url("new_address", {:password => @password, :second_password => @second_password, :label => label})
|
29
38
|
handle(url) { |answer| answer }
|
30
39
|
end
|
@@ -44,12 +53,17 @@ module BlockchainWallet
|
|
44
53
|
handle(url) { |answer| answer.consolidated }
|
45
54
|
end
|
46
55
|
|
47
|
-
def payment(address, amount, from, shared, fee, note)
|
56
|
+
def payment(address, amount, from = nil, shared = nil, fee = nil, note = nil)
|
48
57
|
url = build_url("payment", {:password => @password, :second_password => @second_password, :to => address, :amount => bitcoins_to_satoshi(amount),
|
49
58
|
:from => from, :shared => shared, :fee => fee, :note => note})
|
50
59
|
handle(url) { |answer| answer }
|
51
60
|
end
|
52
61
|
|
62
|
+
def sendmany(recipients, from = nil, shared = nil, fee = nil, note = nil)
|
63
|
+
url = build_url("sendmany", {:password => @password, :second_password => @second_password, :recipients => recipients,
|
64
|
+
:from => from, :shared => shared, :fee => fee, :note => note})
|
65
|
+
handle(url) { |answer| answer }
|
66
|
+
end
|
53
67
|
|
54
68
|
attr_reader :guid
|
55
69
|
|
@@ -72,14 +86,6 @@ module BlockchainWallet
|
|
72
86
|
raise BlockchainException, ex.message
|
73
87
|
end
|
74
88
|
|
75
|
-
def satoshi_to_bitcoins(satoshi)
|
76
|
-
satoshi / (10 ** 8)
|
77
|
-
end
|
78
|
-
|
79
|
-
def bitcoins_to_satoshi(bitcoins)
|
80
|
-
satoshi * (10 ** 8)
|
81
|
-
end
|
82
|
-
|
83
89
|
def check_error(answer)
|
84
90
|
error = answer['error']
|
85
91
|
raise WebApiException, error if error
|