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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ee62dd3b5d2d9e9b29cd797f21bff2514998e95476d69da2367b57f0ac90c660
4
- data.tar.gz: f9f08d7ffcb196d8c954c6ab79f902cb36f5bec5ef6f6ec9b8a39d4454ff241f
3
+ metadata.gz: 78c40c0d76e036c9bbdd536bb25248328148a0697548dec268444cb1ce893570
4
+ data.tar.gz: 9d84d135e46f7abdd71307867c1a3600cd799ff550095ec6efeaf3364f8230b6
5
5
  SHA512:
6
- metadata.gz: c696336cb44fe3c43b2b4403bcb78695d8958d49319bd463068d86248f125183742622ad33a62425cbea625c8df8c209465fbc74b9913566b9d4f26845f4e25c
7
- data.tar.gz: '09b2a85c0bec50dcdcb8470a76b552c81bec5563c6309f7d5a03cacd5f983be49ccbf9a362abf5fe16d54b9f62f855fe48c5bb952d249498c1b5c38808eb25b1'
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
- ## Looking for new maintainer
8
- As we changed our technological stack away from ruby and we are not using ethereum.rb anymore. The gem suffered from neglect. We are looking for person/people who would like to take over developing and maintaining. Ideally, someone who uses it and who already worked with code quite a bit.
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
@@ -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 ||= @client.get_nonce(key.address) - 1
124
- @nonce += 1
123
+ @nonce = @client.get_nonce(key.address)
125
124
  args = {
126
125
  from: key.address,
127
126
  value: 0,
@@ -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.new(UNITS[unit.to_sym] * amount, 16).to_s.to_i rescue nil
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.new(amount, 16) / BigDecimal.new(UNITS[unit.to_sym], 16)).to_s rescue nil
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)
@@ -21,7 +21,8 @@ module Ethereum
21
21
 
22
22
  def mined?
23
23
  return true if @mined
24
- @mined = @connection.eth_get_transaction_by_hash(@id).dig("result", "blockNumber").present?
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)
@@ -1,3 +1,3 @@
1
1
  module Ethereum
2
- VERSION = "2.4"
2
+ VERSION = "2.5"
3
3
  end
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'
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-02-15 00:00:00.000000000 Z
11
+ date: 2020-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler