class CardanoWallet::Shelley::Keys

Base class for Shelley Keys API

Public Instance Methods

create_acc_public_key(wid, index, payload) click to toggle source

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

# File lib/cardano_wallet/shelley.rb, line 111
def create_acc_public_key(wid, index, payload)
  # payload = { passphrase: pass, format: format, purpose: purpose }
  Utils.verify_param_is_hash!(payload)
  self.class.post("/wallets/#{wid}/keys/#{index}",
                  body: payload.to_json,
                  headers: { 'Content-Type' => 'application/json' })
end
get_acc_public_key(wid, query = {}) click to toggle source

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

# File lib/cardano_wallet/shelley.rb, line 120
def get_acc_public_key(wid, query = {})
  query_formatted = query.empty? ? '' : Utils.to_query(query)
  self.class.get("/wallets/#{wid}/keys#{query_formatted}")
end
get_public_key(wid, role, index) click to toggle source

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

# File lib/cardano_wallet/shelley.rb, line 106
def get_public_key(wid, role, index)
  self.class.get("/wallets/#{wid}/keys/#{role}/#{index}")
end
sign_metadata(wid, role, index, pass, metadata) click to toggle source

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

# File lib/cardano_wallet/shelley.rb, line 95
def sign_metadata(wid, role, index, pass, metadata)
  payload = { passphrase: pass }
  payload[:metadata] = metadata if metadata

  self.class.post("/wallets/#{wid}/signatures/#{role}/#{index}",
                  body: payload.to_json,
                  headers: { 'Content-Type' => 'application/json',
                             'Accept' => 'application/octet-stream' })
end