stellar_base-rails 1.1.2 → 2.0.0.pre.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (23) hide show
  1. checksums.yaml +4 -4
  2. data/app/models/stellar_base/stellar_operation.rb +8 -43
  3. data/app/models/stellar_base/stellar_payment.rb +14 -0
  4. data/app/models/stellar_base/stellar_transaction.rb +6 -45
  5. data/app/services/stellar_base/account_subscriptions/execute_account_subscription_callback.rb +19 -0
  6. data/app/services/stellar_base/account_subscriptions/find_or_create_operation.rb +42 -0
  7. data/app/services/stellar_base/account_subscriptions/find_or_create_transaction.rb +26 -0
  8. data/app/services/stellar_base/account_subscriptions/{get_operations.rb → get_remote_operations.rb} +5 -6
  9. data/app/services/stellar_base/account_subscriptions/get_remote_transaction.rb +17 -0
  10. data/app/services/stellar_base/account_subscriptions/process_withdrawal.rb +14 -0
  11. data/app/services/stellar_base/account_subscriptions/save_cursor.rb +3 -2
  12. data/app/services/stellar_base/subscribe_account.rb +7 -4
  13. data/app/services/stellar_base/withdrawal_requests/call_on_withdraw.rb +3 -2
  14. data/app/services/stellar_base/withdrawal_requests/find_withdrawal_request.rb +22 -11
  15. data/app/services/stellar_base/withdrawal_requests/process.rb +2 -2
  16. data/db/migrate/20181217090323_create_stellar_transactions_and_operations.rb +21 -0
  17. data/lib/stellar_base/factories/stellar_operations.rb +13 -9
  18. data/lib/stellar_base/factories/stellar_transactions.rb +3 -23
  19. data/lib/stellar_base/version.rb +1 -1
  20. data/lib/stellar_base.rb +1 -0
  21. metadata +40 -7
  22. data/app/services/stellar_base/account_subscriptions/execute_callback.rb +0 -18
  23. data/app/services/stellar_base/account_subscriptions/get_tx.rb +0 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a319a99fc2f060ee9f0daad71147adee9690ccb924eed9188fbd96dbfecb4fa
4
- data.tar.gz: a8028f862188d0211e071825534cd7e7ff7d3437dc7bbb011679ea66c4133ca5
3
+ metadata.gz: e77799d69798a3dcad04f791128556561d0ad1c08f5711a2379d1bbcccbc5d64
4
+ data.tar.gz: 9f3f1524dcbc5fe322d41bb753ad035f26383abeeca017c477d10baa64e049b3
5
5
  SHA512:
6
- metadata.gz: 9458ac072fb4656e2a4f28a761a93a4a4116f89afbed22143803b59c205aec589ac71ccad4869671f17005751c1cb707787fa71cbc67cc12e88ea95514868e06
7
- data.tar.gz: b9d982cfbbaf1fb061c0d47b4eb48126c397d55e7148776c380161efad8f9004078a1e365c187476577c7eac4c39612c8812370b6564283db33b6fd9431ecc23
6
+ metadata.gz: f9c6fc4d4f505bd85c2eaf42e2611ceeba8468e771391afcc28a37172d9e90f54c75eeef60419903999f520305ce965c271fb7facc7c130caea537d643d04148
7
+ data.tar.gz: 64274b0663f9a83197375bc81ab405545c0ad8e0ecb46423e69d72e49c45c6e4b1a1db507864ccf586e86ed0005a3b20cc04976053b3cd0c0cc57bb36999dfc8
@@ -1,49 +1,14 @@
1
1
  module StellarBase
2
- class StellarOperation
2
+ class StellarOperation < ApplicationRecord
3
3
 
4
- include Virtus.model
4
+ include Storext.model
5
+ store :data, coder: JSON
5
6
 
