Module: StellarBase

Includes:
GemConfig::Base
Defined in:
lib/stellar_base.rb,
lib/stellar_base/engine.rb,
lib/stellar_base/version.rb,
app/models/stellar_base/balance.rb,
app/models/stellar_base/deposit.rb,
lib/stellar_base/horizon_client.rb,
app/models/stellar_base/fee_request.rb,
app/models/stellar_base/stellar_toml.rb,
app/jobs/stellar_base/application_job.rb,
app/services/stellar_base/gen_memo_for.rb,
app/errors/stellar_base/not_found_error.rb,
app/models/stellar_base/bridge_callback.rb,
app/models/stellar_base/deposit_request.rb,
app/models/stellar_base/stellar_payment.rb,
app/twins/stellar_base/application_twin.rb,
app/models/stellar_base/stellar_operation.rb,
app/models/stellar_base/application_record.rb,
app/models/stellar_base/withdrawal_request.rb,
app/helpers/stellar_base/application_helper.rb,
app/jobs/stellar_base/subscribe_account_job.rb,
app/mailers/stellar_base/application_mailer.rb,
app/models/stellar_base/stellar_transaction.rb,
app/services/stellar_base/gen_random_string.rb,
app/services/stellar_base/get_callback_from.rb,
app/services/stellar_base/subscribe_account.rb,
app/twins/stellar_base/deposit_request_twin.rb,
app/controllers/stellar_base/home_controller.rb,
app/models/stellar_base/account_subscription.rb,
app/services/stellar_base/find_asset_details.rb,
app/services/stellar_base/init_stellar_client.rb,
app/concepts/stellar_base/application_contract.rb,
app/services/stellar_base/determine_extra_info.rb,
app/twins/stellar_base/withdrawal_request_twin.rb,
app/concepts/stellar_base/application_operation.rb,
app/controllers/stellar_base/deposit_controller.rb,
app/controllers/stellar_base/balances_controller.rb,
app/controllers/stellar_base/withdraw_controller.rb,
app/services/stellar_base/bridge_callbacks/check.rb,
app/concepts/stellar_base/balances/contracts/show.rb,
app/representers/stellar_base/balance_representer.rb,
app/services/stellar_base/configured_class_runner.rb,
app/concepts/stellar_base/balances/balances_policy.rb,
app/concepts/stellar_base/balances/operations/show.rb,
app/services/stellar_base/bridge_callbacks/compare.rb,
app/services/stellar_base/bridge_callbacks/process.rb,
app/services/stellar_base/deposit_requests/trigger.rb,
app/controllers/stellar_base/application_controller.rb,
app/services/stellar_base/init_asset_sending_client.rb,
app/controllers/stellar_base/fee_requests_controller.rb,
app/jobs/stellar_base/enqueue_subscribe_accounts_job.rb,
app/concepts/stellar_base/fee_requests/contracts/show.rb,
app/representers/stellar_base/application_representer.rb,
app/representers/stellar_base/fee_request_representer.rb,
app/services/stellar_base/deposit_requests/send_asset.rb,
app/services/stellar_base/withdrawal_requests/process.rb,
app/concepts/stellar_base/fee_requests/operations/show.rb,
app/services/stellar_base/deposit_requests/find_config.rb,
app/controllers/stellar_base/bridge_callbacks_controller.rb,
app/services/stellar_base/bridge_callbacks/get_operation.rb,
app/services/stellar_base/deposit_requests/determine_eta.rb,
app/services/stellar_base/deposit_requests/determine_how.rb,
app/concepts/stellar_base/fee_requests/fee_request_policy.rb,
app/representers/stellar_base/deposit_request_representer.rb,
app/services/stellar_base/deposit_requests/create_deposit.rb,
app/services/stellar_base/deposit_requests/update_deposit.rb,
app/services/stellar_base/account_subscriptions/get_cursor.rb,
app/services/stellar_base/bridge_callbacks/get_transaction.rb,
app/concepts/stellar_base/bridge_callbacks/contracts/create.rb,
app/concepts/stellar_base/deposit_requests/contracts/create.rb,
app/services/stellar_base/account_subscriptions/save_cursor.rb,
app/services/stellar_base/withdrawal_requests/determine_fee.rb,
app/concepts/stellar_base/bridge_callbacks/operations/create.rb,
app/concepts/stellar_base/deposit_requests/operations/create.rb,
app/representers/stellar_base/withdrawal_request_representer.rb,
app/services/stellar_base/bridge_callbacks/verify_mac_payload.rb,
app/services/stellar_base/deposit_requests/init_stellar_asset.rb,
app/concepts/stellar_base/withdrawal_requests/contracts/create.rb,
app/services/stellar_base/deposit_requests/init_stellar_amount.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/services/stellar_base/deposit_requests/find_deposit_request.rb,
app/concepts/stellar_base/bridge_callbacks/bridge_callback_policy.rb,
app/concepts/stellar_base/deposit_requests/deposit_request_policy.rb,
app/services/stellar_base/deposit_requests/find_depositable_asset.rb,
app/services/stellar_base/withdrawal_requests/call_fee_fixed_from.rb,
app/services/stellar_base/account_subscriptions/process_withdrawal.rb,
app/services/stellar_base/withdrawal_requests/determine_max_amount.rb,
app/services/stellar_base/bridge_callbacks/initialize_horizon_client.rb,
app/services/stellar_base/account_subscriptions/get_remote_operations.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_withdrawable_asset.rb,
app/services/stellar_base/withdrawal_requests/find_withdrawal_request.rb,
app/services/stellar_base/account_subscriptions/get_remote_transaction.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/services/stellar_base/deposit_requests/init_stellar_issuer_account.rb,
app/concepts/stellar_base/withdrawal_requests/withdrawal_request_policy.rb,
app/services/stellar_base/account_subscriptions/find_or_create_operation.rb,
app/services/stellar_base/deposit_requests/init_stellar_recipient_account.rb,
app/services/stellar_base/fee_requests/call_withdraw_fee_fixed_quote_from.rb,
app/services/stellar_base/account_subscriptions/find_or_create_transaction.rb,
app/services/stellar_base/deposit_requests/init_stellar_distribution_account.rb,
app/services/stellar_base/account_subscriptions/execute_account_subscription_callback.rb

