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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7c0aae999751b43b648ba96d17650988e53b1eab
4
- data.tar.gz: f54e3401230894089309f502d7518f85c0c7b09f
3
+ metadata.gz: c0bf22d811102a2fd2ed625ee119be678f21408e
4
+ data.tar.gz: 9e72a532f766048cfbe112307ba163befad6a062
5
5
  SHA512:
6
- metadata.gz: 1b487675d3ac5a29cdaf1813a8e22f34681f02fa2b765f71a705041f84ae18a59458f5b132e7dda15d2071a676d303bc475b67d6098a21fc8fbd9e00717705d8
7
- data.tar.gz: 618c590a7f6f9d6391f48de32115201d0c9b9691e7c5614cf28ea7eea94d86e2645925f13a5438b30077a4d125bbe86df9b3a51d0f0e3f4f99288689bc0c2597
6
+ metadata.gz: aa1a464eff0d0678bf5ce43bf726c9312ea00d64ef45a0a39f3e8bf660c685077a8473dd155f3371d7720b03654d2068028708036aa1ec11636e12d06029f4e9
7
+ data.tar.gz: 521d1b2de4820899e1f29b82c0232725273b4a9d27edcec7606c9cec1c677bd8942ab8357fbcf3d57129c2b7e077c04e5f4326e83a103b65fbb0df4e838d4f2f
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- coin-address-validators (0.0.5)
4
+ coin-address-validators (0.0.6)
5
5
  base_x
6
6
  bitcoin-ruby
7
7
  cashaddress
@@ -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
@@ -1,3 +1,3 @@
1
1
  class CoinAddressValidators
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  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.5
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-09-24 00:00:00.000000000 Z
11
+ date: 2018-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bitcoin-ruby