Class: CardanoWallet::Byron::Addresses

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

Overview

Byron addresses

Examples:

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

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

#bulk_import(wid, addresses) ⇒ Object

Import addresses to Byron wallet.

Parameters:

  • wid (String)

    wallet id

  • addresses (Array)

    array of addresses

See Also:



212
213
214
215
216
# File 'lib/cardano_wallet/byron.rb', line 212

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

#create(wid, params) ⇒ Object

Create address for Byron random wallet.

Examples:

Create address with index.

@cw.byron.addresses.create(wid, {passphrase: "Secure Passphrase", address_index: 2147483648})

Create address with random index.

@cw.byron.addresses.create(wid, {passphrase: "Secure Passphrase"})

Parameters:

  • wid (String)

    wallet id

  • params (Hash)

    passphrase and (optional) address_index

See Also:



193
194
195
196
197
198
# File 'lib/cardano_wallet/byron.rb', line 193

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

#import(wid, addr_id) ⇒ Object

Import address to Byron wallet.

Parameters:

  • wid (String)

    wallet id

  • addr_id (String)

    address id

See Also:



204
205
206
# File 'lib/cardano_wallet/byron.rb', line 204

def import(wid, addr_id)
  self.class.put("/byron-wallets/#{wid}/addresses/#{addr_id}")
end

#list(wid, query = {}) ⇒ Object

List Byron addresses.

Examples:

@cw.byron.addresses.list(wid, {state: "used"})

See Also:



179
180
181
182
# File 'lib/cardano_wallet/byron.rb', line 179

def list(wid, query = {})
  query_formatted = query.empty? ? '' : Utils.to_query(query)
  self.class.get("/byron-wallets/#{wid}/addresses#{query_formatted}")
end