Defined Under Namespace

Modules: AccountSubscriptions, ApplicationHelper, Balances, BridgeCallbacks, DepositRequests, FeeRequests, WithdrawalRequests Classes: AccountSubscription, ApplicationContract, ApplicationController, ApplicationJob, ApplicationMailer, ApplicationOperation, ApplicationRecord, ApplicationRepresenter, ApplicationTwin, Balance, BalanceRepresenter, BalancesController, BridgeCallback, BridgeCallbacksController, ConfiguredClassRunner, Deposit, DepositController, DepositRequest, DepositRequestRepresenter, DepositRequestTwin, DetermineExtraInfo, Engine, EnqueueSubscribeAccountsJob, FeeRequest, FeeRequestRepresenter, FeeRequestsController, FindAssetDetails, GenMemoFor, GenRandomString, GetCallbackFrom, HomeController, HorizonClient, InitAssetSendingClient, InitStellarClient, NotFoundError, StellarOperation, StellarPayment, StellarToml, StellarTransaction, SubscribeAccount, SubscribeAccountJob, WithdrawController, WithdrawalRequest, WithdrawalRequestRepresenter, WithdrawalRequestTwin

Constant Summary collapse

VERSION =
"4.2.1".freeze

Class Method Summary collapse

Class Method Details

.configure_sending_strategy!Object



87
88
89
90
91
# 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!Object



71
72
73
74
75
76
77
# 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!Object



79
80
81
82
83
84
85
# 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) ⇒ Boolean

Returns:

  • (Boolean)


51
52
53
# 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:) ⇒ Object



47
48
49
# 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!Object



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# 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