web3 0.1.0 → 0.2.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/lib/generated_web3_methods.rb +4 -4
- data/lib/web3.rb +2 -7
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63c7ce53e8c9e4f4d82e0eac0befdb315a0efe85
|
4
|
+
data.tar.gz: eaf548ce0b2a526e5f88bda39d1c32ab38193b3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74c4dc5fcb2b1177344ca5b65cab9b8fe5f9a6a430db01313e56ad1f500eb805ff32ad7a574079574dd4ce5b4c26729a920e5c62c8816f0c36811b08a0470fa1
|
7
|
+
data.tar.gz: 5dd86bc88a83b06effbb724a450c10d930e2e66127268bb070d1eafe20c6b3954eb418ccf11bc9231d856afd43c0e6a5c9010351edc0629d3fe6a4a1c6029374
|
@@ -64,7 +64,7 @@ module GeneratedWeb3Methods
|
|
64
64
|
to_decimal response["result"]
|
65
65
|
end
|
66
66
|
|
67
|
-
def eth_getBalance(address
|
67
|
+
def eth_getBalance(address, block = "latest")
|
68
68
|
response = do_request("eth_getBalance",[address, block])
|
69
69
|
to_decimal response["result"]
|
70
70
|
end
|
@@ -74,7 +74,7 @@ module GeneratedWeb3Methods
|
|
74
74
|
response["result"]
|
75
75
|
end
|
76
76
|
|
77
|
-
def eth_getTransactionCount(address
|
77
|
+
def eth_getTransactionCount(address, block = "latest")
|
78
78
|
response = do_request("eth_getTransactionCount",[address, block])
|
79
79
|
to_decimal response["result"]
|
80
80
|
end
|
@@ -99,12 +99,12 @@ module GeneratedWeb3Methods
|
|
99
99
|
to_decimal response["result"]
|
100
100
|
end
|
101
101
|
|
102
|
-
def eth_getCode(address
|
102
|
+
def eth_getCode(address, block = "latest")
|
103
103
|
response = do_request("eth_getCode",[address, block])
|
104
104
|
response["result"]
|
105
105
|
end
|
106
106
|
|
107
|
-
def eth_sign(
|
107
|
+
def eth_sign(address, data)
|
108
108
|
response = do_request("eth_sign",[address, data])
|
109
109
|
response["result"]
|
110
110
|
end
|
data/lib/web3.rb
CHANGED
@@ -3,19 +3,14 @@
|
|
3
3
|
require "httparty"
|
4
4
|
require "json"
|
5
5
|
|
6
|
-
#@method = "eth_getBalance"
|
7
|
-
#@params = ["0x14226aD04625ED4930787D87C82c6c72a5B690a1", "latest"]
|
8
|
-
|
9
6
|
class Web3
|
10
7
|
attr_accessor :address, :endpoint, :id, :debug
|
11
8
|
|
12
9
|
@@jsonrpc = "2.0"
|
13
10
|
@@debug = ENV["ETH_DEBUG"] || false
|
14
11
|
|
15
|
-
def initialize(
|
16
|
-
endpoint = ENV["ETH_ENDPOINT"] || "http://localhost:8545",
|
12
|
+
def initialize( endpoint = ENV["ETH_ENDPOINT"] || "http://localhost:8545",
|
17
13
|
id = ENV["ETH_DEFAULT_CLIENT_ID"] || 999)
|
18
|
-
@address = address
|
19
14
|
@endpoint = endpoint
|
20
15
|
@id = id
|
21
16
|
end
|
@@ -91,7 +86,7 @@ class Web3
|
|
91
86
|
|
92
87
|
end
|
93
88
|
|
94
|
-
w3 = Web3. new
|
89
|
+
w3 = Web3. new
|
95
90
|
#w3.address =
|
96
91
|
#puts w3. web3_clientVersion
|
97
92
|
#puts w3. net_version
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: web3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Spike Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description: A client
|
13
|
+
description: A client library for connecting to an Ethereum Web3 JSON RPC service
|
14
14
|
email: spikewilliams@gmail.com
|
15
15
|
executables: []
|
16
16
|
extensions: []
|
@@ -41,5 +41,5 @@ rubyforge_project:
|
|
41
41
|
rubygems_version: 2.5.1
|
42
42
|
signing_key:
|
43
43
|
specification_version: 4
|
44
|
-
summary: A client
|
44
|
+
summary: A client library for connecting to an Ethereum Web3 JSON RPC service
|
45
45
|
test_files: []
|