0.01
No release in over a year
Ruby wrapper over cardano-wallet.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

= 0.6.0
~> 0.19.0
~> 1.45
~> 13.0
~> 3.12

Runtime

~> 0.21.0
 Project Readme
Gem Version

cardano-wallet-rb

Ruby wrapper over cardano-wallet's REST API. Requires running cardano-wallet.

Cardano-wallet-rb is used for e2e testing of cardano-wallet and also as a backend of Ikar.

Installation

In Gemfile:

gem 'cardano_wallet'

Or:

$ gem install cardano_wallet

Documentation

Link Description
Ruby API (edge) cardano-wallet-rb API
REST API (edge) cardano-wallet's REST API

⚠️ Links point to edge APIs corresponding to master branches for both cardano-wallet and cardano-wallet-rb. Refer to release page for API doc suitable for the latest release.

Examples

CW = CardanoWallet.new

BYRON = CW.byron
SHELLEY = CW.shelley
MISC = CW.misc

#Byron
BYRON.wallets.create({name: "Byron",
                       style: "random",
                       mnemonic_sentence: CW.utils.mnemonic_sentence,
                       passphrase: "Secure Passphrase"})

BYRON.wallets.list.each_with_index do |wal, i|
  BYRON.wallets.update_metadata(wal['id'], {name: "Wallet number #{i}"})
end

BYRON.wallets.list.each do |wal|
  puts wal['name']
end

#Shelley
w = SHELLEY.wallets.create({name: "Shelley",
                       mnemonic_sentence: CW.utils.mnemonic_sentence,
                       passphrase: "Secure Passphrase"})

SHELLEY.wallets.get(w['id'])
SHELLEY.wallets.delete(w['id'])

# Transaction
wid = '1f82e...ccd95'
metadata = { "1" => "test"}
tx_c = SHELLEY.transactions.construct(wid, payments = nil, withdrawal = nil, metadata)
tx_s = SHELLEY.transactions.sign(wid, 'Secure Passphrase', tx_c['transaction'])
tx_sub = SHELLEY.transactions.submit(wid, tx_s['transaction'])
puts SHELLEY.transactions.get(wid, tx_sub['id'])

# Delegation
wid = '1f82e...ccd95'
random_stake_pool_id = SHELLEY.stake_pools.list({stake: 10000}).sample['id']
delegation = [{
                "join" => {
                            "pool" => random_stake_pool_id,
                            "stake_key_index" => "0H"
                          }
              }]
tx_c = SHELLEY.transactions.construct(wid, payments = nil, withdrawal = nil, metadata = nil, delegation)
tx_s = SHELLEY.transactions.sign(wid, 'Secure Passphrase', tx_c['transaction'])
tx_sub = SHELLEY.transactions.submit(wid, tx_s['transaction'])
puts SHELLEY.transactions.get(wid, tx_sub['id'])

#Misc
MISC.network.information
MISC.network.clock
MISC.proxy.submit_external_transaction(File.new("/tmp/blob.bin").read)
MISC.utils.addresses("addr_test1vqrlltfahghjxl5sy5h5mvfrrlt6me5fqphhwjqvj5jd88cccqcek")

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/piotr-iohk/cardano-wallet-rb. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the cardano-wallet-rb project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.