coin-address-validators 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/coin-address-validators.rb +2 -1
- data/lib/coin-address-validators/version.rb +1 -1
- data/spec/lib/coin-address-validators_spec.rb +8 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0bf22d811102a2fd2ed625ee119be678f21408e
|
4
|
+
data.tar.gz: 9e72a532f766048cfbe112307ba163befad6a062
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa1a464eff0d0678bf5ce43bf726c9312ea00d64ef45a0a39f3e8bf660c685077a8473dd155f3371d7720b03654d2068028708036aa1ec11636e12d06029f4e9
|
7
|
+
data.tar.gz: 521d1b2de4820899e1f29b82c0232725273b4a9d27edcec7606c9cec1c677bd8942ab8357fbcf3d57129c2b7e077c04e5f4326e83a103b65fbb0df4e838d4f2f
|
data/Gemfile.lock
CHANGED
@@ -4,6 +4,7 @@ require 'cashaddress'
|
|
4
4
|
require 'eth'
|
5
5
|
|
6
6
|
class CoinAddressValidators
|
7
|
+
TOKENS = %w[ret]
|
7
8
|
require 'coin-address-validators/version'
|
8
9
|
|
9
10
|
attr_reader :coin
|
@@ -30,6 +31,7 @@ class CoinAddressValidators
|
|
30
31
|
|
31
32
|
def inner_validator_class
|
32
33
|
prefix = coin == "usdt" ? "btc" : coin
|
34
|
+
prefix = TOKENS.include?(coin) ? "eth" : prefix
|
33
35
|
CoinAddressValidators.const_get("#{prefix.capitalize}Validator")
|
34
36
|
end
|
35
37
|
|
@@ -93,5 +95,4 @@ class CoinAddressValidators
|
|
93
95
|
Eth::Utils.valid_address? address
|
94
96
|
end
|
95
97
|
end
|
96
|
-
|
97
98
|
end
|
@@ -33,6 +33,13 @@ RSpec.describe CoinAddressValidators do
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
+
context "ret token" do
|
37
|
+
it "returns correctly" do
|
38
|
+
expect(CoinAddressValidators["ret"].valid?("0xff0a8531f38e5f143a0444d066fad0a0f0833853")).to be_truthy
|
39
|
+
expect(CoinAddressValidators["ret"].valid?("0xff0a8531f38e5f143a0444d066fad0a0f08338534")).to be_falsey
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
36
43
|
context "ltc" do
|
37
44
|
it "returns correctly" do
|
38
45
|
expect(CoinAddressValidators["ltc"].valid?("LajyQBeZaBA1NkZDeY8YT5RYYVRkXMvb2T")).to be_truthy
|
@@ -51,7 +58,7 @@ RSpec.describe CoinAddressValidators do
|
|
51
58
|
end
|
52
59
|
|
53
60
|
context "nil address" do
|
54
|
-
%w(btc bch eth ltc xrp).each do |coin|
|
61
|
+
%w(btc bch eth ltc xrp ret).each do |coin|
|
55
62
|
it "returns false" do
|
56
63
|
expect(CoinAddressValidators[coin].valid?(nil)).to be_falsey
|
57
64
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coin-address-validators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Phuong Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bitcoin-ruby
|