etheruby 1.0.0 → 1.0.1
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/etheruby/contract.rb +9 -1
- data/lib/etheruby/contract_method_dsl.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fea4ffff4d28d133a0f998ca40f6040c6c114ae4
|
4
|
+
data.tar.gz: c14ed6dfaaf3d7708d301233b727a6444cb28e6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8899bd1b0bad2748eee4df58a238efb697b753514491292cafdb3192000c826c7e9cd6a9852e49a724b3976b2bb5b09ad82ba7fa67c3ad1f0fa67e84ef16eb00
|
7
|
+
data.tar.gz: 6246fe84e03f713e19160e1fbd4f6ad9efa7e4f2df2cad9a86946988dab2bc5e089b6f9264270d14daf351a13483609fb8b34d581f99d707df7e50ed06735037
|
data/lib/etheruby/contract.rb
CHANGED
@@ -52,11 +52,19 @@ module Etheruby
|
|
52
52
|
arguments = ArgumentsGenerator.new(method_info[:params], args).to_s
|
53
53
|
data = "#{method_info[:signature]}#{arguments}"
|
54
54
|
composed_body = { to: self.address, data: data }
|
55
|
+
|
55
56
|
[ :gas, :gasPrice, :value, :from ].each { |kw|
|
56
57
|
composed_body[kw] = method_info[kw] if method_info.has_key? kw
|
57
58
|
}
|
59
|
+
|
58
60
|
@@logger.debug("Calling #{method_info[:name]} with parameters #{composed_body.inspect}")
|
59
|
-
|
61
|
+
|
62
|
+
response = if method_info.has_key?(:force_transac) and method_info[:force_transac]
|
63
|
+
do_eth_transaction composed_body
|
64
|
+
else
|
65
|
+
call_api composed_body
|
66
|
+
end
|
67
|
+
|
60
68
|
if response.is_a? Hash and response.has_key? 'error'
|
61
69
|
@@logger.error("Failed contract execution #{response['error']['message']}")
|
62
70
|
elsif response.is_a? Hash and response.has_key? 'result'
|
@@ -42,6 +42,10 @@ module Etheruby
|
|
42
42
|
data[:value] = "0x#{_gas.to_s(16)}"
|
43
43
|
end
|
44
44
|
|
45
|
+
def force_transaction!
|
46
|
+
data[:force_transac] = true
|
47
|
+
end
|
48
|
+
|
45
49
|
def validate!
|
46
50
|
data[:params] = [] unless data.has_key? :params
|
47
51
|
signature = "#{@data[:name]}(#{data[:params].join(',')})"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: etheruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jérémy SEBAN
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simplecov
|