ethereum.rb 2.0.7 → 2.0.8

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: 49c6da26b64e4d9ca2cc696c67a455eaed8e3b48
4
- data.tar.gz: 7eb88a934534f292fd05930270f157f1c17a299c
3
+ metadata.gz: 8d44fa6975ccab8a2bdf50c15d4ee88740bd8c95
4
+ data.tar.gz: 9e49ac4b565a4dc53ab0e0230a3e5efc80ef0dd0
5
5
  SHA512:
6
- metadata.gz: 7f2bda6848455535558e18ecc9fde467fba0f685e36bc8befeec29e2bbc083cdd317aeb8ffa3d207cbb96f29004dd0061183a3f5e85544d13aa20fb359bc6b5e
7
- data.tar.gz: 9356203de304aca16fd53a60b04c83da5de78b7427d080e2e87920a8909bdd92fdfb3a9039a5ce8472b6709bcd3a38eead1d31df098fd02222e95779de00481c
6
+ metadata.gz: 5ba25561adbf97eb5f446701baa37f494fdfceb7e66e585205b1e638a0fa9b45a45b32a23f84200690311b058eb28f839e28f1256d59a0fab7060f4bbfe45171
7
+ data.tar.gz: 1fac810a2532aacbca80928b9022778b2646c637b0ba669094df6a65f7640d01c72469e2c76a432b0a37f7b4a02288030bb3ce6ba939ad04ee7c253aefc40379
@@ -3,8 +3,7 @@ language: ruby
3
3
  rvm:
4
4
  - 2.3.1
5
5
  env:
6
- - PARITY="1.5.0"
7
- - PARITY="1.5.7"
6
+ - PARITY="1.6.5"
8
7
  cache:
9
8
  bundler: true
10
9
  directories:
@@ -13,7 +12,7 @@ before_install:
13
12
  - sudo bin/install_parity
14
13
  - gem install bundler -v 1.11.2
15
14
  before_script:
16
- - parity --warp --chain testnet -d ~/.parity --password ~/.parity/pass --unlock 3089630d06fD90Ef48a0c43f000971587c1F3247 --author 3089630d06fD90Ef48a0c43f000971587c1F3247 daemon ~/.parity.pid --log-file ~/.parity.log
15
+ - parity --warp --chain ropsten -d ~/.parity --password ~/.parity/pass --unlock 3089630d06fD90Ef48a0c43f000971587c1F3247 --author 3089630d06fD90Ef48a0c43f000971587c1F3247 daemon ~/.parity.pid --log-file ~/.parity.log
17
16
  - cat ~/.parity.log
18
17
  - sleep 5
19
18
  - parity --chain testnet account list
data/README.md CHANGED
@@ -2,9 +2,7 @@
2
2
 
