ethereum 0.3.51 → 0.3.60

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: 0df371ccbd446a91c3611ad41457a748a09decf6
4
- data.tar.gz: 15c535ac0052c1ec2ba9117821ea27088726e3e4
3
+ metadata.gz: b0cf154121a5ae6d12378544b2dad1217f2e24bc
4
+ data.tar.gz: 743c549360845c8b40d0474638527b90d17a7a53
5
5
  SHA512:
6
- metadata.gz: 64b556b00a089a4275a306793459b689ca674750e25612184082652e3ee76c76321eb9127da55098608784b35c872a6b979e1bf2631b09efeb3f91472f58b77f
7
- data.tar.gz: 24330886788203c870c9bc16b5b32c2066b3145e80921676a1374c5c232ec56079e899064853da567aa062b69f946631c2bb9e887319507a983e01aa368ad89c
6
+ metadata.gz: 2f3f04caee524040a9a7446681dfc6dc28d255f98f182a8dd0e911f52693430a336f6147cffa573957ec4389c334b461f857de3db3025477024b897083f8ef92
7
+ data.tar.gz: 927aaf371ff6606ccb33996d4fa5f9c48912aa09fe74ae7d6d27aaa3c8b5767d8cc80e0a1a01736ed1c02df345ea3bb3adbbcea689aaa098d75bfe136ced141b
data/README.md CHANGED
@@ -106,11 +106,12 @@ simple_name_registry_instance.at("0x734533083b5fc0cd14b7cb8c8eb6ed0c9bd184d3")
106
106
  ## Roadmap
107
107
 
108
108
  * Add JSON RPC Client support
109
+ * Add Windows IPC Client (named pipes)
109
110
  * Add support for creating and sending of raw transactions
110
111
  * Offline account creation
111
- * Add Windows IPC Client (named pipes)
112
112
  * Solidity constant function output should be properly formatted according to the ouput data type
113
- * Unit testing and contract testing examples
113
+ * Unit testing and contract testing examples. Use [web3.js](https://github.com/ethereum/web3.js) tests as a baseline.
114
+ * ContractTransaction class
114
115
  * Add more examples
115
116
  * API documentation
116
117
 
@@ -71,41 +71,44 @@ module Ethereum
71
71
  end
72
72
 
73
73
  functions.each do |fun|
74
- if fun.constant
75
- define_method "call_#{fun.name.underscore}".to_sym do |*args|
76
- formatter = Ethereum::Formatter.new
77
- arg_types = fun.inputs.collect(&:type)
78
- #out_types = fun.outputs.collect(&:type)
79
- connection = self.connection
80
- return {result: :error, message: "missing parameters for #{fun.function_string}" } if arg_types.length != args.length
81
- payload = []
82
- payload << fun.signature
83
- arg_types.zip(args).each do |arg|
84
- payload << formatter.to_payload(arg)
85
- end
86
- return {result: connection.call({to: self.address, from: self.sender, data: payload.join()})["result"].gsub(/^0x/,'').scan(/.{64}/)}
87
- end
88
- else
89
- define_method "transact_#{fun.name.underscore}".to_sym do |*args|
90
- formatter = Ethereum::Formatter.new
91
- arg_types = fun.inputs.collect(&:type)
92
- connection = self.connection
93
- return {result: :error, message: "missing parameters for #{fun.function_string}" } if arg_types.length != args.length
94
- payload = []
95
- payload << fun.signature
96
- arg_types.zip(args).each do |arg|
97
- payload << formatter.to_payload(arg)
98
- end
99
- txid = connection.send_transaction({to: self.address, from: self.sender, data: payload.join(), gas: self.gas, gasPrice: self.gas_price})["result"]
100
- return Ethereum::Transaction.new(txid, self.connection)
74
+
75
+ define_method "call_#{fun.name.underscore}".to_sym do |*args|
76
+ formatter = Ethereum::Formatter.new
77
+ arg_types = fun.inputs.collect(&:type)
78
+ #out_types = fun.outputs.collect(&:type)
79
+ connection = self.connection
80
+ return {result: :error, message: "missing parameters for #{fun.function_string}" } if arg_types.length != args.length
81
+ payload = []
82
+ payload << fun.signature
83
+ arg_types.zip(args).each do |arg|
84
+ payload << formatter.to_payload(arg)
101
85
  end
102
- define_method "transact_and_wait_#{fun.name.underscore}".to_sym do |*args|
103
- function_name = "transact_#{fun.name.underscore}".to_sym
104
- tx = self.send(function_name, *args)
105
- tx.wait_for_miner
106
- return tx
86
+ raw_result = connection.call({to: self.address, from: self.sender, data: payload.join()})["result"]
87
+ formatted_result = raw_result.gsub(/^0x/,'').scan(/.{64}/)
88
+ return {data: payload.join(), raw: raw_result, formatted: formatted_result}
89
+ end
90
+
91
+ define_method "transact_#{fun.name.underscore}".to_sym do |*args|
92
+ formatter = Ethereum::Formatter.new
93
+ arg_types = fun.inputs.collect(&:type)
94
+ connection = self.connection
95
+ return {result: :error, message: "missing parameters for #{fun.function_string}" } if arg_types.length != args.length
96
+ payload = []
97
+ payload << fun.signature
98
+ arg_types.zip(args).each do |arg|
99
+ payload << formatter.to_payload(arg)
107
100
  end
101
+ txid = connection.send_transaction({to: self.address, from: self.sender, data: payload.join(), gas: self.gas, gasPrice: self.gas_price})["result"]
102
+ return Ethereum::Transaction.new(txid, self.connection, payload.join(), args)
108
103
  end
104
+
105
+ define_method "transact_and_wait_#{fun.name.underscore}".to_sym do |*args|
106
+ function_name = "transact_#{fun.name.underscore}".to_sym
107
+ tx = self.send(function_name, *args)
108
+ tx.wait_for_miner
109
+ return tx
110
+ end
111
+
109
112
  end
110
113
  end
111
114
  Object.const_set(class_name, class_methods)
@@ -54,11 +54,11 @@ module Ethereum
54
54
  end
55
55
 
56
56
  def uint_to_payload(uint)
57
- self.to_twos_complement(uint)
57
+ self.to_twos_complement(uint).rjust(64, '0')
58
58
  end
59
59
 
60
60
  def int_to_payload(int)
61
- self.to_twos_complement(uint)
61
+ self.to_twos_complement(uint).rjust(64, '0')
62
62
  end
63
63
 
64
64
  def bytes_to_payload(bytes)
@@ -1,12 +1,14 @@
1
1
  module Ethereum
2
2
 
3
3
  class Transaction
4
- attr_accessor :id, :mined, :connection
4
+ attr_accessor :id, :mined, :connection, :input, :input_parameters
5
5
 
6
- def initialize(id, connection)
6
+ def initialize(id, connection, data, input_parameters = [])
7
7
  @mined = false
8
8
  @connection = connection
9
9
  @id = id
10
+ @input = data
11
+ @input_parameters = input_parameters
10
12
  end
11
13
 
12
14
  def mined?
@@ -1,3 +1,3 @@
1
1
  module Ethereum
2
- VERSION = "0.3.51"
2
+ VERSION = "0.3.60"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ethereum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.51
4
+ version: 0.3.60
5
5
  platform: ruby
6
6
  authors:
7
7
  - DigixGlobal Pte Ltd (https://dgx.io)
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-10-09 00:00:00.000000000 Z
11
+ date: 2015-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler