module StellarBase
Constants
- VERSION
Public Class Methods
configure_sending_strategy!()
click to toggle source
# File lib/stellar_base.rb, line 87 def self.configure_sending_strategy! sending_strategy = self.configuration.sending_strategy return if !sending_strategy.is_a?(Symbol) self.configuration.sending_strategy = Array(sending_strategy) end
convert_config_deposit!()
click to toggle source
# File lib/stellar_base.rb, line 71 def self.convert_config_deposit! depositable_assets = configuration.depositable_assets return if depositable_assets.is_a?(Array) || depositable_assets.nil? configuration.depositable_assets = convert_config!(depositable_assets) end
convert_config_withdraw!()
click to toggle source
# File lib/stellar_base.rb, line 79 def self.convert_config_withdraw! withdrawable_assets = configuration.withdrawable_assets return if withdrawable_assets.is_a?(Array) || withdrawable_assets.nil? configuration.withdrawable_assets = convert_config!(withdrawable_assets) end
included_module?(module_name)
click to toggle source
# File lib/stellar_base.rb, line 51 def self.included_module?(module_name) configuration.modules&.include?(module_name) end
on_deposit_trigger(network:, deposit_address:, tx_id:, amount:)
click to toggle source
# File lib/stellar_base.rb, line 47 def self.on_deposit_trigger(network:, deposit_address:, tx_id:, amount:) DepositRequests::Trigger.(network, deposit_address, tx_id, amount) end
set_stellar_network!()
click to toggle source
# File lib/stellar_base.rb, line 55 def self.set_stellar_network! stellar_network = configuration.stellar_network case stellar_network when "public" Stellar.default_network = Stellar::Networks::PUBLIC when "testnet" Stellar.default_network = Stellar::Networks::TESTNET else raise( ArgumentError, "'#{stellar_network}' not a valid stellar_network config", ) end end
Private Class Methods
convert_config!(asset_config)
click to toggle source
# File lib/stellar_base.rb, line 93 def self.convert_config!(asset_config) array_of_hashes = try_from_yaml_file_path(asset_config) || try_from_json(asset_config) array_of_hashes.map(&:with_indifferent_access) end
try_from_json(str)
click to toggle source
# File lib/stellar_base.rb, line 101 def self.try_from_json(str) JSON.parse(str) rescue JSON::ParserError end
try_from_yaml_file_path(str)
click to toggle source
# File lib/stellar_base.rb, line 107 def self.try_from_yaml_file_path(str) YAML.load_file(str.to_s) rescue Errno::ENOENT end