ethereum.rb 2.2 → 2.3

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
- SHA1:
3
- metadata.gz: fe82a37129944871e8670fbc4dde4818fdbc5c7a
4
- data.tar.gz: 144ff632e0837e2eb72d64900aba51791250e26b
2
+ SHA256:
3
+ metadata.gz: c33919d2cb389821935ad3be1720651dc881e1eee3cc6f1d14a032fda3a67537
4
+ data.tar.gz: 77732ab3a7e55ca68cfcbdb19d9ee5d46ae034b61494381976e0dba36d6e4371
5
5
  SHA512:
6
- metadata.gz: dc154bb5b6c11573df10f15d8d05e3d08b4094970b9be4f36053e29d2c267357dc51c75c51db45656ab1435a1e3428a26855d1cdfc2537d4d049ca43ac8572ea
7
- data.tar.gz: 0b0d6d9b5e79220ca4ecec3f93cb9cca1b91b63eaae5aa51e2aeaba2c2e8be4bd9dc1696b7b4872f05ed228fe097e068f78e9a62c73820aaa7a6fc4b7a5877d4
6
+ metadata.gz: b0ea22590997e63558511be9763c4dfc6d49b11b8b0fe1188b68617f433bf084d921ffb82c636519c5fde7d150b3ace3b92e398d2d25b23c71fac8aad9a1551c
7
+ data.tar.gz: 49fc134565158beaec9f97e5e124e70ecb1b7171aa35026d2833d8920c473ad2f0ded9e81427ceaa4a1214eaf8e9513bcae2b61eaf9b4c9191d01e4d86099b8a
@@ -1,22 +1,22 @@
1
- dist: trusty
1
+ dist: xenial
2
2
  language: ruby
3
3
  rvm:
4
- - 2.3.6
5
4
  - 2.4.3
6
5
  - 2.5.0
7
6
  env:
8
- - PARITY="1.6.10"
7
+ - PARITY="2.5.12"
9
8
  cache:
10
9
  bundler: true
11
10
  directories:
12
11
  - ~/.parity
13
12
  before_install:
14
13
  - sudo bin/install_parity
15
- - gem install bundler -v 1.11.2
14
+ - gem update --system
15
+ - gem install bundler
16
16
  before_script:
17
- - parity --warp --chain dev --password ~/.devpass --unlock 00a329c0648769a73afac7f9381e08fb43dbea72 --author 00a329c0648769a73afac7f9381e08fb43dbea72 daemon ~/.parity.pid --log-file ~/.parity.log
17
+ - ./parity --warp --chain dev --password ~/.devpass --unlock 00a329c0648769a73afac7f9381e08fb43dbea72 --author 00a329c0648769a73afac7f9381e08fb43dbea72 daemon ~/.parity.pid --log-file ~/.parity.log
18
18
  - sleep 5
19
- - parity --chain dev account list
19
+ - ./parity --chain dev account list
20
20
  - cat ~/.parity.log
21
21
  script:
22
22
  - bundle exec rspec --tag ~blockchain && bundle exec rspec --tag blockchain
@@ -25,3 +25,6 @@ before_cache:
25
25
  - sleep 3
26
26
  after_script:
27
27
  - cat /tmp/ethereum_ruby_http.log
