![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
adequate_crypto_address
Advanced tools
Simple wallet address validator and normalizer for cryptocurrencies addresses in Ruby.
Inspired by ognus/wallet-address-validator.
Add this line to your application's Gemfile:
gem 'adequate_crypto_address'
Or install it yourself as:
gem install adequate_crypto_address
:bitcoin
or 'BTC'
or :btc
or 'BitCoin'
Returns true if the address (string) is a valid wallet address for the crypto currency specified, see below for supported currencies.
'bitcoin'
or 'BTC'
types: :segwit_v0_keyhash :segwit_v0_scripthash :hash160 :p2sh
'bitcoincash'
or 'BCH'
types: :p2sh :p2pkh :p2pkhtest :p2shtest
'dash'
or 'DASH'
types: :prod :test
'zcash'
or 'ZEC'
types: :prod :test
'ethereum'
or 'ETH'
'ripple'
or 'XRP'
'TON'
'monero'
require 'adequate_crypto_address'
# BTC
AdequateCryptoAddress.valid?('12QeMLzSrB8XH8FvEzPMVoRxVAzTr5XM2y', 'BTC') #=> true
AdequateCryptoAddress.valid?('3NJZLcZEEYBpxYEUGewU4knsQRn1WM5Fkt', :bitcoin, :p2sh) #=> true
# BCH
AdequateCryptoAddress.valid?('bitcoincash:qrtj3rd8524cndt2eew3s6wljqggmne00sgh4kfypk', :bch) #=> true
AdequateCryptoAddress.valid?('mmRH4e9WW4ekZUP5HvBScfUyaSUjfQRyvD', :BCH, :p2pkhtest) #=> true
# ETH
AdequateCryptoAddress.valid?('0xde709f2102306220921060314715629080e2fb77', :ETH) #=> true
AdequateCryptoAddress.valid?('de709f2102306220921060314715629080e2fb77', :ethereum) #=> true
require 'adequate_crypto_address'
# BCH
AdequateCryptoAddress.address('mmRH4e9WW4ekZUP5HvBScfUyaSUjfQRyvD', 'bch').cash_address #=> "bchtest:qpqtmmfpw79thzq5z7s0spcd87uhn6d34uqqem83hf"
AdequateCryptoAddress.address('bitcoincash:qrtj3rd8524cndt2eew3s6wljqggmne00sgh4kfypk', 'bch').legacy_address #=> "1LcerwTc1oPsMtByDCNUXFxReZpN1EXHoe"
address_string = 'qrtj3rd8524cndt2eew3s6wljqggmne00sgh4kfypk'
addr = AdequateCryptoAddress.address(address_string, 'bch')
addr.prefix #=> "bitcoincash"
addr.type #=> :p2pkh
addr.address #=> "bitcoincash:qrtj3rd8524cndt2eew3s6wljqggmne00sgh4kfypk"
# ETH
AdequateCryptoAddress.address('D1220A0cf47c7B9Be7A2E6BA89F429762e7b9aDb', 'eth').address #=> "0xD1220A0cf47c7B9Be7A2E6BA89F429762e7b9aDb"
class Model < ActiveRecord::Base
attribute :address, :string
attribute :dest_tag, :string
attribute :currency, :string
validate :validate_address_type
validate :validate_destination_tag
def validate_address_type
errors.add(:address, 'invalid address') unless AdequateCryptoAddress.valid?(address, currency)
end
# for Ripple
def validate_destination_tag
errors.add(:dest_tag, 'invalid destination tag') if dest_tag.present? && !(dest_tag =~ /\A\d{1,10}\z/)
end
end
# frozen_string_literal: true
# for Rails /config/initializers/adequate_crypto_address.rb
module AdequateCryptoAddress
class Coin
attr_reader :address
def initialize(address_sring)
@address = address_sring
end
def valid?(_type)
address.present?
end
end
end
AdequateCryptoAddress.valid?('addr', :coin) #=> true
Run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
bundle install
bundle exec rake spec
Bug reports and pull requests are welcome on GitHub at https://github.com/vtm9/adequate_crypto_address/issues
FAQs
Unknown package
We found that adequate_crypto_address demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.