eth 0.5.9 → 0.5.11
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/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
data/lib/eth/client/http_auth.rb
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
# Copyright (c) 2016-2023 The Ruby-Eth Contributors
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
|
-
require "net/http"
|
16
|
-
|
17
|
-
# Provides the {Eth} module.
|
18
|
-
module Eth
|
19
|
-
|
20
|
-
# Provides an HTTP/S-RPC client with basic authentication.
|
21
|
-
class Client::HttpAuth < Client
|
22
|
-
|
23
|
-
# The host of the HTTP endpoint.
|
24
|
-
attr_reader :host
|
25
|
-
|
26
|
-
# The port of the HTTP endpoint.
|
27
|
-
attr_reader :port
|
28
|
-
|
29
|
-
# The full URI of the HTTP endpoint, including path.
|
30
|
-
attr_reader :uri
|
31
|
-
|
32
|
-
# Attribute indicator for SSL.
|
33
|
-
attr_reader :ssl
|
34
|
-
|
35
|
-
# Attribute for user.
|
36
|
-
attr_reader :user
|
37
|
-
|
38
|
-
# Constructor for the HTTP Client. Should not be used; use
|
39
|
-
# {Client.create} intead.
|
40
|
-
#
|
41
|
-
# @param host [String] an URI pointing to an HTTP RPC-API.
|
42
|
-
def initialize(host)
|
43
|
-
super
|
44
|
-
uri = URI.parse(host)
|
45
|
-
raise ArgumentError, "Unable to parse the HTTP-URI!" unless ["http", "https"].include? uri.scheme
|
46
|
-
@host = uri.host
|
47
|
-
@port = uri.port
|
48
|
-
@ssl = uri.scheme == "https"
|
49
|
-
@user = uri.user
|
50
|
-
@password = uri.password
|
51
|
-
@uri = URI("#{uri.scheme}://#{uri.user}:#{uri.password}@#{@host}:#{@port}#{uri.path}")
|
52
|
-
end
|
53
|
-
|
54
|
-
# Sends an RPC request to the connected HTTP client.
|
55
|
-
#
|
56
|
-
# @param payload [Hash] the RPC request parameters.
|
57
|
-
# @return [String] a JSON-encoded response.
|
58
|
-
def send(payload)
|
59
|
-
http = Net::HTTP.new(@host, @port)
|
60
|
-
http.use_ssl = @ssl
|
61
|
-
header = { "Content-Type" => "application/json" }
|
62
|
-
request = Net::HTTP::Post.new(@uri, header)
|
63
|
-
request.body = payload
|
64
|
-
response = http.request(request)
|
65
|
-
response.body
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
private
|
70
|
-
|
71
|
-
# Attribute for password.
|
72
|
-
attr_reader :password
|
73
|
-
end
|