28
+ notifications:
29
+ slack:
30
+ secure: is1TFfNJTX4VsDTu3zC5vIZ+Cowj0fQDFyqHPYxvuX60NHh8WBrjZ1qwnehTlLtC6d58EByxr+KVChCxrRdZ6IenpdXq+2Oz4IRS5I8tkvFbc8o30weBd7Umw3MzwTdSdoV0jQsyy395jYr3cxzJCBt+7tJRA93V8tN6yiHe8w7ImY3R20HKtLuE3ZWh3gjrAVx3u9fEolNBIuQvWl1jMl23ptizoHuesMCYgeehdtPxxOq/smKWN6Ds30hDG16lfEtSm8jxNjepMYZ/zGcHB/DCCRBgo5wHMmLzjCHL5mzf5YDr47gAtywXT7zpdMGbMep8H/QRR9kkCmp5o1FUzHx1CjFHIHCngwawBz6oy3/3jDIuLa3Z+SYHxbDHYZ3Xb8UKDrHl7IKF2dQ5fQRoxpaQ4mMAHbIQDyWp9kRwLljAX6cBDDjGF6/+TCn/BUE+KQZupBG79KymoFZlH7TYyKofHvcp7dcfSFyF8XKsHUglDSmISERbt/KN9zP2876o1ZDt+4HOzGM0lW6Z0nibhTdLHmzrA2fdxGpsJY7Eh6j9h7imgXP7rfCcXb3c4ib+XU1B2S1clmdyj/+03V+wLhvUqse5pBbQqTogr92gziLGKhDGBk4zz0q1a4D4y0qe79AA79R14VbdYC23+nehvpSW8gANfN4IcuX9srBCJjY=
@@ -2,8 +2,8 @@
2
2
 
3
3
  ## Compatibility and requirements
4
4
 
5
- * Tested with parity 1.5, might work with geth and older parity, but was not tested.
6
- * Tested with solc 0.4.9
5
+ * Tested with parity 2.5, might work with geth and older parity, but was not tested.
6
+ * Tested with solc 0.4.16
7
7
  * Ruby 2.x
8
8
  * UNIX/Linux or OS X environment
9
9
 
