etherlite 0.5.2 → 0.5.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
2
  SHA256:
3
- metadata.gz: 6bd7c04f60e0b06abbc63f817737ef0deea013791b885151d41f1789d57092a5
4
- data.tar.gz: dbd6bf87f3e54a7e7c855e6e6bcf14226f5b708c5d8789c7b80b52e931f0dffc
3
+ metadata.gz: 3e0dfced593354434b36a9de586f7b19828b9f5e7eb30764efd9623b91a3496e
4
+ data.tar.gz: 68fbf0acbe771dc1c86d94a969f8222b05697c0b954c41ffb78e4017ffa22180
5
5
  SHA512:
6
- metadata.gz: 2afa891466239576519823c40b146196ecd64f1ec9ff2afb20bac2b3b5010f2d4fe79dbc2811c83e461d3005b917dc405163f2e06556126f9af3644aea22a50f
7
- data.tar.gz: cd7ce4b0800fe121a0ba5b9ed0e7c86de252101f3186d9504c4f69df0d0dde6300ba885762feb4f76f41ccd2981e1dacc75f1234ae01876324be8ffb6527d492
6
+ metadata.gz: 69bdfe008c0d08c9cabcda8f651401715441eba7b97de61fc55e9b99459ac428b17b465eacdfd96698ca5cd361d7133a0c17b70e964684ae9d0cb279d5ccc861
7
+ data.tar.gz: dc82638a7c9a62c28bb507e0e213fe3afcf5836f2a11b8b717b6caac1b06c87bc9073373fbb0e88d0fab43557de4bf8d4be9be1ea04c9a2c0ecbc62cb4d00c3f
@@ -0,0 +1,25 @@
1
+ name: Publish to rubygems
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - v*
7
+ jobs:
8
+ build:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v3
12
+ - uses: ruby/setup-ruby@v1
13
+ with:
14
+ ruby-version: 3.0.0
15
+ - run: bundle install
16
+ - name: publish gem
17
+ run: |
18
+ mkdir -p $HOME/.gem
19
+ touch $HOME/.gem/credentials
20
+ chmod 0600 $HOME/.gem/credentials
21
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
22
+ gem build *.gemspec
23
+ gem push *.gem
24
+ env:
25
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_API_KEY}}"
data/etherlite.gemspec CHANGED
@@ -1,5 +1,4 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path('lib', __dir__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require 'etherlite/version'
5
4
 
@@ -7,28 +6,30 @@ Gem::Specification.new do |spec|
7
6
  spec.name = "etherlite"
8
7
  spec.version = Etherlite::VERSION
9
8
  spec.authors = ["Ignacio Baixas"]
10
- spec.email = ["ignacio@surbtc.com"]
9
+ spec.email = ["ignacio@budacom.com"]
11
10
 
12
- spec.summary = %q{Ethereum integration for ruby on rails}
13
- spec.description = %q{}
14
- spec.homepage = "https://github.com/SurBTC/etherlite"
11
+ spec.summary = 'Ethereum integration for ruby on rails'
12
+ spec.description = ''
13
+ spec.homepage = "https://github.com/budacom/etherlite"
15
14
  spec.license = "MIT"
16
15
 
17
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
16
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
+ f.match(%r{^(test|spec|features)/})
18
+ end
18
19
  spec.bindir = "exe"
19
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
21
  spec.require_paths = ["lib"]
21
22
 
22
- spec.add_dependency "digest-sha3", "~> 1.1"
23
- spec.add_dependency "power-types", "~> 0.1"
24
- spec.add_dependency "eth", "~> 0.4.4"
25
23
  spec.add_dependency "activesupport"
24
+ spec.add_dependency "eth", "~> 0.4.4"
25
+ spec.add_dependency 'keccak', '~> 1.3', '>= 1.3.1'
26
+ spec.add_dependency "power-types", "~> 0.1"
26
27
 
27
- spec.add_development_dependency "bundler", "~> 2.1.4"
28
- spec.add_development_dependency "rake", "~> 10.0"
29
- spec.add_development_dependency "rspec", "~> 3.0"
28
+ spec.add_development_dependency "bundler", "~> 2.1"
30
29
  spec.add_development_dependency "guard", "~> 2.14"
31
30
  spec.add_development_dependency "guard-rspec", "~> 4.7"
32
- spec.add_development_dependency "webmock", "~> 3.7.5"
33
31
  spec.add_development_dependency "pry"
32
+ spec.add_development_dependency "rake", "~> 10.0"
33
+ spec.add_development_dependency "rspec", "~> 3.0"
34
+ spec.add_development_dependency "webmock", "~> 3.7.5"
34
35
  end
@@ -5,7 +5,7 @@ module Etherlite
5
5
  extend self
6
6
 
7
7
  def sha3(_data)
8
- Digest::SHA3.hexdigest(_data, 256)
8
+ Digest::Keccak.hexdigest(_data, 256)
9
9
  end
10
10
 
11
11
  def uint_to_hex(_value, bytes: 32)
@@ -13,7 +13,7 @@ module Etherlite
13
13
  end
14
14
 
15
15
  def int_to_hex(_value, bytes: 32)
16
- if _value < 0
16
+ if _value.negative?
17
17
  # 2's complement for negative values
18
18
  (_value & ((1 << bytes * 8) - 1)).to_s(16)
19
19
  else
@@ -28,7 +28,7 @@ module Etherlite
28
28
  def hex_to_int(_hex_value, bytes: 32)
29
29
  value = _hex_value.hex
30
30
  top_bit = (1 << (bytes * 8 - 1))
31
- value & top_bit > 0 ? (value - 2 * top_bit) : value
31
+ (value & top_bit).positive? ? (value - 2 * top_bit) : value
32
32
  end
33
33
 
34
34
  def valid_address?(_address)
@@ -45,21 +45,23 @@ module Etherlite
45
45
  else
46
46
  _value = _value.to_s
47
47
  raise ArgumentError, 'invalid address' unless valid_address? _value
48
+
48
49
  normalize_address _value
49
50
  end
50
51
  end
51
52
 
52
53
  def encode_address_param(_value)
53
- '0x' + normalize_address_param(_value)
54
+ "0x#{normalize_address_param(_value)}"
54
55
  end
55
56
 
56
57
  def encode_block_param(_value)
57
58
  return _value.to_s if ['pending', 'earliest', 'latest'].include?(_value.to_s)
58
- '0x' + _value.to_s(16)
59
+
60
+ "0x#{_value.to_s(16)}"
59
61
  end
60
62
 
61
63
  def encode_quantity_param(_value)
62
- '0x' + _value.to_s(16)
64
+ "0x#{_value.to_s(16)}"
63
65
  end
64
66
  end
65
67
  end
@@ -1,3 +1,3 @@
1
1
  module Etherlite
2
- VERSION = "0.5.2"
2
+ VERSION = "0.5.3"
3
3
  end
data/lib/etherlite.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "digest/sha3"
1
+ require 'digest/keccak'
2
2
  require "active_support/all"
3
3
  require "forwardable"
4
4
  require "net/http"
metadata CHANGED
@@ -1,179 +1,185 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: etherlite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ignacio Baixas
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-29 00:00:00.000000000 Z
11
+ date: 2023-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: digest-sha3
14
+ name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.1'
19
+ version: '0'
20
20
  type: :runtime
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.1'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: power-types
28
+ name: eth
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.1'
33
+ version: 0.4.4
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.1'
40
+ version: 0.4.4
41
41
  - !ruby/object:Gem::Dependency
42
- name: eth
42
+ name: keccak
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.4.4
47
+ version: '1.3'
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 1.3.1
48
51
  type: :runtime
49
52
  prerelease: false
50
53
  version_requirements: !ruby/object:Gem::Requirement
51
54
  requirements:
52
55
  - - "~>"
53
56
  - !ruby/object:Gem::Version
54
- version: 0.4.4
57
+ version: '1.3'
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 1.3.1
55
61
  - !ruby/object:Gem::Dependency
56
- name: activesupport
62
+ name: power-types
57
63
  requirement: !ruby/object:Gem::Requirement
58
64
  requirements:
59
- - - ">="
65
+ - - "~>"
60
66
  - !ruby/object:Gem::Version
61
- version: '0'
67
+ version: '0.1'
62
68
  type: :runtime
63
69
  prerelease: false
64
70
  version_requirements: !ruby/object:Gem::Requirement
65
71
  requirements:
66
- - - ">="
72
+ - - "~>"
67
73
  - !ruby/object:Gem::Version
68
- version: '0'
74
+ version: '0.1'
69
75
  - !ruby/object:Gem::Dependency
70
76
  name: bundler
71
77
  requirement: !ruby/object:Gem::Requirement
72
78
  requirements:
73
79
  - - "~>"
74
80
  - !ruby/object:Gem::Version
75
- version: 2.1.4
81
+ version: '2.1'
76
82
  type: :development
77
83
  prerelease: false
78
84
  version_requirements: !ruby/object:Gem::Requirement
79
85
  requirements:
80
86
  - - "~>"
81
87
  - !ruby/object:Gem::Version
82
- version: 2.1.4
88
+ version: '2.1'
83
89
  - !ruby/object:Gem::Dependency
84
- name: rake
90
+ name: guard
85
91
  requirement: !ruby/object:Gem::Requirement
86
92
  requirements:
87
93
  - - "~>"
88
94
  - !ruby/object:Gem::Version
89
- version: '10.0'
95
+ version: '2.14'
90
96
  type: :development
91
97
  prerelease: false
92
98
  version_requirements: !ruby/object:Gem::Requirement
93
99
  requirements:
94
100
  - - "~>"
95
101
  - !ruby/object:Gem::Version
96
- version: '10.0'
102
+ version: '2.14'
97
103
  - !ruby/object:Gem::Dependency
98
- name: rspec
104
+ name: guard-rspec
99
105
  requirement: !ruby/object:Gem::Requirement
100
106
  requirements:
101
107
  - - "~>"
102
108
  - !ruby/object:Gem::Version
103
- version: '3.0'
109
+ version: '4.7'
104
110
  type: :development
105
111
  prerelease: false
106
112
  version_requirements: !ruby/object:Gem::Requirement
107
113
  requirements:
108
114
  - - "~>"
109
115
  - !ruby/object:Gem::Version
110
- version: '3.0'
116
+ version: '4.7'
111
117
  - !ruby/object:Gem::Dependency
112
- name: guard
118
+ name: pry
113
119
  requirement: !ruby/object:Gem::Requirement
114
120
  requirements:
115
- - - "~>"
121
+ - - ">="
116
122
  - !ruby/object:Gem::Version
117
- version: '2.14'
123
+ version: '0'
118
124
  type: :development
119
125
  prerelease: false
120
126
  version_requirements: !ruby/object:Gem::Requirement
121
127
  requirements:
122
- - - "~>"
128
+ - - ">="
123
129
  - !ruby/object:Gem::Version
124
- version: '2.14'
130
+ version: '0'
125
131
  - !ruby/object:Gem::Dependency
126
- name: guard-rspec
132
+ name: rake
127
133
  requirement: !ruby/object:Gem::Requirement
128
134
  requirements:
129
135
  - - "~>"
130
136
  - !ruby/object:Gem::Version
131
- version: '4.7'
137
+ version: '10.0'
132
138
  type: :development
133
139
  prerelease: false
134
140
  version_requirements: !ruby/object:Gem::Requirement
135
141
  requirements:
136
142
  - - "~>"
137
143
  - !ruby/object:Gem::Version
138
- version: '4.7'
144
+ version: '10.0'
139
145
  - !ruby/object:Gem::Dependency
140
- name: webmock
146
+ name: rspec
141
147
  requirement: !ruby/object:Gem::Requirement
142
148
  requirements:
143
149
  - - "~>"
144
150
  - !ruby/object:Gem::Version
145
- version: 3.7.5
151
+ version: '3.0'
146
152
  type: :development
147
153
  prerelease: false
148
154
  version_requirements: !ruby/object:Gem::Requirement
149
155
  requirements:
150
156
  - - "~>"
151
157
  - !ruby/object:Gem::Version
152
- version: 3.7.5
158
+ version: '3.0'
153
159
  - !ruby/object:Gem::Dependency
154
- name: pry
160
+ name: webmock
155
161
  requirement: !ruby/object:Gem::Requirement
156
162
  requirements:
157
- - - ">="
163
+ - - "~>"
158
164
  - !ruby/object:Gem::Version
159
- version: '0'
165
+ version: 3.7.5
160
166
  type: :development
161
167
  prerelease: false
162
168
  version_requirements: !ruby/object:Gem::Requirement
163
169
  requirements:
164
- - - ">="
170
+ - - "~>"
165
171
  - !ruby/object:Gem::Version
166
- version: '0'
172
+ version: 3.7.5
167
173
  description: ''
168
174
  email:
169
- - ignacio@surbtc.com
175
+ - ignacio@budacom.com
170
176
  executables: []
171
177
  extensions: []
172
178
  extra_rdoc_files: []
173
179
  files:
180
+ - ".github/workflows/publisher.yaml"
174
181
  - ".gitignore"
175
182
  - ".rspec"
176
- - ".travis.yml"
177
183
  - CODE_OF_CONDUCT.md
178
184
  - Gemfile
179
185
  - Guardfile
@@ -229,7 +235,7 @@ files:
229
235
  - lib/etherlite/version.rb
230
236
  - lib/generators/etherlite/init_generator.rb
231
237
  - lib/generators/etherlite/templates/etherlite.yml
232
- homepage: https://github.com/SurBTC/etherlite
238
+ homepage: https://github.com/budacom/etherlite
233
239
  licenses:
234
240
  - MIT
235
241
  metadata: {}
@@ -248,7 +254,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
248
254
  - !ruby/object:Gem::Version
249
255
  version: '0'
250
256
  requirements: []
251
- rubygems_version: 3.0.3
257
+ rubygems_version: 3.2.3
252
258
  signing_key:
253
259
  specification_version: 4
254
260
  summary: Ethereum integration for ruby on rails
data/.travis.yml DELETED
@@ -1,5 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.3.1
5
- before_install: gem install bundler -v 1.12.4