3
3
  [![Build Status](https://travis-ci.org/marekkirejczyk/ethereum.rb.svg?branch=master)](https://travis-ci.org/marekkirejczyk/ethereum.rb) [![security](https://hakiri.io/github/NullVoxPopuli/MetaHash/master.svg)](https://hakiri.io/github/NullVoxPopuli/MetaHash/master) [![Dependency Status](https://gemnasium.com/marekkirejczyk/ethereum.rb.svg)](https://gemnasium.com/marekkirejczyk/ethereum.rb) [![Code Climate](https://codeclimate.com/github/marekkirejczyk/ethereum.rb/badges/gpa.svg)](https://codeclimate.com/github/marekkirejczyk/ethereum.rb)
4
4
 
5
- The goal of ethereum.rb is to make interacting with ethereum blockchain from ruby as easy as possible (but not easier).
6
-
7
- Note: The Ropsten testnet network is currently being spammed. CI builds might fail beacause of that. If you have issues working with testnet, you might want to use mainnet instead. Using parity --warp mode is helpful thou.
5
+ The goal of ethereum.rb is to make interacting with ethereum blockchain from ruby as fast and easy as possible (but not easier!).
8
6
 
9
7
  ## Highlights
10
8
 
@@ -12,6 +12,7 @@ module Ethereum
12
12
  require 'ethereum/solidity'
13
13
  require 'ethereum/initializer'
14
14
  require 'ethereum/contract'
15
+ require 'ethereum/explorer_url_helper'
15
16
  require 'ethereum/function'
16
17
  require 'ethereum/function_input'
17
18
  require 'ethereum/function_output'
@@ -63,7 +63,6 @@ module Ethereum
63
63
 
64
64
  payload = {jsonrpc: "2.0", method: command, params: encode_params(args), id: get_id}
65
65
  @logger.info("Sending #{payload.to_json}") if @log
66
-
67
66
  if @batch
68
67
  @batch << payload
69
68
  return true
@@ -71,6 +70,7 @@ module Ethereum
71
70
  output = JSON.parse(send_single(payload.to_json))
72
71
  @logger.info("Received #{output.to_json}") if @log
73
72
  reset_id
73
+ raise IOError, output["error"]["message"] if output["error"]
74
74
  return output
75
75
  end
76
76
  end
@@ -50,8 +50,9 @@ module Ethereum
50
50
  end
51
51
  deploy_arguments = @encoder.encode_arguments(@constructor_inputs, params)
52
52
  payload = "0x" + @code + deploy_arguments
53
- tx = @client.eth_send_transaction({from: sender, data: payload})["result"]
54
- raise "Failed to deploy, did you unlock #{sender} account? Transaction hash: #{deploytx}" if tx.nil? || tx == "0x0000000000000000000000000000000000000000000000000000000000000000"
53
+ args = add_gas_options_args({from: sender, data: payload})
54
+ tx = @client.eth_send_transaction(args)["result"]
55
+ raise IOError, "Failed to deploy, did you unlock #{sender} account? Transaction hash: #{tx}" if tx.nil? || tx == "0x0000000000000000000000000000000000000000000000000000000000000000"
55
56
  @deployment = Ethereum::Deployment.new(tx, @client)
56
57
  end
57
58
 
@@ -93,12 +94,6 @@ module Ethereum
93
94
  end
94
95
  end
95
96
 
96
- def add_gas_options_args(args)
97
- args[:gas] = @client.int_to_hex(@gas) if @gas.present?
98
- args[:gasPrice] = @client.int_to_hex(@gas_price) if @gas_price.present?
99
- args
100
- end
101
-
102
97
  def transact(fun, *args)
103
98
  payload = fun.signature + @encoder.encode_arguments(fun.inputs, args)
104
99
  args = {to: @address, from: @sender, data: "0x" + payload}
@@ -179,6 +174,12 @@ module Ethereum
179
174
  end
180
175
 
181
176
  private
177
+ def add_gas_options_args(args)
178
+ args[:gas] = @client.int_to_hex(@gas) if @gas.present?
179
+ args[:gasPrice] = @client.int_to_hex(@gas_price) if @gas_price.present?
180
+ args
181
+ end
182
+
182
183
  def create_function_proxies
183
184
  parent = self
184
185
  call_raw_proxy, call_proxy, transact_proxy, transact_and_wait_proxy = Class.new, Class.new, Class.new, Class.new
@@ -0,0 +1,20 @@
1
+ module Ethereum
2
+ module ExplorerUrlHelper
3
+ def link_to_tx(label, txid, **opts)
4
+ link_to label, explorer_path("tx/#{txid}"), {target: "_blank"}.merge(opts)
5
+ end
6
+
7
+ def link_to_address(label, address, **opts)
8
+ link_to label, explorer_path("address/#{address}"), {target: "_blank"}.merge(opts)
9
+ end
10
+
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
17
+ "https://#{prefix}etherscan.io/#{suffix}"
18
+ end
19
+ end
20
+ end
@@ -1,3 +1,3 @@
1
1
  module Ethereum
2
- VERSION = "2.0.7"
2
+ VERSION = "2.0.8"
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.0.7
4
+ version: 2.0.8
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-03-20 00:00:00.000000000 Z
11
+ date: 2017-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -156,6 +156,7 @@ files:
156
156
  - lib/ethereum/decoder.rb
157
157
  - lib/ethereum/deployment.rb
158
158
  - lib/ethereum/encoder.rb
159
+ - lib/ethereum/explorer_url_helper.rb
159
160
  - lib/ethereum/formatter.rb
160
161
  - lib/ethereum/function.rb
161
162
  - lib/ethereum/function_input.rb