Cardano Explorer
A Ruby gem that wraps the Cardano SL Explorer API. At the moment, you can
retrieve summary information on addresses, transactions, and blocks.
Author: Philip Q Nguyen
Copyright: Copyright (c) 2018 Philip Q Nguyen
License: MIT
Info: https://github.com/philipqnguyen/cardano_explorer
Bugs: https://github.com/philipqnguyen/cardano_explorer/issues
If this is useful to you, consider donating Cardano to:
DdzFFzCqrhspCkE7nghFTDKLuVqwXEzYkqzTaZLCZbrKKQEs3Ygy4f6BeP4U6SPLh8yPU4PFpGoBdZejjKG3ksigtkcirrpZusiwzvBy
Installation
Manual:
Run gem install cardano_explorer
Project with Bundler or with Rails
Inside your Gemfile add:
gem 'cardano_explorer'
Then run bundle install
Usage
Address
Find a summary detailing the balance of an Address along with other info.
address_id = 'Ae2tdPwUPEZKmwoy3AU3cXb5Chnasj6mvVNxV1H11997q3VW5ihbSfQwGpm'
address = CardanoExplorer::Address.find address_id
address.summary
Transaction
Find a summary of a Transaction.
transaction_id = '7012fcaabcbc1be16afdaf754125c93e9216058321d4777c13c251d0cb5067fa'
transaction = CardanoExplorer::Transaction.find transaction_id
transaction.summary
Get the latest transactions.
CardanoExplorer::Transaction.latest
Each of these is an instance of CardanoExplorer::Transaction
with its methods.
transactions = CardanoExplorer::Transaction.latest
transactions.first.summary
Block
Find a summary of a Block.
block_id = 'd3fdc8c8ea4050cc87a21cb73110d54e3ec92f8ae76941e8a1957ed6e6a7e0b0'
block = CardanoExplorer::Block.find block_id
block.summary
Genesis
Get a summary of the genesis block
genesis = CardanoExplorer::Genesis.new
genesis.summary
Get the total pages of the genesis block
genesis = CardanoExplorer::Genesis.new
genesis.pages_total
Notes
Denominations: The quantity of ADA coins is in denominations of Lovelaces.
1 ADA == 1,000,000 Lovelaces. Learn more about denominations here:
https://cardanodocs.com/cardano/monetary-policy/#treasury-and-fees
Configuring
You can change the root url like so:
CardanoExplorer.configuration do |config|
config.root_url = 'https://cardanoexplorer.com'
end
Contributing
Issues and pull requests are welcome on GitHub at https://github.com/philipqnguyen/cardano_explorer. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
Development and testing
After checking out the repo, run bundle install
to install dependencies. Then, run bundle exec rake
to run the tests. You can also run bundle console
for an interactive prompt that will allow you to experiment.
Releasing
To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
License
The gem is available as open source under the terms of the MIT License.