Module: StellarBase

Includes:
GemConfig::Base
Defined in:
lib/stellar_base.rb,
lib/stellar_base/engine.rb,
lib/stellar_base/version.rb,
lib/stellar_base/horizon_client.rb,
app/models/stellar_base/stellar_toml.rb,
app/jobs/stellar_base/application_job.rb,
app/models/stellar_base/bridge_callback.rb,
app/models/stellar_base/application_record.rb,
app/models/stellar_base/withdrawal_request.rb,
app/helpers/stellar_base/application_helper.rb,
app/mailers/stellar_base/application_mailer.rb,
app/services/stellar_base/gen_random_string.rb,
app/controllers/stellar_base/home_controller.rb,
app/concepts/stellar_base/application_contract.rb,
app/concepts/stellar_base/application_operation.rb,
app/controllers/stellar_base/withdraw_controller.rb,
app/services/stellar_base/bridge_callbacks/check.rb,
app/services/stellar_base/bridge_callbacks/compare.rb,
app/services/stellar_base/bridge_callbacks/process.rb,
app/controllers/stellar_base/application_controller.rb,
app/services/stellar_base/withdrawal_requests/process.rb,
app/services/stellar_base/withdrawal_requests/gen_memo.rb,
app/controllers/stellar_base/bridge_callbacks_controller.rb,
app/services/stellar_base/bridge_callbacks/get_operation.rb,
app/services/stellar_base/bridge_callbacks/get_transaction.rb,
app/concepts/stellar_base/bridge_callbacks/contracts/create.rb,
app/services/stellar_base/withdrawal_requests/determine_fee.rb,
app/concepts/stellar_base/bridge_callbacks/operations/create.rb,
app/services/stellar_base/bridge_callbacks/verify_mac_payload.rb,
app/concepts/stellar_base/withdrawal_requests/contracts/create.rb,
app/services/stellar_base/withdrawal_requests/call_on_withdraw.rb,
app/concepts/stellar_base/withdrawal_requests/operations/create.rb,
app/services/stellar_base/bridge_callbacks/mac_payloads/compare.rb,
app/concepts/stellar_base/bridge_callbacks/bridge_callback_policy.rb,
app/services/stellar_base/bridge_callbacks/initialize_horizon_client.rb,
app/services/stellar_base/bridge_callbacks/mac_payloads/check_payload.rb,
app/services/stellar_base/bridge_callbacks/mac_payloads/encode_params.rb,
app/services/stellar_base/withdrawal_requests/find_withdrawal_request.rb,
app/services/stellar_base/bridge_callbacks/mac_payloads/decode_mac_key.rb,
app/services/stellar_base/bridge_callbacks/mac_payloads/decode_payload.rb,
app/concepts/stellar_base/withdrawal_requests/withdrawal_request_policy.rb

Defined Under Namespace

Modules: ApplicationHelper, BridgeCallbacks, WithdrawalRequests Classes: ApplicationContract, ApplicationController, ApplicationJob, ApplicationMailer, ApplicationOperation, ApplicationRecord, BridgeCallback, BridgeCallbacksController, Engine, GenRandomString, HomeController, HorizonClient, StellarToml, WithdrawController, WithdrawalRequest

Constant Summary collapse

VERSION =
"0.5.3".freeze

Class Method Summary collapse

Class Method Details

.convert_config_withdraw!Object



44
45
46
47
48
49
50
51
52
53
# File 'lib/stellar_base.rb', line 44

def self.convert_config_withdraw!
  withdrawable_assets = self.configuration.withdrawable_assets
  return if withdrawable_assets.is_a?(Array) || withdrawable_assets.nil?

  array_of_hashes = try_from_yaml_file_path(withdrawable_assets) ||
    try_from_json(withdrawable_assets)

  self.configuration.withdrawable_assets =
    array_of_hashes.map(&:with_indifferent_access)
end

.included_module?(module_name) ⇒ Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/stellar_base.rb', line 40

def self.included_module?(module_name)
  self.configuration.modules&.include?(module_name)
end

.try_from_json(str) ⇒ Object



55
56
57
58
# File 'lib/stellar_base.rb', line 55

def self.try_from_json(str)
  JSON.parse(str)
rescue JSON::ParserError
end

.try_from_yaml_file_path(str) ⇒ Object



60
61
62
63
# File 'lib/stellar_base.rb', line 60

def self.try_from_yaml_file_path(str)
  YAML.load_file(str.to_s)
rescue Errno::ENOENT
end