class CardanoWallet::Shelley::Assets

Base class for Shelley Assets API

Public Instance Methods

get(wid, policy_id = nil, asset_name = nil) click to toggle source

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

# File lib/cardano_wallet/shelley.rb, line 83
def get(wid, policy_id = nil, asset_name = nil)
  ep = "/wallets/#{wid}/assets"
  ep += "/#{policy_id}" if policy_id
  ep += "/#{asset_name}" if asset_name
  self.class.get(ep)
end
mint(wid, mint_burn, pass, metadata = nil, ttl = nil) click to toggle source

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

# File lib/cardano_wallet/shelley.rb, line 66
def mint(wid, mint_burn, pass, metadata = nil, ttl = nil)
  payload = {
    mint_burn: mint_burn,
    passphrase: pass
  }

  payload[:metadata] = metadata if metadata
  payload[:time_to_live] = { quantity: ttl, unit: 'second' } if ttl

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