erc20 0.2.2 → 0.2.3
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 +7 -4
- 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: c000b5455dfb26a625500563fa1906f58d441b55b0e03f5e7e60c7e9f308dfd7
|
|
4
|
+
data.tar.gz: 63b09e6727a881dc625c5e68cbef7a301f3f5f9e27d3d5ef07e1d8e4a0a4d4a3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c112d03a57b44edb7e48135340d2b88edcdf6abcb0cc0d4ad0091b94d1e82fbc1fade682b5f4a49a85064e8a2e7efdd7ceba31fc5d772e28608ff6b18efe70d8
|
|
7
|
+
data.tar.gz: 8adfe06ede8c5ba56388c406e59e95fabed750536e8e505bcfacafcb92eb09b059b594f7c8b826be770d36d2b6cd673a7cbb8d7a8dd257e06ecf7e9635ce617a
|
data/bin/erc20
CHANGED
|
@@ -116,12 +116,15 @@ Options are:"
|
|
|
116
116
|
raise 'Address is required' if address.nil?
|
|
117
117
|
log.debug("Sending ERC20 tokens to #{address}")
|
|
118
118
|
amount = opts.arguments[3]
|
|
119
|
-
raise 'Amount argument is required (for example, "19.9usdt")' if amount.nil?
|
|
120
|
-
raise 'Amount is not valid' unless /^[0-9]+(usdt)?$/.match?(amount)
|
|
119
|
+
raise 'Amount argument is required (for example, "19.9usdt" or "$19.9")' if amount.nil?
|
|
121
120
|
if /^[0-9]+$/.match?(amount)
|
|
122
121
|
amount = amount.to_i
|
|
123
|
-
elsif /^[0-9]usdt
|
|
124
|
-
amount = (amount.gsub(/usdt
|
|
122
|
+
elsif /^[0-9]+(\.[0-9]+)?usdt$/.match?(amount)
|
|
123
|
+
amount = (amount.gsub(/usdt$/, '').to_f * 1_000_000).to_i
|
|
124
|
+
elsif /^\$[0-9]+(\.[0-9]+)?$/.match?(amount)
|
|
125
|
+
amount = (amount.gsub(/^\$/, '').to_f * 1_000_000).to_i
|
|
126
|
+
else
|
|
127
|
+
raise "Can't understand amount: #{amount.inspect}"
|
|
125
128
|
end
|
|
126
129
|
log.debug("Sending #{amount} ERC20 tokens")
|
|
127
130
|
puts wallet.pay(priv.private_hex, address, amount)
|
data/lib/erc20/erc20.rb
CHANGED