6
- attribute :raw, Object
7
- attribute :id, String, default: :default_id, lazy: true
8
- attribute :paging_token, String, default: :default_paging_token, lazy: true
9
- attribute :source_account, String, default: :default_source_account, lazy: true
10
- attribute :type, String, default: :default_type, lazy: true
11
- attribute :type_i, Integer, default: :default_type_i, lazy: true
12
- attribute :created_at, DateTime, default: :default_created_at, lazy: true
13
- attribute :transaction_hash, String, default: :default_transaction_hash, lazy: true
14
- attribute :asset_type, String, default: :default_asset_type, lazy: true
15
- attribute :asset_code, String, default: :default_asset_code, lazy: true
16
- attribute :asset_issuer, String, default: :default_asset_issuer, lazy: true
17
- attribute :from, String, default: :default_from, lazy: true
18
- attribute :to, String, default: :default_to, lazy: true
19
- attribute :amount, BigDecimal, default: :default_amount, lazy: true
20
- attribute :starting_balance, BigDecimal, default: :default_starting_balance, lazy: true
21
- attribute :funder, String, default: :default_funder, lazy: true
22
- attribute :account, String, default: :default_account, lazy: true
7
+ belongs_to(:stellar_transaction, {
8
+ class_name: "StellarBase::StellarTransaction",
9
+ primary_key: :transaction_id,
10
+ foreign_key: :transaction_hash,
11
+ })
23
12
 
24
- private
25
-
26
- %i[
27
- id
28
- paging_token
29
- source_account
30
- type
31
- type_i
32
- created_at
33
- transaction_hash
34
- starting_balance
35
- funder
36
- account
37
- asset_type
38
- asset_code
39
- asset_issuer
40
- from
41
- to
42
- amount
43
- ].each do |attr|
44
- define_method :"default_#{attr}" do
45
- raw.to_hash[attr.to_s]
46
- end
47
- end
48
13
  end
49
14
  end
@@ -0,0 +1,14 @@
1
+ module StellarBase
2
+ class StellarPayment < StellarOperation
3
+
4
+ store_attributes :data do
5
+ amount BigDecimal
6
+ asset_code String
7
+ asset_issuer Boolean
8
+ asset_type String
9
+ from String
10
+ to String
11
+ end
12
+
13
+ end
14
+ end
@@ -1,50 +1,11 @@
1
1
  module StellarBase
2
- class StellarTransaction
2
+ class StellarTransaction < ApplicationRecord
3
3
 
4
- include Virtus.model
5
-
6
- attribute :raw, Object
7
- attribute :id, String, default: :default_id, lazy: true
8
- attribute :paging_token, String, default: :default_paging_token, lazy: true
9
- attribute :ledger, Integer, default: :default_ledger, lazy: true
10
- attribute :created_at, DateTime, default: :default_created_at, lazy: true
11
- attribute :source_account, String, default: :default_source_account, lazy: true
12
- attribute :source_account_sequence, String, default: :default_source_account_sequence, lazy: true
13
- attribute :fee_paid, Integer, default: :default_fee_paid, lazy: true
14
- attribute :operation_count, Integer, default: :default_operation_count, lazy: true
15
- attribute :envelope_xdr, String, default: :default_envelope_xdr, lazy: true
16
- attribute :result_xdr, String, default: :default_result_xdr, lazy: true
17
- attribute :result_meta_xdr, String, default: :default_result_meta_xdr, lazy: true
18
- attribute :fee_meta_xdr, String, default: :default_fee_meta_xdr, lazy: true
19
- attribute :memo_type, String, default: :default_memo_type, lazy: true
20
- attribute :memo, String, default: :default_memo, lazy: true
21
- attribute :signatures, Array, default: :default_signatures, lazy: true
22
- attribute :valid_after, DateTime, default: :default_valid_after, lazy: true
23
-
24
- private
25
-
26
- %i[
27
- id
28
- paging_token
29
- ledger
30
- created_at
31
- source_account
32
- source_account_sequence
33
- fee_paid
34
- operation_count
35
- envelope_xdr
36
- result_xdr
37
- result_meta_xdr
38
- fee_meta_xdr
39
- memo_type
40
- memo
41
- signatures
42
- valid_after
43
- ].each do |attr|
44
- define_method :"default_#{attr}" do
45
- raw.to_hash[attr.to_s]
46
- end
47
- end
4
+ has_many(:stellar_operations, {
5
+ class_name: "StellarBase::StellarOperation",
6
+ primary_key: :transaction_id,
7
+ foreign_key: :transaction_hash,
8
+ })
48
9
 
