Skip to content

Commit ec692cc

Browse files
author
Atif Nazir
committed
update README
1 parent 790ed38 commit ec692cc

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ Add this line to your application's Gemfile:
1010

1111
And then execute:
1212

13-
$ bundle
13+
$ bundle install
1414

1515
Or install it yourself as:
1616

17-
$ gem install block_io -v=1.2.1
17+
$ gem install block_io -v=2.0.0
1818

1919
## Changelog
2020

21+
*07/02/20*: BREAKING CHANGES. Version 2.0.0. Remove support for Ruby < 2.3.0. Behavior and interfaces have changed. By upgrading you'll need to revise your code and tests.
2122
*05/10/19*: Prevent inadvertent passing of PINs (user error).
2223
*06/25/18*: Remove support for Ruby < 1.9.3 (OpenSSL::Cipher::Cipher). Remove connection_pool dependency.
2324
*01/21/15*: Added ability to sweep coins from one address to another.
@@ -31,14 +32,19 @@ Or install it yourself as:
3132
It's super easy to get started. In your Ruby shell ($ irb), for example, do this:
3233

3334
require 'block_io'
34-
BlockIo.set_options :api_key => 'API KEY', :pin => 'SECRET PIN', :version => 2
35-
35+
blockio = BlockIo::Client.new(:api_key => "API KEY", :pin => "SECRET PIN")
36+
37+
If you do not have your PIN, or just wish to use your private key backup directly, do this:
38+
39+
blockio = BlockIo::Client.new(:api_key => "API KEY", :keys => [BlockIo::Key.from_wif("PRIVATE KEY BACKUP")])
40+
3641
And you're good to go:
3742

38-
BlockIo.get_new_address
39-
BlockIo.get_my_addresses
43+
blockio.get_new_address
44+
blockio.get_my_addresses
4045

41-
For more information, see https://block.io/api/simple/ruby
46+
For other initialization options/parameters, see `lib/block_io/client.rb`.
47+
For more information, see https://block.io/api/simple/ruby.
4248

4349
## Contributing
4450

block_io.gemspec

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# coding: utf-8
21
lib = File.expand_path('../lib', __FILE__)
32
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
43
require 'block_io/version'

lib/block_io/client.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ def finalize_signature(args = {}, method_name = "sign_and_finalize_withdrawal")
156156

157157
def api_call(args)
158158

159+
raise Exception.new("No connections left to perform API call. Please re-initialize BlockIo::Client with :pool_size greater than #{@conn.size}.") unless @conn.available > 0
160+
159161
response = @conn.with {|http| http.post("/api/v#{@version}/#{args[:method_name]}", :json => args[:params].merge({:api_key => @api_key}))}
160162

161163
begin

lib/block_io/key.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def public_key
2727
def sign(data)
2828
# sign the given hexadecimal string
2929

30-
counter = nil
30+
counter = 0
3131
signature = nil
3232

3333
loop do
@@ -50,7 +50,6 @@ def sign(data)
5050

5151
break if !@use_low_r or Helper.low_r?(signature)
5252

53-
counter ||= 0
5453
counter += 1
5554

5655
end
@@ -106,7 +105,7 @@ def self.deterministicGenerateK(data, privkey, extra_entropy = nil, group = ECDS
106105
k = [0] * 32
107106
v = [1] * 32
108107

109-
e = (extra_entropy.nil? ? [] : [extra_entropy.to_s(16).rjust(64,"0").scan(/../).reverse.join].pack("H*").bytes.to_a)
108+
e = (extra_entropy.to_i <= 0 ? [] : [extra_entropy.to_s(16).rjust(64,"0").scan(/../).reverse.join].pack("H*").bytes.to_a)
110109

111110
# step D
112111
k_data = [v, [0], x, hash, e]

0 commit comments

Comments
 (0)