Class: CardanoWallet::Shared::Wallets

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

Overview

API for Wallets

Examples:

@cw = CardanoWallet.new
@cw.shared.wallets # API for Shared Wallets

See Also:

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(params) ⇒ Object

Create a wallet based on the params.

Examples:

Create wallet from mnemonic sentence

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

See Also:



205
206
207
208
209
210
# File 'lib/cardano_wallet/shared.rb', line 205

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

#delete(wid) ⇒ Object

Delete wallet



214
215
216
# File 'lib/cardano_wallet/shared.rb', line 214

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

#get(wid) ⇒ Object

Get wallet details



190
191
192
# File 'lib/cardano_wallet/shared.rb', line 190

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

#listObject

List all wallets



184
185
186
# File 'lib/cardano_wallet/shared.rb', line 184

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

#update_delegation_script(wid, cosigner, acc_pub_key) ⇒ Object

Update delegation script



228
229
230
231
232
# File 'lib/cardano_wallet/shared.rb', line 228

def update_delegation_script(wid, cosigner, acc_pub_key)
  self.class.patch("/shared-wallets/#{wid}/delegation-script-template",
                   body: { cosigner => acc_pub_key }.to_json,
                   headers: { 'Content-Type' => 'application/json' })
end

#update_payment_script(wid, cosigner, acc_pub_key) ⇒ Object

Update payment script



220
221
222
223
224
# File 'lib/cardano_wallet/shared.rb', line 220

def update_payment_script(wid, cosigner, acc_pub_key)
  self.class.patch("/shared-wallets/#{wid}/payment-script-template",
                   body: { cosigner => acc_pub_key }.to_json,
                   headers: { 'Content-Type' => 'application/json' })
end

#utxo(wid) ⇒ Object



235
236
237
# File 'lib/cardano_wallet/shared.rb', line 235

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

#utxo_snapshot(wid) ⇒ Object



240
241
242
# File 'lib/cardano_wallet/shared.rb', line 240

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