49
10
  end
50
11
  end
@@ -0,0 +1,19 @@
1
+ module StellarBase
2
+ module AccountSubscriptions
3
+ class ExecuteAccountSubscriptionCallback
4
+
5
+ extend LightService::Action
6
+ expects(*%i[
7
+ account_subscription
8
+ stellar_operation
9
+ on_account_event
10
+ ])
11
+
12
+ executed do |c|
13
+ next c if c.on_account_event.nil?
14
+ c.on_account_event.(c.account_subscription.address, c.stellar_operation)
15
+ end
16
+
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,42 @@
1
+ module StellarBase
2
+ module AccountSubscriptions
3
+ class FindOrCreateOperation
4
+
5
+ extend LightService::Action
6
+ expects :remote_operation
7
+ promises :stellar_operation
8
+
9
+ SUPPORTED_TYPES = %w(payment).freeze
10
+
11
+ executed do |c|
12
+ remote_operation = c.remote_operation
13
+
14
+ c.stellar_operation = StellarOperation.
15
+ find_by(operation_id: remote_operation["id"])
16
+
17
+ next c if c.stellar_operation.present?
18
+
19
+ if SUPPORTED_TYPES.include?(remote_operation["type"])
20
+ klass = StellarBase.
21
+ const_get("stellar_#{remote_operation["type"]}".classify)
22
+ c.stellar_operation = klass.create!(
23
+ operation_id: remote_operation["id"],
24
+ transaction_hash: remote_operation["transaction_hash"],
25
+ asset_code: remote_operation["asset_code"],
26
+ asset_issuer: remote_operation["asset_issuer"],
27
+ from: remote_operation["from"],
28
+ to: remote_operation["to"],
29
+ amount: remote_operation["amount"],
30
+ )
31
+ else
32
+ c.stellar_operation = StellarOperation.create!(
33
+ operation_id: remote_operation["id"],
34
+ transaction_hash: remote_operation["transaction_hash"],
35
+ )
36
+ end
37
+
38
+ end
39
+
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,26 @@
1
+ module StellarBase
2
+ module AccountSubscriptions
3
+ class FindOrCreateTransaction
4
+
5
+ extend LightService::Action
6
+ expects :remote_transaction
7
+ promises :stellar_transaction
8
+
9
+ executed do |c|
10
+ remote_transaction = c.remote_transaction
11
+
12
+ c.stellar_transaction = StellarTransaction.
13
+ find_by(transaction_id: remote_transaction["id"])
14
+
15
+ next c if c.stellar_transaction.present?
16
+
17
+ c.stellar_transaction = StellarTransaction.create!(
18
+ transaction_id: remote_transaction["id"],
19
+ memo: remote_transaction["memo"],
20
+ memo_type: remote_transaction["memo_type"],
21
+ )
22
+ end
23
+
24
+ end
25
+ end
26
+ end
@@ -1,6 +1,6 @@
1
1
  module StellarBase
2
2
  module AccountSubscriptions
3
- class GetOperations
3
+ class GetRemoteOperations
4
4
 
5
5
  extend LightService::Action
6
6
  expects(
@@ -9,19 +9,18 @@ module StellarBase
9
9
  :stellar_sdk_client,
10
10
  :operation_limit,
11
11
  )
12
- promises :operations
12
+ promises :remote_operations
13
13
 
14
14
  executed do |c|
15
15
  address = c.account_subscription.address
16
16
 
