eth 0.5.12 → 0.5.13
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 +5 -5
- data/CHANGELOG.md +39 -1
- data/Gemfile +8 -8
- data/SECURITY.md +1 -1
- data/eth.gemspec +1 -1
- data/lib/eth/abi/decoder.rb +1 -2
- data/lib/eth/address.rb +8 -0
- data/lib/eth/api.rb +95 -0
- data/lib/eth/chain.rb +57 -11
- data/lib/eth/client.rb +2 -2
- data/lib/eth/tx/eip1559.rb +1 -1
- data/lib/eth/tx/eip2930.rb +1 -1
- data/lib/eth/tx.rb +3 -1
- data/lib/eth/util.rb +5 -2
- data/lib/eth/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc5ddb568fad899fb1b19cce7995c8152b799475fbca603932d840d561fa4b4c
|
4
|
+
data.tar.gz: fc69a4e2c2866a719336cc94a0adb9244383a6c80116ab7da8a1165262743ac9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35062c2f2b04723b2889195a5a16c662e2f2913fed4ecc3d5903a6167ed125d23a3b066125756023b2b71451f5899a58f5a36e61049f0e744b6a24583a6eff9e
|
7
|
+
data.tar.gz: 51732510c1e64a48d3095fb6a6502038e493ace3390da31cde1006f67f4b7a4e130f78de2ab667ae235ce4285c2bb986a3720be8b6648e91d845de5bdb6f1a8f
|
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-latest, macos-latest]
|
22
|
-
ruby: ['3.
|
22
|
+
ruby: ['3.2', '3.3']
|
23
23
|
steps:
|
24
24
|
- uses: actions/checkout@v4
|
25
25
|
- uses: ruby/setup-ruby@v1
|
@@ -29,13 +29,13 @@ jobs:
|
|
29
29
|
- name: MacOs Dependencies
|
30
30
|
run: |
|
31
31
|
brew tap ethereum/ethereum
|
32
|
-
brew install --verbose pkg-config automake autogen
|
32
|
+
brew install --verbose pkg-config automake autogen geth solidity
|
33
33
|
if: startsWith(matrix.os, 'macOS')
|
34
34
|
- name: Ubuntu Dependencies
|
35
35
|
run: |
|
36
36
|
sudo add-apt-repository -y ppa:ethereum/ethereum
|
37
37
|
sudo apt-get update
|
38
|
-
sudo apt-get install
|
38
|
+
sudo apt-get install geth solc
|
39
39
|
if: startsWith(matrix.os, 'Ubuntu')
|
40
40
|
- name: Run Geth
|
41
41
|
run: |
|
@@ -51,7 +51,7 @@ jobs:
|
|
51
51
|
env:
|
52
52
|
INFURA_TOKEN: ${{ secrets.INFURA_TOKEN }}
|
53
53
|
- name: Upload coverage to Codecov
|
54
|
-
uses: codecov/codecov-action@
|
54
|
+
uses: codecov/codecov-action@v5
|
55
55
|
with:
|
56
|
-
fail_ci_if_error:
|
56
|
+
fail_ci_if_error: true
|
57
57
|
token: ${{ secrets.CODECOV_TOKEN }}
|
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,47 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
+
## [0.5.13]
|
5
|
+
### Changed
|
6
|
+
* Eth/api: update to latest available go-ethereum apis [#301](https://github.com/q9f/eth.rb/pull/301)
|
7
|
+
* Eth/chain: update ids [#300](https://github.com/q9f/eth.rb/pull/300)
|
8
|
+
* Spec: update ethereum/tests fixtures [#303](https://github.com/q9f/eth.rb/pull/303)
|
9
|
+
* Ci: fix codecov uploader [#302](https://github.com/q9f/eth.rb/pull/302)
|
10
|
+
* Eth/tx: only enforce block gas limit on mainnet [#299](https://github.com/q9f/eth.rb/pull/299)
|
11
|
+
* Eth/util: fix single-byte hex-string nibbles [#298](https://github.com/q9f/eth.rb/pull/298)
|
12
|
+
* Eth/address: rename null address to zero address [#297](https://github.com/q9f/eth.rb/pull/297)
|
13
|
+
* Eth/address: add support to check for the ethereum "null address" [#296](https://github.com/q9f/eth.rb/pull/296)
|
14
|
+
* Build(deps): bump codecov/codecov-action from 4 to 5 [#295](https://github.com/q9f/eth.rb/pull/295)
|
15
|
+
* Build(deps): bump JamesIves/github-pages-deploy-action [#294](https://github.com/q9f/eth.rb/pull/294)
|
16
|
+
* Build(deps): bump JamesIves/github-pages-deploy-action [#288](https://github.com/q9f/eth.rb/pull/288)
|
17
|
+
* Eth/client: always return hash even if transaction didn't succeed [#284](https://github.com/q9f/eth.rb/pull/284)
|
18
|
+
* Eth/chain: update list of chains [#283](https://github.com/q9f/eth.rb/pull/283)
|
19
|
+
* Fix undefined method `raise_error' for an instance of Eth::Tx::Eip1559 (NoMethodError) [#282](https://github.com/q9f/eth.rb/pull/282)
|
20
|
+
* Gem: bump version to 0.5.13 [#281](https://github.com/q9f/eth.rb/pull/281)
|
21
|
+
|
4
22
|
## [0.5.12]
|
5
23
|
### Added
|
24
|
+
* Allow to call JSON RPC with custom block number [#268](https://github.com/q9f/eth.rb/pull/268)
|
25
|
+
* Support tuple params in EventLog [#276](https://github.com/q9f/eth.rb/pull/276)
|
26
|
+
|
6
27
|
### Changed
|
28
|
+
* Eth: update version [#280](https://github.com/q9f/eth.rb/pull/280)
|
29
|
+
* Eth/abi: fix negative integer coding [#279](https://github.com/q9f/eth.rb/pull/279)
|
30
|
+
* Support negative number from JSON RPC [#267](https://github.com/q9f/eth.rb/pull/267)
|
31
|
+
* Abi/event: confirm decoding tuples works [#278](https://github.com/q9f/eth.rb/pull/278)
|
32
|
+
* Allow to call JSON RPC with custom block number [#268](https://github.com/q9f/eth.rb/pull/268)
|
33
|
+
* Gem: run rufo [#277](https://github.com/q9f/eth.rb/pull/277)
|
34
|
+
* Fix event signature [#250](https://github.com/q9f/eth.rb/pull/250)
|
35
|
+
* Support tuple params in EventLog [#276](https://github.com/q9f/eth.rb/pull/276)
|
36
|
+
* Ci: update ruby version [#271](https://github.com/q9f/eth.rb/pull/271)
|
37
|
+
* Eth/api: remove coinbase as default account [#269](https://github.com/q9f/eth.rb/pull/269)
|
38
|
+
* Build(deps): bump JamesIves/github-pages-deploy-action from 4.5.0 to 4.6.1 [#275](https://github.com/q9f/eth.rb/pull/275)
|
39
|
+
* Build(deps): bump github/codeql-action from 2 to 3 [#257](https://github.com/q9f/eth.rb/pull/257)
|
40
|
+
* Build(deps): bump JamesIves/github-pages-deploy-action from 4.4.3 to 4.5.0 [#256](https://github.com/q9f/eth.rb/pull/256)
|
41
|
+
* Fix typo in contract_spec.rb [#253](https://github.com/q9f/eth.rb/pull/253)
|
42
|
+
* Eth/eip721: fix data type bug for bytes, fix #251 [#252](https://github.com/q9f/eth.rb/pull/252)
|
43
|
+
* Ci: unpatch geth [#248](https://github.com/q9f/eth.rb/pull/248)
|
44
|
+
* Build(deps): bump actions/checkout from 3 to 4 [#246](https://github.com/q9f/eth.rb/pull/246)
|
7
45
|
|
8
46
|
## [0.5.11]
|
9
47
|
### Added
|
@@ -55,7 +93,7 @@ All notable changes to this project will be documented in this file.
|
|
55
93
|
|
56
94
|
## [0.5.9]
|
57
95
|
### Added
|
58
|
-
* Eth/abi: dynamic struct encoding
|
96
|
+
* Eth/abi: dynamic struct encoding [#135](https://github.com/q9f/eth.rb/pull/135) [#185](https://github.com/q9f/eth.rb/pull/185)
|
59
97
|
* Eth/client: support camel case (convert before sending the tx) [#172](https://github.com/q9f/eth.rb/pull/172)
|
60
98
|
* Eth/client: add `tx_succeeded?` [#173](https://github.com/q9f/eth.rb/pull/173)
|
61
99
|
|
data/Gemfile
CHANGED
@@ -3,14 +3,14 @@
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
5
|
group :test, :development do
|
6
|
-
gem "bundler", "~> 2.
|
7
|
-
gem "
|
8
|
-
gem "
|
9
|
-
gem "
|
10
|
-
gem "
|
11
|
-
gem "
|
12
|
-
gem "
|
13
|
-
gem "simplecov", "~>
|
6
|
+
gem "bundler", "~> 2.4"
|
7
|
+
gem "pry", "~> 0.15"
|
8
|
+
gem "rake", "~> 13.2"
|
9
|
+
gem "rdoc", "~> 6.9"
|
10
|
+
gem "rspec", "~> 3.13"
|
11
|
+
gem "rufo", "~> 0.18"
|
12
|
+
gem "simplecov", "~> 0.22"
|
13
|
+
gem "simplecov-cobertura", "~> 2.1"
|
14
14
|
gem "yard", "~> 0.9"
|
15
15
|
end
|
16
16
|
|
data/SECURITY.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
## Supported Versions
|
4
4
|
|
5
|
-
Ruby Ethereum 0.5.
|
5
|
+
Ruby Ethereum 0.5.x is a complete rewrite of the old `eth` 0.4.x gem.
|
6
6
|
It also contains modules from `abi`, `rlp` and the `ethereum` gem.
|
7
7
|
|
8
8
|
None of these gems are maintained anymore except for `eth` 0.5.0 and
|
data/eth.gemspec
CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.test_files = spec.files.grep %r{^(test|spec|features)/}
|
33
33
|
|
34
34
|
spec.platform = Gem::Platform::RUBY
|
35
|
-
spec.required_ruby_version = ">=
|
35
|
+
spec.required_ruby_version = ">= 3.0", "< 4.0"
|
36
36
|
|
37
37
|
# forwardable for contracts meta programming
|
38
38
|
spec.add_dependency "forwardable", "~> 1.3"
|
data/lib/eth/abi/decoder.rb
CHANGED
@@ -54,19 +54,18 @@ module Eth
|
|
54
54
|
elsif type.base_type == "tuple"
|
55
55
|
offset = 0
|
56
56
|
data = {}
|
57
|
+
raise DecodingError, "Cannot decode tuples without known components" if type.components.nil?
|
57
58
|
type.components.each do |c|
|
58
59
|
if c.dynamic?
|
59
60
|
pointer = Util.deserialize_big_endian_to_int arg[offset, 32] # Pointer to the size of the array's element
|
60
61
|
data_len = Util.deserialize_big_endian_to_int arg[pointer, 32] # length of the element
|
61
62
|
|
62
63
|
data[c.name] = type(c, arg[pointer, Util.ceil32(data_len) + 32])
|
63
|
-
# puts data
|
64
64
|
offset += 32
|
65
65
|
else
|
66
66
|
size = c.size
|
67
67
|
data[c.name] = type(c, arg[offset, size])
|
68
68
|
offset += size
|
69
|
-
# puts data
|
70
69
|
end
|
71
70
|
end
|
72
71
|
data
|
data/lib/eth/address.rb
CHANGED
@@ -17,6 +17,7 @@ module Eth
|
|
17
17
|
|
18
18
|
# The {Eth::Address} class to handle checksummed Ethereum addresses.
|
19
19
|
class Address
|
20
|
+
ZERO = "0x0000000000000000000000000000000000000000"
|
20
21
|
|
21
22
|
# Provides a special checksum error if EIP-55 is violated.
|
22
23
|
class CheckSumError < StandardError; end
|
@@ -51,6 +52,13 @@ module Eth
|
|
51
52
|
end
|
52
53
|
end
|
53
54
|
|
55
|
+
# Checks that the address is the zero address.
|
56
|
+
#
|
57
|
+
# @return [Boolean] true if the address is the zero address.
|
58
|
+
def zero?
|
59
|
+
address == ZERO
|
60
|
+
end
|
61
|
+
|
54
62
|
# Generate a checksummed address.
|
55
63
|
#
|
56
64
|
# @return [String] prefixed hexstring representing an checksummed address.
|
data/lib/eth/api.rb
CHANGED
@@ -27,17 +27,25 @@ module Eth
|
|
27
27
|
"account_signTypedData",
|
28
28
|
"admin_addPeer",
|
29
29
|
"admin_addTrustedPeer",
|
30
|
+
"admin_clearHistory",
|
30
31
|
"admin_datadir",
|
31
32
|
"admin_exportChain",
|
33
|
+
"admin_getDatadir",
|
34
|
+
"admin_getNodeInfo",
|
35
|
+
"admin_getPeers",
|
32
36
|
"admin_importChain",
|
33
37
|
"admin_nodeInfo",
|
34
38
|
"admin_peerEvents",
|
35
39
|
"admin_peers",
|
36
40
|
"admin_removePeer",
|
37
41
|
"admin_removeTrustedPeer",
|
42
|
+
"admin_sleep",
|
43
|
+
"admin_sleepBlocks",
|
38
44
|
"admin_startHTTP",
|
45
|
+
"admin_startRPC",
|
39
46
|
"admin_startWS",
|
40
47
|
"admin_stopHTTP",
|
48
|
+
"admin_stopRPC",
|
41
49
|
"admin_stopWS",
|
42
50
|
"clef_deriveAccount",
|
43
51
|
"clef_listWallets",
|
@@ -78,6 +86,7 @@ module Eth
|
|
78
86
|
"debug_getRawHeader",
|
79
87
|
"debug_getRawReceipts",
|
80
88
|
"debug_getRawTransaction",
|
89
|
+
"debug_getTrieFlushInterval",
|
81
90
|
"debug_goTrace",
|
82
91
|
"debug_intermediateRoots",
|
83
92
|
"debug_memStats",
|
@@ -89,6 +98,7 @@ module Eth
|
|
89
98
|
"debug_setGCPercent",
|
90
99
|
"debug_setHead",
|
91
100
|
"debug_setMutexProfileFraction",
|
101
|
+
"debug_setTrieFlushInterval",
|
92
102
|
"debug_stacks",
|
93
103
|
"debug_standardTraceBadBlockToFile",
|
94
104
|
"debug_standardTraceBlockToFile",
|
@@ -111,51 +121,92 @@ module Eth
|
|
111
121
|
"debug_writeBlockProfile",
|
112
122
|
"debug_writeMemProfile",
|
113
123
|
"debug_writeMutexProfile",
|
124
|
+
"dev_addWithdrawal",
|
125
|
+
"dev_setFeeRecipient",
|
114
126
|
"eth_accounts",
|
127
|
+
"eth_blobBaseFee",
|
115
128
|
"eth_blockNumber",
|
116
129
|
"eth_call",
|
117
130
|
"eth_chainId",
|
131
|
+
"eth_coinbase",
|
132
|
+
"eth_compile",
|
118
133
|
"eth_compileLLL",
|
119
134
|
"eth_compileSerpent",
|
120
135
|
"eth_compileSolidity",
|
136
|
+
"eth_contract",
|
121
137
|
"eth_createAccessList",
|
138
|
+
"eth_defaultAccount",
|
139
|
+
"eth_defaultBlock",
|
122
140
|
"eth_estimateGas",
|
123
141
|
"eth_feeHistory",
|
142
|
+
"eth_fillTransaction",
|
143
|
+
"eth_filter",
|
124
144
|
"eth_gasPrice",
|
145
|
+
"eth_getAccounts",
|
125
146
|
"eth_getBalance",
|
147
|
+
"eth_getBlobBaseFee",
|
148
|
+
"eth_getBlock",
|
126
149
|
"eth_getBlockByHash",
|
127
150
|
"eth_getBlockByNumber",
|
151
|
+
"eth_getBlockNumber",
|
152
|
+
"eth_getBlockReceipts",
|
153
|
+
"eth_getBlockTransactionCount",
|
128
154
|
"eth_getBlockTransactionCountByHash",
|
129
155
|
"eth_getBlockTransactionCountByNumber",
|
156
|
+
"eth_getBlockUncleCount",
|
130
157
|
"eth_getCode",
|
158
|
+
"eth_getCoinbase",
|
131
159
|
"eth_getCompilers",
|
132
160
|
"eth_getFilterChanges",
|
133
161
|
"eth_getFilterLogs",
|
162
|
+
"eth_getGasPrice",
|
163
|
+
"eth_getHashrate",
|
164
|
+
"eth_getHeaderByHash",
|
165
|
+
"eth_getHeaderByNumber",
|
134
166
|
"eth_getLogs",
|
167
|
+
"eth_getMaxPriorityFeePerGas",
|
168
|
+
"eth_getMining",
|
169
|
+
"eth_getPendingTransactions",
|
135
170
|
"eth_getProof",
|
171
|
+
"eth_getProtocolVersion",
|
172
|
+
"eth_getRawTransaction",
|
173
|
+
"eth_getRawTransactionFromBlock",
|
136
174
|
"eth_getStorageAt",
|
175
|
+
"eth_getSyncing",
|
176
|
+
"eth_getTransaction",
|
137
177
|
"eth_getTransactionByBlockHashAndIndex",
|
138
178
|
"eth_getTransactionByBlockNumberAndIndex",
|
139
179
|
"eth_getTransactionByHash",
|
140
180
|
"eth_getTransactionCount",
|
181
|
+
"eth_getTransactionFromBlock",
|
141
182
|
"eth_getTransactionReceipt",
|
183
|
+
"eth_getUncle",
|
142
184
|
"eth_getUncleByBlockHashAndIndex",
|
143
185
|
"eth_getUncleByBlockNumberAndIndex",
|
144
186
|
"eth_getUncleCountByBlockHash",
|
145
187
|
"eth_getUncleCountByBlockNumber",
|
146
188
|
"eth_getWork",
|
147
189
|
"eth_hashrate",
|
190
|
+
"eth_iban",
|
191
|
+
"eth_icapNamereg",
|
192
|
+
"eth_isSyncing",
|
148
193
|
"eth_maxPriorityFeePerGas",
|
149
194
|
"eth_mining",
|
195
|
+
"eth_namereg",
|
150
196
|
"eth_newBlockFilter",
|
151
197
|
"eth_newFilter",
|
152
198
|
"eth_newPendingTransactionFilter",
|
199
|
+
"eth_pendingTransactions",
|
153
200
|
"eth_protocolVersion",
|
201
|
+
"eth_resend",
|
202
|
+
"eth_sendIBANTransaction",
|
154
203
|
"eth_sendRawTransaction",
|
155
204
|
"eth_sendTransaction",
|
156
205
|
"eth_sign",
|
157
206
|
"eth_signTransaction",
|
207
|
+
"eth_simulateV1",
|
158
208
|
"eth_submitHashrate",
|
209
|
+
"eth_submitTransaction",
|
159
210
|
"eth_submitWork",
|
160
211
|
"eth_syncing",
|
161
212
|
"eth_uninstallFilter",
|
@@ -177,6 +228,9 @@ module Eth
|
|
177
228
|
"miner_setRecommitInterval",
|
178
229
|
"miner_start",
|
179
230
|
"miner_stop",
|
231
|
+
"net_getListening",
|
232
|
+
"net_getPeerCount",
|
233
|
+
"net_getVersion",
|
180
234
|
"net_listening",
|
181
235
|
"net_peerCount",
|
182
236
|
"net_version",
|
@@ -195,6 +249,8 @@ module Eth
|
|
195
249
|
"personal_signTransaction",
|
196
250
|
"personal_unlockAccount",
|
197
251
|
"personal_unpair",
|
252
|
+
"rpc_getModules",
|
253
|
+
"rpc_modules",
|
198
254
|
"shh_addToGroup",
|
199
255
|
"shh_getFilterChanges",
|
200
256
|
"shh_getMessages",
|
@@ -207,10 +263,49 @@ module Eth
|
|
207
263
|
"shh_version",
|
208
264
|
"txpool_content",
|
209
265
|
"txpool_contentFrom",
|
266
|
+
"txpool_getContent",
|
267
|
+
"txpool_getInspect",
|
268
|
+
"txpool_getStatus",
|
210
269
|
"txpool_inspect",
|
211
270
|
"txpool_status",
|
271
|
+
"web3_admin",
|
272
|
+
"web3_bzz",
|
212
273
|
"web3_clientVersion",
|
274
|
+
"web3_createBatch",
|
275
|
+
"web3_currentProvider",
|
276
|
+
"web3_db",
|
277
|
+
"web3_debug",
|
278
|
+
"web3_dev",
|
279
|
+
"web3_eth",
|
280
|
+
"web3_fromAscii",
|
281
|
+
"web3_fromDecimal",
|
282
|
+
"web3_fromICAP",
|
283
|
+
"web3_fromUtf8",
|
284
|
+
"web3_fromWei",
|
285
|
+
"web3_isAddress",
|
286
|
+
"web3_isChecksumAddress",
|
287
|
+
"web3_isConnected",
|
288
|
+
"web3_isIBAN",
|
289
|
+
"web3_miner",
|
290
|
+
"web3_net",
|
291
|
+
"web3_padLeft",
|
292
|
+
"web3_padRight",
|
293
|
+
"web3_personal",
|
294
|
+
"web3_providers",
|
295
|
+
"web3_reset",
|
296
|
+
"web3_rpc",
|
297
|
+
"web3_setProvider",
|
298
|
+
"web3_settings",
|
213
299
|
"web3_sha3",
|
300
|
+
"web3_shh",
|
301
|
+
"web3_toAscii",
|
302
|
+
"web3_toChecksumAddress",
|
303
|
+
"web3_toDecimal",
|
304
|
+
"web3_toHex",
|
305
|
+
"web3_toUtf8",
|
306
|
+
"web3_toWei",
|
307
|
+
"web3_txpool",
|
308
|
+
"web3_version",
|
214
309
|
]
|
215
310
|
end
|
216
311
|
end
|
data/lib/eth/chain.rb
CHANGED
@@ -32,6 +32,15 @@ module Eth
|
|
32
32
|
# Chain ID for Optimistic Ethereum mainnet.
|
33
33
|
OPTIMISM = 10.freeze
|
34
34
|
|
35
|
+
# Chain ID for Cronos mainnet.
|
36
|
+
CRONOS = 25.freeze
|
37
|
+
|
38
|
+
# Chain ID for Rootstock mainnet.
|
39
|
+
RSK = 30.freeze
|
40
|
+
|
41
|
+
# Chain ID for BNB Smart Chain mainnet.
|
42
|
+
BNB = 56.freeze
|
43
|
+
|
35
44
|
# Chain ID for Ethereum Classic mainnet.
|
36
45
|
CLASSIC = 61.freeze
|
37
46
|
|
@@ -50,9 +59,45 @@ module Eth
|
|
50
59
|
# Chain ID for the Polygon mainnet (formerly Matic).
|
51
60
|
POLYGON = MATIC.freeze
|
52
61
|
|
53
|
-
# Chain ID for
|
62
|
+
# Chain ID for Filecoin mainnet.
|
63
|
+
FILECOIN = 314.freeze
|
64
|
+
|
65
|
+
# Chain ID for the Cronos zkEVM chain.
|
66
|
+
CRONOS_ZK = 388.freeze
|
67
|
+
|
68
|
+
# Chain ID for Redstone Optimistic Rollup.
|
69
|
+
REDSTONE = 690.freeze
|
70
|
+
|
71
|
+
# Chain ID for the Polygon zkEVM.
|
72
|
+
POLYGON_ZK = 1101.freeze
|
73
|
+
|
74
|
+
# Chain ID for the Lisk layer 2.
|
75
|
+
LISK = 1135.freeze
|
76
|
+
|
77
|
+
# Chain ID for Moonbeam
|
78
|
+
MOONBEAM = 1284.freeze
|
79
|
+
|
80
|
+
# Chain ID for Base mainnet.
|
81
|
+
BASE = 8453.freeze
|
82
|
+
|
83
|
+
# Chain ID for the EVMOS mainnet.
|
84
|
+
EVMOS = 9001.freeze
|
85
|
+
|
86
|
+
# Chain ID for the Celo layer 2.
|
87
|
+
CELO = 42220.freeze
|
88
|
+
|
89
|
+
# Chain ID for Arbitrum One mainnet.
|
54
90
|
ARBITRUM = 42161.freeze
|
55
91
|
|
92
|
+
# Chain ID for Avalance C-Chain mainnet.
|
93
|
+
AVALANCHE = 43114.freeze
|
94
|
+
|
95
|
+
# Chain ID for Linea mainnet.
|
96
|
+
LINEA = 59144.freeze
|
97
|
+
|
98
|
+
# Chain ID for the Scroll layer 2.
|
99
|
+
SCROLL = 534352.freeze
|
100
|
+
|
56
101
|
# Chain ID for Morden (Ethereum) testnet.
|
57
102
|
MORDEN = 2.freeze
|
58
103
|
|
@@ -77,7 +122,7 @@ module Eth
|
|
77
122
|
# Chain ID for Mordor testnet.
|
78
123
|
MORDOR = 63.freeze
|
79
124
|
|
80
|
-
# Chain ID for
|
125
|
+
# Chain ID for Optimistm Kovan testnet.
|
81
126
|
KOVAN_OPTIMISM = 69.freeze
|
82
127
|
|
83
128
|
# Chain ID for Arbitrum xDAI testnet.
|
@@ -86,6 +131,15 @@ module Eth
|
|
86
131
|
# Chain ID for Optimistic Goerli testnet.
|
87
132
|
GOERLI_OPTIMISM = 420.freeze
|
88
133
|
|
134
|
+
# Chain ID for Moonriver testnet
|
135
|
+
MOONRIVER = 1285.freeze
|
136
|
+
|
137
|
+
# Chain ID for Moonbase alpha
|
138
|
+
MOONBASE = 1287.freeze
|
139
|
+
|
140
|
+
# Chain ID for the Garnet Holesky testnet
|
141
|
+
GARNET = 17069.freeze
|
142
|
+
|
89
143
|
# Chain ID for the Polygon Mumbai testnet.
|
90
144
|
MUMBAI = 80001.freeze
|
91
145
|
|
@@ -100,19 +154,11 @@ module Eth
|
|
100
154
|
|
101
155
|
# Chain ID for Holesovice testnet.
|
102
156
|
HOLESOVICE = 11166111.freeze
|
157
|
+
HOLESKY = HOLESOVICE
|
103
158
|
|
104
159
|
# Chain ID for the geth private network preset.
|
105
160
|
PRIVATE_GETH = 1337.freeze
|
106
161
|
|
107
|
-
# Chain ID for Moonbase
|
108
|
-
MOONBASE = 1287.freeze
|
109
|
-
|
110
|
-
# Chain ID for Moonriver
|
111
|
-
MOONRIVER = 1285.freeze
|
112
|
-
|
113
|
-
# Chain ID for Moonbeam
|
114
|
-
MOONBEAM = 1284.freeze
|
115
|
-
|
116
162
|
# Indicates wether the given `v` indicates a legacy chain value
|
117
163
|
# used by ledger wallets without EIP-155 replay protection.
|
118
164
|
#
|
data/lib/eth/client.rb
CHANGED
@@ -315,11 +315,11 @@ module Eth
|
|
315
315
|
# See {#transact} for params and overloads.
|
316
316
|
#
|
317
317
|
# @raise [Client::ContractExecutionError] if the execution fails.
|
318
|
-
# @return [Object] returns the result of the transaction.
|
318
|
+
# @return [Object, Boolean] returns the result of the transaction (hash and execution status).
|
319
319
|
def transact_and_wait(contract, function, *args, **kwargs)
|
320
320
|
begin
|
321
321
|
hash = wait_for_tx(transact(contract, function, *args, **kwargs))
|
322
|
-
return hash
|
322
|
+
return hash, tx_succeeded?(hash)
|
323
323
|
rescue IOError => e
|
324
324
|
raise ContractExecutionError, e
|
325
325
|
end
|
data/lib/eth/tx/eip1559.rb
CHANGED
@@ -180,7 +180,7 @@ module Eth
|
|
180
180
|
# allows us to force-setting a signature if the transaction is signed already
|
181
181
|
_set_signature(recovery_id, r, s)
|
182
182
|
else
|
183
|
-
|
183
|
+
raise DecoderError, "Cannot decode EIP-1559 payload!"
|
184
184
|
end
|
185
185
|
|
186
186
|
# last but not least, set the type.
|
data/lib/eth/tx/eip2930.rb
CHANGED
@@ -175,7 +175,7 @@ module Eth
|
|
175
175
|
# allows us to force-setting a signature if the transaction is signed already
|
176
176
|
_set_signature(recovery_id, r, s)
|
177
177
|
else
|
178
|
-
|
178
|
+
raise DecoderError, "Cannot decode EIP-2930 payload!"
|
179
179
|
end
|
180
180
|
|
181
181
|
# last but not least, set the type.
|
data/lib/eth/tx.rb
CHANGED
@@ -210,7 +210,9 @@ module Eth
|
|
210
210
|
if fields[:nonce].nil? or fields[:nonce] < 0
|
211
211
|
raise ParameterError, "Invalid signer nonce #{fields[:nonce]}!"
|
212
212
|
end
|
213
|
-
if fields[:gas_limit].nil? or
|
213
|
+
if fields[:gas_limit].nil? or
|
214
|
+
fields[:gas_limit] < DEFAULT_GAS_LIMIT or
|
215
|
+
(fields[:gas_limit] > BLOCK_GAS_LIMIT and fields[:chain_id] == Chain::ETHEREUM)
|
214
216
|
raise ParameterError, "Invalid gas limit #{fields[:gas_limit]}!"
|
215
217
|
end
|
216
218
|
unless fields[:value] >= 0
|
data/lib/eth/util.rb
CHANGED
@@ -12,6 +12,8 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
+
# -*- encoding : ascii-8bit -*-
|
16
|
+
|
15
17
|
require "digest/keccak"
|
16
18
|
|
17
19
|
# Provides the {Eth} module.
|
@@ -48,7 +50,7 @@ module Eth
|
|
48
50
|
# @raise [TypeError] if value is not a string.
|
49
51
|
def bin_to_hex(bin)
|
50
52
|
raise TypeError, "Value must be an instance of String" unless bin.instance_of? String
|
51
|
-
bin.unpack("H*").first
|
53
|
+
hex = bin.unpack("H*").first
|
52
54
|
end
|
53
55
|
|
54
56
|
# Packs a hexa-decimal string into a binary string. Also works with
|
@@ -61,7 +63,8 @@ module Eth
|
|
61
63
|
raise TypeError, "Value must be an instance of String" unless hex.instance_of? String
|
62
64
|
hex = remove_hex_prefix hex
|
63
65
|
raise TypeError, "Non-hexadecimal digit found" unless hex? hex
|
64
|
-
|
66
|
+
hex = "0#{hex}" if hex.size % 2 != 0
|
67
|
+
bin = [hex].pack("H*")
|
65
68
|
end
|
66
69
|
|
67
70
|
# Prefixes a hexa-decimal string with `0x`.
|
data/lib/eth/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Ellis
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-
|
12
|
+
date: 2024-12-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: forwardable
|
@@ -192,7 +192,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
192
192
|
requirements:
|
193
193
|
- - ">="
|
194
194
|
- !ruby/object:Gem::Version
|
195
|
-
version: '
|
195
|
+
version: '3.0'
|
196
196
|
- - "<"
|
197
197
|
- !ruby/object:Gem::Version
|
198
198
|
version: '4.0'
|
@@ -202,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
202
202
|
- !ruby/object:Gem::Version
|
203
203
|
version: '0'
|
204
204
|
requirements: []
|
205
|
-
rubygems_version: 3.
|
205
|
+
rubygems_version: 3.5.16
|
206
206
|
signing_key:
|
207
207
|
specification_version: 4
|
208
208
|
summary: Ruby Ethereum library.
|