ethereum-tx 0.2.1 → 0.2.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b2761e4b52932a26abc89be0e206d48718a01c27
4
- data.tar.gz: b6c598d84e32d5737463810ea85de85ae42799b8
3
+ metadata.gz: 7eff205b89b2dd3f4df69edeb1de683d078d1768
4
+ data.tar.gz: 0c2cb86325ab0e908cd1e91d6efd29c95ce1618c
5
5
  SHA512:
6
- metadata.gz: 0d5a3a42bdc730965597b6b772d766c6afc5e5112a57a1d7ec2533dfdf4fa938c578ac92c2f540a9f4039601e42277b4150dc167cdcf8385af68481d1444464f
7
- data.tar.gz: 18fda80dfc1e6b26b593127a2e9ee39b2227d587d32aa1f3f33e7d2b5ad7c68c2108a439aba648fa4176123fc03c49f442b274e3094a6590353c374fc3dbcb65
6
+ metadata.gz: b690b0f72f26621e368b33b79ca76bcc9c70a56642d56d783f0d057f8c835dd188b3179c5e0d71fbc471d7547fa57acb780ffd55ef7bb8416c3f5c387d16b112
7
+ data.tar.gz: 07a07199a54f69a8aae1b5ce3abb1e3f2e3c111a024bddf4b4d941e9b6064bb6c74849b83b01be62e16a39e87ad6ed72e4893b9a821c8ef8478ddbe5da361fe8
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require "bundler/setup"
4
- require "ethereum"
4
+ require "ethereum-tx"
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'ethereum/tx'
4
+ require 'ethereum-tx'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "ethereum-tx"
@@ -9,9 +9,9 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Steve Ellis"]
10
10
  spec.email = ["email@steveell.is"]
11
11
 