@@ -14,7 +14,7 @@
14
14
  Currently the only node supported by ethereum.rb is [parity](https://ethcore.io/parity.html). To install parity on mac simply:
15
15
 
16
16
  $ brew tap ethcore/ethcore
17
- $ brew install parity --beta
17
+ $ brew install parity
18
18
 
19
19
  To install parity on linux download latest package from [parity github](https://github.com/paritytech/parity/releases) and install on your computer.
20
20
 
@@ -60,7 +60,7 @@ There is a rake task to run node on testnet network, that you can run from your
60
60
 
61
61
  $ rake ethereum:node:test
62
62
 
63
- It will run parity node, unlock the first account on the account list, but you need to supply it with password.
63
+ It will run parity node, unlock the first account on the account list, but you need to supply it with password.
64
64
  To do that adding create file containing password accessable from your parity folder, which should be one of the following:
65
65
  * `/Users/You/AppData/Roaming/Parity/Ethereum` on Windows
66
66
  * `/Users/you/Library/Application Support/io.parity.ethereum` on MacOS
@@ -69,4 +69,7 @@ To do that adding create file containing password accessable from your parity fo
69
69
 
70
70
  Warnning: Running a parity node with unlock wallet is a considerable security risk and should be avoided on production servers. Especially avoid running node with unlocked wallet and enabled json rpc server in http mode.
71
71
 
72
- To send transaction on a testnet blockchain you will need test ether, you can get it [here](http://faucet.ropsten.be:3001/).
72
+ To send transaction on a testnet blockchain you will need test ether, you can get it at the following site.
73
+
74
+ * [Goerli Testnet Faucet](https://goerli-faucet.slock.it/)
75
+ * [Goerli: Authenticated Faucet](https://faucet.goerli.mudit.blog/)
data/README.md CHANGED
@@ -4,6 +4,10 @@
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.
10
+
7
11
  ## Highlights
8
12
 
9
13
  * Simple syntax, programmer friendly
@@ -101,13 +105,13 @@ contract = Ethereum::Contract.create(name: "MyContract", abi: abi, code: "...")
101
105
  If you use Truffle to build and deploy contracts, you can pick up the Truffle artifacts to initialize
102
106
  a contract. For example, if you have a MyContract in the Truffle directory at `/my/truffle/project`:
103
107
 
104
- ```
108
+ ```ruby
105
109
  contract = Ethereum::Contract.create(name: "MyContract", truffle: { paths: [ '/my/truffle/project' ] }, client: client, address: '0x01a4d1A62F01ED966646acBfA8BB0b59960D06dd')
106
110
  ```
107
111
 
108
112
  The contract factory will attempt to load the deployed address from the Truffle artifacts if the client's network is present:
109
113
 
110
- ```
114
+ ```ruby
111
115
  contract = Ethereum::Contract.create(name: "MyContract", truffle: { paths: [ '/my/truffle/project' ] }, client: client)
112
116
  ```
113
117
 
@@ -115,7 +119,7 @@ contract = Ethereum::Contract.create(name: "MyContract", truffle: { paths: [ '/m
115
119
 
116
120
  Functions defined in a contract are exposed using the following conventions:
117
121
 
118
- ```
122
+ ```ruby
119
123
  contract.transact.[function_name](params)
120
124
  contract.transact_and_wait.[function_name](params)
121
125
  contract.call.[function_name](params)
@@ -333,7 +337,9 @@ Then, run `rake spec` to run the tests.
333
337
 
334
338
  Test that do send transactions to blockchain are marked with `blockchain` tag. Good practice is to run first fast tests that use no ether and only if they pass, run slow tests that do spend ether. To do that use the following line:
335
339
 
336
- $ bundle exec rspec --tag ~blockchain && bundle exec rspec --tag blockchain
340
+ ```bash
341
+ $ bundle exec rspec --tag ~blockchain && bundle exec rspec --tag blockchain
342
+ ```
337
343
 
338
344
  You need ethereum node up and running for tests to pass and it needs to be working on testnet (Ropsten).
339
345
 
@@ -3,12 +3,17 @@
3
3
  echo "Installing parity..."
4
4
  sudo add-apt-repository ppa:ethereum/ethereum -y
5
5
  sudo apt-get update
6
- sudo apt-get install solc
6
+ sudo apt-get -y install dpkg
7
7
  sudo apt-get -y install libssl-dev
8
+ curl -o /usr/bin/solc -fL https://github.com/ethereum/solidity/releases/download/v0.4.16/solc-static-linux \
9
+ && chmod 775 /usr/bin/solc \
10
+ && chown travis:travis /usr/bin/solc
8
11
  echo "Solc version"
9
12
  solc --version
10
- wget http://d1h4xl4cr1h0mo.cloudfront.net/v$PARITY\/x86_64-unknown-linux-gnu/parity_$PARITY\_amd64.deb
11
- sudo dpkg -i parity_$PARITY\_amd64.deb
13
+
14
+ wget https://releases.parity.io/ethereum/v$PARITY\/x86_64-unknown-linux-gnu/parity
15
+ chmod u+x parity
16
+ chown travis:travis parity
12
17
 
13
18
  echo "Setuping parity..."
14
19
  mkdir -p ~/.local/share/io.parity.ethereum/keys/DevelopmentChain
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
26
  spec.require_paths = ["lib", "bin"]
27
27
 
28
- spec.add_development_dependency "bundler", "~> 1.13"
28
+ spec.add_development_dependency "bundler", "~> 2.0"
29
29
  spec.add_development_dependency "rake", "~> 12.0"
30
30
  spec.add_development_dependency "rspec", "~> 3.5"
31
31
  spec.add_development_dependency "pry", "~> 0.10"
@@ -263,8 +263,8 @@ module Ethereum
263
263
  parent
264
264
  end
265
265
  end
266
- Object.send(:remove_const, class_name) if Object.const_defined?(class_name)
267
- Object.const_set(class_name, class_methods)
266
+ Ethereum::Contract.send(:remove_const, class_name) if Ethereum::Contract.const_defined?(class_name, false)
267
+ Ethereum::Contract.const_set(class_name, class_methods)
268
268
  @class_object = class_methods
269
269
  end
270
270
 
@@ -301,7 +301,7 @@ module Ethereum
301
301
  subpath = File.join('build', 'contracts', "#{name}.json")
302
302
 
303
303
  found = paths.concat(truffle_paths).find { |p| File.file?(File.join(p, subpath)) }
304
- if (found)
304
+ if (found)
305
305
  JSON.parse(IO.read(File.join(found, subpath)))
306
306
  else
307
307
  nil
@@ -62,7 +62,7 @@ module Ethereum
62
62
  end
63
63
 
64
64
  def encode_dynamic_bytes(value)
65
- location = encode_uint(@inputs ? @inputs.size * 32 : 32)
65
+ location = encode_uint(@inputs ? size_of_inputs(@inputs) + @tail.size/2 : 32)
66
66
  size = encode_uint(value.size)
67
67
  content = encode_static_bytes(value)
68
68
  [location, size + content]
@@ -4,7 +4,9 @@ module Ethereum
4
4
  CHAIN_PREFIX = {
5
5
  17 => "no-explorer-for-devmode.",
6
6
  42 => "kovan.",
7
- 3 => "ropsten."
7
+ 3 => "ropsten.",
8
+ 4 => "rinkeby.",
9
+ 5 => "goerli."
8
10
  }
9
11
 
10
12
  def link_to_tx(label, txid, **opts)
@@ -36,4 +36,4 @@ class Ethereum::Singleton
36
36
  end
37
37
 
38
38
 
39
- end
39
+ end
@@ -21,7 +21,7 @@ module Ethereum
21
21
 
22
22
  def mined?
23
23
  return true if @mined
24
- @mined = @connection.eth_get_transaction_by_hash(@id)["result"]["blockNumber"].present?
24
+ @mined = @connection.eth_get_transaction_by_hash(@id).dig("result", "blockNumber").present?
25
25
  end
26
26
 
27
27
  def wait_for_miner(timeout: DEFAULT_TIMEOUT, step: DEFAULT_STEP)
@@ -1,3 +1,3 @@
1
1
  module Ethereum
2
- VERSION = "2.2"
2
+ VERSION = "2.3"
3
3
  end
@@ -3,11 +3,11 @@ require 'open3'
3
3
  namespace :ethereum do
4
4
  namespace :node do
5
5
 
6
- desc "Run testnet (ropsten) node"
6
+ desc "Run testnet (goerli) node"
7
7
  task :test do
8
- args = "--chain testnet --warp"
8
+ args = "--chain testnet"
9
9
  out, _, _ = Open3.capture3("parity #{args} account list")
10
- account = out.split(/[\[,\]]/)[1]
10
+ account = out.split(/[\[\n\]]/)[0]
11
11
  cmd = "parity #{args} --password ~/Library/Application\\ Support/io.parity.ethereum/pass --unlock #{account} --author #{account}"
12
12
  puts cmd
13
13
  system cmd
@@ -49,4 +49,4 @@ namespace :ethereum do
49
49
  end
50
50
 
51
51
  end
52
- end
52
+ end
@@ -6,7 +6,7 @@ namespace :ethereum do
6
6
  @client = Ethereum::Singleton.instance
7
7
 
8
8
  network_id = @client.net_version["result"].to_i
9
- raise "Error: Run your tests on ropsten testnet. Use rake ethereum:node:test to run node. Net id: #{network_id}" if network_id != 3
9
+ raise "Error: Run your tests on goerli testnet. Use rake ethereum:node:test to run node. Net id: #{network_id}" if network_id != 5
10
10
 
11
11
  accounts = @client.eth_accounts["result"]
12
12
  if accounts.size > 0
@@ -29,4 +29,4 @@ namespace :ethereum do
29
29
  end
30
30
 
31
31
  end
32
- end
32
+ 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.2'
4
+ version: '2.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marek Kirejczyk
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-28 00:00:00.000000000 Z
11
+ date: 2019-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.13'
19
+ version: '2.0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.13'
26
+ version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -209,8 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
209
209
  - !ruby/object:Gem::Version
210
210
  version: '0'
211
211
  requirements: []
212
- rubyforge_project:
213
- rubygems_version: 2.6.8
212
+ rubygems_version: 3.0.3
214
213
  signing_key:
215
214
  specification_version: 4
216
215
  summary: Ruby Ethereum client using the JSON-RPC interface