erc20 0.0.19 → 0.0.21

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.
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2025 Yegor Bugayenko
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the 'Software'), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
22
5
 
23
6
  require 'backtrace'
24
7
  require 'donce'
@@ -67,19 +50,13 @@ class TestWallet < Minitest::Test
67
50
  assert_equal(0, b)
68
51
  end
69
52
 
70
- def test_checks_gas_required_on_mainnet
71
- b = mainnet.gas_required(STABLE, Eth::Key.new(priv: JEFF).address.to_s)
53
+ def test_checks_gas_estimate_on_mainnet
54
+ b = mainnet.gas_estimate(STABLE, Eth::Key.new(priv: JEFF).address.to_s, 44_000)
72
55
  refute_nil(b)
73
56
  assert_predicate(b, :positive?)
74
57
  assert_operator(b, :>, 1000)
75
58
  end
76
59
 
77
- def test_checks_same_address_gas_required_on_mainnet
78
- b = mainnet.gas_required(STABLE, STABLE)
79
- refute_nil(b)
80
- assert_predicate(b, :positive?)
81
- end
82
-
83
60
  def test_fails_with_invalid_infura_key
84
61
  skip('Apparently, even with invalid key, Infura returns balance')
85
62
  w = ERC20::Wallet.new(
@@ -107,28 +84,15 @@ class TestWallet < Minitest::Test
107
84
  assert_predicate(b, :zero?)
108
85
  end
109
86
 
110
- def test_checks_gas_required_on_hardhat
111
- on_hardhat do |wallet|
112
- b1 = wallet.gas_required(
113
- Eth::Key.new(priv: JEFF).address.to_s,
114
- Eth::Key.new(priv: WALTER).address.to_s
115
- )
116
- assert_equal(21_597, b1)
117
- b2 = wallet.gas_required(
118
- Eth::Key.new(priv: JEFF).address.to_s,
119
- Eth::Key.new(priv: JEFF).address.to_s
120
- )
121
- assert_equal(b1, b2)
122
- end
123
- end
124
-
125
- def test_checks_eth_gas_required_on_hardhat
87
+ def test_checks_gas_estimate_on_hardhat
88
+ sum = 100_000
126
89
  on_hardhat do |wallet|
127
- b = wallet.eth_gas_required(
90
+ b1 = wallet.gas_estimate(
128
91
  Eth::Key.new(priv: JEFF).address.to_s,
129
- Eth::Key.new(priv: WALTER).address.to_s
92
+ Eth::Key.new(priv: WALTER).address.to_s,
93
+ sum
130
94
  )
131
- assert_equal(21_001, b)
95
+ assert_operator(b1, :>, 21_000)
132
96
  end
133
97
  end
134
98
 
data/test/test__helper.rb CHANGED
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2025 Yegor Bugayenko
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the 'Software'), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
22
5
 
23
6
  $stdout.sync = true
24
7
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: erc20
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.19
4
+ version: 0.0.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-02-17 00:00:00.000000000 Z
11
+ date: 2025-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eth
@@ -99,6 +99,7 @@ files:
99
99
  - ".github/workflows/markdown-lint.yml"
100
100
  - ".github/workflows/pdd.yml"
101
101
  - ".github/workflows/rake.yml"
102
+ - ".github/workflows/reuse.yml"
102
103
  - ".github/workflows/shellcheck.yml"
103
104
  - ".github/workflows/xcop.yml"
104
105
  - ".github/workflows/yamllint.yml"
@@ -112,7 +113,9 @@ files:
112
113
  - Gemfile
113
114
  - Gemfile.lock
114
115
  - LICENSE.txt
116
+ - LICENSES/MIT.txt
115
117
  - README.md
118
+ - REUSE.toml
116
119
  - Rakefile
117
120
  - erc20.gemspec
118
121
  - hardhat/.gitignore