ethereum.rb 2.4 → 2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -3
- data/lib/ethereum/contract.rb +1 -2
- data/lib/ethereum/formatter.rb +2 -2
- data/lib/ethereum/transaction.rb +2 -1
- data/lib/ethereum/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78c40c0d76e036c9bbdd536bb25248328148a0697548dec268444cb1ce893570
|
4
|
+
data.tar.gz: 9d84d135e46f7abdd71307867c1a3600cd799ff550095ec6efeaf3364f8230b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98899c7e483b3b72ad7d800c85f07d678e36524afd037041950b570e21d106e582b4b85166a1e1abb46d63caea391dd056418c9c00048c574cca51a1a4bc0bb7
|
7
|
+
data.tar.gz: 033c9200ec00deedb7d8882ad7691a2d5225bc7a9658e5840d9059b668dc99368bbc6053fb82e847d679d5005b49fda4e764d15dd2a9e7ea9deed3c6d346a239
|
data/README.md
CHANGED
@@ -4,9 +4,8 @@
|
|
4
4
|
|
5
5
|
The goal of ethereum.rb is to make interacting with ethereum blockchain from ruby as fast and easy as possible (but not easier!).
|
6
6
|
|
7
|
-
##
|
8
|
-
|
9
|
-
If you are interested send an email to marek@ethworks.io.
|
7
|
+
## Maintainer
|
8
|
+
Project is currently maintained by [@kurotaky](https://github.com/kurotaky).
|
10
9
|
|
11
10
|
## Highlights
|
12
11
|
|
@@ -60,6 +59,8 @@ contract.call.greet # => "Hello from ethereum.rb!"
|
|
60
59
|
|
61
60
|
You can see example contract [greeter here](https://github.com/marekkirejczyk/ruby_ethereum_example/blob/master/contracts/greeter.sol).
|
62
61
|
|
62
|
+
> If contract method name uses camel case you must convert it to snake case when use call: `call.your_method`.
|
63
|
+
|
63
64
|
## Smart contracts
|
64
65
|
|
65
66
|
### Compile multiple contracts at once
|
data/lib/ethereum/contract.rb
CHANGED
@@ -120,8 +120,7 @@ module Ethereum
|
|
120
120
|
|
121
121
|
def send_raw_transaction(payload, to = nil)
|
122
122
|
Eth.configure { |c| c.chain_id = @client.net_version["result"].to_i }
|
123
|
-
@nonce
|
124
|
-
@nonce += 1
|
123
|
+
@nonce = @client.get_nonce(key.address)
|
125
124
|
args = {
|
126
125
|
from: key.address,
|
127
126
|
value: 0,
|
data/lib/ethereum/formatter.rb
CHANGED
@@ -73,12 +73,12 @@ module Ethereum
|
|
73
73
|
|
74
74
|
def to_wei(amount, unit = "ether")
|
75
75
|
return nil if amount.nil?
|
76
|
-
BigDecimal
|
76
|
+
BigDecimal(UNITS[unit.to_sym] * amount, 16).to_s.to_i rescue nil
|
77
77
|
end
|
78
78
|
|
79
79
|
def from_wei(amount, unit = "ether")
|
80
80
|
return nil if amount.nil?
|
81
|
-
(BigDecimal
|
81
|
+
(BigDecimal(amount, 16) / BigDecimal(UNITS[unit.to_sym], 16)).to_s rescue nil
|
82
82
|
end
|
83
83
|
|
84
84
|
def from_address(address)
|
data/lib/ethereum/transaction.rb
CHANGED
@@ -21,7 +21,8 @@ module Ethereum
|
|
21
21
|
|
22
22
|
def mined?
|
23
23
|
return true if @mined
|
24
|
-
|
24
|
+
tx = @connection.eth_get_transaction_by_hash(@id)
|
25
|
+
@mined = !tx.nil? && !tx["result"].nil? && tx["result"]["blockNumber"].present?
|
25
26
|
end
|
26
27
|
|
27
28
|
def wait_for_miner(timeout: DEFAULT_TIMEOUT, step: DEFAULT_STEP)
|
data/lib/ethereum/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ethereum.rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '2.
|
4
|
+
version: '2.5'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marek Kirejczyk
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|