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 +4 -4
- data/bin/erc20 +11 -4
- data/features/dry.feature +17 -1
- data/lib/erc20/erc20.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 231e88a1813d9ff5cfba23a82717977e402dfa01c1a39d0373c2a5e212a6abf5
|
|
4
|
+
data.tar.gz: c9614714b16800d821096212466c61ef2650c00a5f5c3ec2ca9e63f63a4bec23
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
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