eth 0.5.8 → 0.5.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/spec.yml +2 -1
  3. data/CHANGELOG.md +32 -0
  4. data/CODE_OF_CONDUCT.md +122 -0
  5. data/CONTRIBUTING.md +61 -0
  6. data/LICENSE.txt +1 -1
  7. data/README.md +6 -2
  8. data/SECURITY.md +24 -0
  9. data/abi/ens_registry.json +436 -0
  10. data/abi/ens_resolver.json +885 -0
  11. data/lib/eth/abi/event.rb +1 -1
  12. data/lib/eth/abi/type.rb +46 -12
  13. data/lib/eth/abi.rb +72 -14
  14. data/lib/eth/address.rb +2 -2
  15. data/lib/eth/api.rb +1 -1
  16. data/lib/eth/chain.rb +19 -7
  17. data/lib/eth/client/http.rb +1 -1
  18. data/lib/eth/client/http_auth.rb +1 -1
  19. data/lib/eth/client/ipc.rb +1 -1
  20. data/lib/eth/client.rb +118 -16
  21. data/lib/eth/constant.rb +1 -1
  22. data/lib/eth/contract/event.rb +1 -1
  23. data/lib/eth/contract/function.rb +2 -2
  24. data/lib/eth/contract/function_input.rb +7 -2
  25. data/lib/eth/contract/function_output.rb +1 -1
  26. data/lib/eth/contract/initializer.rb +1 -1
  27. data/lib/eth/contract.rb +1 -1
  28. data/lib/eth/eip712.rb +2 -2
  29. data/lib/eth/ens/coin_type.rb +50 -0
  30. data/lib/eth/ens/resolver.rb +68 -24
  31. data/lib/eth/ens.rb +28 -0
  32. data/lib/eth/key/decrypter.rb +1 -1
  33. data/lib/eth/key/encrypter.rb +1 -1
  34. data/lib/eth/key.rb +5 -5
  35. data/lib/eth/rlp/decoder.rb +2 -2
  36. data/lib/eth/rlp/encoder.rb +3 -3
  37. data/lib/eth/rlp/sedes/big_endian_int.rb +1 -1
  38. data/lib/eth/rlp/sedes/binary.rb +2 -2
  39. data/lib/eth/rlp/sedes/list.rb +5 -5
  40. data/lib/eth/rlp/sedes.rb +4 -4
  41. data/lib/eth/rlp.rb +1 -1
  42. data/lib/eth/signature.rb +4 -4
  43. data/lib/eth/solidity.rb +5 -3
  44. data/lib/eth/tx/eip1559.rb +3 -3
  45. data/lib/eth/tx/eip2930.rb +3 -3
  46. data/lib/eth/tx/legacy.rb +3 -3
  47. data/lib/eth/tx.rb +5 -5
  48. data/lib/eth/unit.rb +1 -1
  49. data/lib/eth/util.rb +14 -14
  50. data/lib/eth/version.rb +2 -2
  51. data/lib/eth.rb +2 -2
  52. metadata +9 -3
  53. data/abis/ens.json +0 -422
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8bb2370cb186c41e849c2949bbfcc1cb5cc6b2572064d8abba4631ed3ed3a692
4
- data.tar.gz: dabde7655f7d8921f05a1cdb5d860981c3ee4cced8e1a7b085482d01b14c24b1
3
+ metadata.gz: 1fd0b420dd7b4641fe8e87f57f13fdb74b3a23a2c11e7c2e23355f1cc5f6b4a3
4
+ data.tar.gz: e0c219b1c827ec4fcd4d730bfbb7d7e819a9d3049df6f01271cb79d7a81191ea
5
5
  SHA512:
6
- metadata.gz: 23a6ac9854368723b40fc0e46fed5e7ae90d1691358538f94cf8a9a43c333dc3e002e5d359513914440823501f882608d9e55e7a71a5a19ee88d38a57498a570
7
- data.tar.gz: 14f5f74ea076a2fbdd5b538521a2b4006e58bf9105e34f0a942560841371f69a48cf80e86c680228ee5253e9483c3d85a857aeea7f48e8f4c1698a0f5ae0236c
6
+ metadata.gz: cdfa9a6cc91db7fba7e6ffe02dba0c4ec5a3e93a4948c5080f461f20415a9803b566dbf8049a63951e82c85007b31202d1826bc2261fc0e6d806bc4af0caade9
7
+ data.tar.gz: 97d962828b3c98387127ba69505a1170ef43ac8a40ba8aa70dc017cdc9ed91ca790b331fca7ca22eea3ba4d25158fcf3fb9e214bd195472a5b27b4bbc22ad790
@@ -35,7 +35,7 @@ jobs:
35
35
  run: |
36
36
  sudo add-apt-repository -y ppa:ethereum/ethereum
37
37
  sudo apt-get update
38
- sudo apt-get install ethereum solc
38
+ sudo apt-get install ethereum solc libyaml-dev
39
39
  if: startsWith(matrix.os, 'Ubuntu')
40
40
  - name: Run Geth
41
41
  run: |
@@ -50,3 +50,4 @@ jobs:
50
50
  bundle exec rspec
51
51
  env:
52
52
  COVERAGE: true
53
+ INFURA_TOKEN: ${{ secrets.INFURA_TOKEN }}
data/CHANGELOG.md CHANGED
@@ -1,6 +1,38 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [0.5.9]
5
+ ### Added
6
+ * Eth/abi: dynamic struct encoding (#135) [#185](https://github.com/q9f/eth.rb/pull/185)
7
+ * Eth/client: support camel case (convert before sending the tx) [#172](https://github.com/q9f/eth.rb/pull/172)
8
+ * Eth/client: add `tx_succeeded?` [#173](https://github.com/q9f/eth.rb/pull/173)
9
+
10
+ ### Changed
11
+ * Eth/client: raise an error if a contract interaction reverts [#186](https://github.com/q9f/eth.rb/pull/186)
12
+ * Eth/client: dup params to prevent marshalling on client obj [#184](https://github.com/q9f/eth.rb/pull/184)
13
+ * Eth/client: add test for tx_succeeded? [#183](https://github.com/q9f/eth.rb/pull/183)
14
+ * Eth: rename functions prefixed with is_ [#182](https://github.com/q9f/eth.rb/pull/182)
15
+ * Eth/chain: update available chains [#181](https://github.com/q9f/eth.rb/pull/181)
16
+ * Docs: update changelog for 0.5.8 [#180](https://github.com/q9f/eth.rb/pull/180)
17
+ * Eth: happy new 2023 [#179](https://github.com/q9f/eth.rb/pull/179)
18
+ * Docs: fix readme workflow badge [#178](https://github.com/q9f/eth.rb/pull/178)
19
+ * Solidity: sanitize the contract path before compiling [#176](https://github.com/q9f/eth.rb/pull/176)
20
+ * Ci: add libyaml on ubuntu [#175](https://github.com/q9f/eth.rb/pull/175)
21
+
22
+ ## [0.5.8]
23
+ ### Added
24
+ * Client: ability to manual set nonce of tx for transfer, deploy, transact methods was added. [#169](https://github.com/q9f/eth.rb/pull/169)
25
+ * Client: ability for call contract methods with specific transaction value was added [#168](https://github.com/q9f/eth.rb/pull/168)
26
+ * Client: add ENS resolve support [#150](https://github.com/q9f/eth.rb/pull/150)
27
+
28
+ ### Changed
29
+ * Client: satisfy yard docs for transfer kwargs [#170](https://github.com/q9f/eth.rb/pull/170)
30
+ * Client: remove invalid parameters from call_raw method [#166](https://github.com/q9f/eth.rb/pull/166)
31
+ * Gem: bump required ruby version to 3 [#165](https://github.com/q9f/eth.rb/pull/165)
32
+ * Build(deps): bump JamesIves/github-pages-deploy-action from 4.4.0 to 4.4.1 [#162](https://github.com/q9f/eth.rb/pull/162)
33
+ * Gem: bump version to 0.5.8 [#161](https://github.com/q9f/eth.rb/pull/161)
34
+ * Docs: update changelog [#160](https://github.com/q9f/eth.rb/pull/160)
35
+
4
36
  ## [0.5.7]
5
37
  ### Added
6
38
  * Eth/client: add http basic support auth ([#151](https://github.com/q9f/eth.rb/pull/151))
@@ -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/LICENSE.txt CHANGED
@@ -187,7 +187,7 @@
187
187
  same "printed page" as the copyright notice for easier
188
188
  identification within third-party archives.
189
189
 
190
- Copyright (c) 2016-2022 The Ruby-Eth Contributors
190
+ Copyright (c) 2016-2023 The Ruby-Eth Contributors
191
191
 
192
192
  Licensed under the Apache License, Version 2.0 (the "License");
193
193
  you may not use this file except in compliance with the License.
data/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Ethereum for Ruby
8
8
 
9
- [![GitHub Workflow Status](https://img.shields.io/github/workflow/status/q9f/eth.rb/Spec)](https://github.com/q9f/eth.rb/actions)
9
+ [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/q9f/eth.rb/spec.yml?branch=main)](https://github.com/q9f/eth.rb/actions)
10
10
  [![GitHub release (latest by date)](https://img.shields.io/github/v/release/q9f/eth.rb)](https://github.com/q9f/eth.rb/releases)
11
11
  [![Gem](https://img.shields.io/gem/v/eth)](https://rubygems.org/gems/eth)
12
12
  [![Gem](https://img.shields.io/gem/dt/eth)](https://rubygems.org/gems/eth)
@@ -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] ~~Full~~ Some smart-contract support (deploy, transact, and call)
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.