Class: CardanoWallet::Shelley::Keys

Inherits:
Base
  • Object
show all
Defined in:
lib/cardano_wallet/shelley.rb

Overview

Base class for Shelley Keys API

Examples:

@cw = CardanoWallet.new
@cw.shelley.keys # API for Shelley Keys

Instance Attribute Summary

Attributes inherited from Base

#opt

Instance Method Summary collapse

Methods inherited from Base

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

Constructor Details

This class inherits a constructor from CardanoWallet::Base

Instance Method Details

#create_acc_public_key(wid, index, payload) ⇒ Object



116
117
118
119
120
121
122
# File 'lib/cardano_wallet/shelley.rb', line 116

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

#create_policy_id(wid, policy_script_template) ⇒ Object



146
147
148
149
150
151
# File 'lib/cardano_wallet/shelley.rb', line 146

def create_policy_id(wid, policy_script_template)
  payload = { policy_script_template: policy_script_template }
  self.class.post("/wallets/#{wid}/policy-id",
                  body: payload.to_json,
                  headers: { 'Content-Type' => 'application/json' })
end

#create_policy_key(wid, passphrase, query = {}) ⇒ Object



137
138
139
140
141
142
143
# File 'lib/cardano_wallet/shelley.rb', line 137

def create_policy_key(wid, passphrase, query = {})
  query_formatted = query.empty? ? '' : Utils.to_query(query)
  payload = { passphrase: passphrase }
  self.class.post("/wallets/#{wid}/policy-key#{query_formatted}",
                  body: payload.to_json,
                  headers: { 'Content-Type' => 'application/json' })
end

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



125
126
127
128
# File 'lib/cardano_wallet/shelley.rb', line 125

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_policy_key(wid, query = {}) ⇒ Object



131
132
133
134
# File 'lib/cardano_wallet/shelley.rb', line 131

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

#get_public_key(wid, role, index, query = {}) ⇒ Object



110
111
112
113
# File 'lib/cardano_wallet/shelley.rb', line 110

def get_public_key(wid, role, index, query = {})
  query_formatted = query.empty? ? '' : Utils.to_query(query)
  self.class.get("/wallets/#{wid}/keys/#{role}/#{index}#{query_formatted}")
end

#sign_metadata(wid, role, index, pass, metadata) ⇒ Object



99
100
101
102
103
104
105
106
107
# File 'lib/cardano_wallet/shelley.rb', line 99

def (wid, role, index, pass, )
  payload = { passphrase: pass }
  payload[:metadata] =  if 

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