erc20 0.2.4 → 0.2.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e5b9458add234faedc7e3827c363cf16b083b2c409b13577a7b30ac601d0ddef
4
- data.tar.gz: 4593c178c97685ec74c1c2bc0855daddf19082c6b9eead27254d79d644c2a0e2
3
+ metadata.gz: 7cd7942c943defda491f59fa29cc3f5aa05fef9afa2291172f9d52f60881fba3
4
+ data.tar.gz: 0ccd463b7c6799d800983dc10bbafbcd4220c79578790863f6fa031dd09d07ad
5
5
  SHA512:
6
- metadata.gz: 7c2459cfdc15924c674852a078116ad91e0c78fa38e522f4bf1075fb409a8756c7f73f9931206c6f3e16c98119ca278c04a6cd0f2ed7470cb765ab1a35284a87
7
- data.tar.gz: 8ad83464049ed10ec9d261b8ffbd2b1a889d56fc376c2c79fa159fc95f4bba48786fbbab54ab855461f81e10bc551c494a61cd1907f3b5b1636084e9bd04b34e
6
+ metadata.gz: 7e0b97b3c470965c061ce1680303083311c37d22b96b766fbb761ced8844558864eff8603fb0dc804c180f04d9155c79112f7c82b2c575b539fbdd6e6b214a0b
7
+ data.tar.gz: 98752411eb97107ea8a1d2dd2c70b14161c8e788bdc0d5508e3fe94d43037737d5174d301fdf17f233e77c24dac44d06830385275d28a2d3581ef61219173672
data/Gemfile CHANGED
@@ -18,7 +18,7 @@ gem 'minitest-retry', '~>0.2', require: false
18
18
  gem 'qbash', '~>0.4', require: false
19
19
  gem 'rake', '~>13.2', require: false
20
20
  gem 'random-port', '~>0.7', require: false
21
- gem 'rdoc', '~>6.17', require: false
21
+ gem 'rdoc', '~>7.0', require: false
22
22
  gem 'rubocop', '~>1.75', require: false
23
23
  gem 'rubocop-minitest', '~>0.38', require: false
24
24
  gem 'rubocop-performance', '~>1.25', require: false
data/Gemfile.lock CHANGED
@@ -38,26 +38,26 @@ GEM
38
38
  multi_test (~> 1.1)
39
39
  sys-uname (~> 1.3)
40
40
  cucumber-ci-environment (11.0.0)
41
- cucumber-core (16.0.0)
42
- cucumber-gherkin (> 33, < 40)
43
- cucumber-messages (> 28, < 33)
41
+ cucumber-core (16.1.1)
42
+ cucumber-gherkin (> 36, < 40)
43
+ cucumber-messages (> 31, < 33)
44
44
  cucumber-tag-expressions (> 6, < 9)
45
45
  cucumber-cucumber-expressions (18.0.1)
46
46
  bigdecimal
47
- cucumber-gherkin (36.1.0)
48
- cucumber-messages (> 25, < 30)
49
- cucumber-html-formatter (22.2.0)
50
- cucumber-messages (> 19, < 31)
51
- cucumber-messages (29.0.1)
47
+ cucumber-gherkin (37.0.1)
48
+ cucumber-messages (>= 31, < 32)
49
+ cucumber-html-formatter (22.3.0)
50
+ cucumber-messages (> 23, < 33)
51
+ cucumber-messages (31.2.0)
52
52
  cucumber-tag-expressions (8.1.0)
53
53
  date (3.5.1)
54
54
  diff-lcs (1.6.2)
55
55
  docile (1.4.1)
56
- donce (0.2.4)
56
+ donce (0.4.0)
57
57
  backtrace (~> 0.3)
58
58
  os (~> 1.1)
59
59
  qbash (~> 0.3)
60
- elapsed (0.2.1)
60
+ elapsed (0.2.2)
61
61
  loog (~> 0.6)
62
62
  tago (~> 0.1)
63
63
  erb (6.0.1)
@@ -80,10 +80,10 @@ GEM
80
80
  faye-websocket (0.12.0)
81
81
  eventmachine (>= 0.12.0)
82
82
  websocket-driver (>= 0.8.0)
83
- ffi (1.17.2-arm64-darwin)
84
- ffi (1.17.2-x64-mingw-ucrt)
85
- ffi (1.17.2-x86_64-darwin)
86
- ffi (1.17.2-x86_64-linux-gnu)
83
+ ffi (1.17.3-arm64-darwin)
84
+ ffi (1.17.3-x64-mingw-ucrt)
85
+ ffi (1.17.3-x86_64-darwin)
86
+ ffi (1.17.3-x86_64-linux-gnu)
87
87
  ffi-compiler (1.3.2)