17
- c.operations = c.stellar_sdk_client
17
+ c.remote_operations = c.stellar_sdk_client
18
18
  .horizon
19
19
  .account(account_id: address)
20
20
  .operations(order: "asc", cursor: c.cursor, limit: c.operation_limit)
21
- .records
22
- .map { |op| StellarOperation.new(raw: op) }
21
+ .records.map(&:to_hash)
23
22
 
24
- if c.operations.empty?
23
+ if c.remote_operations.empty?
25
24
  c.fail_and_return! "No operations found for #{address}"
26
25
  end
27
26
  rescue Faraday::ClientError => e
@@ -0,0 +1,17 @@
1
+ module StellarBase
2
+ module AccountSubscriptions
3
+ class GetRemoteTransaction
4
+
5
+ extend LightService::Action
6
+ expects :stellar_sdk_client, :remote_operation
7
+ promises :remote_transaction
8
+
9
+ executed do |c|
10
+ hash = c.remote_operation["transaction_hash"]
11
+ c.remote_transaction = c.stellar_sdk_client.horizon.
12
+ transaction(hash: hash).to_hash
13
+ end
14
+
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,14 @@
1
+ module StellarBase
2
+ module AccountSubscriptions
3
+ class ProcessWithdrawal
4
+
5
+ extend LightService::Action
6
+ expects :stellar_operation
7
+
8
+ executed do |c|
9
+ WithdrawalRequests::Process.(c.stellar_operation)
10
+ end
11
+
12
+ end
13
+ end
14
+ end
@@ -3,10 +3,11 @@ module StellarBase
3
3
  class SaveCursor
4
4
 
5
5
  extend LightService::Action
6
- expects :account_subscription, :operations
6
+ expects :account_subscription, :remote_operations
7
7
 
8
8
  executed do |c|
9
- c.account_subscription.update!(cursor: c.operations.last.id)
9
+ last_operation = c.remote_operations.last
10
+ c.account_subscription.update!(cursor: last_operation["id"])
10
11
  end
11
12
 
12
13
  end
