eth-patched 0.4.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.gitmodules +3 -0
- data/.rspec +4 -0
- data/.travis.yml +10 -0
- data/CHANGELOG.md +102 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +145 -0
- data/Rakefile +6 -0
- data/bin/console +10 -0
- data/bin/setup +8 -0
- data/eth.gemspec +31 -0
- data/lib/eth/address.rb +62 -0
- data/lib/eth/gas.rb +9 -0
- data/lib/eth/key/decrypter.rb +113 -0
- data/lib/eth/key/encrypter.rb +128 -0
- data/lib/eth/key.rb +79 -0
- data/lib/eth/open_ssl.rb +264 -0
- data/lib/eth/secp256k1.rb +7 -0
- data/lib/eth/sedes.rb +40 -0
- data/lib/eth/tx.rb +197 -0
- data/lib/eth/utils.rb +130 -0
- data/lib/eth/version.rb +3 -0
- data/lib/eth.rb +69 -0
- metadata +181 -0
data/lib/eth/version.rb
ADDED
data/lib/eth.rb
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'digest/sha3'
|
2
|
+
require 'ffi'
|
3
|
+
require 'money-tree'
|
4
|
+
require 'rlp'
|
5
|
+
|
6
|
+
module Eth
|
7
|
+
BYTE_ZERO = "\x00".freeze
|
8
|
+
UINT_MAX = 2**256 - 1
|
9
|
+
|
10
|
+
autoload :Address, 'eth/address'
|
11
|
+
autoload :Gas, 'eth/gas'
|
12
|
+
autoload :Key, 'eth/key'
|
13
|
+
autoload :OpenSsl, 'eth/open_ssl'
|
14
|
+
autoload :Secp256k1, 'eth/secp256k1'
|
15
|
+
autoload :Sedes, 'eth/sedes'
|
16
|
+
autoload :Tx, 'eth/tx'
|
17
|
+
autoload :Utils, 'eth/utils'
|
18
|
+
|
19
|
+
class << self
|
20
|
+
def configure
|
21
|
+
yield(configuration)
|
22
|
+
end
|
23
|
+
|
24
|
+
def replayable_chain_id
|
25
|
+
27
|
26
|
+
end
|
27
|
+
|
28
|
+
def chain_id
|
29
|
+
configuration.chain_id
|
30
|
+
end
|
31
|
+
|
32
|
+
def v_base
|
33
|
+
replayable_chain_id
|
34
|
+
end
|
35
|
+
|
36
|
+
def replayable_v?(v)
|
37
|
+
[replayable_chain_id, replayable_chain_id + 1].include? v
|
38
|
+
end
|
39
|
+
|
40
|
+
def tx_data_hex?
|
41
|
+
!!configuration.tx_data_hex
|
42
|
+
end
|
43
|
+
|
44
|
+
def chain_id_from_signature(signature)
|
45
|
+
return nil if Eth.replayable_v?(signature[:v])
|
46
|
+
|
47
|
+
cid = (signature[:v] - 35) / 2
|
48
|
+
(cid < 1) ? nil : cid
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def configuration
|
54
|
+
@configuration ||= Configuration.new
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
class Configuration
|
59
|
+
attr_accessor :chain_id, :tx_data_hex
|
60
|
+
|
61
|
+
def initialize
|
62
|
+
self.chain_id = nil
|
63
|
+
self.tx_data_hex = true
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
class ValidationError < StandardError; end
|
68
|
+
class InvalidTransaction < ValidationError; end
|
69
|
+
end
|
metadata
ADDED
@@ -0,0 +1,181 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: eth-patched
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.4.13
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Steve Ellis
|
8
|
+
- Afri Schoedon
|
9
|
+
autorequire:
|
10
|
+
bindir: exe
|
11
|
+
cert_chain: []
|
12
|
+
date: 2021-09-23 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: digest-sha3-patched-ruby-3
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.1'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '1.1'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: ffi
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '1.0'
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '1.0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: money-tree
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 0.10.0
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 0.10.0
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rlp
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 0.7.3
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 0.7.3
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: scrypt
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 3.0.6
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: 3.0.6
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: pry
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - "~>"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0.1'
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0.1'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: rake
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: 12.3.3
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: 12.3.3
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: rspec
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - "~>"
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '3.0'
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - "~>"
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '3.0'
|
126
|
+
description: Library to build, parse, and sign Ethereum transactions.
|
127
|
+
email:
|
128
|
+
- email@steveell.is
|
129
|
+
- gems@q9f.cc
|
130
|
+
executables: []
|
131
|
+
extensions: []
|
132
|
+
extra_rdoc_files: []
|
133
|
+
files:
|
134
|
+
- ".gitignore"
|
135
|
+
- ".gitmodules"
|
136
|
+
- ".rspec"
|
137
|
+
- ".travis.yml"
|
138
|
+
- CHANGELOG.md
|
139
|
+
- Gemfile
|
140
|
+
- LICENSE.txt
|
141
|
+
- README.md
|
142
|
+
- Rakefile
|
143
|
+
- bin/console
|
144
|
+
- bin/setup
|
145
|
+
- eth.gemspec
|
146
|
+
- lib/eth.rb
|
147
|
+
- lib/eth/address.rb
|
148
|
+
- lib/eth/gas.rb
|
149
|
+
- lib/eth/key.rb
|
150
|
+
- lib/eth/key/decrypter.rb
|
151
|
+
- lib/eth/key/encrypter.rb
|
152
|
+
- lib/eth/open_ssl.rb
|
153
|
+
- lib/eth/secp256k1.rb
|
154
|
+
- lib/eth/sedes.rb
|
155
|
+
- lib/eth/tx.rb
|
156
|
+
- lib/eth/utils.rb
|
157
|
+
- lib/eth/version.rb
|
158
|
+
homepage: https://github.com/q9f/ruby-eth
|
159
|
+
licenses:
|
160
|
+
- MIT
|
161
|
+
metadata: {}
|
162
|
+
post_install_message:
|
163
|
+
rdoc_options: []
|
164
|
+
require_paths:
|
165
|
+
- lib
|
166
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
167
|
+
requirements:
|
168
|
+
- - ">="
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: '0'
|
171
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
172
|
+
requirements:
|
173
|
+
- - ">="
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: '0'
|
176
|
+
requirements: []
|
177
|
+
rubygems_version: 3.2.21
|
178
|
+
signing_key:
|
179
|
+
specification_version: 4
|
180
|
+
summary: Simple API to sign Ethereum transactions.
|
181
|
+
test_files: []
|