88
88
  ffi (>= 1.15.5)
89
89
  rake
@@ -103,32 +103,32 @@ GEM
103
103
  memoist3 (1.0.0)
104
104
  mini_mime (1.1.5)
105
105
  mini_portile2 (2.8.9)
106
- minitest (6.0.0)
106
+ minitest (6.0.1)
107
107
  prism (~> 1.5)
108
108
  minitest-reporters (1.7.1)
109
109
  ansi
110
110
  builder
111
111
  minitest (>= 5.0)
112
112
  ruby-progressbar
113
- minitest-retry (0.2.5)
113
+ minitest-retry (0.3.1)
114
114
  minitest (>= 5.0)
115
- multi_json (1.18.0)
115
+ multi_json (1.19.1)
116
116
  multi_test (1.1.0)
117
117
  net-http (0.9.1)
118
118
  uri (>= 0.11.1)
119
119
  openssl (3.3.2)
120
120
  os (1.1.4)
121
121
  parallel (1.27.0)
122
- parser (3.3.10.0)
122
+ parser (3.3.10.1)
123
123
  ast (~> 2.4.1)
124
124
  racc
125
125
  pkg-config (1.6.5)
126
- prism (1.6.0)
126
+ prism (1.8.0)
127
127
  psych (5.3.1)
128
128
  date
129
129
  stringio
130
- public_suffix (7.0.0)
131
- qbash (0.4.8)
130
+ public_suffix (7.0.2)
131
+ qbash (0.5.0)
132
132
  backtrace (> 0)
133
133
  elapsed (> 0)
134
134
  loog (> 0)
@@ -142,13 +142,13 @@ GEM
142
142
  mini_portile2 (~> 2.8)
143
143
  pkg-config (~> 1.5)
144
144
  rubyzip (~> 2.3)
145
- rdoc (6.17.0)
145
+ rdoc (7.1.0)
146
146
  erb
147
147
  psych (>= 4.0.0)
148
148
  tsort
149
149
  regexp_parser (2.11.3)
150
150
  rexml (3.4.4)
151
- rubocop (1.82.0)
151
+ rubocop (1.82.1)
152
152
  json (~> 2.3)
153
153
  language_server-protocol (~> 3.17.0.2)
154
154
  lint_roller (~> 1.1.0)
@@ -159,9 +159,9 @@ GEM
159
159
  rubocop-ast (>= 1.48.0, < 2.0)
160
160
  ruby-progressbar (~> 1.7)
161
161
  unicode-display_width (>= 2.4.0, < 4.0)
162
- rubocop-ast (1.48.0)
162
+ rubocop-ast (1.49.0)
163
163
  parser (>= 3.3.7.2)
164
- prism (~> 1.4)
164
+ prism (~> 1.7)
165
165
  rubocop-minitest (0.38.2)
166
166
  lint_roller (~> 1.1)
167
167
  rubocop (>= 1.75.0, < 2.0)
@@ -236,7 +236,7 @@ DEPENDENCIES
236
236
  qbash (~> 0.4)
237
237
  rake (~> 13.2)
238
238
  random-port (~> 0.7)
239
- rdoc (~> 6.17)
239
+ rdoc (~> 7.0)
240
240
  rubocop (~> 1.75)
241
241
  rubocop-minitest (~> 0.38)
242
242
  rubocop-performance (~> 1.25)
data/bin/erc20 CHANGED
@@ -156,10 +156,17 @@ Options are:"
156
156
  amount = opts.arguments[3]
157
157
  raise 'Amount argument is required' if amount.nil?
158
158
  raise "Amount #{amount.inspect} is not valid" unless /^[0-9]+(\.[0-9]+)?(eth|wei|gwei)?$/.match?(amount)
159
- amount = amount.to_i if /^[0-9]+$/.match?(amount)
160
- amount = amount.gsub(/wei^/, '').to_i if /[0-9]wei+$/.match?(amount)
161
- amount = (amount.gsub(/gwei^/, '').to_f * 1_000_000_000).to_i if /[0-9]gwei+$/.match?(amount)
162
- amount = (amount.gsub(/eth^/, '').to_f * 1_000_000_000_000_000_000).to_i if /[0-9]eth+$/.match?(amount)
159
+ if /^[0-9]+$/.match?(amount)
160
+ amount = amount.to_i
161
+ elsif /[0-9]wei+$/.match?(amount)
162
+ amount = amount.gsub(/wei^/, '').to_i
163
+ elsif /[0-9]gwei+$/.match?(amount)
164
+ amount = (amount.gsub(/gwei^/, '').to_f * 1_000_000_000).to_i
165
+ elsif /[0-9]eth+$/.match?(amount)
166
+ amount = (amount.gsub(/eth^/, '').to_f * 1_000_000_000_000_000_000).to_i
167
+ else
168
+ raise "Can't understand amount: #{amount.inspect}"
169
+ end
163
170
  log.debug("Sending #{amount} wei...")
