coin-address-validators 0.0.2 → 0.0.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/Gemfile.lock +1 -1
- data/build-and-publish.sh +2 -0
- data/lib/coin-address-validators.rb +12 -12
- data/lib/coin-address-validators/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56edfdfd7d5f1a470161a6b023912670965de8d8
|
4
|
+
data.tar.gz: 9d11bd8bec9a018592e5fa10ad59e92133c2b74b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 120653700405dc6acef33ea0dda46c1e68fe77ee923d480d516ed1535bc1f25fa9a5da73f33b4fa3f6a42f5719875ec41fe9263b9e2d028f762c51884734cc54
|
7
|
+
data.tar.gz: 018b1bf5ad16408657d32d444b0d7cd5fe76a068c059a9794386d2c24d7ee30981041946ad1711f1b289b96e2040d196e581d7880495529dc7f8adfa46f7497a
|
data/Gemfile.lock
CHANGED
@@ -71,20 +71,20 @@ class CoinAddressValidators
|
|
71
71
|
|
72
72
|
class BchValidator
|
73
73
|
include Bitcoin::Util
|
74
|
+
def parse_cash_addr(address)
|
75
|
+
if address.start_with?("bitcoincash:")
|
76
|
+
[Cashaddress.to_legacy(address), true]
|
77
|
+
else
|
78
|
+
[Cashaddress.to_legacy("bitcoincash:#{address}"), true]
|
79
|
+
end
|
80
|
+
rescue Cashaddress::Error
|
81
|
+
[nil, false]
|
82
|
+
end
|
83
|
+
|
74
84
|
def valid?(address)
|
75
85
|
return true if valid_address?(address)
|
76
|
-
|
77
|
-
|
78
|
-
return true
|
79
|
-
rescue Cashaddress::Error
|
80
|
-
return false if address.start_with?("bitcoincash:")
|
81
|
-
begin
|
82
|
-
legacy_address = Cashaddress.to_legacy("bitcoincash:" + address)
|
83
|
-
return true
|
84
|
-
rescue Cashaddress::Error
|
85
|
-
return false
|
86
|
-
end
|
87
|
-
end
|
86
|
+
legacy_address, ok = parse_cash_addr(address)
|
87
|
+
ok
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Phuong Nguyen
|
@@ -118,6 +118,7 @@ files:
|
|
118
118
|
- ".gitignore"
|
119
119
|
- Gemfile
|
120
120
|
- Gemfile.lock
|
121
|
+
- build-and-publish.sh
|
121
122
|
- coin-address-validators.gemspec
|
122
123
|
- lib/coin-address-validators.rb
|
123
124
|
- lib/coin-address-validators/version.rb
|