Class: WalletValidator::Sol
- Inherits:
-
Object
- Object
- WalletValidator::Sol
- Defined in:
- lib/wallet_validator/sol.rb
Constant Summary collapse
- MIN_LENGTH =
43
- MAX_LENGTH =
44
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#is_testnet ⇒ Object
readonly
Returns the value of attribute is_testnet.
Instance Method Summary collapse
-
#initialize(address, is_testnet) ⇒ Sol
constructor
A new instance of Sol.
- #valid? ⇒ Boolean
Constructor Details
#initialize(address, is_testnet) ⇒ Sol
Returns a new instance of Sol.
9 10 11 12 |
# File 'lib/wallet_validator/sol.rb', line 9 def initialize(address, is_testnet) @address = address @is_testnet = is_testnet end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
4 5 6 |
# File 'lib/wallet_validator/sol.rb', line 4 def address @address end |
#is_testnet ⇒ Object (readonly)
Returns the value of attribute is_testnet.
4 5 6 |
# File 'lib/wallet_validator/sol.rb', line 4 def is_testnet @is_testnet end |
Instance Method Details
#valid? ⇒ Boolean
14 15 16 17 18 19 20 21 |
# File 'lib/wallet_validator/sol.rb', line 14 def valid? return false if address.length <= MIN_LENGTH return false if address.length > MAX_LENGTH size = Crypto::Base58.base58_to_int(address, "SOL").size size == 32 || size == 33 end |