Class: CardanoWallet::Shelley::CoinSelections
- Defined in:
- lib/cardano_wallet/shelley.rb
Overview
API for CoinSelections
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#random(wid, payments, withdrawal = nil, metadata = nil) ⇒ Object
Show random coin selection for particular payment.
-
#random_deleg(wid, deleg_action) ⇒ Object
Coin selection -> Delegation action.
Methods inherited from Base
#byron, #initialize, #misc, #shared, #shelley, #utils
Constructor Details
This class inherits a constructor from CardanoWallet::Base
Instance Method Details
#random(wid, payments, withdrawal = nil, metadata = nil) ⇒ Object
Show random coin selection for particular payment
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
# File 'lib/cardano_wallet/shelley.rb', line 266 def random(wid, payments, withdrawal = nil, = nil) Utils.verify_param_is_array!(payments) payments_formatted = if payments.any? { |p| p.key?(:address) || p.key?('address') } payments else Utils.format_payments(payments) end payload = { payments: payments_formatted } payload[:withdrawal] = withdrawal if withdrawal payload[:metadata] = if self.class.post("/wallets/#{wid}/coin-selections/random", debug_output: $stdout, body: payload.to_json, headers: { 'Content-Type' => 'application/json' }) end |
#random_deleg(wid, deleg_action) ⇒ Object
Coin selection -> Delegation action
289 290 291 292 293 294 |
# File 'lib/cardano_wallet/shelley.rb', line 289 def random_deleg(wid, deleg_action) Utils.verify_param_is_hash!(deleg_action) self.class.post("/wallets/#{wid}/coin-selections/random", body: { delegation_action: deleg_action }.to_json, headers: { 'Content-Type' => 'application/json' }) end |