ethereum 0.4.40 → 0.4.41
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/ethereum/contract.rb +7 -5
- data/lib/ethereum/function.rb +1 -1
- data/lib/ethereum/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b33eb89e9ff725f99146e1ef5d9037acaf7241c
|
4
|
+
data.tar.gz: dda537dc15caa46e74da2729d0579424c9099231
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8accc888ecf1b0ef4a40d90742eb8ca7c16691843454f835e92e21db249d38e9afc362fcdfade3c0569bc9598d46ebb78cb95c33b7a45e715fd50c98370cc8ad
|
7
|
+
data.tar.gz: a8c48aa2524ce2736857e8c47a19bbac495a2ec593cca0f71ed6ba8467c95a07b81a798d4840ab651d0b0a73c21bfe135350d7995d387484765a65476e5ec16e
|
data/lib/ethereum/contract.rb
CHANGED
@@ -84,10 +84,12 @@ module Ethereum
|
|
84
84
|
|
85
85
|
functions.each do |fun|
|
86
86
|
|
87
|
-
|
87
|
+
fun_count = functions.select {|x| x.name == fun.name }.count
|
88
|
+
derived_function_name = (fun_count == 1) ? "#{fun.name.underscore}" : "#{fun.name.underscore}__#{fun.inputs.collect {|x| x.type}.join("__")}"
|
89
|
+
|
90
|
+
define_method "call_#{derived_function_name}".to_sym do |*args|
|
88
91
|
formatter = Ethereum::Formatter.new
|
89
92
|
arg_types = fun.inputs.collect(&:type)
|
90
|
-
#out_types = fun.outputs.collect(&:type)
|
91
93
|
connection = self.connection
|
92
94
|
return {result: :error, message: "missing parameters for #{fun.function_string}" } if arg_types.length != args.length
|
93
95
|
payload = []
|
@@ -101,7 +103,7 @@ module Ethereum
|
|
101
103
|
return {data: payload.join(), raw: raw_result, formatted: output}
|
102
104
|
end
|
103
105
|
|
104
|
-
define_method "transact_#{
|
106
|
+
define_method "transact_#{derived_function_name}".to_sym do |*args|
|
105
107
|
formatter = Ethereum::Formatter.new
|
106
108
|
arg_types = fun.inputs.collect(&:type)
|
107
109
|
connection = self.connection
|
@@ -115,8 +117,8 @@ module Ethereum
|
|
115
117
|
return Ethereum::Transaction.new(txid, self.connection, payload.join(), args)
|
116
118
|
end
|
117
119
|
|
118
|
-
define_method "transact_and_wait_#{
|
119
|
-
function_name = "transact_#{
|
120
|
+
define_method "transact_and_wait_#{derived_function_name}".to_sym do |*args|
|
121
|
+
function_name = "transact_#{derived_function_name}".to_sym
|
120
122
|
tx = self.send(function_name, *args)
|
121
123
|
tx.wait_for_miner
|
122
124
|
return tx
|
data/lib/ethereum/function.rb
CHANGED
data/lib/ethereum/version.rb
CHANGED