eth 0.5.9 → 0.5.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/docs.yml +1 -1
- data/.github/workflows/spec.yml +9 -3
- data/CHANGELOG.md +34 -0
- data/CODE_OF_CONDUCT.md +122 -0
- data/CONTRIBUTING.md +61 -0
- data/README.md +5 -1
- data/SECURITY.md +24 -0
- data/abi/ens_registry.json +436 -0
- data/abi/ens_resolver.json +885 -0
- data/eth.gemspec +4 -1
- data/lib/eth/abi/decoder.rb +135 -0
- data/lib/eth/abi/encoder.rb +304 -0
- data/lib/eth/abi/event.rb +13 -2
- data/lib/eth/abi/type.rb +1 -1
- data/lib/eth/abi.rb +10 -385
- data/lib/eth/api.rb +45 -51
- data/lib/eth/chain.rb +9 -0
- data/lib/eth/client/http.rb +18 -4
- data/lib/eth/client/ipc.rb +2 -2
- data/lib/eth/client.rb +120 -113
- data/lib/eth/contract.rb +11 -1
- data/lib/eth/ens/coin_type.rb +50 -0
- data/lib/eth/ens/resolver.rb +67 -23
- data/lib/eth/ens.rb +28 -0
- data/lib/eth/solidity.rb +7 -4
- data/lib/eth/tx/eip1559.rb +10 -5
- data/lib/eth/tx/eip2930.rb +10 -5
- data/lib/eth/tx/legacy.rb +0 -2
- data/lib/eth/tx.rb +9 -2
- data/lib/eth/util.rb +1 -0
- data/lib/eth/version.rb +11 -2
- data/lib/eth.rb +1 -1
- metadata +28 -7
- data/abis/ens.json +0 -422
- data/lib/eth/client/http_auth.rb +0 -73
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ddb9f142d1985c57f8abecee08a3275ed0e2dfd6a008cf608bf8c3ac239335d
|
4
|
+
data.tar.gz: d33f16301d9421c4ae584cc293fe26c18e88e2783d8184a91999833753f6f904
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c32065a3eb99ca9dc142c5acd7de9a2a957e850743afa45f8c2ddb9b95597c55d75063e28dd4cce757b4ac228402fa988a7cd76fdbc6b33e2fa7770038068db7
|
7
|
+
data.tar.gz: 8c44621156a464b8676ca9dd6e1bd92295e84a0c41329687b8a84f5335abc10683a3ae39ecfa548f5f5203f218adb6850aa76f227057e69da47405a55d0d81f3
|
data/.github/workflows/docs.yml
CHANGED
data/.github/workflows/spec.yml
CHANGED
@@ -19,7 +19,7 @@ jobs:
|
|
19
19
|
fail-fast: false
|
20
20
|
matrix:
|
21
21
|
os: [ubuntu-22.04, macos-12]
|
22
|
-
ruby: ['3.0', '3.1']
|
22
|
+
ruby: ['3.0', '3.1', '3.2']
|
23
23
|
steps:
|
24
24
|
- uses: actions/checkout@v3
|
25
25
|
- uses: ruby/setup-ruby@v1
|
@@ -37,10 +37,15 @@ jobs:
|
|
37
37
|
sudo apt-get update
|
38
38
|
sudo apt-get install ethereum solc libyaml-dev
|
39
39
|
if: startsWith(matrix.os, 'Ubuntu')
|
40
|
+
- name: Patch Geth # https://github.com/ethereum/go-ethereum/pull/27360
|
41
|
+
run: |
|
42
|
+
git clone https://github.com/q9f/go-ethereum.git -b q9f/params/shanghai
|
43
|
+
pushd go-ethereum/
|
44
|
+
make geth
|
45
|
+
popd
|
40
46
|
- name: Run Geth
|
41
47
|
run: |
|
42
|
-
geth --dev --http --ipcpath /tmp/geth.ipc &
|
43
|
-
disown &
|
48
|
+
./go-ethereum/build/bin/geth --dev --http --ipcpath /tmp/geth.ipc &
|
44
49
|
- name: Gem Dependencies
|
45
50
|
run: |
|
46
51
|
git submodule update --init
|
@@ -50,3 +55,4 @@ jobs:
|
|
50
55
|
bundle exec rspec
|
51
56
|
env:
|
52
57
|
COVERAGE: true
|
58
|
+
INFURA_TOKEN: ${{ secrets.INFURA_TOKEN }}
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,40 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
+
## [0.5.10]
|
5
|
+
### Added
|
6
|
+
* Eth/client: add transfer_erc20 function [#197](https://github.com/q9f/eth.rb/pull/197)
|
7
|
+
* Eth/client: add resolve_ens function [#192](https://github.com/q9f/eth.rb/pull/192)
|
8
|
+
|
9
|
+
### Changed
|
10
|
+
* Eth/ens: restore docs for normalize [#198](https://github.com/q9f/eth.rb/pull/198)
|
11
|
+
* Docs: update readme [#195](https://github.com/q9f/eth.rb/pull/195)
|
12
|
+
* Eth/contract: ensure address arrays support [#194](https://github.com/q9f/eth.rb/pull/194)
|
13
|
+
* Eth/client: do not allow accessing local accounts on remote connections [#193](https://github.com/q9f/eth.rb/pull/193)
|
14
|
+
* Eth/client: correctly select functions [#191](https://github.com/q9f/eth.rb/pull/191)
|
15
|
+
* Docs: create security policy [#190](https://github.com/q9f/eth.rb/pull/190)
|
16
|
+
* Docs: add contribution guidelines [#189](https://github.com/q9f/eth.rb/pull/189)
|
17
|
+
* Docs: add coc [#188](https://github.com/q9f/eth.rb/pull/188)
|
18
|
+
* Docs: update changelog for 0.5.9 [#187](https://github.com/q9f/eth.rb/pull/187)
|
19
|
+
|
20
|
+
## [0.5.9]
|
21
|
+
### Added
|
22
|
+
* Eth/abi: dynamic struct encoding (#135) [#185](https://github.com/q9f/eth.rb/pull/185)
|
23
|
+
* Eth/client: support camel case (convert before sending the tx) [#172](https://github.com/q9f/eth.rb/pull/172)
|
24
|
+
* Eth/client: add `tx_succeeded?` [#173](https://github.com/q9f/eth.rb/pull/173)
|
25
|
+
|
26
|
+
### Changed
|
27
|
+
* Eth/client: raise an error if a contract interaction reverts [#186](https://github.com/q9f/eth.rb/pull/186)
|
28
|
+
* Eth/client: dup params to prevent marshalling on client obj [#184](https://github.com/q9f/eth.rb/pull/184)
|
29
|
+
* Eth/client: add test for tx_succeeded? [#183](https://github.com/q9f/eth.rb/pull/183)
|
30
|
+
* Eth: rename functions prefixed with is_ [#182](https://github.com/q9f/eth.rb/pull/182)
|
31
|
+
* Eth/chain: update available chains [#181](https://github.com/q9f/eth.rb/pull/181)
|
32
|
+
* Docs: update changelog for 0.5.8 [#180](https://github.com/q9f/eth.rb/pull/180)
|
33
|
+
* Eth: happy new 2023 [#179](https://github.com/q9f/eth.rb/pull/179)
|
34
|
+
* Docs: fix readme workflow badge [#178](https://github.com/q9f/eth.rb/pull/178)
|
35
|
+
* Solidity: sanitize the contract path before compiling [#176](https://github.com/q9f/eth.rb/pull/176)
|
36
|
+
* Ci: add libyaml on ubuntu [#175](https://github.com/q9f/eth.rb/pull/175)
|
37
|
+
|
4
38
|
## [0.5.8]
|
5
39
|
### Added
|
6
40
|
* Client: ability to manual set nonce of tx for transfer, deploy, transact methods was added. [#169](https://github.com/q9f/eth.rb/pull/169)
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
|
2
|
+
# Code of Conduct
|
3
|
+
|
4
|
+
## Our Pledge
|
5
|
+
|
6
|
+
We as members, contributors, and leaders pledge to make participation in our
|
7
|
+
community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
9
|
+
identity and expression, level of experience, education, socio-economic status,
|
10
|
+
nationality, personal appearance, race, caste, color, religion, or sexual
|
11
|
+
identity and orientation.
|
12
|
+
|
13
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
14
|
+
diverse, inclusive, and healthy community.
|
15
|
+
|
16
|
+
## Our Standards
|
17
|
+
|
18
|
+
Examples of behavior that contributes to a positive environment for our
|
19
|
+
community include:
|
20
|
+
|
21
|
+
* Demonstrating empathy and kindness toward other people
|
22
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
23
|
+
* Giving and gracefully accepting constructive feedback
|
24
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
25
|
+
and learning from the experience
|
26
|
+
* Focusing on what is best not just for us as individuals, but for the overall
|
27
|
+
community
|
28
|
+
|
29
|
+
Examples of unacceptable behavior include:
|
30
|
+
|
31
|
+
* The use of sexualized language or imagery, and sexual attention or advances of
|
32
|
+
any kind
|
33
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
34
|
+
* Public or private harassment
|
35
|
+
* Publishing others' private information, such as a physical or email address,
|
36
|
+
without their explicit permission
|
37
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
38
|
+
professional setting
|
39
|
+
|
40
|
+
## Enforcement Responsibilities
|
41
|
+
|
42
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
43
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
44
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
45
|
+
or harmful.
|
46
|
+
|
47
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
48
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
49
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
50
|
+
decisions when appropriate.
|
51
|
+
|
52
|
+
## Scope
|
53
|
+
|
54
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
55
|
+
an individual is officially representing the community in public spaces.
|
56
|
+
Examples of representing our community include using an official e-mail address,
|
57
|
+
posting via an official social media account, or acting as an appointed
|
58
|
+
representative at an online or offline event.
|
59
|
+
|
60
|
+
## Enforcement
|
61
|
+
|
62
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
63
|
+
reported to the community leaders responsible for enforcement at
|
64
|
+
<github@q9f.cc>.
|
65
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
66
|
+
|
67
|
+
All community leaders are obligated to respect the privacy and security of the
|
68
|
+
reporter of any incident.
|
69
|
+
|
70
|
+
## Enforcement Guidelines
|
71
|
+
|
72
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
73
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
74
|
+
|
75
|
+
### 1. Correction
|
76
|
+
|
77
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
78
|
+
unprofessional or unwelcome in the community.
|
79
|
+
|
80
|
+
**Consequence**: A private, written warning from community leaders, providing
|
81
|
+
clarity around the nature of the violation and an explanation of why the
|
82
|
+
behavior was inappropriate. A public apology may be requested.
|
83
|
+
|
84
|
+
### 2. Warning
|
85
|
+
|
86
|
+
**Community Impact**: A violation through a single incident or series of
|
87
|
+
actions.
|
88
|
+
|
89
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
90
|
+
interaction with the people involved, including unsolicited interaction with
|
91
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
92
|
+
includes avoiding interactions in community spaces as well as external channels
|
93
|
+
like social media. Violating these terms may lead to a temporary or permanent
|
94
|
+
ban.
|
95
|
+
|
96
|
+
### 3. Temporary Ban
|
97
|
+
|
98
|
+
**Community Impact**: A serious violation of community standards, including
|
99
|
+
sustained inappropriate behavior.
|
100
|
+
|
101
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
102
|
+
communication with the community for a specified period of time. No public or
|
103
|
+
private interaction with the people involved, including unsolicited interaction
|
104
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
105
|
+
Violating these terms may lead to a permanent ban.
|
106
|
+
|
107
|
+
### 4. Permanent Ban
|
108
|
+
|
109
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
110
|
+
standards, including sustained inappropriate behavior, harassment of an
|
111
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
112
|
+
|
113
|
+
**Consequence**: A permanent ban from any sort of public interaction within the
|
114
|
+
community.
|
115
|
+
|
116
|
+
## Attribution
|
117
|
+
|
118
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
119
|
+
version 2.1, available at
|
120
|
+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
121
|
+
Community Impact Guidelines were inspired by
|
122
|
+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# Contributing to Ruby Ethereum
|
2
|
+
|
3
|
+
Everyone is welcome to contribute to the Ruby Ethereum gem. It is
|
4
|
+
more than six years old and had seen many maintainers come and go.
|
5
|
+
|
6
|
+
Current maintainers:
|
7
|
+
* [@q9f](https://github.com/q9f)
|
8
|
+
* [@kurotaky](https://github.com/kurotaky)
|
9
|
+
|
10
|
+
### Workflow
|
11
|
+
|
12
|
+
To propose a change, fix, or new feature, create an issue or comment
|
13
|
+
on an existing issue to see if anyone else has an opinion on it or is
|
14
|
+
eventually already working on it
|
15
|
+
|
16
|
+
The general workflow looks roughly like this:
|
17
|
+
|
18
|
+
1. Discuss it
|
19
|
+
2. Fork it
|
20
|
+
3. Improve it
|
21
|
+
4. Test it
|
22
|
+
5. Document it
|
23
|
+
6. Submit it
|
24
|
+
|
25
|
+
### Linting
|
26
|
+
|
27
|
+
We use the Ruby formatter `rufo` to ensure consistent formatting across
|
28
|
+
the code base.
|
29
|
+
* <https://github.com/ruby-formatter/rufo>
|
30
|
+
|
31
|
+
Simply run `rufo .` before comitting your changes.
|
32
|
+
|
33
|
+
### Testing
|
34
|
+
|
35
|
+
We use behaviour-driven development and this codebase is at least 100%
|
36
|
+
unit tested. We use RSpec to run the spec tests.
|
37
|
+
* <https://rspec.info>
|
38
|
+
|
39
|
+
The full Ethereum test-suite is available in `fixtures/ethereum/tests`.
|
40
|
+
Run `git submodule update --init --recursive` to fetch it.
|
41
|
+
* <https://github.com/ethereum/tests>
|
42
|
+
|
43
|
+
If your tests are failing make sure you pulled the ethereum/tests
|
44
|
+
submodule and run a local geth node in background with
|
45
|
+
`geth --dev --http --ipcpath /tmp/geth.ipc` as we are running some tests
|
46
|
+
against a local live node.
|
47
|
+
|
48
|
+
Other static test data is available in `fixtures/`
|
49
|
+
|
50
|
+
### Documentation
|
51
|
+
|
52
|
+
We use the Ruby documentation tool Yard.
|
53
|
+
* <https://yardoc.org>
|
54
|
+
|
55
|
+
The code base is 100% API documented.
|
56
|
+
* <https://q9f.github.io/eth.rb>
|
57
|
+
|
58
|
+
More involved documentation, tutorials, and usage examples should go
|
59
|
+
into the wiki.
|
60
|
+
* <https://github.com/q9f/eth.rb/wiki>
|
61
|
+
|
data/README.md
CHANGED
@@ -23,7 +23,9 @@ A straightforward library to build, sign, and broadcast Ethereum transactions. I
|
|
23
23
|
|
24
24
|
What you get:
|
25
25
|
- [x] Secp256k1 Key-Pairs and Encrypted Ethereum Key-Stores (JSON)
|
26
|
+
- [x] EIP-20 Token Transfers (ERC20)
|
26
27
|
- [x] EIP-55 Checksummed Ethereum Addresses
|
28
|
+
- [x] EIP-137 Ethereum Domain Name Service (ENS)
|
27
29
|
- [x] EIP-155 Replay protection with Chain IDs (with presets)
|
28
30
|
- [x] EIP-191 Ethereum Signed Messages (with prefix and type)
|
29
31
|
- [x] EIP-712 Ethereum Signed Type Data
|
@@ -36,7 +38,7 @@ What you get:
|
|
36
38
|
- [x] RLP-Encoder and Decoder (including sedes)
|
37
39
|
- [x] RPC-Client (IPC/HTTP) for Execution-Layer APIs
|
38
40
|
- [x] Solidity bindings (compile contracts from Ruby)
|
39
|
-
- [x]
|
41
|
+
- [x] Full smart-contract support (deploy, transact, and call)
|
40
42
|
|
41
43
|
## Installation
|
42
44
|
Add this line to your application's Gemfile:
|
@@ -78,6 +80,8 @@ The test suite expects working local HTTP and IPC endpoints with a prefunded dev
|
|
78
80
|
geth --dev --http --ipcpath /tmp/geth.ipc &
|
79
81
|
```
|
80
82
|
|
83
|
+
It also expects an `$INFURA_TOKEN` in environment to test some ENS queries on mainnet.
|
84
|
+
|
81
85
|
To run tests, simply use `rspec`. Note, that the Ethereum test fixtures are also required.
|
82
86
|
|
83
87
|
```shell
|
data/SECURITY.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# Security Policy
|
2
|
+
|
3
|
+
## Supported Versions
|
4
|
+
|
5
|
+
Ruby Ethereum 0.5.0 is a complete rewrite of the old `eth` 0.4.x gem.
|
6
|
+
It also contains modules from `abi`, `rlp` and the `ethereum` gem.
|
7
|
+
|
8
|
+
None of these gems are maintained anymore except for `eth` 0.5.0 and
|
9
|
+
later.
|
10
|
+
|
11
|
+
| Gem | Version | Supported |
|
12
|
+
| -------------- | ------- | ------------------ |
|
13
|
+
| `eth` | 0.5.x | :white_check_mark: |
|
14
|
+
| `eth` | < 0.5 | :x: |
|
15
|
+
| `ethereum` | _any_ | :x: |
|
16
|
+
| `ethereum-abi` | _any_ | :x: |
|
17
|
+
| `rlp` | _any_ | :x: |
|
18
|
+
|
19
|
+
## Reporting a Vulnerability
|
20
|
+
|
21
|
+
Please report your findings to <security@q9f.cc>. Do not create a
|
22
|
+
Github issue!
|
23
|
+
|
24
|
+
You can expect an answer within 48 hours.
|