Class: WalletValidator::Bnb

Inherits:
Btc
  • Object
show all
Defined in:
lib/wallet_validator/bnb.rb

Constant Summary collapse

CURRENCY_ATTR =
{
  "main" => {
    "bech32" => {
      "hrp" => "bnb", # hrp
      "separator" => "1", # separator
    },
  },
  "testnet" => {
    "bech32" => {
      "hrp" => "tbnb", # hrp
      "separator" => "1", # separator
    }
  }
}.freeze

Constants inherited from Btc

WalletValidator::Btc::ALPHA

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Btc

#initialize

Constructor Details

This class inherits a constructor from WalletValidator::Btc

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



4
5
6
# File 'lib/wallet_validator/bnb.rb', line 4

def address
  @address
end

#is_testnetObject (readonly)

Returns the value of attribute is_testnet.



4
5
6
# File 'lib/wallet_validator/bnb.rb', line 4

def is_testnet
  @is_testnet
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/wallet_validator/bnb.rb', line 21

def valid?
  Crypto::Bech32.valid?(address, attribute["bech32"]["hrp"], attribute["bech32"]["separator"])
end