class CardanoWallet::Shelley::Wallets

API for Wallets @see input-output-hk.github.io/cardano-wallet/api/edge/#tag/Wallets

Public Instance Methods

create(params) click to toggle source

Create a wallet based on the params. @see input-output-hk.github.io/cardano-wallet/api/edge/#operation/postWallet

@example Create wallet from mnemonic sentence

create({name: "Wallet from mnemonic_sentence",
        passphrase: "Secure Passphrase",
        mnemonic_sentence: %w[story egg fun ... ],
       })

@example Create wallet from pub key

create({name: "Wallet from pub key",
        account_public_key: "b47546e...",
        address_pool_gap: 20,
       })
# File lib/cardano_wallet/shelley.rb, line 154
def create(params)
  Utils.verify_param_is_hash!(params)
  self.class.post('/wallets',
                  body: params.to_json,
                  headers: { 'Content-Type' => 'application/json' })
end
delete(wid) click to toggle source

Delete wallet @see input-output-hk.github.io/cardano-wallet/api/edge/#operation/deleteWallet

# File lib/cardano_wallet/shelley.rb, line 163
def delete(wid)
  self.class.delete("/wallets/#{wid}")
end
get(wid) click to toggle source

Get wallet details @see input-output-hk.github.io/cardano-wallet/api/edge/#operation/getWallet

# File lib/cardano_wallet/shelley.rb, line 137
def get(wid)
  self.class.get("/wallets/#{wid}")
end
list() click to toggle source

List all wallets @see input-output-hk.github.io/cardano-wallet/api/edge/#operation/listWallets

# File lib/cardano_wallet/shelley.rb, line 131
def list
  self.class.get('/wallets')
end
update_metadata(wid, params) click to toggle source

Update wallet's metadata @see input-output-hk.github.io/cardano-wallet/api/edge/#operation/putWallet

@example

update_metadata(wid, {name: "New wallet name"})
# File lib/cardano_wallet/shelley.rb, line 172
def update_metadata(wid, params)
  Utils.verify_param_is_hash!(params)
  self.class.put("/wallets/#{wid}",
                 body: params.to_json,
                 headers: { 'Content-Type' => 'application/json' })
end
update_passphrase(wid, params) click to toggle source

Update wallet's passphrase @see input-output-hk.github.io/cardano-wallet/api/edge/#operation/putWalletPassphrase

@example

update_passphrase(wid, {old_passphrase: "Secure Passphrase", new_passphrase: "Securer Passphrase"})
# File lib/cardano_wallet/shelley.rb, line 195
def update_passphrase(wid, params)
  Utils.verify_param_is_hash!(params)
  self.class.put("/wallets/#{wid}/passphrase",
                 body: params.to_json,
                 headers: { 'Content-Type' => 'application/json' })
end
utxo(wid) click to toggle source

See wallet's utxo distribution @see input-output-hk.github.io/cardano-wallet/api/edge/#operation/getUTxOsStatistics

# File lib/cardano_wallet/shelley.rb, line 181
def utxo(wid)
  self.class.get("/wallets/#{wid}/statistics/utxos")
end
utxo_snapshot(wid) click to toggle source

@see input-output-hk.github.io/cardano-wallet/api/edge/#operation/getWalletUtxoSnapshot

# File lib/cardano_wallet/shelley.rb, line 186
def utxo_snapshot(wid)
  self.class.get("/wallets/#{wid}/utxo")
end