klay 0.0.1 → 0.0.4
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/AUTHORS.txt +1 -5
- data/LICENSE.txt +0 -1
- data/README.md +28 -84
- data/bin/setup +1 -1
- data/klay.gemspec +1 -1
- data/lib/klay/abi/type.rb +8 -8
- data/lib/klay/abi.rb +7 -7
- data/lib/klay/address.rb +5 -5
- data/lib/klay/api.rb +4 -4
- data/lib/klay/chain.rb +2 -2
- data/lib/klay/client/http.rb +2 -2
- data/lib/klay/client/ipc.rb +2 -2
- data/lib/klay/client.rb +17 -17
- data/lib/klay/constant.rb +2 -2
- data/lib/klay/eip712.rb +2 -2
- data/lib/klay/key/decrypter.rb +9 -9
- data/lib/klay/key/encrypter.rb +8 -8
- data/lib/klay/key.rb +12 -12
- data/lib/klay/rlp/decoder.rb +3 -3
- data/lib/klay/rlp/encoder.rb +4 -4
- data/lib/klay/rlp/sedes/big_endian_int.rb +2 -2
- data/lib/klay/rlp/sedes/binary.rb +3 -3
- data/lib/klay/rlp/sedes/list.rb +2 -2
- data/lib/klay/rlp/sedes.rb +6 -6
- data/lib/klay/rlp.rb +4 -4
- data/lib/klay/signature.rb +10 -9
- data/lib/klay/tx/eip1559.rb +9 -9
- data/lib/klay/tx/eip2930.rb +9 -9
- data/lib/klay/tx/legacy.rb +9 -9
- data/lib/klay/tx.rb +7 -7
- data/lib/klay/unit.rb +9 -21
- data/lib/klay/util.rb +5 -5
- data/lib/klay/version.rb +4 -4
- data/lib/klay.rb +3 -3
- metadata +1 -3
- data/.github/workflows/codeql.yml +0 -48
- data/.github/workflows/docs.yml +0 -26
data/lib/klay/unit.rb
CHANGED
@@ -14,36 +14,24 @@
|
|
14
14
|
|
15
15
|
require "bigdecimal"
|
16
16
|
|
17
|
-
# Provides the {
|
17
|
+
# Provides the {Klay} module.
|
18
18
|
module Klay
|
19
19
|
|
20
20
|
# Provides constants for common Ethereum units.
|
21
21
|
module Unit
|
22
22
|
extend self
|
23
23
|
|
24
|
-
# Ethereum unit 1
|
25
|
-
|
24
|
+
# Ethereum unit 1 peb := 0.000000000000000001 Klay.
|
25
|
+
PEB = BigDecimal("1e0").freeze
|
26
26
|
|
27
|
-
# Ethereum unit 1
|
28
|
-
|
27
|
+
# Ethereum unit 1 ston := 0.000000001 Klay or 1_000_000_000 peb.
|
28
|
+
STON = BigDecimal("1e9").freeze
|
29
29
|
|
30
|
-
# Ethereum unit 1
|
31
|
-
LOVELACE = BigDecimal("1e6").freeze
|
32
|
-
|
33
|
-
# Ethereum unit 1 shannon := 0.000000001 Ether or 1_000_000_000 wei.
|
34
|
-
SHANNON = BigDecimal("1e9").freeze
|
35
|
-
|
36
|
-
# Ethereum unit 1 szabo := 0.000_001 Ether or 1_000_000_000_000 wei.
|
37
|
-
SZABO = BigDecimal("1e12").freeze
|
38
|
-
|
39
|
-
# Ethereum unit 1 finney := 0.001 Ether or 1_000_000_000_000_000 wei.
|
40
|
-
FINNEY = BigDecimal("1e15").freeze
|
41
|
-
|
42
|
-
# Ethereum unit 1 Ether := 1_000_000_000_000_000_000 wei.
|
30
|
+
# Ethereum unit 1 Klay := 1_000_000_000_000_000_000 peb.
|
43
31
|
ETHER = BigDecimal("1e18").freeze
|
44
32
|
|
45
|
-
# Ethereum unit 1
|
46
|
-
# Same as shannon, but more commonly used (billion
|
47
|
-
|
33
|
+
# Ethereum unit 1 Gpeb := 0.000000001 Ether or 1_000_000_000 peb.
|
34
|
+
# Same as shannon, but more commonly used (billion peb).
|
35
|
+
GPEB = STON.freeze
|
48
36
|
end
|
49
37
|
end
|
data/lib/klay/util.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2016-2022 The Ruby-
|
1
|
+
# Copyright (c) 2016-2022 The Ruby-Klay Contributors
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -14,18 +14,18 @@
|
|
14
14
|
|
15
15
|
require "digest/keccak"
|
16
16
|
|
17
|
-
# Provides the {
|
17
|
+
# Provides the {Klay} module.
|
18
18
|
module Klay
|
19
19
|
|
20
|
-
# Defines handy tools for the {
|
20
|
+
# Defines handy tools for the {Klay} gem for convenience.
|
21
21
|
module Util
|
22
22
|
extend self
|
23
23
|
|
24
|
-
# Generates an
|
24
|
+
# Generates an Klaytn address from a given compressed or
|
25
25
|
# uncompressed binary or hexadecimal public key string.
|
26
26
|
#
|
27
27
|
# @param str [String] the public key to be converted.
|
28
|
-
# @return [
|
28
|
+
# @return [Klay::Address] an Klaytn address.
|
29
29
|
def public_key_to_address(str)
|
30
30
|
str = hex_to_bin str if is_hex? str
|
31
31
|
bytes = keccak256(str[1..-1])[-20..-1]
|
data/lib/klay/version.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2016-2022 The Ruby-
|
1
|
+
# Copyright (c) 2016-2022 The Ruby-Klay Contributors
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -12,9 +12,9 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
-
# Provides the {
|
15
|
+
# Provides the {Klay} module.
|
16
16
|
module Klay
|
17
17
|
|
18
|
-
# Defines the version of the {
|
19
|
-
VERSION = "0.0.
|
18
|
+
# Defines the version of the {Klay} module.
|
19
|
+
VERSION = "0.0.4".freeze
|
20
20
|
end
|
data/lib/klay.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2016-2022 The Ruby-
|
1
|
+
# Copyright (c) 2016-2022 The Ruby-Klay Contributors
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -12,11 +12,11 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
-
# Provides the {
|
15
|
+
# Provides the {Klay} module.
|
16
16
|
module Klay
|
17
17
|
end
|
18
18
|
|
19
|
-
# Loads the {
|
19
|
+
# Loads the {Klay} module classes.
|
20
20
|
require "klay/abi"
|
21
21
|
require "klay/api"
|
22
22
|
require "klay/address"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: klay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sehan Park
|
@@ -87,8 +87,6 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
-
- ".github/workflows/codeql.yml"
|
91
|
-
- ".github/workflows/docs.yml"
|
92
90
|
- ".github/workflows/spec.yml"
|
93
91
|
- ".gitignore"
|
94
92
|
- ".gitmodules"
|
@@ -1,48 +0,0 @@
|
|
1
|
-
---
|
2
|
-
name: CodeQL
|
3
|
-
|
4
|
-
on:
|
5
|
-
pull_request:
|
6
|
-
branches:
|
7
|
-
- main
|
8
|
-
push:
|
9
|
-
branches:
|
10
|
-
- main
|
11
|
-
|
12
|
-
jobs:
|
13
|
-
analyze:
|
14
|
-
name: Analyze
|
15
|
-
runs-on: ubuntu-latest
|
16
|
-
permissions:
|
17
|
-
actions: read
|
18
|
-
contents: read
|
19
|
-
security-events: write
|
20
|
-
strategy:
|
21
|
-
fail-fast: false
|
22
|
-
matrix:
|
23
|
-
language:
|
24
|
-
- ruby
|
25
|
-
steps:
|
26
|
-
- name: "Checkout repository"
|
27
|
-
uses: actions/checkout@v2
|
28
|
-
- name: "Initialize CodeQL"
|
29
|
-
uses: github/codeql-action/init@v1
|
30
|
-
with:
|
31
|
-
languages: "${{ matrix.language }}"
|
32
|
-
- name: Autobuild
|
33
|
-
uses: github/codeql-action/autobuild@v1
|
34
|
-
- name: "Perform CodeQL Analysis"
|
35
|
-
uses: github/codeql-action/analyze@v1
|
36
|
-
- uses: ruby/setup-ruby@v1
|
37
|
-
with:
|
38
|
-
ruby-version: '2.7'
|
39
|
-
bundler-cache: true
|
40
|
-
- name: "Run rufo code formatting checks"
|
41
|
-
run: |
|
42
|
-
gem install rufo
|
43
|
-
rufo --check ./lib
|
44
|
-
rufo --check ./spec
|
45
|
-
- name: "Run yard documentation checks"
|
46
|
-
run: |
|
47
|
-
gem install yard
|
48
|
-
yard doc --fail-on-warning
|
data/.github/workflows/docs.yml
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
---
|
2
|
-
name: Docs
|
3
|
-
|
4
|
-
on:
|
5
|
-
push:
|
6
|
-
branches:
|
7
|
-
- main
|
8
|
-
|
9
|
-
jobs:
|
10
|
-
docs:
|
11
|
-
runs-on: ubuntu-latest
|
12
|
-
steps:
|
13
|
-
- uses: actions/checkout@v2
|
14
|
-
- uses: ruby/setup-ruby@v1
|
15
|
-
with:
|
16
|
-
ruby-version: '2.7'
|
17
|
-
bundler-cache: true
|
18
|
-
- name: Run Yard Doc
|
19
|
-
run: |
|
20
|
-
gem install yard
|
21
|
-
yard doc
|
22
|
-
- name: Deploy GH Pages
|
23
|
-
uses: JamesIves/github-pages-deploy-action@4.1.7
|
24
|
-
with:
|
25
|
-
branch: gh-pages
|
26
|
-
folder: doc/
|