etherlite 0.5.3 → 0.7.0
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 +4 -4
- data/.github/workflows/test_n_release.yml +64 -0
- data/.release-please-manifest.json +3 -0
- data/CHANGELOG.md +8 -0
- data/docker-compose.yaml +10 -0
- data/etherlite.gemspec +17 -17
- data/lib/etherlite/account/local.rb +1 -1
- data/lib/etherlite/account/private_key.rb +6 -15
- data/lib/etherlite/api/node.rb +0 -9
- data/lib/etherlite/connection.rb +1 -1
- data/lib/etherlite/nonce_manager.rb +1 -1
- data/lib/etherlite/version.rb +1 -1
- data/lib/etherlite.rb +1 -1
- data/release-please-config.json +14 -0
- metadata +16 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 626fba1b9958c4b2499a432d916348331eb8ec68a248c0090aa6d2209f3653ad
|
4
|
+
data.tar.gz: 26daecaf69987f8924a2d1a0de06765a653c42a55441f57764f7e777625158c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f87105259a066457ab461dd137a15b2c1de39f8be2a9b278aef1b7f1e2c8b08def5871ceb007c2232993628d91ae3122d8ef12d7bccb9b8b4d5ae126fa9c9a4
|
7
|
+
data.tar.gz: d9f8f9b3c02edfc4d6523a96496f7548b56b7f055b551f8895dc6b2b6a25ae3b2aeca39d261d1abe84490e981cb6a7c15e951df37e32e039e835129f04a06f1f
|
@@ -0,0 +1,64 @@
|
|
1
|
+
name: Test and release
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
pull_request:
|
8
|
+
branches:
|
9
|
+
- master
|
10
|
+
workflow_dispatch:
|
11
|
+
|
12
|
+
concurrency:
|
13
|
+
group: ${{ github.workflow }}-${{ github.sha }}
|
14
|
+
cancel-in-progress: true
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
test:
|
18
|
+
runs-on: ubuntu-latest
|
19
|
+
strategy:
|
20
|
+
fail-fast: false
|
21
|
+
matrix:
|
22
|
+
ruby: ['2.7', '3.0', '3.1', '3.2', '3.3', '3.4']
|
23
|
+
include:
|
24
|
+
- ruby: '2.7'
|
25
|
+
rubygems: '3.3.22'
|
26
|
+
services:
|
27
|
+
ganache:
|
28
|
+
image: trufflesuite/ganache-cli:v6.12.2
|
29
|
+
ports:
|
30
|
+
- 8545:8545
|
31
|
+
options: >-
|
32
|
+
--health-cmd "nc -zv 127.0.0.1 8545"
|
33
|
+
--health-interval 5s
|
34
|
+
--health-timeout 10s
|
35
|
+
--health-retries 10
|
36
|
+
|
37
|
+
env:
|
38
|
+
GANACHE_HOST: 127.0.0.1
|
39
|
+
GANACHE_PORT: 8545
|
40
|
+
|
41
|
+
steps:
|
42
|
+
- uses: actions/checkout@v4
|
43
|
+
|
44
|
+
- uses: ruby/setup-ruby@v1
|
45
|
+
with:
|
46
|
+
ruby-version: ${{ matrix.ruby }}
|
47
|
+
rubygems: ${{ matrix.rubygems || '' }}
|
48
|
+
bundler-cache: true
|
49
|
+
|
50
|
+
- name: Run tests
|
51
|
+
run: bundle exec rspec
|
52
|
+
|
53
|
+
release-please:
|
54
|
+
runs-on: ubuntu-latest
|
55
|
+
needs: [test]
|
56
|
+
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
|
57
|
+
permissions:
|
58
|
+
contents: write
|
59
|
+
issues: write
|
60
|
+
pull-requests: write
|
61
|
+
steps:
|
62
|
+
- uses: actions/checkout@v4
|
63
|
+
|
64
|
+
- uses: googleapis/release-please-action@v4
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## [0.7.0](https://github.com/budacom/etherlite/compare/etherlite/v0.6.0...etherlite/v0.7.0) (2025-04-16)
|
4
|
+
|
5
|
+
|
6
|
+
### Features
|
7
|
+
|
8
|
+
* **ruby:** add support for ruby > 3 ([582acdb](https://github.com/budacom/etherlite/commit/582acdbad57dfb23f188302c65ba0f2bcdfee116))
|
data/docker-compose.yaml
ADDED
data/etherlite.gemspec
CHANGED
@@ -3,33 +3,33 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
3
|
require 'etherlite/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
-
spec.name =
|
6
|
+
spec.name = 'etherlite'
|
7
7
|
spec.version = Etherlite::VERSION
|
8
|
-
spec.authors = [
|
9
|
-
spec.email = [
|
8
|
+
spec.authors = ['Ignacio Baixas']
|
9
|
+
spec.email = ['ignacio@budacom.com']
|
10
10
|
|
11
11
|
spec.summary = 'Ethereum integration for ruby on rails'
|
12
12
|
spec.description = ''
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
13
|
+
spec.homepage = 'https://github.com/budacom/etherlite'
|
14
|
+
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
17
|
f.match(%r{^(test|spec|features)/})
|
18
18
|
end
|
19
|
-
spec.bindir =
|
19
|
+
spec.bindir = 'exe'
|
20
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
-
spec.require_paths = [
|
21
|
+
spec.require_paths = ['lib']
|
22
22
|
|
23
|
-
spec.add_dependency
|
24
|
-
spec.add_dependency
|
23
|
+
spec.add_dependency 'activesupport'
|
24
|
+
spec.add_dependency 'eth', '~> 0.5.10'
|
25
25
|
spec.add_dependency 'keccak', '~> 1.3', '>= 1.3.1'
|
26
|
-
spec.add_dependency
|
26
|
+
spec.add_dependency 'power-types', '~> 0.1'
|
27
27
|
|
28
|
-
spec.add_development_dependency
|
29
|
-
spec.add_development_dependency
|
30
|
-
spec.add_development_dependency
|
31
|
-
spec.add_development_dependency
|
32
|
-
spec.add_development_dependency
|
33
|
-
spec.add_development_dependency
|
34
|
-
spec.add_development_dependency
|
28
|
+
spec.add_development_dependency 'bundler', '~> 2.1'
|
29
|
+
spec.add_development_dependency 'guard', '~> 2.14'
|
30
|
+
spec.add_development_dependency 'guard-rspec', '~> 4.7'
|
31
|
+
spec.add_development_dependency 'pry'
|
32
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
33
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
34
|
+
spec.add_development_dependency 'webmock', '~> 3.7'
|
35
35
|
end
|
@@ -30,7 +30,7 @@ module Etherlite
|
|
30
30
|
|
31
31
|
def send_transaction_with_passphrase(_params, _passphrase)
|
32
32
|
if _passphrase.nil?
|
33
|
-
@connection.eth_send_transaction _params
|
33
|
+
@connection.eth_send_transaction **_params
|
34
34
|
else
|
35
35
|
@connection.personal_send_transaction _params, _passphrase
|
36
36
|
end
|
@@ -5,13 +5,14 @@ module Etherlite
|
|
5
5
|
class PrivateKey < Base
|
6
6
|
def initialize(_connection, _pk)
|
7
7
|
@key = Eth::Key.new priv: _pk
|
8
|
-
super _connection, Etherlite::Utils.normalize_address(@key.address)
|
8
|
+
super _connection, Etherlite::Utils.normalize_address(@key.address.to_s)
|
9
9
|
end
|
10
10
|
|
11
11
|
def build_raw_transaction(_options = {})
|
12
|
-
nonce = nonce_manager.next_nonce_for(normalized_address, _options.slice(:replace, :nonce))
|
12
|
+
nonce = nonce_manager.next_nonce_for(normalized_address, **_options.slice(:replace, :nonce))
|
13
13
|
|
14
14
|
tx = Eth::Tx.new(
|
15
|
+
chain_id: @connection.chain_id,
|
15
16
|
value: _options.fetch(:value, 0),
|
16
17
|
data: _options.fetch(:data, ''),
|
17
18
|
gas_limit: _options.fetch(:gas, 90_000),
|
@@ -20,23 +21,20 @@ module Etherlite
|
|
20
21
|
nonce: nonce
|
21
22
|
)
|
22
23
|
|
23
|
-
|
24
|
-
|
24
|
+
tx.sign @key
|
25
25
|
tx
|
26
26
|
end
|
27
27
|
|
28
28
|
def send_transaction(_options = {})
|
29
29
|
tx = build_raw_transaction(_options)
|
30
30
|
|
31
|
-
nonce_manager.with_next_nonce_for(normalized_address, nonce: tx.
|
32
|
-
Etherlite::Transaction.new @connection, @connection.eth_send_raw_transaction(tx.hex)
|
31
|
+
nonce_manager.with_next_nonce_for(normalized_address, nonce: tx.signer_nonce) do |_|
|
32
|
+
Etherlite::Transaction.new @connection, @connection.eth_send_raw_transaction("0x#{tx.hex}")
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
private
|
37
37
|
|
38
|
-
@@eth_mutex = Mutex.new
|
39
|
-
|
40
38
|
def gas_price
|
41
39
|
# TODO: improve on this
|
42
40
|
@gas_price ||= connection.eth_gas_price
|
@@ -45,13 +43,6 @@ module Etherlite
|
|
45
43
|
def nonce_manager
|
46
44
|
Etherlite::NonceManager.new @connection
|
47
45
|
end
|
48
|
-
|
49
|
-
def sign_with_connection_chain(_tx)
|
50
|
-
@@eth_mutex.synchronize do
|
51
|
-
Eth.configure { |c| c.chain_id = @connection.chain_id }
|
52
|
-
_tx.sign @key
|
53
|
-
end
|
54
|
-
end
|
55
46
|
end
|
56
47
|
end
|
57
48
|
end
|
data/lib/etherlite/api/node.rb
CHANGED
@@ -60,15 +60,6 @@ module Etherlite
|
|
60
60
|
@anonymous_account ||= Etherlite::Account::Anonymous.new(connection)
|
61
61
|
end
|
62
62
|
|
63
|
-
def account_from_pk(_pk)
|
64
|
-
Etherlite.logger.warn(
|
65
|
-
"use of 'account_from_pk' is deprecated and will be removed in next version, \
|
66
|
-
use 'load_account' instead"
|
67
|
-
)
|
68
|
-
|
69
|
-
load_account(from_pk: _pk)
|
70
|
-
end
|
71
|
-
|
72
63
|
def_delegators :default_account, :unlock, :lock, :normalized_address, :transfer_to, :call
|
73
64
|
end
|
74
65
|
end
|
data/lib/etherlite/connection.rb
CHANGED
@@ -28,7 +28,7 @@ module Etherlite
|
|
28
28
|
|
29
29
|
def with_next_nonce_for(_normalized_address, _options = {})
|
30
30
|
@@nonce_mutex.synchronize do
|
31
|
-
nonce = next_nonce_for(_normalized_address, _options)
|
31
|
+
nonce = next_nonce_for(_normalized_address, **_options)
|
32
32
|
|
33
33
|
begin
|
34
34
|
result = yield nonce
|
data/lib/etherlite/version.rb
CHANGED
data/lib/etherlite.rb
CHANGED
@@ -56,7 +56,7 @@ module Etherlite
|
|
56
56
|
_url = URI(_url) unless _url.is_a? URI
|
57
57
|
|
58
58
|
options = config.default_connection_options
|
59
|
-
options = options.merge _options.slice
|
59
|
+
options = options.merge _options.slice(*options.keys)
|
60
60
|
|
61
61
|
Client.new Connection.new(_url, options)
|
62
62
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
{
|
2
|
+
"packages": {
|
3
|
+
".": {
|
4
|
+
"changelog-path": "CHANGELOG.md",
|
5
|
+
"release-type": "ruby",
|
6
|
+
"bump-minor-pre-major": true,
|
7
|
+
"bump-patch-for-minor-pre-major": false,
|
8
|
+
"draft": false,
|
9
|
+
"prerelease": false,
|
10
|
+
"package-name": "etherlite"
|
11
|
+
}
|
12
|
+
},
|
13
|
+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
|
14
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: etherlite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ignacio Baixas
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.5.10
|
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.
|
40
|
+
version: 0.5.10
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: keccak
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -134,14 +134,14 @@ dependencies:
|
|
134
134
|
requirements:
|
135
135
|
- - "~>"
|
136
136
|
- !ruby/object:Gem::Version
|
137
|
-
version: '
|
137
|
+
version: '13.0'
|
138
138
|
type: :development
|
139
139
|
prerelease: false
|
140
140
|
version_requirements: !ruby/object:Gem::Requirement
|
141
141
|
requirements:
|
142
142
|
- - "~>"
|
143
143
|
- !ruby/object:Gem::Version
|
144
|
-
version: '
|
144
|
+
version: '13.0'
|
145
145
|
- !ruby/object:Gem::Dependency
|
146
146
|
name: rspec
|
147
147
|
requirement: !ruby/object:Gem::Requirement
|
@@ -162,14 +162,14 @@ dependencies:
|
|
162
162
|
requirements:
|
163
163
|
- - "~>"
|
164
164
|
- !ruby/object:Gem::Version
|
165
|
-
version: 3.7
|
165
|
+
version: '3.7'
|
166
166
|
type: :development
|
167
167
|
prerelease: false
|
168
168
|
version_requirements: !ruby/object:Gem::Requirement
|
169
169
|
requirements:
|
170
170
|
- - "~>"
|
171
171
|
- !ruby/object:Gem::Version
|
172
|
-
version: 3.7
|
172
|
+
version: '3.7'
|
173
173
|
description: ''
|
174
174
|
email:
|
175
175
|
- ignacio@budacom.com
|
@@ -178,8 +178,11 @@ extensions: []
|
|
178
178
|
extra_rdoc_files: []
|
179
179
|
files:
|
180
180
|
- ".github/workflows/publisher.yaml"
|
181
|
+
- ".github/workflows/test_n_release.yml"
|
181
182
|
- ".gitignore"
|
183
|
+
- ".release-please-manifest.json"
|
182
184
|
- ".rspec"
|
185
|
+
- CHANGELOG.md
|
183
186
|
- CODE_OF_CONDUCT.md
|
184
187
|
- Gemfile
|
185
188
|
- Guardfile
|
@@ -188,6 +191,7 @@ files:
|
|
188
191
|
- Rakefile
|
189
192
|
- bin/console
|
190
193
|
- bin/setup
|
194
|
+
- docker-compose.yaml
|
191
195
|
- etherlite.gemspec
|
192
196
|
- lib/etherlite.rb
|
193
197
|
- lib/etherlite/abi.rb
|
@@ -235,11 +239,12 @@ files:
|
|
235
239
|
- lib/etherlite/version.rb
|
236
240
|
- lib/generators/etherlite/init_generator.rb
|
237
241
|
- lib/generators/etherlite/templates/etherlite.yml
|
242
|
+
- release-please-config.json
|
238
243
|
homepage: https://github.com/budacom/etherlite
|
239
244
|
licenses:
|
240
245
|
- MIT
|
241
246
|
metadata: {}
|
242
|
-
post_install_message:
|
247
|
+
post_install_message:
|
243
248
|
rdoc_options: []
|
244
249
|
require_paths:
|
245
250
|
- lib
|
@@ -255,7 +260,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
255
260
|
version: '0'
|
256
261
|
requirements: []
|
257
262
|
rubygems_version: 3.2.3
|
258
|
-
signing_key:
|
263
|
+
signing_key:
|
259
264
|
specification_version: 4
|
260
265
|
summary: Ethereum integration for ruby on rails
|
261
266
|
test_files: []
|