Class: CardanoWallet::Byron::Wallets

Inherits:
CardanoWallet::Base show all
Defined in:
lib/cardano_wallet/byron.rb

Overview

Byron wallets

Examples:

@cw = CardanoWallet.new
@cw.byron.wallets # API for Byron wallets

See Also:

Instance Attribute Summary

Attributes inherited from CardanoWallet::Base

#opt

Instance Method Summary collapse

Methods inherited from CardanoWallet::Base

#byron, #initialize, #misc, #shared, #shelley, #utils

Constructor Details

This class inherits a constructor from CardanoWallet::Base

Instance Method Details

#create(params) ⇒ Object

Create a Byron wallet based on the params.

Examples:

create({style: "random",
        name: "Random Wallet from mnemonic_sentence",
        passphrase: "Secure Passphrase",
        mnemonic_sentence: %w[arctic decade pizza ...],
       })

See Also:



112
113
114
115
116
117
# File 'lib/cardano_wallet/byron.rb', line 112

def create(params)
  Utils.verify_param_is_hash!(params)
  self.class.post('/byron-wallets',
                  body: params.to_json,
                  headers: { 'Content-Type' => 'application/json' })
end

#delete(wid) ⇒ Object

Delete Byron wallet

Examples:

Delete Byron wallet

@cw.byron.wallets.delete(wallet_id)

See Also:



123
124
125
# File 'lib/cardano_wallet/byron.rb', line 123

def delete(wid)
  self.class.delete("/byron-wallets/#{wid}")
end

#get(wid) ⇒ Object

Get Byron wallet details

Examples:

Get Byron wallet details

@cw.byron.wallets.get(wallet_id)

See Also:



99
100
101
# File 'lib/cardano_wallet/byron.rb', line 99

def get(wid)
  self.class.get("/byron-wallets/#{wid}")
end

#listObject

List Byron wallets

Examples:

Get all Byron wallets

@cw.byron.wallets.get

See Also:



91
92
93
# File 'lib/cardano_wallet/byron.rb', line 91

def list
  self.class.get('/byron-wallets')
end

#update_metadata(wid, params) ⇒ Object

Update Byron wallet’s metadata

Examples:

@cw.byron.wallets.(wid, {name: "New wallet name"})

See Also:



132
133
134
135
136
137
# File 'lib/cardano_wallet/byron.rb', line 132

def (wid, params)
  Utils.verify_param_is_hash!(params)
  self.class.put("/byron-wallets/#{wid}",
                 body: params.to_json,
                 headers: { 'Content-Type' => 'application/json' })
end

#update_passphrase(wid, params) ⇒ Object

Update Byron wallet’s passphrase.

Examples:

@cw.byron.wallets.update_passphrase(wid, {old_passphrase: "Secure Passphrase",
                                          new_passphrase: "Securer Passphrase"})

See Also:



160
161
162
163
164
165
# File 'lib/cardano_wallet/byron.rb', line 160

def update_passphrase(wid, params)
  Utils.verify_param_is_hash!(params)
  self.class.put("/byron-wallets/#{wid}/passphrase",
                 body: params.to_json,
                 headers: { 'Content-Type' => 'application/json' })
end

#utxo(wid) ⇒ Object

See Byron wallet’s utxo distribution



143
144
145
# File 'lib/cardano_wallet/byron.rb', line 143

def utxo(wid)
  self.class.get("/byron-wallets/#{wid}/statistics/utxos")
end

#utxo_snapshot(wid) ⇒ Object



150
151
152
# File 'lib/cardano_wallet/byron.rb', line 150

def utxo_snapshot(wid)
  self.class.get("/byron-wallets/#{wid}/utxo")
end