12
- spec.summary = %q{Simple API to sign Ethereum transactions.}
13
- spec.description = %q{Library to build, parse, and sign Ethereum transactions.}
14
- spec.homepage = "https://github.com/se3000/ethereum-tx"
12
+ spec.summary = %q{Deprecated: see 'eth' gem instead}
13
+ spec.description = %q{Deprecated: see https://github.com/se3000/ruby-eth instead}
14
+ spec.homepage = "https://github.com/se3000/ruby-eth"
15
15
  spec.license = "MIT"
16
16
 
17
17
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.require_paths = ["lib"]
21
21
 
22
22
  spec.add_dependency "digest-sha3", "~> 1.1"
23
+ spec.add_dependency "ethereum-base", "0.1.2"
23
24
  spec.add_dependency "ffi", "~> 1.0"
24
25
  spec.add_dependency "money-tree", "~> 0.9"
25
26
  spec.add_dependency "rlp", "~> 0.7"
@@ -1,10 +1,29 @@
1
- #lifted from https://github.com/janx/ruby-ethereum
2
- #TODO: try to extract gem for common behavior
3
- require_relative '../ethereum'
1
+ require 'digest/sha3'
2
+ require 'ethereum/base'
3
+ require 'ffi'
4
+ require 'money-tree'
5
+ require 'rlp'
4
6
 
5
7
  module Ethereum
6
8
  class Tx
7
9
 
10
+ VERSION = "0.2.9"
11
+
12
+ BYTE_ZERO = "\x00".freeze
13
+ GTXCOST = 21000 # TX BASE GAS COST
14
+ GTXDATANONZERO = 68 # TX DATA NON ZERO BYTE GAS COST
15
+ GTXDATAZERO = 4 # TX DATA ZERO BYTE GAS COST
16
+ SECP256K1_N = 115792089237316195423570985008687907852837564279074904382605163141518161494337
17
+ UINT_MAX = 2**256 - 1
18
+
19
+ autoload :Key, 'ethereum-tx/key'
20
+ autoload :OpenSsl, 'ethereum-tx/open_ssl'
21
+ autoload :Sedes, 'ethereum-tx/sedes'
22
+ autoload :Utils, 'ethereum-tx/utils'
23
+
24
+ class ValidationError < StandardError; end
25
+ class InvalidTransaction < ValidationError; end
26
+
8
27
  include RLP::Sedes::Serializable
9
28
  extend Sedes
10
29
 
@@ -44,6 +63,10 @@ module Ethereum
44
63
  RLP.encode self
45
64
  end
46
65
 
66
+ def hex
67
+ bin_to_hex encoded
68
+ end
69
+
47
70
  def sign(key)
48
71
  self.signature = key.sign(unsigned_encoded)
49
72
  self.vrs = Utils.v_r_s_for signature
@@ -1,4 +1,4 @@
1
- module Ethereum
1
+ class Ethereum::Tx
2
2
  class Key
3
3
 
4
4
  attr_reader :private_key, :public_key
@@ -2,7 +2,7 @@
2
2
  # thanks to everyone there for figuring this out
3
3
  # TODO: Pull shared code out into a separate library
4
4
 
5
- module Ethereum
5
+ class Ethereum::Tx
6
6
  class OpenSsl
7
7
  extend FFI::Library
8
8
 
@@ -1,4 +1,4 @@
1
- module Ethereum
1
+ class Ethereum::Tx
2
2
  module Sedes
3
3
  include RLP::Sedes
4
4
 
@@ -1,4 +1,5 @@
1
- module Ethereum
1
+ class Ethereum::Tx
2
+
2
3
  module Utils
3
4
 
4
5
  extend self
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ethereum-tx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Ellis
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-27 00:00:00.000000000 Z
11
+ date: 2016-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: digest-sha3
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: ethereum-base
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 0.1.2
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 0.1.2
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: ffi
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -122,7 +136,7 @@ dependencies:
122
136
  - - "~>"
123
137
  - !ruby/object:Gem::Version
124
138
  version: '3.0'
125
- description: Library to build, parse, and sign Ethereum transactions.
139
+ description: 'Deprecated: see https://github.com/se3000/ruby-eth instead'
126
140
  email:
127
141
  - email@steveell.is
128
142
  executables: []
@@ -139,13 +153,12 @@ files:
139
153
  - bin/console
140
154
  - bin/setup
141
155
  - ethereum-tx.gemspec
142
- - lib/ethereum.rb
143
- - lib/ethereum/key.rb
144
- - lib/ethereum/open_ssl.rb
145
- - lib/ethereum/sedes.rb
146
- - lib/ethereum/tx.rb
147
- - lib/ethereum/utils.rb
148
- homepage: https://github.com/se3000/ethereum-tx
156
+ - lib/ethereum-tx.rb
157
+ - lib/ethereum-tx/key.rb
158
+ - lib/ethereum-tx/open_ssl.rb
159
+ - lib/ethereum-tx/sedes.rb
160
+ - lib/ethereum-tx/utils.rb
161
+ homepage: https://github.com/se3000/ruby-eth
149
162
  licenses:
150
163
  - MIT
151
164
  metadata: {}
@@ -168,6 +181,6 @@ rubyforge_project:
168
181
  rubygems_version: 2.5.1
169
182
  signing_key:
170
183
  specification_version: 4
171
- summary: Simple API to sign Ethereum transactions.
184
+ summary: 'Deprecated: see ''eth'' gem instead'
172
185
  test_files: []
173
186
  has_rdoc:
@@ -1,28 +0,0 @@
1
- require 'digest/sha3'
2
- require 'ffi'
3
- require 'money-tree'
4
- require 'rlp'
5
-
6
- module Ethereum
7
-
8
- BYTE_ZERO = "\x00".freeze
9
- GTXCOST = 21000 # TX BASE GAS COST
10
- GTXDATANONZERO = 68 # TX DATA NON ZERO BYTE GAS COST
11
- GTXDATAZERO = 4 # TX DATA ZERO BYTE GAS COST
12
- SECP256K1_N = 115792089237316195423570985008687907852837564279074904382605163141518161494337
13
- UINT_MAX = 2**256 - 1
14
-
15
- autoload :Key, 'ethereum/key'
16
- autoload :OpenSsl, 'ethereum/open_ssl'
17
- autoload :Sedes, 'ethereum/sedes'
18
- autoload :Tx, 'ethereum/tx'
19
- autoload :Utils, 'ethereum/utils'
20
-
21
- class ValidationError < StandardError; end
22
- class InvalidTransaction < ValidationError; end
23
-
24
- class Tx
25
- VERSION = '0.2.1'
26
- end
27
-
28
- end