@@ -23,10 +23,13 @@ module StellarBase
23
23
  [
24
24
  InitStellarClient,
25
25
  AccountSubscriptions::GetCursor,
26
- AccountSubscriptions::GetOperations,
27
- iterate(:operations, [
28
- AccountSubscriptions::GetTx,
29
- AccountSubscriptions::ExecuteCallback,
26
+ AccountSubscriptions::GetRemoteOperations,
27
+ iterate(:remote_operations, [
28
+ AccountSubscriptions::GetRemoteTransaction,
29
+ AccountSubscriptions::FindOrCreateTransaction,
30
+ AccountSubscriptions::FindOrCreateOperation,
31
+ AccountSubscriptions::ExecuteAccountSubscriptionCallback,
32
+ AccountSubscriptions::ProcessWithdrawal,
30
33
  ]),
31
34
  AccountSubscriptions::SaveCursor,
32
35
  ]
@@ -3,14 +3,15 @@ module StellarBase
3
3
  class CallOnWithdraw
4
4
 
5
5
  extend LightService::Action
6
- expects :withdrawal_request, :bridge_callback, :on_withdraw
6
+ expects :withdrawal_request, :stellar_operation, :on_withdraw
7
7
 
8
8
  ON_WITHDRAW_ERROR = "`on_withdraw` must be a string of an object " \
9
9
  "that responds to `.call` or the object itself"
10
10
 
11
11
  executed do |c|
12
+ next c if c.on_withdraw.nil?
12
13
  callback = callback_from(c.on_withdraw)
13
- callback.(c.withdrawal_request, c.bridge_callback)
14
+ callback.(c.withdrawal_request, c.stellar_operation)
14
15
  end
15
16
 
16
17
  def self.callback_from(on_withdraw)
@@ -3,33 +3,44 @@ module StellarBase
3
3
  class FindWithdrawalRequest
4
4
 
5
5
  extend LightService::Action
6
- expects :bridge_callback
6
+ expects :stellar_operation
7
7
  promises :withdrawal_request
8
8
 
9
- MATCH_WITHDRAWAL_REQUEST_TO_BRIDGE_CALLBACK_MAP = {
10
- asset_code: :asset_code,
11
- issuer: :asset_issuer,
9
+ MATCH_WITHDRAWAL_REQUEST_TO_STELLAR_TX_MAP = {
12
10
  memo_type: :memo_type,
13
11
  memo: :memo,
14
12
  }.freeze
15
13
 
14
+ MATCH_WITHDRAWAL_REQUEST_TO_STELLAR_OP_MAP = {
15
+ asset_code: :asset_code,
16
+ issuer: :asset_issuer,
17
+ }.freeze
18
+
16
19
  executed do |c|
17
- bridge_callback = c.bridge_callback
18
- c.withdrawal_request = withdrawal_request = WithdrawalRequest.
19
- find_by(memo: bridge_callback.memo)
20
+ stellar_operation = c.stellar_operation
21
+ stellar_transaction = stellar_operation.stellar_transaction
22
+
23
+ c.withdrawal_request = withdrawal_request =
24
+ WithdrawalRequest.find_by(memo: stellar_transaction.memo)
20
25
 
21
26
  if withdrawal_request.nil?
22
27
  c.skip_remaining!
23
28
  next c
24
29
  end
25
30
 
26
- map = MATCH_WITHDRAWAL_REQUEST_TO_BRIDGE_CALLBACK_MAP
27
- mismatch = map.any? do |withdrawal_request_attr, bridge_callback_attr|
31
+ tx_map = MATCH_WITHDRAWAL_REQUEST_TO_STELLAR_TX_MAP
32
+ mismatch_tx = tx_map.any? do |withdrawal_request_attr, stellar_tx_attr|
33
+ withdrawal_request.send(withdrawal_request_attr) !=
34
+ stellar_transaction.send(stellar_tx_attr)
35
+ end
36
+
37
+ op_map = MATCH_WITHDRAWAL_REQUEST_TO_STELLAR_OP_MAP
38
+ mismatch_op = op_map.any? do |withdrawal_request_attr, stellar_op_attr|
28
39
  withdrawal_request.send(withdrawal_request_attr) !=
29
- bridge_callback.send(bridge_callback_attr)
40
+ stellar_operation.send(stellar_op_attr)
30
41
  end
31
42
 
32
- if mismatch
43
+ if [mismatch_tx, mismatch_op].any?
33
44
  c.skip_remaining!
34
45
  next c
35
46
  end
@@ -5,11 +5,11 @@ module StellarBase
5
5
  extend LightService::Organizer
6
6
 
7
7
  def self.call(
8
- bridge_callback,
8
+ operation,
9
9
  on_withdraw: StellarBase.configuration.on_withdraw
10
10
  )
11
11
  with(
12
- bridge_callback: bridge_callback,
12
+ stellar_operation: operation,
13
13
  on_withdraw: on_withdraw,
14
14
  ).reduce(actions)
15
15
  end
@@ -0,0 +1,21 @@
1
+ class CreateStellarTransactionsAndOperations < ActiveRecord::Migration[5.2]
2
+ def change
3
+ create_table :stellar_base_stellar_operations do |t|
4
+ t.string :operation_id, null: false
5
+ t.string :transaction_hash, null: false
6
+ t.string :type
7
+ t.text :data
8
+ t.index :operation_id, unique: true
9
+ t.timestamps
10
+ end
11
+
12
+ create_table :stellar_base_stellar_transactions do |t|
13
+ t.string :transaction_id, null: false
14
+ t.string :memo
15
+ t.string :memo_type
16
+ t.index :memo
17
+ t.index :transaction_id, unique: true
18
+ t.timestamps
19
+ end
20
+ end
21
+ end
@@ -2,20 +2,24 @@ FactoryBot.define do
2
2
  factory(:stellar_base_stellar_operation, {
3
3
  class: "StellarBase::StellarOperation"
4
4
  }) do
5
- id "id"
6
- paging_token "1234"
7
- source_account "G-TEST"
8
- type "payment"
9
- type_i { 1 }
10
- created_at { Time.zone.now }
5
+ operation_id "id"
11
6
  transaction_hash "tx1234"
12
- asset_type "native"
7
+ association(:stellar_transaction, {
8
+ factory: :stellar_base_stellar_transaction,
9
+ })
10
+ end
11
+
12
+ factory(:stellar_base_stellar_payment, {
13
+ class: "StellarBase::StellarPayment",
14
+ parent: :stellar_base_stellar_operation,
15
+ }) do
13
16
  asset_code nil
14
17
  asset_issuer nil
15
18
  from "G-SOURCE"
16
19
  to "G-RECIPIENT"
17
20
  amount 10.0
18
-
19
- skip_create
21
+ association(:stellar_transaction, {
22
+ factory: :stellar_base_stellar_transaction,
23
+ })
20
24
  end
21
25
  end
@@ -1,27 +1,7 @@
1
1
  FactoryBot.define do
2
2
  factory :stellar_base_stellar_transaction, class: "StellarBase::StellarTransaction" do
3
- id { "1234" }
4
- paging_token { "1234" }
5
- ledger { 120 }
6
- created_at { DateTime.parse("2018-10-04T09:36:18Z") }
7
- source_account { "G-SOURCE" }
8
- source_account_sequence { "1" }
9
- fee_paid { 1000 }
10
- operation_count { 10 }
11
- envelope_xdr { "AAA" }
12
- result_xdr { "BBB" }
13
- result_meta_xdr { "CCC" }
14
- fee_meta_xdr { "DDD" }
15
- memo_type { "none" }
16
- signatures do
17
- [
18
- "SIG1===",
19
- "SIG2===",
20
- "SIG3===",
21
- "SIG4===",
22
- ]
23
- end
24
-
25
- skip_create
3
+ transaction_id { "1234" }
4
+ memo_type { "text" }
5
+ memo { "VBA" }
26
6
  end
27
7
  end
@@ -1,3 +1,3 @@
1
1
  module StellarBase
2
- VERSION = "1.1.2".freeze
2
+ VERSION = "2.0.0-alpha.1".freeze
3
3
  end
data/lib/stellar_base.rb CHANGED
@@ -13,6 +13,7 @@ require "representable"
13
13
  require "toml-rb"
14
14
  require "sidekiq"
15
15
  require "sidekiq-unique-jobs"
16
+ require "storext"
16
17
 
17
18
  require "stellar_base/engine"
18
19
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stellar_base-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 2.0.0.pre.alpha.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ace Subido
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-15 00:00:00.000000000 Z
11
+ date: 2018-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: disposable
@@ -178,6 +178,20 @@ dependencies:
178
178
  - - ">="
179
179
  - !ruby/object:Gem::Version
180
180
  version: 0.18.0
181
+ - !ruby/object:Gem::Dependency
182
+ name: storext
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: '2.0'
188
+ type: :runtime
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: '2.0'
181
195
  - !ruby/object:Gem::Dependency
182
196
  name: toml-rb
183
197
  requirement: !ruby/object:Gem::Requirement
@@ -304,6 +318,20 @@ dependencies:
304
318
  - - ">="
305
319
  - !ruby/object:Gem::Version
306
320
  version: '0'
321
+ - !ruby/object:Gem::Dependency
322
+ name: shoulda-matchers
323
+ requirement: !ruby/object:Gem::Requirement
324
+ requirements:
325
+ - - ">="
326
+ - !ruby/object:Gem::Version
327
+ version: '0'
328
+ type: :development
329
+ prerelease: false
330
+ version_requirements: !ruby/object:Gem::Requirement
331
+ requirements:
332
+ - - ">="
333
+ - !ruby/object:Gem::Version
334
+ version: '0'
307
335
  - !ruby/object:Gem::Dependency
308
336
  name: sqlite3
309
337
  requirement: !ruby/object:Gem::Requirement
@@ -433,6 +461,7 @@ files:
433
461
  - app/models/stellar_base/deposit.rb
434
462
  - app/models/stellar_base/deposit_request.rb
435
463
  - app/models/stellar_base/stellar_operation.rb
464
+ - app/models/stellar_base/stellar_payment.rb
436
465
  - app/models/stellar_base/stellar_toml.rb
437
466
  - app/models/stellar_base/stellar_transaction.rb
438
467
  - app/models/stellar_base/withdrawal_request.rb
@@ -440,10 +469,13 @@ files:
440
469
  - app/representers/stellar_base/balance_representer.rb
441
470
  - app/representers/stellar_base/deposit_request_representer.rb
442
471
  - app/representers/stellar_base/withdrawal_request_representer.rb
443
- - app/services/stellar_base/account_subscriptions/execute_callback.rb
472
+ - app/services/stellar_base/account_subscriptions/execute_account_subscription_callback.rb
473
+ - app/services/stellar_base/account_subscriptions/find_or_create_operation.rb
474
+ - app/services/stellar_base/account_subscriptions/find_or_create_transaction.rb
444
475
  - app/services/stellar_base/account_subscriptions/get_cursor.rb
445
- - app/services/stellar_base/account_subscriptions/get_operations.rb
446
- - app/services/stellar_base/account_subscriptions/get_tx.rb
476
+ - app/services/stellar_base/account_subscriptions/get_remote_operations.rb
477
+ - app/services/stellar_base/account_subscriptions/get_remote_transaction.rb
478
+ - app/services/stellar_base/account_subscriptions/process_withdrawal.rb
447
479
  - app/services/stellar_base/account_subscriptions/save_cursor.rb
448
480
  - app/services/stellar_base/bridge_callbacks/check.rb
449
481
  - app/services/stellar_base/bridge_callbacks/compare.rb
@@ -495,6 +527,7 @@ files:
495
527
  - db/migrate/20181001070647_create_stellar_base_deposits.rb
496
528
  - db/migrate/20181003072138_create_stellar_base_account_subscriptions.rb
497
529
  - db/migrate/20181210043919_add_unique_index_to_deposits.rb
530
+ - db/migrate/20181217090323_create_stellar_transactions_and_operations.rb
498
531
  - lib/stellar_base-rails.rb
499
532
  - lib/stellar_base.rb
500
533
  - lib/stellar_base/engine.rb
@@ -525,9 +558,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
525
558
  version: '0'
526
559
  required_rubygems_version: !ruby/object:Gem::Requirement
527
560
  requirements:
528
- - - ">="
561
+ - - ">"
529
562
  - !ruby/object:Gem::Version
530
- version: '0'
563
+ version: 1.3.1
531
564
  requirements: []
532
565
  rubyforge_project:
533
566
  rubygems_version: 2.7.7
@@ -1,18 +0,0 @@
1
- module StellarBase
2
- module AccountSubscriptions
3
- class ExecuteCallback
4
-
5
- extend LightService::Action
6
- expects :account_subscription, :tx, :operation, :on_account_event
7
-
8
- executed do |c|
9
- c.on_account_event.(
10
- c.account_subscription.address,
11
- c.tx,
12
- c.operation,
13
- )
14
- end
15
-
16
- end
17
- end
18
- end
@@ -1,17 +0,0 @@
1
- module StellarBase
2
- module AccountSubscriptions
3
- class GetTx
4
-
5
- extend LightService::Action
6
- expects :stellar_sdk_client, :operation
7
- promises :tx
8
-
9
- executed do |c|
10
- hash = c.operation.transaction_hash
11
- tx_json = c.stellar_sdk_client.horizon.transaction(hash: hash)
12
- c.tx = StellarTransaction.new(raw: tx_json)
13
- end
14
-
15
- end
16
- end
17
- end