164
171
  puts wallet.eth_pay(priv.private_hex, address, amount)
165
172
  else
data/features/dry.feature CHANGED
@@ -16,6 +16,22 @@ Feature: Command Line Processing, in Dry Mode
16
16
  When I run bin/erc20 with "eth_balance 0x7232148927F8a580053792f44D4d59d40Fd00ABD --verbose --dry"
17
17
  Then Exit code is zero
18
18
 
19
- Scenario: ERC20 payment can be sent
19
+ Scenario: ERC20 payment can be sent in tokens
20
+ When I run bin/erc20 with "pay --dry --verbose 46feba063e9b59a8ae0dba68abd39a3cb8f52089e776576d6eb1bb5bfec123d1 0x7232148927F8a580053792f44D4d59d40Fd00ABD 10"
21
+ Then Exit code is zero
22
+
23
+ Scenario: ERC20 payment can be sent in dollars
20
24
  When I run bin/erc20 with "pay --dry --verbose 46feba063e9b59a8ae0dba68abd39a3cb8f52089e776576d6eb1bb5bfec123d1 0x7232148927F8a580053792f44D4d59d40Fd00ABD $10"
21
25
  Then Exit code is zero
26
+
27
+ Scenario: ERC20 payment can be sent in USDT
28
+ When I run bin/erc20 with "pay --dry --verbose 46feba063e9b59a8ae0dba68abd39a3cb8f52089e776576d6eb1bb5bfec123d1 0x7232148927F8a580053792f44D4d59d40Fd00ABD 10usdt"
29
+ Then Exit code is zero
30
+
31
+ Scenario: ETH payment can be sent in wei
32
+ When I run bin/erc20 with "eth_pay --dry --verbose 46feba063e9b59a8ae0dba68abd39a3cb8f52089e776576d6eb1bb5bfec123d1 0x7232148927F8a580053792f44D4d59d40Fd00ABD 10000000"
33
+ Then Exit code is zero
34
+
35
+ Scenario: ETH payment can be sent in ETH
36
+ When I run bin/erc20 with "eth_pay --dry --verbose 46feba063e9b59a8ae0dba68abd39a3cb8f52089e776576d6eb1bb5bfec123d1 0x7232148927F8a580053792f44D4d59d40Fd00ABD 1eth"
37
+ Then Exit code is zero
data/lib/erc20/erc20.rb CHANGED
@@ -25,5 +25,5 @@
25
25
  # License:: MIT
26
26
  module ERC20
27
27
  # Current version of the gem (changed by the +.rultor.yml+ on every release)
28
- VERSION = '0.2.4'
28
+ VERSION = '0.2.6'
29
29
  end
@@ -102,12 +102,12 @@ class ERC20::FakeWallet
102
102
  # @param [String] priv Private key, in hex
103
103
  # @param [String] address Public key, in hex
104
104
  # @param [Integer] amount The amount of ERC20 tokens to send
105
- # @param [Integer] gas_limit Optional gas limit
106
- # @param [Integer] gas_price Optional gas price in gwei
105
+ # @param [Integer] limit Optional gas limit
106
+ # @param [Integer] price Optional gas price in gwei
107
107
  # @return [String] Transaction hash
108
- def pay(priv, address, amount, gas_limit: nil, gas_price: nil)
108
+ def pay(priv, address, amount, limit: nil, price: nil)
109
109
  hex = TXN_HASH
110
- @history << { method: :pay, priv:, address:, amount:, gas_limit:, gas_price:, result: hex }
110
+ @history << { method: :pay, priv:, address:, amount:, limit:, price:, result: hex }
111
111
  hex
112
112
  end
113
113
 
@@ -116,11 +116,11 @@ class ERC20::FakeWallet
116
116
  # @param [String] priv Private key, in hex
117
117
  # @param [String] address Public key, in hex
118
118
  # @param [Integer] amount The amount of ETHs to send
119
- # @param [Integer] gas_price Optional gas price in gwei
119
+ # @param [Integer] price Optional gas price in gwei
120
120
  # @return [String] Transaction hash
121
- def eth_pay(priv, address, amount, gas_price: nil)
121
+ def eth_pay(priv, address, amount, price: nil)
122
122
  hex = TXN_HASH
123
- @history << { method: :eth_pay, priv:, address:, amount:, gas_price:, result: hex }
123
+ @history << { method: :eth_pay, priv:, address:, amount:, price:, result: hex }
124
124
  hex
125
125
  end
126
126
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: erc20
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko