ethereum 0.4.99 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b587b530c3f3fdf42f4dd23f2ef32e88744ea366
4
- data.tar.gz: de6d9f9995d2029e2a20f36a488c7f62696e4616
3
+ metadata.gz: 8f1177d726d56bdd0d7d0979824d067b4da1aff9
4
+ data.tar.gz: 091280255725556472bedad0b99d1f9151070585
5
5
  SHA512:
6
- metadata.gz: 3330163ae56a7d7302a632ab06c240c554c461afa1790633f2f754d208ee62acfedfe90782624d9a0d93d86f157032432ff56a068e888c6aa4b6fb50b5e82c42
7
- data.tar.gz: bd1c9cc34da66cecb53fbfeaa88768712f6c2bdf4a1f600f47eb3bf87f9596d59d6b98b9f1662b517d888bea9a651f923f969cd9ca5736b3de81648d75382be1
6
+ metadata.gz: e5bea3d33b137ee29571bb3f961996c307a1e8ef699455eee4abd9d0702bb1b42675dc2f4a03c4b99981f0bc723a7d56087709b1ad62d8b92f4254484bd87b5e
7
+ data.tar.gz: f4250eaec615d1354b6bc445cebced74976db3338c6bcd075f0e7dc59022ccc939f7443111408dde98d5fd1af1eb24987ec4499f5d978b97503849170452b7a2
@@ -30,5 +30,5 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency "rspec"
31
31
  spec.add_development_dependency "pry"
32
32
  spec.add_dependency "activesupport"
33
- spec.add_dependency "sha3-pure-ruby"
33
+ spec.add_dependency "sha3-pure-ruby", "0.1.1"
34
34
  end
@@ -1,13 +1,17 @@
1
1
  require 'net/http'
2
2
  module Ethereum
3
3
  class HttpClient < Client
4
- attr_accessor :command, :id, :host, :port, :batch, :converted_transactions, :uri, :ssl
4
+ attr_accessor :command, :id, :host, :port, :batch, :converted_transactions, :uri, :ssl, :logger, :log
5
5
 
6
- def initialize(host, port, ssl = false)
6
+ def initialize(host, port, ssl = false, log = true)
7
7
  @host = host
8
8
  @port = port
9
9
  @id = 1
10
10
  @ssl = ssl
11
+ @log = log
12
+ if @log == true
13
+ @logger = Logger.new("/tmp/ethereum_ruby_http.log")
14
+ end
11
15
  if ssl
12
16
  @uri = URI("https://#{@host}:#{@port}")
13
17
  else
@@ -27,6 +31,9 @@ module Ethereum
27
31
  end
28
32
  header = {'Content-Type' => 'application/json'}
29
33
  request = ::Net::HTTP::Post.new(uri, header)
34
+ if @log == true
35
+ @logger.info("Sending #{payload.to_json}")
36
+ end
30
37
  request.body = payload.to_json
31
38
  response = http.request(request)
32
39
  return JSON.parse(response.body)
@@ -1,12 +1,16 @@
1
1
  require 'socket'
2
2
  module Ethereum
3
3
  class IpcClient < Client
4
- attr_accessor :command, :id, :ipcpath, :batch, :converted_transactions
4
+ attr_accessor :command, :id, :ipcpath, :batch, :converted_transactions, :log, :logger
5
5
 
6
- def initialize(ipcpath = "#{ENV['HOME']}/.ethereum/geth.ipc")
6
+ def initialize(ipcpath = "#{ENV['HOME']}/.ethereum/geth.ipc", log = true)
7
7
  @ipcpath = ipcpath
8
8
  @id = 1
9
9
  @batch = []
10
+ @log = log
11
+ if @log == true
12
+ @logger = Logger.new("/tmp/ethereum_ruby_ipc.log")
13
+ end
10
14
  end
11
15
 
12
16
  RPC_COMMANDS.each do |rpc_command|
@@ -16,6 +20,9 @@ module Ethereum
16
20
  payload = {jsonrpc: "2.0", method: command, params: args, id: get_id}
17
21
  socket = UNIXSocket.new(@ipcpath)
18
22
  socket.write(payload.to_json)
23
+ if @log == true
24
+ @logger.info("Sending #{payload.to_json}")
25
+ end
19
26
  socket.close_write
20
27
  read = socket.read
21
28
  socket.close_read
@@ -1,3 +1,3 @@
1
1
  module Ethereum
2
- VERSION = "0.4.99"
2
+ VERSION = "0.5.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ethereum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.99
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - DigixGlobal Pte Ltd (https://dgx.io)
@@ -84,16 +84,16 @@ dependencies:
84
84
  name: sha3-pure-ruby
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - '='
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: 0.1.1
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - '='
95
95
  - !ruby/object:Gem::Version
96
- version: '0'
96
+ version: 0.1.1
97
97
  description: Ethereum libraries for ruby programming language.
98
98
  email:
99
99
  - ace@dgx.io