Class: StellarBase::SubscribeAccount

Inherits:
Object
  • Object
show all
Extended by:
LightService::Organizer
Defined in:
app/services/stellar_base/subscribe_account.rb

Constant Summary collapse

OPERATION_LIMIT =
200

Class Method Summary collapse

Class Method Details

.actionsObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/services/stellar_base/subscribe_account.rb', line 22

def self.actions
  [
    InitStellarClient,
    AccountSubscriptions::GetCursor,
    AccountSubscriptions::GetRemoteOperations,
    iterate(:remote_operations, [
      AccountSubscriptions::GetRemoteTransaction,
      AccountSubscriptions::FindOrCreateTransaction,
      AccountSubscriptions::FindOrCreateOperation,
      AccountSubscriptions::ExecuteAccountSubscriptionCallback,
      AccountSubscriptions::ProcessWithdrawal,
    ]),
    AccountSubscriptions::SaveCursor,
  ]
end

.call(account_subscription, operation_limit: OPERATION_LIMIT, on_account_event: StellarBase.configuration.on_account_event) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/services/stellar_base/subscribe_account.rb', line 7

def self.call(
  ,
  operation_limit: OPERATION_LIMIT,
  on_account_event: StellarBase.configuration.
)
  result = with(
    account_subscription: ,
    operation_limit: operation_limit,
    on_account_event: ,
  ).reduce(actions)

  Rails.logger.warn result.message if result.failure?
  result
end