ethereum.rb 2.1.3 → 2.1.4

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: 983ae0ab36496c8c5b7ed3e2b88d2d3f4a379c68
4
- data.tar.gz: d1195c8af999b50e72b360d68e789f51dcd30fbb
3
+ metadata.gz: 521d5de9ea9a0d4d65ea0a9c8d40aee5cd30059a
4
+ data.tar.gz: 301e695e2005d2b4c4b1a5860f3ca4251ac81d6e
5
5
  SHA512:
6
- metadata.gz: fb0b65cd1d7e8c32d1fb45948b77dc9638e2cc3e09d8711a0aef63a4c0fd9d09930436d5eb2a220b3a57cfabb329ce8817604134e4872749fc595db056f05a17
7
- data.tar.gz: dcdd85cdf021fc80e9e864ee1fe4fd937d89e6cf2e6719a8bffeccec528b7f38db92a73a2713e70b3bf0738eec385133123f13b6b816a468d7283551dda6d257
6
+ metadata.gz: 0cc58822478802ba206592bbe70e3293f6abbcbf5b3a8dfd8be2ee235a87fa0ae13e05540feb2690b22c307d2812a0aee47dbb6c725e7e6f5a3748da4ec39dae
7
+ data.tar.gz: e4688a1546e99107facf5e6cde3240c4b9cb5490a49d8e17793d138cdc0d3fb282edd129c927fc2a6f4b89493390748ff7aa5af445559b7af16ddafb0da1c396
@@ -53,7 +53,7 @@ module Ethereum
53
53
  end
54
54
 
55
55
  def default_account
56
- @default_account || eth_accounts["result"][0]
56
+ @default_account ||= eth_accounts["result"][0]
57
57
  end
58
58
 
59
59
  def int_to_hex(p)
@@ -69,7 +69,7 @@ module Ethereum
69
69
  end
70
70
 
71
71
  def get_chain
72
- net_version["result"].to_i(16)
72
+ @net_version ||= net_version["result"].to_i(16)
73
73
  end
74
74
 
75
75
  def get_nonce(address)
@@ -1,5 +1,12 @@
1
1
  module Ethereum
2
2
  module ExplorerUrlHelper
3
+
4
+ CHAIN_PREFIX = {
5
+ 23 => "no-explorer-for-devmode.",
6
+ 66 => "kovan.",
7
+ 3 => "ropsten."
8
+ }
9
+
3
10
  def link_to_tx(label, txid, **opts)
4
11
  link_to label, explorer_path("tx/#{txid}"), {target: "_blank"}.merge(opts)
5
12
  end
@@ -8,12 +15,8 @@ module Ethereum
8
15
  link_to label, explorer_path("address/#{address}"), {target: "_blank"}.merge(opts)
9
16
  end
10
17
 
11
- def explorer_path(suffix)
12
- version = Ethereum::Singleton.instance.net_version["result"]
13
- prefix = ""
14
- prefix = "no-explorer-for-devmode." if version.to_i == 17
15
- prefix = "kovan." if version.to_i == 42
16
- prefix = "ropsten." if version.to_i == 3
18
+ def explorer_path(suffix, version = Ethereum::Singleton.instance.get_chain)
19
+ prefix = CHAIN_PREFIX.fetch(version, "")
17
20
  "https://#{prefix}etherscan.io/#{suffix}"
18
21
  end
19
22
  end
@@ -1,3 +1,3 @@
1
1
  module Ethereum
2
- VERSION = "2.1.3"
2
+ VERSION = "2.1.4"
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.1.3
4
+ version: 2.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marek Kirejczyk
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-21 00:00:00.000000000 Z
11
+ date: 2017-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -210,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
210
210
  version: '0'
211
211
  requirements: []
212
212
  rubyforge_project:
213
- rubygems_version: 2.5.1
213
+ rubygems_version: 2.6.8
214
214
  signing_key:
215
215
  specification_version: 4
216
216
  summary: Ruby Ethereum client using the JSON-RPC interface