erc20 0.2.4 → 0.2.5

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: 231e88a1813d9ff5cfba23a82717977e402dfa01c1a39d0373c2a5e212a6abf5
4
+ data.tar.gz: c9614714b16800d821096212466c61ef2650c00a5f5c3ec2ca9e63f63a4bec23
5
5
  SHA512:
6
- metadata.gz: 7c2459cfdc15924c674852a078116ad91e0c78fa38e522f4bf1075fb409a8756c7f73f9931206c6f3e16c98119ca278c04a6cd0f2ed7470cb765ab1a35284a87
7
- data.tar.gz: 8ad83464049ed10ec9d261b8ffbd2b1a889d56fc376c2c79fa159fc95f4bba48786fbbab54ab855461f81e10bc551c494a61cd1907f3b5b1636084e9bd04b34e
6
+ metadata.gz: bf8d6d0be5be355bbb54261c0e34c8102019b5c264ce8190f6be2f3256e8f18b6f071b68379826640c20aae739cde7414d0b31587521d512921b7956c2145d65
7
+ data.tar.gz: f63d968b6f87e0ccbd4f3cba7c63ea41062b1e5ee341d88715dd60b74d0932b20a83855f324b6a6b5e74dbb63931c30e5349581cef7d68e6fad2b9714d8413bf
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.5'
29
29
  end
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.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko