bitbank 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +6 -0
- data/README.md +9 -0
- data/VERSION +1 -1
- data/bitbank.gemspec +8 -1
- data/lib/bitbank/account.rb +6 -2
- data/lib/bitbank/client.rb +25 -2
- data/spec/account_spec.rb +25 -6
- data/spec/client_spec.rb +49 -0
- data/spec/fixtures/vcr_cassettes/account/address.yml +1 -1
- data/spec/fixtures/vcr_cassettes/account/pay.yml +37 -9
- data/spec/fixtures/vcr_cassettes/account/pay_invalid.yml +30 -0
- data/spec/fixtures/vcr_cassettes/account/pay_local.yml +30 -0
- data/spec/fixtures/vcr_cassettes/client/address_by_account.yml +30 -0
- data/spec/fixtures/vcr_cassettes/client/address_by_account_not_found.yml +30 -0
- data/spec/fixtures/vcr_cassettes/client/validate_address_invalid.yml +30 -0
- data/spec/fixtures/vcr_cassettes/client/validate_address_nolocal.yml +30 -0
- data/spec/fixtures/vcr_cassettes/client/validate_address_valid.yml +30 -0
- metadata +35 -28
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -20,6 +20,11 @@ Configure the username and password to match the ones in your bitcoind config. I
|
|
20
20
|
|
21
21
|
You can have a number of different Bitcoin accounts and addresses.
|
22
22
|
|
23
|
+
account = client.new_account('named-account')
|
24
|
+
|
25
|
+
account = client.account('named-account') # or account_by_address
|
26
|
+
puts "#{account.name} has bitcoin address #{account.address}"
|
27
|
+
|
23
28
|
client.accounts.each do |account|
|
24
29
|
puts "#{account.name}: #{account.balance}"
|
25
30
|
end
|
@@ -37,6 +42,10 @@ Each account also has a list of transactions (both sent and received).
|
|
37
42
|
puts "[#{transaction.category}] #{transaction.address} #{transaction.amount}"
|
38
43
|
end
|
39
44
|
|
45
|
+
You can move money between your accounts:
|
46
|
+
|
47
|
+
account.move('another-account', 0.5)
|
48
|
+
|
40
49
|
And of course you can send payments using the library too:
|
41
50
|
|
42
51
|
account.pay('1DSwyVqyhKKQwrdFw3jpAEqnrXEjTcTKMB', 1.0)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/bitbank.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{bitbank}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Nick Plante"]
|
@@ -41,8 +41,12 @@ Gem::Specification.new do |s|
|
|
41
41
|
"spec/fixtures/vcr_cassettes/account/move.yml",
|
42
42
|
"spec/fixtures/vcr_cassettes/account/new_address.yml",
|
43
43
|
"spec/fixtures/vcr_cassettes/account/pay.yml",
|
44
|
+
"spec/fixtures/vcr_cassettes/account/pay_invalid.yml",
|
45
|
+
"spec/fixtures/vcr_cassettes/account/pay_local.yml",
|
44
46
|
"spec/fixtures/vcr_cassettes/account/transactions.yml",
|
45
47
|
"spec/fixtures/vcr_cassettes/client/accounts.yml",
|
48
|
+
"spec/fixtures/vcr_cassettes/client/address_by_account.yml",
|
49
|
+
"spec/fixtures/vcr_cassettes/client/address_by_account_not_found.yml",
|
46
50
|
"spec/fixtures/vcr_cassettes/client/balance.yml",
|
47
51
|
"spec/fixtures/vcr_cassettes/client/balance_account.yml",
|
48
52
|
"spec/fixtures/vcr_cassettes/client/block_count.yml",
|
@@ -56,6 +60,9 @@ Gem::Specification.new do |s|
|
|
56
60
|
"spec/fixtures/vcr_cassettes/client/new_address.yml",
|
57
61
|
"spec/fixtures/vcr_cassettes/client/transactions.yml",
|
58
62
|
"spec/fixtures/vcr_cassettes/client/transactions_account.yml",
|
63
|
+
"spec/fixtures/vcr_cassettes/client/validate_address_invalid.yml",
|
64
|
+
"spec/fixtures/vcr_cassettes/client/validate_address_nolocal.yml",
|
65
|
+
"spec/fixtures/vcr_cassettes/client/validate_address_valid.yml",
|
59
66
|
"spec/fixtures/vcr_cassettes/transaction/details.yml",
|
60
67
|
"spec/spec_helper.rb",
|
61
68
|
"spec/support/focused.rb",
|
data/lib/bitbank/account.rb
CHANGED
@@ -47,8 +47,12 @@ module Bitbank
|
|
47
47
|
# Note that +amount+ is a real and is rounded to 8 decimal places.
|
48
48
|
# Returns the transaction if successful.
|
49
49
|
def pay(address, amount)
|
50
|
-
|
51
|
-
|
50
|
+
if @client.validate_address(address, true)
|
51
|
+
txid = @client.request('sendfrom', name, address, amount)
|
52
|
+
Transaction.new(@client, txid)
|
53
|
+
else
|
54
|
+
false
|
55
|
+
end
|
52
56
|
end
|
53
57
|
|
54
58
|
# Returns a list of the most recent transactions for this account.
|
data/lib/bitbank/client.rb
CHANGED
@@ -7,8 +7,19 @@ module Bitbank
|
|
7
7
|
end
|
8
8
|
|
9
9
|
# Retrieve a particular named account.
|
10
|
-
def account(
|
11
|
-
Bitbank::Account.new(self,
|
10
|
+
def account(account_name)
|
11
|
+
Bitbank::Account.new(self, account_name, nil, true)
|
12
|
+
end
|
13
|
+
|
14
|
+
# Rerieve the account that the given Bitcoin address belongs to.
|
15
|
+
# Returns nil if the account
|
16
|
+
def account_by_address(address)
|
17
|
+
account_name = request('getaccount', address)
|
18
|
+
if account_name.present?
|
19
|
+
account(account_name)
|
20
|
+
else
|
21
|
+
nil
|
22
|
+
end
|
12
23
|
end
|
13
24
|
|
14
25
|
# Returns a list of local accounts.
|
@@ -84,6 +95,18 @@ module Bitbank
|
|
84
95
|
end
|
85
96
|
end
|
86
97
|
|
98
|
+
# Determine if the given address is valid.
|
99
|
+
def validate_address(address, locals_invalid=false)
|
100
|
+
status = request('validateaddress', address)
|
101
|
+
|
102
|
+
if locals_invalid && status['ismine']
|
103
|
+
warn "WARNING: Bitcoin address '#{address}' belongs to local account '#{status['account']}'."
|
104
|
+
return false
|
105
|
+
end
|
106
|
+
|
107
|
+
status['isvalid']
|
108
|
+
end
|
109
|
+
|
87
110
|
def request(method, *args)
|
88
111
|
body = { 'id' => 'jsonrpc', 'method' => method }
|
89
112
|
body['params'] = args unless args.empty? || args.first.nil?
|
data/spec/account_spec.rb
CHANGED
@@ -14,7 +14,7 @@ describe "Bitbank::Account" do
|
|
14
14
|
use_vcr_cassette 'account/address'
|
15
15
|
|
16
16
|
it 'should retrieve the address for this account' do
|
17
|
-
@account.address.should == '
|
17
|
+
@account.address.should == '16FEfkbJHEXnEhZbuNGyFaoCYgVyUtqX6j'
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'should be validated on account creation if a check was requested (default)' do
|
@@ -58,12 +58,31 @@ describe "Bitbank::Account" do
|
|
58
58
|
end
|
59
59
|
|
60
60
|
describe 'pay' do
|
61
|
-
|
61
|
+
context 'when the recipient address is valid' do
|
62
|
+
use_vcr_cassette 'account/pay'
|
63
|
+
|
64
|
+
it 'should return a new transaction' do
|
65
|
+
transaction = @account.pay('15VjRaDX9zpbA8LVnbrCAFzrVzN7ixHNsC', 0.02)
|
66
|
+
transaction.amount.should == -0.02
|
67
|
+
transaction.account.should == @account
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
context 'when the recipient address is invalid' do
|
72
|
+
use_vcr_cassette 'account/pay_invalid'
|
73
|
+
|
74
|
+
it 'should return false' do
|
75
|
+
@account.pay('invalidaddress', 0.01).should be_false
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
context 'when the recipient address is a local address' do
|
80
|
+
use_vcr_cassette 'account/pay_local'
|
62
81
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
82
|
+
it 'should warn the user and return false' do
|
83
|
+
@client.expects(:warn)
|
84
|
+
@account.pay('1DSwyVqyhKKQwrdFw3jpAEqnrXEjTcTKMB', 0.01).should be_false
|
85
|
+
end
|
67
86
|
end
|
68
87
|
end
|
69
88
|
|
data/spec/client_spec.rb
CHANGED
@@ -29,6 +29,29 @@ describe "Bitbank::Client" do
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
+
describe 'account_by_address' do
|
33
|
+
before(:each) do
|
34
|
+
Bitbank::Account.any_instance.stubs(:address).returns(true) # check
|
35
|
+
end
|
36
|
+
|
37
|
+
context 'when the address exists locally' do
|
38
|
+
use_vcr_cassette 'client/address_by_account'
|
39
|
+
|
40
|
+
it 'should retrieve the appropriate account' do
|
41
|
+
account = @client.account_by_address('16FEfkbJHEXnEhZbuNGyFaoCYgVyUtqX6j')
|
42
|
+
account.should == Bitbank::Account.new(@client, 'adent')
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'when the address does not exist locally' do
|
47
|
+
use_vcr_cassette 'client/address_by_account_not_found'
|
48
|
+
|
49
|
+
it 'should return false' do
|
50
|
+
@client.account_by_address('badaddress').should be_nil
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
32
55
|
describe 'accounts' do
|
33
56
|
use_vcr_cassette 'client/accounts'
|
34
57
|
|
@@ -176,4 +199,30 @@ describe "Bitbank::Client" do
|
|
176
199
|
end
|
177
200
|
end
|
178
201
|
end
|
202
|
+
|
203
|
+
describe 'validate_address' do
|
204
|
+
context 'with an invalid address' do
|
205
|
+
use_vcr_cassette 'client/validate_address_invalid'
|
206
|
+
|
207
|
+
it 'should be false' do
|
208
|
+
@client.validate_address('heartofgold').should be_false
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
context 'with a valid address' do
|
213
|
+
use_vcr_cassette 'client/validate_address_valid'
|
214
|
+
|
215
|
+
it 'should be true' do
|
216
|
+
@client.validate_address('1DSwyVqyhKKQwrdFw3jpAEqnrXEjTcTKMB').should be_true
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
context 'when local address are not desired' do
|
221
|
+
use_vcr_cassette 'client/validate_address_nolocal'
|
222
|
+
|
223
|
+
it 'should be false and generate a warning' do
|
224
|
+
@client.validate_address('1DSwyVqyhKKQwrdFw3jpAEqnrXEjTcTKMB', true).should be_false
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end
|
179
228
|
end
|
@@ -24,7 +24,7 @@
|
|
24
24
|
- application/json
|
25
25
|
server:
|
26
26
|
- bitcoin-json-rpc/0.3.21-beta
|
27
|
-
body: ! '{"result":"
|
27
|
+
body: ! '{"result":"16FEfkbJHEXnEhZbuNGyFaoCYgVyUtqX6j","error":null,"id":"jsonrpc"}
|
28
28
|
|
29
29
|
'
|
30
30
|
http_version: '1.1'
|
@@ -3,37 +3,65 @@
|
|
3
3
|
request: !ruby/struct:VCR::Request
|
4
4
|
method: :post
|
5
5
|
uri: http://testuser:testpass@localhost:8332/
|
6
|
-
body: ! '{"id":"jsonrpc","method":"
|
6
|
+
body: ! '{"id":"jsonrpc","method":"validateaddress","params":["15VjRaDX9zpbA8LVnbrCAFzrVzN7ixHNsC"]}'
|
7
7
|
headers:
|
8
8
|
accept:
|
9
9
|
- ! '*/*; q=0.5, application/xml'
|
10
10
|
accept-encoding:
|
11
11
|
- gzip, deflate
|
12
12
|
content-length:
|
13
|
-
- '
|
13
|
+
- '91'
|
14
14
|
response: !ruby/struct:VCR::Response
|
15
15
|
status: !ruby/struct:VCR::ResponseStatus
|
16
16
|
code: 200
|
17
17
|
message: OK
|
18
18
|
headers:
|
19
19
|
date:
|
20
|
-
-
|
20
|
+
- Mon, 11 Jul 2011 16:36:13 +0000
|
21
21
|
content-length:
|
22
|
-
- '
|
22
|
+
- '118'
|
23
23
|
content-type:
|
24
24
|
- application/json
|
25
25
|
server:
|
26
26
|
- bitcoin-json-rpc/0.3.21-beta
|
27
|
-
body: ! '{"result":"
|
27
|
+
body: ! '{"result":{"isvalid":true,"address":"15VjRaDX9zpbA8LVnbrCAFzrVzN7ixHNsC","ismine":false},"error":null,"id":"jsonrpc"}
|
28
28
|
|
29
29
|
'
|
30
30
|
http_version: '1.1'
|
31
|
+
- !ruby/struct:VCR::HTTPInteraction
|
32
|
+
request: !ruby/struct:VCR::Request
|
33
|
+
method: :post
|
34
|
+
uri: http://testuser:testpass@localhost:8332/
|
35
|
+
body: ! '{"id":"jsonrpc","method":"sendfrom","params":["adent","15VjRaDX9zpbA8LVnbrCAFzrVzN7ixHNsC",0.02]}'
|
36
|
+
headers:
|
37
|
+
accept:
|
38
|
+
- ! '*/*; q=0.5, application/xml'
|
39
|
+
accept-encoding:
|
40
|
+
- gzip, deflate
|
41
|
+
content-length:
|
42
|
+
- '97'
|
43
|
+
response: !ruby/struct:VCR::Response
|
44
|
+
status: !ruby/struct:VCR::ResponseStatus
|
45
|
+
code: 200
|
46
|
+
message: OK
|
47
|
+
headers:
|
48
|
+
date:
|
49
|
+
- Mon, 11 Jul 2011 16:36:15 +0000
|
50
|
+
content-length:
|
51
|
+
- '106'
|
52
|
+
content-type:
|
53
|
+
- application/json
|
54
|
+
server:
|
55
|
+
- bitcoin-json-rpc/0.3.21-beta
|
56
|
+
body: ! '{"result":"2c3bb4819349df9c5236496c5182e7bdaff7db8092e98b52b7e387b491054b35","error":null,"id":"jsonrpc"}
|
31
57
|
|
58
|
+
'
|
59
|
+
http_version: '1.1'
|
32
60
|
- !ruby/struct:VCR::HTTPInteraction
|
33
61
|
request: !ruby/struct:VCR::Request
|
34
62
|
method: :post
|
35
63
|
uri: http://testuser:testpass@localhost:8332/
|
36
|
-
body: ! '{"id":"jsonrpc","method":"gettransaction","params":["
|
64
|
+
body: ! '{"id":"jsonrpc","method":"gettransaction","params":["2c3bb4819349df9c5236496c5182e7bdaff7db8092e98b52b7e387b491054b35"]}'
|
37
65
|
headers:
|
38
66
|
accept:
|
39
67
|
- ! '*/*; q=0.5, application/xml'
|
@@ -47,14 +75,14 @@
|
|
47
75
|
message: OK
|
48
76
|
headers:
|
49
77
|
date:
|
50
|
-
- Mon,
|
78
|
+
- Mon, 11 Jul 2011 16:36:15 +0000
|
51
79
|
content-length:
|
52
|
-
- '
|
80
|
+
- '326'
|
53
81
|
content-type:
|
54
82
|
- application/json
|
55
83
|
server:
|
56
84
|
- bitcoin-json-rpc/0.3.21-beta
|
57
|
-
body: ! '{"result":{"amount"
|
85
|
+
body: ! '{"result":{"amount":-0.02000000,"fee":-0.01000000,"confirmations":0,"txid":"2c3bb4819349df9c5236496c5182e7bdaff7db8092e98b52b7e387b491054b35","time":1310402164,"details":[{"account":"adent","address":"15VjRaDX9zpbA8LVnbrCAFzrVzN7ixHNsC","category":"send","amount":-0.02000000,"fee":-0.01000000}]},"error":null,"id":"jsonrpc"}
|
58
86
|
|
59
87
|
'
|
60
88
|
http_version: '1.1'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: http://testuser:testpass@localhost:8332/
|
6
|
+
body: ! '{"id":"jsonrpc","method":"validateaddress","params":["invalidaddress"]}'
|
7
|
+
headers:
|
8
|
+
accept:
|
9
|
+
- ! '*/*; q=0.5, application/xml'
|
10
|
+
accept-encoding:
|
11
|
+
- gzip, deflate
|
12
|
+
content-length:
|
13
|
+
- '71'
|
14
|
+
response: !ruby/struct:VCR::Response
|
15
|
+
status: !ruby/struct:VCR::ResponseStatus
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
date:
|
20
|
+
- Mon, 11 Jul 2011 16:03:22 +0000
|
21
|
+
content-length:
|
22
|
+
- '57'
|
23
|
+
content-type:
|
24
|
+
- application/json
|
25
|
+
server:
|
26
|
+
- bitcoin-json-rpc/0.3.21-beta
|
27
|
+
body: ! '{"result":{"isvalid":false},"error":null,"id":"jsonrpc"}
|
28
|
+
|
29
|
+
'
|
30
|
+
http_version: '1.1'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: http://testuser:testpass@localhost:8332/
|
6
|
+
body: ! '{"id":"jsonrpc","method":"validateaddress","params":["1DSwyVqyhKKQwrdFw3jpAEqnrXEjTcTKMB"]}'
|
7
|
+
headers:
|
8
|
+
accept:
|
9
|
+
- ! '*/*; q=0.5, application/xml'
|
10
|
+
accept-encoding:
|
11
|
+
- gzip, deflate
|
12
|
+
content-length:
|
13
|
+
- '91'
|
14
|
+
response: !ruby/struct:VCR::Response
|
15
|
+
status: !ruby/struct:VCR::ResponseStatus
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
date:
|
20
|
+
- Mon, 11 Jul 2011 16:03:22 +0000
|
21
|
+
content-length:
|
22
|
+
- '145'
|
23
|
+
content-type:
|
24
|
+
- application/json
|
25
|
+
server:
|
26
|
+
- bitcoin-json-rpc/0.3.21-beta
|
27
|
+
body: ! '{"result":{"isvalid":true,"address":"1DSwyVqyhKKQwrdFw3jpAEqnrXEjTcTKMB","ismine":true,"account":"nap@zerosum.org"},"error":null,"id":"jsonrpc"}
|
28
|
+
|
29
|
+
'
|
30
|
+
http_version: '1.1'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: http://testuser:testpass@localhost:8332/
|
6
|
+
body: ! '{"id":"jsonrpc","method":"getaccount","params":["16FEfkbJHEXnEhZbuNGyFaoCYgVyUtqX6j"]}'
|
7
|
+
headers:
|
8
|
+
accept:
|
9
|
+
- ! '*/*; q=0.5, application/xml'
|
10
|
+
accept-encoding:
|
11
|
+
- gzip, deflate
|
12
|
+
content-length:
|
13
|
+
- '86'
|
14
|
+
response: !ruby/struct:VCR::Response
|
15
|
+
status: !ruby/struct:VCR::ResponseStatus
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
date:
|
20
|
+
- Mon, 11 Jul 2011 17:11:33 +0000
|
21
|
+
content-length:
|
22
|
+
- '47'
|
23
|
+
content-type:
|
24
|
+
- application/json
|
25
|
+
server:
|
26
|
+
- bitcoin-json-rpc/0.3.21-beta
|
27
|
+
body: ! '{"result":"adent","error":null,"id":"jsonrpc"}
|
28
|
+
|
29
|
+
'
|
30
|
+
http_version: '1.1'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: http://testuser:testpass@localhost:8332/
|
6
|
+
body: ! '{"id":"jsonrpc","method":"getaccount","params":["badaddress"]}'
|
7
|
+
headers:
|
8
|
+
accept:
|
9
|
+
- ! '*/*; q=0.5, application/xml'
|
10
|
+
accept-encoding:
|
11
|
+
- gzip, deflate
|
12
|
+
content-length:
|
13
|
+
- '62'
|
14
|
+
response: !ruby/struct:VCR::Response
|
15
|
+
status: !ruby/struct:VCR::ResponseStatus
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
date:
|
20
|
+
- Mon, 11 Jul 2011 17:11:33 +0000
|
21
|
+
content-length:
|
22
|
+
- '42'
|
23
|
+
content-type:
|
24
|
+
- application/json
|
25
|
+
server:
|
26
|
+
- bitcoin-json-rpc/0.3.21-beta
|
27
|
+
body: ! '{"result":"","error":null,"id":"jsonrpc"}
|
28
|
+
|
29
|
+
'
|
30
|
+
http_version: '1.1'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: http://testuser:testpass@localhost:8332/
|
6
|
+
body: ! '{"id":"jsonrpc","method":"validateaddress","params":["heartofgold"]}'
|
7
|
+
headers:
|
8
|
+
accept:
|
9
|
+
- ! '*/*; q=0.5, application/xml'
|
10
|
+
accept-encoding:
|
11
|
+
- gzip, deflate
|
12
|
+
content-length:
|
13
|
+
- '68'
|
14
|
+
response: !ruby/struct:VCR::Response
|
15
|
+
status: !ruby/struct:VCR::ResponseStatus
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
date:
|
20
|
+
- Mon, 11 Jul 2011 15:54:58 +0000
|
21
|
+
content-length:
|
22
|
+
- '57'
|
23
|
+
content-type:
|
24
|
+
- application/json
|
25
|
+
server:
|
26
|
+
- bitcoin-json-rpc/0.3.21-beta
|
27
|
+
body: ! '{"result":{"isvalid":false},"error":null,"id":"jsonrpc"}
|
28
|
+
|
29
|
+
'
|
30
|
+
http_version: '1.1'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: http://testuser:testpass@localhost:8332/
|
6
|
+
body: ! '{"id":"jsonrpc","method":"validateaddress","params":["1DSwyVqyhKKQwrdFw3jpAEqnrXEjTcTKMB"]}'
|
7
|
+
headers:
|
8
|
+
accept:
|
9
|
+
- ! '*/*; q=0.5, application/xml'
|
10
|
+
accept-encoding:
|
11
|
+
- gzip, deflate
|
12
|
+
content-length:
|
13
|
+
- '91'
|
14
|
+
response: !ruby/struct:VCR::Response
|
15
|
+
status: !ruby/struct:VCR::ResponseStatus
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
date:
|
20
|
+
- Mon, 11 Jul 2011 15:54:58 +0000
|
21
|
+
content-length:
|
22
|
+
- '145'
|
23
|
+
content-type:
|
24
|
+
- application/json
|
25
|
+
server:
|
26
|
+
- bitcoin-json-rpc/0.3.21-beta
|
27
|
+
body: ! '{"result":{"isvalid":true,"address":"1DSwyVqyhKKQwrdFw3jpAEqnrXEjTcTKMB","ismine":true,"account":"nap@zerosum.org"},"error":null,"id":"jsonrpc"}
|
28
|
+
|
29
|
+
'
|
30
|
+
http_version: '1.1'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: http://testuser:testpass@localhost:8332/
|
6
|
+
body: ! '{"id":"jsonrpc","method":"validateaddress","params":["1DSwyVqyhKKQwrdFw3jpAEqnrXEjTcTKMB"]}'
|
7
|
+
headers:
|
8
|
+
accept:
|
9
|
+
- ! '*/*; q=0.5, application/xml'
|
10
|
+
accept-encoding:
|
11
|
+
- gzip, deflate
|
12
|
+
content-length:
|
13
|
+
- '91'
|
14
|
+
response: !ruby/struct:VCR::Response
|
15
|
+
status: !ruby/struct:VCR::ResponseStatus
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
date:
|
20
|
+
- Mon, 11 Jul 2011 15:57:06 +0000
|
21
|
+
content-length:
|
22
|
+
- '145'
|
23
|
+
content-type:
|
24
|
+
- application/json
|
25
|
+
server:
|
26
|
+
- bitcoin-json-rpc/0.3.21-beta
|
27
|
+
body: ! '{"result":{"isvalid":true,"address":"1DSwyVqyhKKQwrdFw3jpAEqnrXEjTcTKMB","ismine":true,"account":"nap@zerosum.org"},"error":null,"id":"jsonrpc"}
|
28
|
+
|
29
|
+
'
|
30
|
+
http_version: '1.1'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bitbank
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -14,7 +14,7 @@ default_executable:
|
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rest-client
|
17
|
-
requirement: &
|
17
|
+
requirement: &2156403060 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: 1.6.3
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *2156403060
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: activesupport
|
28
|
-
requirement: &
|
28
|
+
requirement: &2156402080 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: 3.0.7
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *2156402080
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: i18n
|
39
|
-
requirement: &
|
39
|
+
requirement: &2156401040 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: 0.5.0
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *2156401040
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: rspec
|
50
|
-
requirement: &
|
50
|
+
requirement: &2156399840 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ! '>='
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: 2.6.0
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *2156399840
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: yard
|
61
|
-
requirement: &
|
61
|
+
requirement: &2156399120 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ! '>='
|
@@ -66,10 +66,10 @@ dependencies:
|
|
66
66
|
version: 0.6.0
|
67
67
|
type: :development
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *2156399120
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: bundler
|
72
|
-
requirement: &
|
72
|
+
requirement: &2156398360 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - ~>
|
@@ -77,10 +77,10 @@ dependencies:
|
|
77
77
|
version: 1.0.0
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
|
-
version_requirements: *
|
80
|
+
version_requirements: *2156398360
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: jeweler
|
83
|
-
requirement: &
|
83
|
+
requirement: &2156397580 !ruby/object:Gem::Requirement
|
84
84
|
none: false
|
85
85
|
requirements:
|
86
86
|
- - ~>
|
@@ -88,10 +88,10 @@ dependencies:
|
|
88
88
|
version: 1.6.2
|
89
89
|
type: :development
|
90
90
|
prerelease: false
|
91
|
-
version_requirements: *
|
91
|
+
version_requirements: *2156397580
|
92
92
|
- !ruby/object:Gem::Dependency
|
93
93
|
name: webmock
|
94
|
-
requirement: &
|
94
|
+
requirement: &2156396820 !ruby/object:Gem::Requirement
|
95
95
|
none: false
|
96
96
|
requirements:
|
97
97
|
- - ~>
|
@@ -99,10 +99,10 @@ dependencies:
|
|
99
99
|
version: 1.6.4
|
100
100
|
type: :development
|
101
101
|
prerelease: false
|
102
|
-
version_requirements: *
|
102
|
+
version_requirements: *2156396820
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: vcr
|
105
|
-
requirement: &
|
105
|
+
requirement: &2156396180 !ruby/object:Gem::Requirement
|
106
106
|
none: false
|
107
107
|
requirements:
|
108
108
|
- - ! '>='
|
@@ -110,10 +110,10 @@ dependencies:
|
|
110
110
|
version: 1.10.0
|
111
111
|
type: :development
|
112
112
|
prerelease: false
|
113
|
-
version_requirements: *
|
113
|
+
version_requirements: *2156396180
|
114
114
|
- !ruby/object:Gem::Dependency
|
115
115
|
name: mocha
|
116
|
-
requirement: &
|
116
|
+
requirement: &2156395380 !ruby/object:Gem::Requirement
|
117
117
|
none: false
|
118
118
|
requirements:
|
119
119
|
- - ! '>='
|
@@ -121,10 +121,10 @@ dependencies:
|
|
121
121
|
version: 0.9.12
|
122
122
|
type: :development
|
123
123
|
prerelease: false
|
124
|
-
version_requirements: *
|
124
|
+
version_requirements: *2156395380
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: rcov
|
127
|
-
requirement: &
|
127
|
+
requirement: &2156394680 !ruby/object:Gem::Requirement
|
128
128
|
none: false
|
129
129
|
requirements:
|
130
130
|
- - ! '>='
|
@@ -132,10 +132,10 @@ dependencies:
|
|
132
132
|
version: '0'
|
133
133
|
type: :development
|
134
134
|
prerelease: false
|
135
|
-
version_requirements: *
|
135
|
+
version_requirements: *2156394680
|
136
136
|
- !ruby/object:Gem::Dependency
|
137
137
|
name: fuubar
|
138
|
-
requirement: &
|
138
|
+
requirement: &2156394040 !ruby/object:Gem::Requirement
|
139
139
|
none: false
|
140
140
|
requirements:
|
141
141
|
- - ! '>='
|
@@ -143,10 +143,10 @@ dependencies:
|
|
143
143
|
version: 0.0.5
|
144
144
|
type: :development
|
145
145
|
prerelease: false
|
146
|
-
version_requirements: *
|
146
|
+
version_requirements: *2156394040
|
147
147
|
- !ruby/object:Gem::Dependency
|
148
148
|
name: autotest
|
149
|
-
requirement: &
|
149
|
+
requirement: &2156393360 !ruby/object:Gem::Requirement
|
150
150
|
none: false
|
151
151
|
requirements:
|
152
152
|
- - ! '>='
|
@@ -154,7 +154,7 @@ dependencies:
|
|
154
154
|
version: 4.4.6
|
155
155
|
type: :development
|
156
156
|
prerelease: false
|
157
|
-
version_requirements: *
|
157
|
+
version_requirements: *2156393360
|
158
158
|
description: Easy to use Ruby interface to the Bitcoind JSON-RPC API
|
159
159
|
email: nap@zerosum.org
|
160
160
|
executables: []
|
@@ -187,8 +187,12 @@ files:
|
|
187
187
|
- spec/fixtures/vcr_cassettes/account/move.yml
|
188
188
|
- spec/fixtures/vcr_cassettes/account/new_address.yml
|
189
189
|
- spec/fixtures/vcr_cassettes/account/pay.yml
|
190
|
+
- spec/fixtures/vcr_cassettes/account/pay_invalid.yml
|
191
|
+
- spec/fixtures/vcr_cassettes/account/pay_local.yml
|
190
192
|
- spec/fixtures/vcr_cassettes/account/transactions.yml
|
191
193
|
- spec/fixtures/vcr_cassettes/client/accounts.yml
|
194
|
+
- spec/fixtures/vcr_cassettes/client/address_by_account.yml
|
195
|
+
- spec/fixtures/vcr_cassettes/client/address_by_account_not_found.yml
|
192
196
|
- spec/fixtures/vcr_cassettes/client/balance.yml
|
193
197
|
- spec/fixtures/vcr_cassettes/client/balance_account.yml
|
194
198
|
- spec/fixtures/vcr_cassettes/client/block_count.yml
|
@@ -202,6 +206,9 @@ files:
|
|
202
206
|
- spec/fixtures/vcr_cassettes/client/new_address.yml
|
203
207
|
- spec/fixtures/vcr_cassettes/client/transactions.yml
|
204
208
|
- spec/fixtures/vcr_cassettes/client/transactions_account.yml
|
209
|
+
- spec/fixtures/vcr_cassettes/client/validate_address_invalid.yml
|
210
|
+
- spec/fixtures/vcr_cassettes/client/validate_address_nolocal.yml
|
211
|
+
- spec/fixtures/vcr_cassettes/client/validate_address_valid.yml
|
205
212
|
- spec/fixtures/vcr_cassettes/transaction/details.yml
|
206
213
|
- spec/spec_helper.rb
|
207
214
|
- spec/support/focused.rb
|
@@ -222,7 +229,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
222
229
|
version: '0'
|
223
230
|
segments:
|
224
231
|
- 0
|
225
|
-
hash: -
|
232
|
+
hash: -3155454592692986753
|
226
233
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
227
234
|
none: false
|
228
235
|
requirements:
|