ethereum 0.4.99 → 0.5.0
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/ethereum.gemspec +1 -1
- data/lib/ethereum/http_client.rb +9 -2
- data/lib/ethereum/ipc_client.rb +9 -2
- data/lib/ethereum/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f1177d726d56bdd0d7d0979824d067b4da1aff9
|
4
|
+
data.tar.gz: 091280255725556472bedad0b99d1f9151070585
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5bea3d33b137ee29571bb3f961996c307a1e8ef699455eee4abd9d0702bb1b42675dc2f4a03c4b99981f0bc723a7d56087709b1ad62d8b92f4254484bd87b5e
|
7
|
+
data.tar.gz: f4250eaec615d1354b6bc445cebced74976db3338c6bcd075f0e7dc59022ccc939f7443111408dde98d5fd1af1eb24987ec4499f5d978b97503849170452b7a2
|
data/ethereum.gemspec
CHANGED
data/lib/ethereum/http_client.rb
CHANGED
@@ -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)
|
data/lib/ethereum/ipc_client.rb
CHANGED
@@ -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
|
data/lib/ethereum/version.rb
CHANGED
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
|
+
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:
|
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:
|
96
|
+
version: 0.1.1
|
97
97
|
description: Ethereum libraries for ruby programming language.
|
98
98
|
email:
|
99
99
|
- ace@dgx.io
|