Class: StellarBase::FindAssetDetails

Inherits:
Object
  • Object
show all
Defined in:
app/services/stellar_base/find_asset_details.rb

Class Method Summary collapse

Class Method Details

.call(operation:, asset_code:) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/services/stellar_base/find_asset_details.rb', line 4

def self.call(operation:, asset_code:)
  return nil if operation.blank?
  return nil if asset_code.blank?

  assets = if operation == "deposit"
             StellarBase.configuration.depositable_assets
           elsif operation == "withdraw"
             StellarBase.configuration.withdrawable_assets
           else
             []
           end
  assets.find {|asset| asset[:asset_code] == asset_code }
end