From ba5bbc4aaba2aff786b623baa43855ea904cfa0d Mon Sep 17 00:00:00 2001 From: Timur Ramazanov Date: Mon, 29 Nov 2021 21:18:31 +0300 Subject: [PATCH 1/2] feat: serve claimable balances from Horizon --- base/lib/stellar/asset.rb | 4 +- base/lib/stellar/claim_predicate.rb | 48 ++ base/lib/stellar/dsl.rb | 19 +- base/spec/lib/stellar/asset_spec.rb | 8 + base/spec/lib/stellar/claim_predicate_spec.rb | 106 ++- horizon/lib/stellar-horizon.rb | 3 +- .../stellar/horizon/claimable_balance_page.rb | 11 + horizon/lib/stellar/horizon/client.rb | 27 +- .../{transaction_page.rb => resource_page.rb} | 15 +- .../fetches_claimable_balances.yml | 670 ++++++++++++++++++ ...fetches_only_balances_with_given_asset.yml | 271 +++++++ ...ches_only_balances_with_given_claimant.yml | 247 +++++++ .../fetches_balances_strating_from_cursor.yml | 670 ++++++++++++++++++ .../fetches_claimable_balances.yml | 670 ++++++++++++++++++ ...tches_only_balances_with_given_sponsor.yml | 271 +++++++ .../spec/lib/stellar/horizon/client_spec.rb | 62 +- 16 files changed, 3058 insertions(+), 44 deletions(-) create mode 100644 horizon/lib/stellar/horizon/claimable_balance_page.rb rename horizon/lib/stellar/horizon/{transaction_page.rb => resource_page.rb} (57%) create mode 100644 horizon/spec/fixtures/vcr_cassettes/Stellar_Horizon_Client/_claimable_balances/fetches_claimable_balances.yml create mode 100644 horizon/spec/fixtures/vcr_cassettes/Stellar_Horizon_Client/_claimable_balances/with_asset_set/fetches_only_balances_with_given_asset.yml create mode 100644 horizon/spec/fixtures/vcr_cassettes/Stellar_Horizon_Client/_claimable_balances/with_claimant_set/fetches_only_balances_with_given_claimant.yml create mode 100644 horizon/spec/fixtures/vcr_cassettes/Stellar_Horizon_Client/_claimable_balances/with_cursor_set/fetches_balances_strating_from_cursor.yml create mode 100644 horizon/spec/fixtures/vcr_cassettes/Stellar_Horizon_Client/_claimable_balances/with_default_parameters/fetches_claimable_balances.yml create mode 100644 horizon/spec/fixtures/vcr_cassettes/Stellar_Horizon_Client/_claimable_balances/with_sponsor_set/fetches_only_balances_with_given_sponsor.yml diff --git a/base/lib/stellar/asset.rb b/base/lib/stellar/asset.rb index bad05d59..5adf2cd3 100644 --- a/base/lib/stellar/asset.rb +++ b/base/lib/stellar/asset.rb @@ -45,11 +45,11 @@ def to_s when AssetType.asset_type_credit_alphanum4 anum = alpha_num4! issuer_address = Stellar::Convert.pk_to_address(anum.issuer) - "#{anum.asset_code}/#{issuer_address}" + "#{anum.asset_code.delete("\x00")}:#{issuer_address}" when AssetType.asset_type_credit_alphanum12 anum = alpha_num12! issuer_address = Stellar::Convert.pk_to_address(anum.issuer) - "#{anum.asset_code}/#{issuer_address}" + "#{anum.asset_code.delete("\x00")}:#{issuer_address}" end end diff --git a/base/lib/stellar/claim_predicate.rb b/base/lib/stellar/claim_predicate.rb index 735fc11f..2e131672 100644 --- a/base/lib/stellar/claim_predicate.rb +++ b/base/lib/stellar/claim_predicate.rb @@ -1,6 +1,7 @@ # frozen_string_literals: true require "active_support/core_ext/integer/time" require "active_support/core_ext/string/conversions" +require "active_support/core_ext/hash/indifferent_access.rb" module Stellar # Represents claim predicate on Stellar network. @@ -74,6 +75,53 @@ def after(time) ~before(time) end + # Compose a predicate from json-like hash. + # Useful for parsing Horizon output + # + # @example: + # ClaimPredicate.parse( + # "and" => [ + # { "not" => { "abs_before" => "2021-09-17T09:59:34Z" } }, + # { "abs_before" => "2021-10-17T09:59:34Z" } + # ] + # ) + # + # @param object [Hash] see example for the format + # @return [ClaimPredicate] + def parse(object) + object = object.with_indifferent_access + + # binding.irb + if object["unconditional"] + return unconditional + end + + if object["not"] + return parse(object["not"]).not + end + + method, args = object.to_a.first + + if %w(and or).include?(method) + unless args.is_a?(Array) + raise ArgumentError, "invalid arguments #{args} for predicate '#{method}'" + end + + parse(args[0]).public_send(method, parse(args[1])) + else + callable_method = { + "abs_before" => :before_absolute_time, + "rel_before" => :before_relative_time, + }[method] + + if callable_method.blank? + raise ArgumentError, "Unknown predicate '#{method}'" + end + + public_send(callable_method, args) + end + end + # Compose a complex predicate by calling DSL methods from the block. # # @example diff --git a/base/lib/stellar/dsl.rb b/base/lib/stellar/dsl.rb index b90c0b94..d95c9991 100644 --- a/base/lib/stellar/dsl.rb +++ b/base/lib/stellar/dsl.rb @@ -1,3 +1,5 @@ +require "date" + module Stellar module DSL module_function @@ -27,6 +29,19 @@ def Claimant(destination, &block) ) end + def ClaimableBalance(id:, claimants: [], asset:, amount:) + Stellar::ClaimableBalanceEntry.new( + balance_id: id, + asset: Asset(asset), + amount: amount, + claimants: claimants.map do |claimant| + Claimant(claimant[:destination]) do + parse(claimant[:predicate]) + end + end + ) + end + def Account(subject = nil) case subject when Account @@ -58,9 +73,9 @@ def Asset(subject = nil) Asset.send(*subject) when nil, /^(XLM[-:])?native$/ Asset.native - when /^([0-9A-Z]{1,4})[-:](G[A-Z0-9]{55})$/ + when /^([0-9a-zA-Z]{1,4})[-:](G[A-Z0-9]{55})$/ Asset.alphanum4($1, KeyPair($2)) - when /^([0-9A-Z]{5,12})[-:](G[A-Z0-9]{55})$/ + when /^([0-9a-zA-Z]{5,12})[-:](G[A-Z0-9]{55})$/ Asset.alphanum12($1, KeyPair($2)) else raise TypeError, "Cannot convert #{subject.inspect} to Stellar::Asset" diff --git a/base/spec/lib/stellar/asset_spec.rb b/base/spec/lib/stellar/asset_spec.rb index e1d7811e..7609b10c 100644 --- a/base/spec/lib/stellar/asset_spec.rb +++ b/base/spec/lib/stellar/asset_spec.rb @@ -41,3 +41,11 @@ expect { Stellar::Asset.native.code }.to raise_error(RuntimeError) end end + +RSpec.describe Stellar::Asset, "#to_s" do + it "returns text representation of asset" do + a = Stellar::Asset.alphanum4("XXX", KeyPair("GCGQMVO4AOOQ3BQHGUGT52Y3XOMME6DPEB6QQDX44MC466FMDW2QTMRE")) + + expect(a.to_s).to eq("XXX:GCGQMVO4AOOQ3BQHGUGT52Y3XOMME6DPEB6QQDX44MC466FMDW2QTMRE") + end +end diff --git a/base/spec/lib/stellar/claim_predicate_spec.rb b/base/spec/lib/stellar/claim_predicate_spec.rb index eb3910ff..0c452413 100644 --- a/base/spec/lib/stellar/claim_predicate_spec.rb +++ b/base/spec/lib/stellar/claim_predicate_spec.rb @@ -1,4 +1,29 @@ RSpec.describe Stellar::ClaimPredicate do + def self.specify_claim(created_at:, claimable_at:, not_claimable_at:) + created_at = created_at.to_time + subject(:evaluate) { predicate.method(:evaluate) } + + context "with claim created at #{created_at.to_formatted_s(:db)}" do + let(:created) { created_at.to_time } + + Array(claimable_at).each do |claimed| + claimed = created_at + claimed if claimed.is_a?(ActiveSupport::Duration) + + it "evaluates to true at #{claimed.to_time.to_formatted_s(:db)}" do + expect(evaluate.call(created, claimed)).to be_truthy + end + end + + Array(not_claimable_at).each do |claimed| + claimed = created_at + claimed if claimed.is_a?(ActiveSupport::Duration) + + it "evaluates to false at #{claimed.to_time.to_formatted_s(:db)}" do + expect(evaluate.call(created, claimed)).to be_falsey + end + end + end + end + describe ".unconditional" do subject { described_class.unconditional } @@ -34,6 +59,60 @@ end end + describe ".parse" do + context "unconditional" do + let(:predicate) { { "unconditional" => true } } + subject { described_class.parse(predicate) } + + it { is_expected.to be_a(Stellar::ClaimPredicate) } + its(:type) { is_expected.to be(Stellar::ClaimPredicateType::UNCONDITIONAL) } + end + + context "abs before" do + let(:timestamp) { "2022-11-16T00:00:00Z" } + let(:predicate) { { "abs_before" => timestamp } } + subject { described_class.parse(predicate) } + + it { is_expected.to be_a(Stellar::ClaimPredicate) } + its(:type) { is_expected.to be(Stellar::ClaimPredicateType::BEFORE_ABSOLUTE_TIME) } + its(:abs_before) { is_expected.to be(DateTime.parse(timestamp).to_i) } + end + + context "rel before" do + let(:predicate) { { "rel_before" => "3600" } } + subject { described_class.parse(predicate) } + + it { is_expected.to be_a(Stellar::ClaimPredicate) } + its(:type) { is_expected.to be(Stellar::ClaimPredicateType::BEFORE_RELATIVE_TIME) } + its(:rel_before) { is_expected.to be(3600) } + end + + context "complex case" do + let(:predicate) do + described_class.parse({ + "and" => [ + { "not" => { "abs_before" => "2021-09-17T09:59:34Z" } }, + { "abs_before" => "2021-10-17T09:59:34Z" } + ] + }) + end + + specify_claim( + created_at: "2021-09-18 09:00:00", + claimable_at: [ + "2021-09-20 09:00:00 +0000", + "2021-10-10 09:24:20 +0000", + "2021-10-17 09:59:33 +0000" + ], + not_claimable_at: [ + -2.days, + +2.months, + "2021-10-17 12:59:34", + ] + ) + end + end + describe "#and" do let(:predicate) { described_class.unconditional } let(:other) { described_class.before_relative_time(3600) } @@ -76,31 +155,6 @@ describe "#evaluate" do let(:predicate) { described_class.unconditional } - def self.specify_claim(created_at:, claimable_at:, not_claimable_at:) - created_at = created_at.to_time - subject(:evaluate) { predicate.method(:evaluate) } - - context "with claim created at #{created_at.to_formatted_s(:db)}" do - let(:created) { created_at.to_time } - - Array(claimable_at).each do |claimed| - claimed = created_at + claimed if claimed.is_a?(ActiveSupport::Duration) - - it "evaluates to true at #{claimed.to_time.to_formatted_s(:db)}" do - expect(evaluate.call(created, claimed)).to be_truthy - end - end - - Array(not_claimable_at).each do |claimed| - claimed = created_at + claimed if claimed.is_a?(ActiveSupport::Duration) - - it "evaluates to false at #{claimed.to_time.to_formatted_s(:db)}" do - expect(evaluate.call(created, claimed)).to be_falsey - end - end - end - end - context "before_relative_time(1.hour)" do let(:predicate) { described_class.before_relative_time(1.hour) } @@ -118,7 +172,7 @@ def self.specify_claim(created_at:, claimable_at:, not_claimable_at:) ) end - context "before_relative_time(1.hour)" do + context "before_absolute_time" do let(:predicate) { described_class.before_absolute_time("2020-10-22") } specify_claim( diff --git a/horizon/lib/stellar-horizon.rb b/horizon/lib/stellar-horizon.rb index cc4cb9fd..36cf2b17 100644 --- a/horizon/lib/stellar-horizon.rb +++ b/horizon/lib/stellar-horizon.rb @@ -8,6 +8,7 @@ module Horizon autoload :Client autoload :Problem - autoload :TransactionPage + autoload :ResourcePage + autoload :ClaimableBalancePage end end diff --git a/horizon/lib/stellar/horizon/claimable_balance_page.rb b/horizon/lib/stellar/horizon/claimable_balance_page.rb new file mode 100644 index 00000000..429402f2 --- /dev/null +++ b/horizon/lib/stellar/horizon/claimable_balance_page.rb @@ -0,0 +1,11 @@ +module Stellar::Horizon + class ClaimableBalancePage < ResourcePage + private + + def objectify(record) + attributes = %i(id claimants asset amount) + hash = record.to_hash.deep_symbolize_keys.slice(*attributes) + ClaimableBalance(**hash) + end + end +end diff --git a/horizon/lib/stellar/horizon/client.rb b/horizon/lib/stellar/horizon/client.rb index 08829ea6..cc02aa33 100644 --- a/horizon/lib/stellar/horizon/client.rb +++ b/horizon/lib/stellar/horizon/client.rb @@ -1,5 +1,6 @@ require "hyperclient" require "active_support/core_ext/object/blank" +require "active_support/core_ext/hash/keys" require "securerandom" module Stellar::Horizon @@ -14,6 +15,8 @@ def initialize(message, account_id, operation_index) end class Client + include Stellar::DSL + DEFAULT_FEE = 100 HORIZON_LOCALHOST_URL = "http://127.0.0.1:8000" @@ -45,7 +48,7 @@ def self.localhost(options = {}) # @option options [String] :horizon The Horizon server URL. def initialize(options) @options = options - @horizon = Hyperclient.new(options[:horizon]) { |client| + @horizon = Hyperclient.new(options[:horizon]) do |client| client.faraday_block = lambda do |conn| conn.use Faraday::Response::RaiseError conn.use FaradayMiddleware::FollowRedirects @@ -58,7 +61,7 @@ def initialize(options) "X-Client-Name" => "ruby-stellar-sdk", "X-Client-Version" => Stellar::Horizon::VERSION } - } + end end # @param [Stellar::Account|String] account_or_address @@ -115,6 +118,20 @@ def create_account(options = {}) submit_transaction(tx_envelope: envelope) end + # Requests /claimable_balances endpoint with given parameters + # + # @param [Stellar::Asset|String] asset + # @param [Stellar::Account|String] claimant + # @param [Stellar::Account|String] sponsor + def claimable_balances(asset: nil, claimant: nil, sponsor: nil) + resource = @horizon.claimable_balances( + asset: asset.presence && Asset(asset).to_s, + claimant: claimant.presence && Account(claimant).address, + sponsor: sponsor.presence && Account(sponsor).address + ) + Stellar::Horizon::ClaimableBalancePage.new(resource) + end + # @option options [Stellar::Account] :from The source account # @option options [Stellar::Account] :to The destination account # @option options [Stellar::Amount] :amount The amount to send @@ -147,18 +164,18 @@ def send_payment(options = {}) # @option options [Stellar::Account] :account # @option options [Integer] :limit # @option options [Integer] :cursor - # @return [TransactionPage] + # @return [ResourcePage] def transactions(options = {}) args = options.slice(:limit, :cursor) resource = if options[:account] - args = args.merge(account_id: options[:account].address) + args = args.merge(account_id: Account(options[:account]).address) @horizon.account_transactions(args) else @horizon.transactions(args) end - TransactionPage.new(resource) + Stellar::Horizon::ResourcePage.new(resource) end # @param [Array(Symbol,String,Stellar::KeyPair|Stellar::Account)] asset diff --git a/horizon/lib/stellar/horizon/transaction_page.rb b/horizon/lib/stellar/horizon/resource_page.rb similarity index 57% rename from horizon/lib/stellar/horizon/transaction_page.rb rename to horizon/lib/stellar/horizon/resource_page.rb index 7184ece7..b9f96f2c 100644 --- a/horizon/lib/stellar/horizon/transaction_page.rb +++ b/horizon/lib/stellar/horizon/resource_page.rb @@ -1,6 +1,7 @@ module Stellar::Horizon - class TransactionPage + class ResourcePage include Enumerable + include Stellar::DSL # @param [Hyperclient::Link] resource def initialize(resource) @@ -8,12 +9,12 @@ def initialize(resource) end def each - @resource.records.each do |tx| - yield tx if block_given? + @resource.records.each do |record| + yield objectify(record) if block_given? end end - # @return [Stellar::TransactionPage] + # @return [Stellar::ResourcePage] def next_page self.class.new(@resource.next) end @@ -21,5 +22,11 @@ def next_page def next_page! @resource = @resource.next end + + private + + def objectify(record) + record + end end end diff --git a/horizon/spec/fixtures/vcr_cassettes/Stellar_Horizon_Client/_claimable_balances/fetches_claimable_balances.yml b/horizon/spec/fixtures/vcr_cassettes/Stellar_Horizon_Client/_claimable_balances/fetches_claimable_balances.yml new file mode 100644 index 00000000..01518714 --- /dev/null +++ b/horizon/spec/fixtures/vcr_cassettes/Stellar_Horizon_Client/_claimable_balances/fetches_claimable_balances.yml @@ -0,0 +1,670 @@ +--- +http_interactions: +- request: + method: get + uri: https://horizon-testnet.stellar.org/ + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Faraday v1.8.0 + Accept: + - application/hal+json,application/problem+json,application/json + X-Client-Name: + - ruby-stellar-sdk + X-Client-Version: + - 0.30.0 + response: + status: + code: 200 + message: OK + headers: + Date: + - Sun, 31 Oct 2021 09:27:44 GMT + Content-Type: + - application/hal+json; charset=utf-8 + Connection: + - keep-alive + Cache-Control: + - no-cache, no-store, max-age=0 + Content-Disposition: + - inline + Vary: + - Origin + X-Ratelimit-Limit: + - '101' + X-Ratelimit-Remaining: + - '100' + X-Ratelimit-Reset: + - '1' + body: + encoding: ASCII-8BIT + string: |- + { + "_links": { + "account": { + "href": "https://horizon-testnet.stellar.org/accounts/{account_id}", + "templated": true + }, + "accounts": { + "href": "https://horizon-testnet.stellar.org/accounts{?signer,sponsor,asset,liquidity_pool,cursor,limit,order}", + "templated": true + }, + "account_transactions": { + "href": "https://horizon-testnet.stellar.org/accounts/{account_id}/transactions{?cursor,limit,order}", + "templated": true + }, + "claimable_balances": { + "href": "https://horizon-testnet.stellar.org/claimable_balances?{asset,claimant,sponsor}", + "templated": true + }, + "assets": { + "href": "https://horizon-testnet.stellar.org/assets{?asset_code,asset_issuer,cursor,limit,order}", + "templated": true + }, + "effects": { + "href": "https://horizon-testnet.stellar.org/effects{?cursor,limit,order}", + "templated": true + }, + "fee_stats": { + "href": "https://horizon-testnet.stellar.org/fee_stats" + }, + "friendbot": { + "href": "https://friendbot.stellar.org/{?addr}", + "templated": true + }, + "ledger": { + "href": "https://horizon-testnet.stellar.org/ledger/{sequence}", + "templated": true + }, + "ledgers": { + "href": "https://horizon-testnet.stellar.org/ledgers{?cursor,limit,order}", + "templated": true + }, + "liquidity_pools": { + "href": "https://horizon-testnet.stellar.org/liquidity_pools?{?reserves}", + "templated": true + }, + "offer": { + "href": "https://horizon-testnet.stellar.org/offers/{offer_id}", + "templated": true + }, + "offers": { + "href": "https://horizon-testnet.stellar.org/offers{?selling,buying,seller,sponsor,cursor,limit,order}", + "templated": true + }, + "operation": { + "href": "https://horizon-testnet.stellar.org/operations/{id}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/operations{?cursor,limit,order,include_failed}", + "templated": true + }, + "order_book": { + "href": "https://horizon-testnet.stellar.org/order_book{?selling_asset_type,selling_asset_code,selling_asset_issuer,buying_asset_type,buying_asset_code,buying_asset_issuer,limit}", + "templated": true + }, + "payments": { + "href": "https://horizon-testnet.stellar.org/payments{?cursor,limit,order,include_failed}", + "templated": true + }, + "self": { + "href": "https://horizon-testnet.stellar.org/" + }, + "strict_receive_paths": { + "href": "https://horizon-testnet.stellar.org/paths/strict-receive{?source_assets,source_account,destination_account,destination_asset_type,destination_asset_issuer,destination_asset_code,destination_amount}", + "templated": true + }, + "strict_send_paths": { + "href": "https://horizon-testnet.stellar.org/paths/strict-send{?destination_account,destination_assets,source_asset_type,source_asset_issuer,source_asset_code,source_amount}", + "templated": true + }, + "trade_aggregations": { + "href": "https://horizon-testnet.stellar.org/trade_aggregations?base_asset_type={base_asset_type}\u0026base_asset_code={base_asset_code}\u0026base_asset_issuer={base_asset_issuer}\u0026counter_asset_type={counter_asset_type}\u0026counter_asset_code={counter_asset_code}\u0026counter_asset_issuer={counter_asset_issuer}", + "templated": true + }, + "trades": { + "href": "https://horizon-testnet.stellar.org/trades?base_asset_type={base_asset_type}\u0026base_asset_code={base_asset_code}\u0026base_asset_issuer={base_asset_issuer}\u0026counter_asset_type={counter_asset_type}\u0026counter_asset_code={counter_asset_code}\u0026counter_asset_issuer={counter_asset_issuer}", + "templated": true + }, + "transaction": { + "href": "https://horizon-testnet.stellar.org/transactions/{hash}", + "templated": true + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/transactions{?cursor,limit,order}", + "templated": true + } + }, + "horizon_version": "2.10.0-e667e8811a8033ac6682ccb597c1087c8b8d1725", + "core_version": "stellar-core 18.1.0 (dc5f5a392098b82bd9453a2aa4259e7af600ad9d)", + "ingest_latest_ledger": 756320, + "history_latest_ledger": 756320, + "history_latest_ledger_closed_at": "2021-10-31T09:27:42Z", + "history_elder_ledger": 2, + "core_latest_ledger": 756320, + "network_passphrase": "Test SDF Network ; September 2015", + "current_protocol_version": 18, + "core_supported_protocol_version": 18 + } + recorded_at: Sun, 31 Oct 2021 09:27:44 GMT +- request: + method: get + uri: https://horizon-testnet.stellar.org/claimable_balances + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Faraday v1.8.0 + Accept: + - application/hal+json,application/problem+json,application/json + X-Client-Name: + - ruby-stellar-sdk + X-Client-Version: + - 0.30.0 + response: + status: + code: 200 + message: OK + headers: + Date: + - Sun, 31 Oct 2021 09:27:47 GMT + Content-Type: + - application/hal+json; charset=utf-8 + Connection: + - keep-alive + Cache-Control: + - no-cache, no-store, max-age=0 + Content-Disposition: + - inline + Latest-Ledger: + - '756320' + Vary: + - Origin + X-Ratelimit-Limit: + - '101' + X-Ratelimit-Remaining: + - '100' + X-Ratelimit-Reset: + - '1' + body: + encoding: ASCII-8BIT + string: |- + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances?cursor=\u0026limit=10\u0026order=asc" + }, + "next": { + "href": "https://horizon-testnet.stellar.org/claimable_balances?cursor=22578-00000000ce94cb2b1079e6c1901b87de0ea1d3f5606cbdff62aa01301d4ced47e8736a79\u0026limit=10\u0026order=asc" + }, + "prev": { + "href": "https://horizon-testnet.stellar.org/claimable_balances?cursor=4776-000000004c251ddca2bc4dddf22ca8548a45ea977a11e301b748e89f45d08903bb74dd49\u0026limit=10\u0026order=desc" + } + }, + "_embedded": { + "records": [ + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000004c251ddca2bc4dddf22ca8548a45ea977a11e301b748e89f45d08903bb74dd49" + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000004c251ddca2bc4dddf22ca8548a45ea977a11e301b748e89f45d08903bb74dd49/transactions{?cursor,limit,order}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000004c251ddca2bc4dddf22ca8548a45ea977a11e301b748e89f45d08903bb74dd49/operations{?cursor,limit,order}", + "templated": true + } + }, + "id": "000000004c251ddca2bc4dddf22ca8548a45ea977a11e301b748e89f45d08903bb74dd49", + "asset": "native", + "amount": "0.0000001", + "sponsor": "GAEWLPWMXYCVSHJR7ONIP7IBCWFLVB27P43YKLSNLBDMEW4WBAXKVCV3", + "last_modified_ledger": 4776, + "last_modified_time": "2021-09-15T16:11:26Z", + "claimants": [ + { + "destination": "GAEWLPWMXYCVSHJR7ONIP7IBCWFLVB27P43YKLSNLBDMEW4WBAXKVCV3", + "predicate": { + "unconditional": true + } + } + ], + "flags": { + "clawback_enabled": false + }, + "paging_token": "4776-000000004c251ddca2bc4dddf22ca8548a45ea977a11e301b748e89f45d08903bb74dd49" + }, + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000006c08443899e3e5d3a4c0c93881dc70c4a35c93a4d35bf8bbfd4dd57770b58365" + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000006c08443899e3e5d3a4c0c93881dc70c4a35c93a4d35bf8bbfd4dd57770b58365/transactions{?cursor,limit,order}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000006c08443899e3e5d3a4c0c93881dc70c4a35c93a4d35bf8bbfd4dd57770b58365/operations{?cursor,limit,order}", + "templated": true + } + }, + "id": "000000006c08443899e3e5d3a4c0c93881dc70c4a35c93a4d35bf8bbfd4dd57770b58365", + "asset": "XXX:GCGQMVO4AOOQ3BQHGUGT52Y3XOMME6DPEB6QQDX44MC466FMDW2QTMRE", + "amount": "10.0000000", + "sponsor": "GDCMAMQQEF762HKWOILEVRTMC36UXC32LXV3XK4QI4POYQ5SUWZAVFSR", + "last_modified_ledger": 16971, + "last_modified_time": "2021-09-16T09:59:36Z", + "claimants": [ + { + "destination": "GBGKGC6U6NAWFHBXQV4KKFMUA4JLTNB4R6AABAHIHUIT2ZCWSR5HKGZB", + "predicate": { + "and": [ + { + "not": { + "abs_before": "2021-09-17T09:59:34Z" + } + }, + { + "abs_before": "2021-10-17T09:59:34Z" + } + ] + } + }, + { + "destination": "GDCMAMQQEF762HKWOILEVRTMC36UXC32LXV3XK4QI4POYQ5SUWZAVFSR", + "predicate": { + "or": [ + { + "abs_before": "2021-09-17T09:59:34Z" + }, + { + "not": { + "abs_before": "2021-10-17T09:59:34Z" + } + } + ] + } + } + ], + "flags": { + "clawback_enabled": false + }, + "paging_token": "16971-000000006c08443899e3e5d3a4c0c93881dc70c4a35c93a4d35bf8bbfd4dd57770b58365" + }, + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000004efb2bf92d0e67aa1095616779d00dcd00f8bad5c3ab9982de2849ad688417dc" + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000004efb2bf92d0e67aa1095616779d00dcd00f8bad5c3ab9982de2849ad688417dc/transactions{?cursor,limit,order}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000004efb2bf92d0e67aa1095616779d00dcd00f8bad5c3ab9982de2849ad688417dc/operations{?cursor,limit,order}", + "templated": true + } + }, + "id": "000000004efb2bf92d0e67aa1095616779d00dcd00f8bad5c3ab9982de2849ad688417dc", + "asset": "XXX:GDZULQEIJV2SJEW4UIJL4O7JCWCZD2YKBYRA7Z32JNEORA4U42ZLKLSZ", + "amount": "10.0000000", + "sponsor": "GA7235CVJPX7Z6ONI5Q5JZMZS4GTN5AFNE7JN35QNULUZVSF55TBPNGE", + "last_modified_ledger": 17003, + "last_modified_time": "2021-09-16T10:02:27Z", + "claimants": [ + { + "destination": "GA7JV4FBCPRYLX6FD6PXE25VAL2MGIUQL54L4SNMZJOQLCXPUSQ75RFT", + "predicate": { + "and": [ + { + "not": { + "abs_before": "2021-09-17T10:02:25Z" + } + }, + { + "abs_before": "2021-10-17T10:02:25Z" + } + ] + } + }, + { + "destination": "GA7235CVJPX7Z6ONI5Q5JZMZS4GTN5AFNE7JN35QNULUZVSF55TBPNGE", + "predicate": { + "or": [ + { + "abs_before": "2021-09-17T10:02:25Z" + }, + { + "not": { + "abs_before": "2021-10-17T10:02:25Z" + } + } + ] + } + } + ], + "flags": { + "clawback_enabled": false + }, + "paging_token": "17003-000000004efb2bf92d0e67aa1095616779d00dcd00f8bad5c3ab9982de2849ad688417dc" + }, + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000003dcd5f7c9fd35736560af95c201a5e3df808e71f19a7e9f95a6ea7616795b6aa" + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000003dcd5f7c9fd35736560af95c201a5e3df808e71f19a7e9f95a6ea7616795b6aa/transactions{?cursor,limit,order}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000003dcd5f7c9fd35736560af95c201a5e3df808e71f19a7e9f95a6ea7616795b6aa/operations{?cursor,limit,order}", + "templated": true + } + }, + "id": "000000003dcd5f7c9fd35736560af95c201a5e3df808e71f19a7e9f95a6ea7616795b6aa", + "asset": "sYBX:GA3NTL5TTMWHFLL6FUZQRTONE2BP6WX5FVC466KO56QZVIVM3O47YSKD", + "amount": "50.0000000", + "sponsor": "GD2KIXZ7A7ULC5X2NMJAS4HLBUIKMA4AXHJXHVYT5EXXN7VT5CFAE5PS", + "last_modified_ledger": 21694, + "last_modified_time": "2021-09-16T16:53:33Z", + "claimants": [ + { + "destination": "GD2KIXZ7A7ULC5X2NMJAS4HLBUIKMA4AXHJXHVYT5EXXN7VT5CFAE5PS", + "predicate": { + "not": { + "unconditional": true + } + } + }, + { + "destination": "GA3NTL5TTMWHFLL6FUZQRTONE2BP6WX5FVC466KO56QZVIVM3O47YSKD", + "predicate": { + "unconditional": true + } + }, + { + "destination": "GAXXZCBJKMIGPGNVGPWJMQEJA4KFOTOTDQK376NKCYRDEHD4DS4JBE6R", + "predicate": { + "not": { + "abs_before": "2022-03-18T08:13:33Z" + } + } + } + ], + "flags": { + "clawback_enabled": false + }, + "paging_token": "21694-000000003dcd5f7c9fd35736560af95c201a5e3df808e71f19a7e9f95a6ea7616795b6aa" + }, + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000dac983d760f7c7c9aec7b25d44e85d120e6553c6ffce8639af635edb481178cb" + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000dac983d760f7c7c9aec7b25d44e85d120e6553c6ffce8639af635edb481178cb/transactions{?cursor,limit,order}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000dac983d760f7c7c9aec7b25d44e85d120e6553c6ffce8639af635edb481178cb/operations{?cursor,limit,order}", + "templated": true + } + }, + "id": "00000000dac983d760f7c7c9aec7b25d44e85d120e6553c6ffce8639af635edb481178cb", + "asset": "YBX:GAK6NV6HOPPEVY3DOAEH3YVOCDSI2YCMJCJ37THUZUMXDQHAZHQPHNDT", + "amount": "100.0000000", + "sponsor": "GD2KIXZ7A7ULC5X2NMJAS4HLBUIKMA4AXHJXHVYT5EXXN7VT5CFAE5PS", + "last_modified_ledger": 21694, + "last_modified_time": "2021-09-16T16:53:33Z", + "claimants": [ + { + "destination": "GD2KIXZ7A7ULC5X2NMJAS4HLBUIKMA4AXHJXHVYT5EXXN7VT5CFAE5PS", + "predicate": { + "not": { + "unconditional": true + } + } + }, + { + "destination": "GA7SWHODKGVLY5SYLSZ2B43EYLH46ZTZWCJ7DVGHOW5YDFZD4R2DJCMT", + "predicate": { + "unconditional": true + } + }, + { + "destination": "GAXXZCBJKMIGPGNVGPWJMQEJA4KFOTOTDQK376NKCYRDEHD4DS4JBE6R", + "predicate": { + "not": { + "abs_before": "2022-03-18T08:13:33Z" + } + } + } + ], + "flags": { + "clawback_enabled": false + }, + "paging_token": "21694-00000000dac983d760f7c7c9aec7b25d44e85d120e6553c6ffce8639af635edb481178cb" + }, + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000668b7e1d57dbc0165deea740737dbb0a914601d0c5515128a0d301a307075c3f" + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000668b7e1d57dbc0165deea740737dbb0a914601d0c5515128a0d301a307075c3f/transactions{?cursor,limit,order}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000668b7e1d57dbc0165deea740737dbb0a914601d0c5515128a0d301a307075c3f/operations{?cursor,limit,order}", + "templated": true + } + }, + "id": "00000000668b7e1d57dbc0165deea740737dbb0a914601d0c5515128a0d301a307075c3f", + "asset": "y01USDC:GA7SWHODKGVLY5SYLSZ2B43EYLH46ZTZWCJ7DVGHOW5YDFZD4R2DJCMT", + "amount": "100000.0000000", + "sponsor": "GD2KIXZ7A7ULC5X2NMJAS4HLBUIKMA4AXHJXHVYT5EXXN7VT5CFAE5PS", + "last_modified_ledger": 21810, + "last_modified_time": "2021-09-16T17:03:44Z", + "claimants": [ + { + "destination": "GD2KIXZ7A7ULC5X2NMJAS4HLBUIKMA4AXHJXHVYT5EXXN7VT5CFAE5PS", + "predicate": { + "not": { + "unconditional": true + } + } + }, + { + "destination": "GA7SWHODKGVLY5SYLSZ2B43EYLH46ZTZWCJ7DVGHOW5YDFZD4R2DJCMT", + "predicate": { + "unconditional": true + } + } + ], + "flags": { + "clawback_enabled": false + }, + "paging_token": "21810-00000000668b7e1d57dbc0165deea740737dbb0a914601d0c5515128a0d301a307075c3f" + }, + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000581ff7b80dd5c61ea3c92fe3a4753df81c22c63e002e8eede63a348ae4aaf7da" + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000581ff7b80dd5c61ea3c92fe3a4753df81c22c63e002e8eede63a348ae4aaf7da/transactions{?cursor,limit,order}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000581ff7b80dd5c61ea3c92fe3a4753df81c22c63e002e8eede63a348ae4aaf7da/operations{?cursor,limit,order}", + "templated": true + } + }, + "id": "00000000581ff7b80dd5c61ea3c92fe3a4753df81c22c63e002e8eede63a348ae4aaf7da", + "asset": "l01USDC:GA7SWHODKGVLY5SYLSZ2B43EYLH46ZTZWCJ7DVGHOW5YDFZD4R2DJCMT", + "amount": "1500.0000000", + "sponsor": "GACXXEZNUCSS5ABWALBERU4SU36SYTQQPOQR4UM3OPHXT3LQO7NLGIHG", + "last_modified_ledger": 21874, + "last_modified_time": "2021-09-16T17:09:16Z", + "claimants": [ + { + "destination": "GACXXEZNUCSS5ABWALBERU4SU36SYTQQPOQR4UM3OPHXT3LQO7NLGIHG", + "predicate": { + "not": { + "unconditional": true + } + } + }, + { + "destination": "GA7SWHODKGVLY5SYLSZ2B43EYLH46ZTZWCJ7DVGHOW5YDFZD4R2DJCMT", + "predicate": { + "unconditional": true + } + }, + { + "destination": "GA3NTL5TTMWHFLL6FUZQRTONE2BP6WX5FVC466KO56QZVIVM3O47YSKD", + "predicate": { + "abs_before": "1970-01-01T00:00:00Z" + } + } + ], + "flags": { + "clawback_enabled": false + }, + "paging_token": "21874-00000000581ff7b80dd5c61ea3c92fe3a4753df81c22c63e002e8eede63a348ae4aaf7da" + }, + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000b83109c0d7714120e408d55019bb84277f00a018d5334810bf0e6a7a0b1b1d4f" + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000b83109c0d7714120e408d55019bb84277f00a018d5334810bf0e6a7a0b1b1d4f/transactions{?cursor,limit,order}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000b83109c0d7714120e408d55019bb84277f00a018d5334810bf0e6a7a0b1b1d4f/operations{?cursor,limit,order}", + "templated": true + } + }, + "id": "00000000b83109c0d7714120e408d55019bb84277f00a018d5334810bf0e6a7a0b1b1d4f", + "asset": "y00XLM:GA7SWHODKGVLY5SYLSZ2B43EYLH46ZTZWCJ7DVGHOW5YDFZD4R2DJCMT", + "amount": "10000.0000000", + "sponsor": "GACXXEZNUCSS5ABWALBERU4SU36SYTQQPOQR4UM3OPHXT3LQO7NLGIHG", + "last_modified_ledger": 21874, + "last_modified_time": "2021-09-16T17:09:16Z", + "claimants": [ + { + "destination": "GACXXEZNUCSS5ABWALBERU4SU36SYTQQPOQR4UM3OPHXT3LQO7NLGIHG", + "predicate": { + "not": { + "unconditional": true + } + } + }, + { + "destination": "GA7SWHODKGVLY5SYLSZ2B43EYLH46ZTZWCJ7DVGHOW5YDFZD4R2DJCMT", + "predicate": { + "unconditional": true + } + } + ], + "flags": { + "clawback_enabled": false + }, + "paging_token": "21874-00000000b83109c0d7714120e408d55019bb84277f00a018d5334810bf0e6a7a0b1b1d4f" + }, + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000734d6099f19c78aaced13e4aa312f6f59071470dc59f33cd0201de9d3f768aa3" + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000734d6099f19c78aaced13e4aa312f6f59071470dc59f33cd0201de9d3f768aa3/transactions{?cursor,limit,order}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000734d6099f19c78aaced13e4aa312f6f59071470dc59f33cd0201de9d3f768aa3/operations{?cursor,limit,order}", + "templated": true + } + }, + "id": "00000000734d6099f19c78aaced13e4aa312f6f59071470dc59f33cd0201de9d3f768aa3", + "asset": "USDPEND:GBMN3TR7M56LHLFYKL2QOUWE466MF2BRR5DHAGYYCGID7DK35LTF7ZOB", + "amount": "10000.0000000", + "sponsor": "GCGDQP6CI2UI2KOR42YIR44SKQEDCDCKGJ6X55K7CIXAQRMAALMB5J7J", + "last_modified_ledger": 22475, + "last_modified_time": "2021-09-16T18:01:38Z", + "claimants": [ + { + "destination": "GCGIU3GJWBSZN3KK7NJZVVINCFZIPPL5M35ISQUTGSOOIRF2RXIE2TBZ", + "predicate": { + "unconditional": true + } + }, + { + "destination": "GBMN3TR7M56LHLFYKL2QOUWE466MF2BRR5DHAGYYCGID7DK35LTF7ZOB", + "predicate": { + "not": { + "abs_before": "2021-09-16T04:00:00Z" + } + } + } + ], + "flags": { + "clawback_enabled": false + }, + "paging_token": "22475-00000000734d6099f19c78aaced13e4aa312f6f59071470dc59f33cd0201de9d3f768aa3" + }, + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000ce94cb2b1079e6c1901b87de0ea1d3f5606cbdff62aa01301d4ced47e8736a79" + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000ce94cb2b1079e6c1901b87de0ea1d3f5606cbdff62aa01301d4ced47e8736a79/transactions{?cursor,limit,order}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000ce94cb2b1079e6c1901b87de0ea1d3f5606cbdff62aa01301d4ced47e8736a79/operations{?cursor,limit,order}", + "templated": true + } + }, + "id": "00000000ce94cb2b1079e6c1901b87de0ea1d3f5606cbdff62aa01301d4ced47e8736a79", + "asset": "USDPEND:GBMN3TR7M56LHLFYKL2QOUWE466MF2BRR5DHAGYYCGID7DK35LTF7ZOB", + "amount": "10000.0000000", + "sponsor": "GCGDQP6CI2UI2KOR42YIR44SKQEDCDCKGJ6X55K7CIXAQRMAALMB5J7J", + "last_modified_ledger": 22578, + "last_modified_time": "2021-09-16T18:10:34Z", + "claimants": [ + { + "destination": "GDPTRBLM6UCRBENCLEGEKPQ4ZVQ7J5LAQ2O2QQV4OS26DVWFPJ6YERIJ", + "predicate": { + "unconditional": true + } + }, + { + "destination": "GBMN3TR7M56LHLFYKL2QOUWE466MF2BRR5DHAGYYCGID7DK35LTF7ZOB", + "predicate": { + "not": { + "abs_before": "2021-09-16T04:00:00Z" + } + } + } + ], + "flags": { + "clawback_enabled": false + }, + "paging_token": "22578-00000000ce94cb2b1079e6c1901b87de0ea1d3f5606cbdff62aa01301d4ced47e8736a79" + } + ] + } + } + recorded_at: Sun, 31 Oct 2021 09:27:49 GMT +recorded_with: VCR 6.0.0 diff --git a/horizon/spec/fixtures/vcr_cassettes/Stellar_Horizon_Client/_claimable_balances/with_asset_set/fetches_only_balances_with_given_asset.yml b/horizon/spec/fixtures/vcr_cassettes/Stellar_Horizon_Client/_claimable_balances/with_asset_set/fetches_only_balances_with_given_asset.yml new file mode 100644 index 00000000..8b620568 --- /dev/null +++ b/horizon/spec/fixtures/vcr_cassettes/Stellar_Horizon_Client/_claimable_balances/with_asset_set/fetches_only_balances_with_given_asset.yml @@ -0,0 +1,271 @@ +--- +http_interactions: +- request: + method: get + uri: https://horizon-testnet.stellar.org/ + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Faraday v1.8.0 + Accept: + - application/hal+json,application/problem+json,application/json + X-Client-Name: + - ruby-stellar-sdk + X-Client-Version: + - 0.30.0 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Nov 2021 17:57:24 GMT + Content-Type: + - application/hal+json; charset=utf-8 + Connection: + - keep-alive + Cache-Control: + - no-cache, no-store, max-age=0 + Content-Disposition: + - inline + Vary: + - Origin + X-Ratelimit-Limit: + - '101' + X-Ratelimit-Remaining: + - '100' + X-Ratelimit-Reset: + - '1' + body: + encoding: ASCII-8BIT + string: |- + { + "_links": { + "account": { + "href": "https://horizon-testnet.stellar.org/accounts/{account_id}", + "templated": true + }, + "accounts": { + "href": "https://horizon-testnet.stellar.org/accounts{?signer,sponsor,asset,liquidity_pool,cursor,limit,order}", + "templated": true + }, + "account_transactions": { + "href": "https://horizon-testnet.stellar.org/accounts/{account_id}/transactions{?cursor,limit,order}", + "templated": true + }, + "claimable_balances": { + "href": "https://horizon-testnet.stellar.org/claimable_balances{?asset,claimant,sponsor}", + "templated": true + }, + "assets": { + "href": "https://horizon-testnet.stellar.org/assets{?asset_code,asset_issuer,cursor,limit,order}", + "templated": true + }, + "effects": { + "href": "https://horizon-testnet.stellar.org/effects{?cursor,limit,order}", + "templated": true + }, + "fee_stats": { + "href": "https://horizon-testnet.stellar.org/fee_stats" + }, + "friendbot": { + "href": "https://friendbot.stellar.org/{?addr}", + "templated": true + }, + "ledger": { + "href": "https://horizon-testnet.stellar.org/ledger/{sequence}", + "templated": true + }, + "ledgers": { + "href": "https://horizon-testnet.stellar.org/ledgers{?cursor,limit,order}", + "templated": true + }, + "liquidity_pools": { + "href": "https://horizon-testnet.stellar.org/liquidity_pools?{?reserves,account}", + "templated": true + }, + "offer": { + "href": "https://horizon-testnet.stellar.org/offers/{offer_id}", + "templated": true + }, + "offers": { + "href": "https://horizon-testnet.stellar.org/offers{?selling,buying,seller,sponsor,cursor,limit,order}", + "templated": true + }, + "operation": { + "href": "https://horizon-testnet.stellar.org/operations/{id}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/operations{?cursor,limit,order,include_failed}", + "templated": true + }, + "order_book": { + "href": "https://horizon-testnet.stellar.org/order_book{?selling_asset_type,selling_asset_code,selling_asset_issuer,buying_asset_type,buying_asset_code,buying_asset_issuer,limit}", + "templated": true + }, + "payments": { + "href": "https://horizon-testnet.stellar.org/payments{?cursor,limit,order,include_failed}", + "templated": true + }, + "self": { + "href": "https://horizon-testnet.stellar.org/" + }, + "strict_receive_paths": { + "href": "https://horizon-testnet.stellar.org/paths/strict-receive{?source_assets,source_account,destination_account,destination_asset_type,destination_asset_issuer,destination_asset_code,destination_amount}", + "templated": true + }, + "strict_send_paths": { + "href": "https://horizon-testnet.stellar.org/paths/strict-send{?destination_account,destination_assets,source_asset_type,source_asset_issuer,source_asset_code,source_amount}", + "templated": true + }, + "trade_aggregations": { + "href": "https://horizon-testnet.stellar.org/trade_aggregations?base_asset_type={base_asset_type}\u0026base_asset_code={base_asset_code}\u0026base_asset_issuer={base_asset_issuer}\u0026counter_asset_type={counter_asset_type}\u0026counter_asset_code={counter_asset_code}\u0026counter_asset_issuer={counter_asset_issuer}", + "templated": true + }, + "trades": { + "href": "https://horizon-testnet.stellar.org/trades?base_asset_type={base_asset_type}\u0026base_asset_code={base_asset_code}\u0026base_asset_issuer={base_asset_issuer}\u0026counter_asset_type={counter_asset_type}\u0026counter_asset_code={counter_asset_code}\u0026counter_asset_issuer={counter_asset_issuer}", + "templated": true + }, + "transaction": { + "href": "https://horizon-testnet.stellar.org/transactions/{hash}", + "templated": true + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/transactions{?cursor,limit,order}", + "templated": true + } + }, + "horizon_version": "2.11.0-07dcbb1e43d9ee991461e1284af1d11dcae645d7", + "core_version": "stellar-core 18.1.0 (dc5f5a392098b82bd9453a2aa4259e7af600ad9d)", + "ingest_latest_ledger": 1238934, + "history_latest_ledger": 1238934, + "history_latest_ledger_closed_at": "2021-11-29T17:57:22Z", + "history_elder_ledger": 2, + "core_latest_ledger": 1238934, + "network_passphrase": "Test SDF Network ; September 2015", + "current_protocol_version": 18, + "core_supported_protocol_version": 18 + } + recorded_at: Mon, 29 Nov 2021 17:57:24 GMT +- request: + method: get + uri: https://horizon-testnet.stellar.org/claimable_balances?asset=XXX:GCGQMVO4AOOQ3BQHGUGT52Y3XOMME6DPEB6QQDX44MC466FMDW2QTMRE + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Faraday v1.8.0 + Accept: + - application/hal+json,application/problem+json,application/json + X-Client-Name: + - ruby-stellar-sdk + X-Client-Version: + - 0.30.0 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Nov 2021 17:57:24 GMT + Content-Type: + - application/hal+json; charset=utf-8 + Connection: + - keep-alive + Cache-Control: + - no-cache, no-store, max-age=0 + Content-Disposition: + - inline + Latest-Ledger: + - '1238934' + Vary: + - Origin + X-Ratelimit-Limit: + - '101' + X-Ratelimit-Remaining: + - '100' + X-Ratelimit-Reset: + - '1' + body: + encoding: ASCII-8BIT + string: |- + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances?asset=XXX%3AGCGQMVO4AOOQ3BQHGUGT52Y3XOMME6DPEB6QQDX44MC466FMDW2QTMRE&;cursor=&limit=10&order=asc" + }, + "next": { + "href": "https://horizon-testnet.stellar.org/claimable_balances?asset=XXX%3AGCGQMVO4AOOQ3BQHGUGT52Y3XOMME6DPEB6QQDX44MC466FMDW2QTMRE&;cursor=16971-000000006c08443899e3e5d3a4c0c93881dc70c4a35c93a4d35bf8bbfd4dd57770b58365&limit=10&order=asc" + }, + "prev": { + "href": "https://horizon-testnet.stellar.org/claimable_balances?asset=XXX%3AGCGQMVO4AOOQ3BQHGUGT52Y3XOMME6DPEB6QQDX44MC466FMDW2QTMRE&;cursor=16971-000000006c08443899e3e5d3a4c0c93881dc70c4a35c93a4d35bf8bbfd4dd57770b58365&limit=10&order=desc" + } + }, + "_embedded": { + "records": [ + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000006c08443899e3e5d3a4c0c93881dc70c4a35c93a4d35bf8bbfd4dd57770b58365" + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000006c08443899e3e5d3a4c0c93881dc70c4a35c93a4d35bf8bbfd4dd57770b58365/transactions{?cursor,limit,order}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000006c08443899e3e5d3a4c0c93881dc70c4a35c93a4d35bf8bbfd4dd57770b58365/operations{?cursor,limit,order}", + "templated": true + } + }, + "id": "000000006c08443899e3e5d3a4c0c93881dc70c4a35c93a4d35bf8bbfd4dd57770b58365", + "asset": "XXX:GCGQMVO4AOOQ3BQHGUGT52Y3XOMME6DPEB6QQDX44MC466FMDW2QTMRE", + "amount": "10.0000000", + "sponsor": "GDCMAMQQEF762HKWOILEVRTMC36UXC32LXV3XK4QI4POYQ5SUWZAVFSR", + "last_modified_ledger": 16971, + "last_modified_time": "2021-09-16T09:59:36Z", + "claimants": [ + { + "destination": "GBGKGC6U6NAWFHBXQV4KKFMUA4JLTNB4R6AABAHIHUIT2ZCWSR5HKGZB", + "predicate": { + "and": [ + { + "not": { + "abs_before": "2021-09-17T09:59:34Z" + } + }, + { + "abs_before": "2021-10-17T09:59:34Z" + } + ] + } + }, + { + "destination": "GDCMAMQQEF762HKWOILEVRTMC36UXC32LXV3XK4QI4POYQ5SUWZAVFSR", + "predicate": { + "or": [ + { + "abs_before": "2021-09-17T09:59:34Z" + }, + { + "not": { + "abs_before": "2021-10-17T09:59:34Z" + } + } + ] + } + } + ], + "flags": { + "clawback_enabled": false + }, + "paging_token": "16971-000000006c08443899e3e5d3a4c0c93881dc70c4a35c93a4d35bf8bbfd4dd57770b58365" + } + ] + } + } + recorded_at: Mon, 29 Nov 2021 17:57:24 GMT +recorded_with: VCR 6.0.0 diff --git a/horizon/spec/fixtures/vcr_cassettes/Stellar_Horizon_Client/_claimable_balances/with_claimant_set/fetches_only_balances_with_given_claimant.yml b/horizon/spec/fixtures/vcr_cassettes/Stellar_Horizon_Client/_claimable_balances/with_claimant_set/fetches_only_balances_with_given_claimant.yml new file mode 100644 index 00000000..b473d19c --- /dev/null +++ b/horizon/spec/fixtures/vcr_cassettes/Stellar_Horizon_Client/_claimable_balances/with_claimant_set/fetches_only_balances_with_given_claimant.yml @@ -0,0 +1,247 @@ +--- +http_interactions: +- request: + method: get + uri: https://horizon-testnet.stellar.org/ + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Faraday v1.8.0 + Accept: + - application/hal+json,application/problem+json,application/json + X-Client-Name: + - ruby-stellar-sdk + X-Client-Version: + - 0.30.0 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Nov 2021 18:01:52 GMT + Content-Type: + - application/hal+json; charset=utf-8 + Connection: + - keep-alive + Cache-Control: + - no-cache, no-store, max-age=0 + Content-Disposition: + - inline + Vary: + - Origin + X-Ratelimit-Limit: + - '101' + X-Ratelimit-Remaining: + - '100' + X-Ratelimit-Reset: + - '1' + body: + encoding: ASCII-8BIT + string: |- + { + "_links": { + "account": { + "href": "https://horizon-testnet.stellar.org/accounts/{account_id}", + "templated": true + }, + "accounts": { + "href": "https://horizon-testnet.stellar.org/accounts{?signer,sponsor,asset,liquidity_pool,cursor,limit,order}", + "templated": true + }, + "account_transactions": { + "href": "https://horizon-testnet.stellar.org/accounts/{account_id}/transactions{?cursor,limit,order}", + "templated": true + }, + "claimable_balances": { + "href": "https://horizon-testnet.stellar.org/claimable_balances{?asset,claimant,sponsor}", + "templated": true + }, + "assets": { + "href": "https://horizon-testnet.stellar.org/assets{?asset_code,asset_issuer,cursor,limit,order}", + "templated": true + }, + "effects": { + "href": "https://horizon-testnet.stellar.org/effects{?cursor,limit,order}", + "templated": true + }, + "fee_stats": { + "href": "https://horizon-testnet.stellar.org/fee_stats" + }, + "friendbot": { + "href": "https://friendbot.stellar.org/{?addr}", + "templated": true + }, + "ledger": { + "href": "https://horizon-testnet.stellar.org/ledger/{sequence}", + "templated": true + }, + "ledgers": { + "href": "https://horizon-testnet.stellar.org/ledgers{?cursor,limit,order}", + "templated": true + }, + "liquidity_pools": { + "href": "https://horizon-testnet.stellar.org/liquidity_pools?{?reserves,account}", + "templated": true + }, + "offer": { + "href": "https://horizon-testnet.stellar.org/offers/{offer_id}", + "templated": true + }, + "offers": { + "href": "https://horizon-testnet.stellar.org/offers{?selling,buying,seller,sponsor,cursor,limit,order}", + "templated": true + }, + "operation": { + "href": "https://horizon-testnet.stellar.org/operations/{id}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/operations{?cursor,limit,order,include_failed}", + "templated": true + }, + "order_book": { + "href": "https://horizon-testnet.stellar.org/order_book{?selling_asset_type,selling_asset_code,selling_asset_issuer,buying_asset_type,buying_asset_code,buying_asset_issuer,limit}", + "templated": true + }, + "payments": { + "href": "https://horizon-testnet.stellar.org/payments{?cursor,limit,order,include_failed}", + "templated": true + }, + "self": { + "href": "https://horizon-testnet.stellar.org/" + }, + "strict_receive_paths": { + "href": "https://horizon-testnet.stellar.org/paths/strict-receive{?source_assets,source_account,destination_account,destination_asset_type,destination_asset_issuer,destination_asset_code,destination_amount}", + "templated": true + }, + "strict_send_paths": { + "href": "https://horizon-testnet.stellar.org/paths/strict-send{?destination_account,destination_assets,source_asset_type,source_asset_issuer,source_asset_code,source_amount}", + "templated": true + }, + "trade_aggregations": { + "href": "https://horizon-testnet.stellar.org/trade_aggregations?base_asset_type={base_asset_type}\u0026base_asset_code={base_asset_code}\u0026base_asset_issuer={base_asset_issuer}\u0026counter_asset_type={counter_asset_type}\u0026counter_asset_code={counter_asset_code}\u0026counter_asset_issuer={counter_asset_issuer}", + "templated": true + }, + "trades": { + "href": "https://horizon-testnet.stellar.org/trades?base_asset_type={base_asset_type}\u0026base_asset_code={base_asset_code}\u0026base_asset_issuer={base_asset_issuer}\u0026counter_asset_type={counter_asset_type}\u0026counter_asset_code={counter_asset_code}\u0026counter_asset_issuer={counter_asset_issuer}", + "templated": true + }, + "transaction": { + "href": "https://horizon-testnet.stellar.org/transactions/{hash}", + "templated": true + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/transactions{?cursor,limit,order}", + "templated": true + } + }, + "horizon_version": "2.11.0-07dcbb1e43d9ee991461e1284af1d11dcae645d7", + "core_version": "stellar-core 18.1.0 (dc5f5a392098b82bd9453a2aa4259e7af600ad9d)", + "ingest_latest_ledger": 1238985, + "history_latest_ledger": 1238985, + "history_latest_ledger_closed_at": "2021-11-29T18:01:51Z", + "history_elder_ledger": 2, + "core_latest_ledger": 1238985, + "network_passphrase": "Test SDF Network ; September 2015", + "current_protocol_version": 18, + "core_supported_protocol_version": 18 + } + recorded_at: Mon, 29 Nov 2021 18:01:52 GMT +- request: + method: get + uri: https://horizon-testnet.stellar.org/claimable_balances?claimant=GAEWLPWMXYCVSHJR7ONIP7IBCWFLVB27P43YKLSNLBDMEW4WBAXKVCV3 + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Faraday v1.8.0 + Accept: + - application/hal+json,application/problem+json,application/json + X-Client-Name: + - ruby-stellar-sdk + X-Client-Version: + - 0.30.0 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Nov 2021 18:01:53 GMT + Content-Type: + - application/hal+json; charset=utf-8 + Connection: + - keep-alive + Cache-Control: + - no-cache, no-store, max-age=0 + Content-Disposition: + - inline + Latest-Ledger: + - '1238985' + Vary: + - Origin + X-Ratelimit-Limit: + - '101' + X-Ratelimit-Remaining: + - '100' + X-Ratelimit-Reset: + - '1' + body: + encoding: ASCII-8BIT + string: |- + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances?claimant=GAEWLPWMXYCVSHJR7ONIP7IBCWFLVB27P43YKLSNLBDMEW4WBAXKVCV3&;cursor=&limit=10&order=asc" + }, + "next": { + "href": "https://horizon-testnet.stellar.org/claimable_balances?claimant=GAEWLPWMXYCVSHJR7ONIP7IBCWFLVB27P43YKLSNLBDMEW4WBAXKVCV3&;cursor=4776-000000004c251ddca2bc4dddf22ca8548a45ea977a11e301b748e89f45d08903bb74dd49&limit=10&order=asc" + }, + "prev": { + "href": "https://horizon-testnet.stellar.org/claimable_balances?claimant=GAEWLPWMXYCVSHJR7ONIP7IBCWFLVB27P43YKLSNLBDMEW4WBAXKVCV3&;cursor=4776-000000004c251ddca2bc4dddf22ca8548a45ea977a11e301b748e89f45d08903bb74dd49&limit=10&order=desc" + } + }, + "_embedded": { + "records": [ + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000004c251ddca2bc4dddf22ca8548a45ea977a11e301b748e89f45d08903bb74dd49" + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000004c251ddca2bc4dddf22ca8548a45ea977a11e301b748e89f45d08903bb74dd49/transactions{?cursor,limit,order}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000004c251ddca2bc4dddf22ca8548a45ea977a11e301b748e89f45d08903bb74dd49/operations{?cursor,limit,order}", + "templated": true + } + }, + "id": "000000004c251ddca2bc4dddf22ca8548a45ea977a11e301b748e89f45d08903bb74dd49", + "asset": "native", + "amount": "0.0000001", + "sponsor": "GAEWLPWMXYCVSHJR7ONIP7IBCWFLVB27P43YKLSNLBDMEW4WBAXKVCV3", + "last_modified_ledger": 4776, + "last_modified_time": "2021-09-15T16:11:26Z", + "claimants": [ + { + "destination": "GAEWLPWMXYCVSHJR7ONIP7IBCWFLVB27P43YKLSNLBDMEW4WBAXKVCV3", + "predicate": { + "unconditional": true + } + } + ], + "flags": { + "clawback_enabled": false + }, + "paging_token": "4776-000000004c251ddca2bc4dddf22ca8548a45ea977a11e301b748e89f45d08903bb74dd49" + } + ] + } + } + recorded_at: Mon, 29 Nov 2021 18:01:53 GMT +recorded_with: VCR 6.0.0 diff --git a/horizon/spec/fixtures/vcr_cassettes/Stellar_Horizon_Client/_claimable_balances/with_cursor_set/fetches_balances_strating_from_cursor.yml b/horizon/spec/fixtures/vcr_cassettes/Stellar_Horizon_Client/_claimable_balances/with_cursor_set/fetches_balances_strating_from_cursor.yml new file mode 100644 index 00000000..2b3a7679 --- /dev/null +++ b/horizon/spec/fixtures/vcr_cassettes/Stellar_Horizon_Client/_claimable_balances/with_cursor_set/fetches_balances_strating_from_cursor.yml @@ -0,0 +1,670 @@ +--- +http_interactions: +- request: + method: get + uri: https://horizon-testnet.stellar.org/ + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Faraday v1.8.0 + Accept: + - application/hal+json,application/problem+json,application/json + X-Client-Name: + - ruby-stellar-sdk + X-Client-Version: + - 0.30.0 + response: + status: + code: 200 + message: OK + headers: + Date: + - Wed, 17 Nov 2021 09:55:22 GMT + Content-Type: + - application/hal+json; charset=utf-8 + Connection: + - keep-alive + Cache-Control: + - no-cache, no-store, max-age=0 + Content-Disposition: + - inline + Vary: + - Origin + X-Ratelimit-Limit: + - '101' + X-Ratelimit-Remaining: + - '100' + X-Ratelimit-Reset: + - '1' + body: + encoding: ASCII-8BIT + string: |- + { + "_links": { + "account": { + "href": "https://horizon-testnet.stellar.org/accounts/{account_id}", + "templated": true + }, + "accounts": { + "href": "https://horizon-testnet.stellar.org/accounts{?signer,sponsor,asset,liquidity_pool,cursor,limit,order}", + "templated": true + }, + "account_transactions": { + "href": "https://horizon-testnet.stellar.org/accounts/{account_id}/transactions{?cursor,limit,order}", + "templated": true + }, + "claimable_balances": { + "href": "https://horizon-testnet.stellar.org/claimable_balances?{asset,claimant,sponsor}", + "templated": true + }, + "assets": { + "href": "https://horizon-testnet.stellar.org/assets{?asset_code,asset_issuer,cursor,limit,order}", + "templated": true + }, + "effects": { + "href": "https://horizon-testnet.stellar.org/effects{?cursor,limit,order}", + "templated": true + }, + "fee_stats": { + "href": "https://horizon-testnet.stellar.org/fee_stats" + }, + "friendbot": { + "href": "https://friendbot.stellar.org/{?addr}", + "templated": true + }, + "ledger": { + "href": "https://horizon-testnet.stellar.org/ledger/{sequence}", + "templated": true + }, + "ledgers": { + "href": "https://horizon-testnet.stellar.org/ledgers{?cursor,limit,order}", + "templated": true + }, + "liquidity_pools": { + "href": "https://horizon-testnet.stellar.org/liquidity_pools?{?reserves,account}", + "templated": true + }, + "offer": { + "href": "https://horizon-testnet.stellar.org/offers/{offer_id}", + "templated": true + }, + "offers": { + "href": "https://horizon-testnet.stellar.org/offers{?selling,buying,seller,sponsor,cursor,limit,order}", + "templated": true + }, + "operation": { + "href": "https://horizon-testnet.stellar.org/operations/{id}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/operations{?cursor,limit,order,include_failed}", + "templated": true + }, + "order_book": { + "href": "https://horizon-testnet.stellar.org/order_book{?selling_asset_type,selling_asset_code,selling_asset_issuer,buying_asset_type,buying_asset_code,buying_asset_issuer,limit}", + "templated": true + }, + "payments": { + "href": "https://horizon-testnet.stellar.org/payments{?cursor,limit,order,include_failed}", + "templated": true + }, + "self": { + "href": "https://horizon-testnet.stellar.org/" + }, + "strict_receive_paths": { + "href": "https://horizon-testnet.stellar.org/paths/strict-receive{?source_assets,source_account,destination_account,destination_asset_type,destination_asset_issuer,destination_asset_code,destination_amount}", + "templated": true + }, + "strict_send_paths": { + "href": "https://horizon-testnet.stellar.org/paths/strict-send{?destination_account,destination_assets,source_asset_type,source_asset_issuer,source_asset_code,source_amount}", + "templated": true + }, + "trade_aggregations": { + "href": "https://horizon-testnet.stellar.org/trade_aggregations?base_asset_type={base_asset_type}\u0026base_asset_code={base_asset_code}\u0026base_asset_issuer={base_asset_issuer}\u0026counter_asset_type={counter_asset_type}\u0026counter_asset_code={counter_asset_code}\u0026counter_asset_issuer={counter_asset_issuer}", + "templated": true + }, + "trades": { + "href": "https://horizon-testnet.stellar.org/trades?base_asset_type={base_asset_type}\u0026base_asset_code={base_asset_code}\u0026base_asset_issuer={base_asset_issuer}\u0026counter_asset_type={counter_asset_type}\u0026counter_asset_code={counter_asset_code}\u0026counter_asset_issuer={counter_asset_issuer}", + "templated": true + }, + "transaction": { + "href": "https://horizon-testnet.stellar.org/transactions/{hash}", + "templated": true + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/transactions{?cursor,limit,order}", + "templated": true + } + }, + "horizon_version": "2.11.0-07dcbb1e43d9ee991461e1284af1d11dcae645d7", + "core_version": "stellar-core 18.1.0 (dc5f5a392098b82bd9453a2aa4259e7af600ad9d)", + "ingest_latest_ledger": 1036168, + "history_latest_ledger": 1036168, + "history_latest_ledger_closed_at": "2021-11-17T09:55:17Z", + "history_elder_ledger": 2, + "core_latest_ledger": 1036168, + "network_passphrase": "Test SDF Network ; September 2015", + "current_protocol_version": 18, + "core_supported_protocol_version": 18 + } + recorded_at: Wed, 17 Nov 2021 09:55:22 GMT +- request: + method: get + uri: https://horizon-testnet.stellar.org/claimable_balances + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Faraday v1.8.0 + Accept: + - application/hal+json,application/problem+json,application/json + X-Client-Name: + - ruby-stellar-sdk + X-Client-Version: + - 0.30.0 + response: + status: + code: 200 + message: OK + headers: + Date: + - Wed, 17 Nov 2021 09:55:23 GMT + Content-Type: + - application/hal+json; charset=utf-8 + Connection: + - keep-alive + Cache-Control: + - no-cache, no-store, max-age=0 + Content-Disposition: + - inline + Latest-Ledger: + - '1036169' + Vary: + - Origin + X-Ratelimit-Limit: + - '101' + X-Ratelimit-Remaining: + - '100' + X-Ratelimit-Reset: + - '1' + body: + encoding: ASCII-8BIT + string: |- + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances?cursor=\u0026limit=10\u0026order=asc" + }, + "next": { + "href": "https://horizon-testnet.stellar.org/claimable_balances?cursor=22578-00000000ce94cb2b1079e6c1901b87de0ea1d3f5606cbdff62aa01301d4ced47e8736a79\u0026limit=10\u0026order=asc" + }, + "prev": { + "href": "https://horizon-testnet.stellar.org/claimable_balances?cursor=4776-000000004c251ddca2bc4dddf22ca8548a45ea977a11e301b748e89f45d08903bb74dd49\u0026limit=10\u0026order=desc" + } + }, + "_embedded": { + "records": [ + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000004c251ddca2bc4dddf22ca8548a45ea977a11e301b748e89f45d08903bb74dd49" + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000004c251ddca2bc4dddf22ca8548a45ea977a11e301b748e89f45d08903bb74dd49/transactions{?cursor,limit,order}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000004c251ddca2bc4dddf22ca8548a45ea977a11e301b748e89f45d08903bb74dd49/operations{?cursor,limit,order}", + "templated": true + } + }, + "id": "000000004c251ddca2bc4dddf22ca8548a45ea977a11e301b748e89f45d08903bb74dd49", + "asset": "native", + "amount": "0.0000001", + "sponsor": "GAEWLPWMXYCVSHJR7ONIP7IBCWFLVB27P43YKLSNLBDMEW4WBAXKVCV3", + "last_modified_ledger": 4776, + "last_modified_time": "2021-09-15T16:11:26Z", + "claimants": [ + { + "destination": "GAEWLPWMXYCVSHJR7ONIP7IBCWFLVB27P43YKLSNLBDMEW4WBAXKVCV3", + "predicate": { + "unconditional": true + } + } + ], + "flags": { + "clawback_enabled": false + }, + "paging_token": "4776-000000004c251ddca2bc4dddf22ca8548a45ea977a11e301b748e89f45d08903bb74dd49" + }, + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000006c08443899e3e5d3a4c0c93881dc70c4a35c93a4d35bf8bbfd4dd57770b58365" + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000006c08443899e3e5d3a4c0c93881dc70c4a35c93a4d35bf8bbfd4dd57770b58365/transactions{?cursor,limit,order}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000006c08443899e3e5d3a4c0c93881dc70c4a35c93a4d35bf8bbfd4dd57770b58365/operations{?cursor,limit,order}", + "templated": true + } + }, + "id": "000000006c08443899e3e5d3a4c0c93881dc70c4a35c93a4d35bf8bbfd4dd57770b58365", + "asset": "XXX:GCGQMVO4AOOQ3BQHGUGT52Y3XOMME6DPEB6QQDX44MC466FMDW2QTMRE", + "amount": "10.0000000", + "sponsor": "GDCMAMQQEF762HKWOILEVRTMC36UXC32LXV3XK4QI4POYQ5SUWZAVFSR", + "last_modified_ledger": 16971, + "last_modified_time": "2021-09-16T09:59:36Z", + "claimants": [ + { + "destination": "GBGKGC6U6NAWFHBXQV4KKFMUA4JLTNB4R6AABAHIHUIT2ZCWSR5HKGZB", + "predicate": { + "and": [ + { + "not": { + "abs_before": "2021-09-17T09:59:34Z" + } + }, + { + "abs_before": "2021-10-17T09:59:34Z" + } + ] + } + }, + { + "destination": "GDCMAMQQEF762HKWOILEVRTMC36UXC32LXV3XK4QI4POYQ5SUWZAVFSR", + "predicate": { + "or": [ + { + "abs_before": "2021-09-17T09:59:34Z" + }, + { + "not": { + "abs_before": "2021-10-17T09:59:34Z" + } + } + ] + } + } + ], + "flags": { + "clawback_enabled": false + }, + "paging_token": "16971-000000006c08443899e3e5d3a4c0c93881dc70c4a35c93a4d35bf8bbfd4dd57770b58365" + }, + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000004efb2bf92d0e67aa1095616779d00dcd00f8bad5c3ab9982de2849ad688417dc" + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000004efb2bf92d0e67aa1095616779d00dcd00f8bad5c3ab9982de2849ad688417dc/transactions{?cursor,limit,order}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000004efb2bf92d0e67aa1095616779d00dcd00f8bad5c3ab9982de2849ad688417dc/operations{?cursor,limit,order}", + "templated": true + } + }, + "id": "000000004efb2bf92d0e67aa1095616779d00dcd00f8bad5c3ab9982de2849ad688417dc", + "asset": "XXX:GDZULQEIJV2SJEW4UIJL4O7JCWCZD2YKBYRA7Z32JNEORA4U42ZLKLSZ", + "amount": "10.0000000", + "sponsor": "GA7235CVJPX7Z6ONI5Q5JZMZS4GTN5AFNE7JN35QNULUZVSF55TBPNGE", + "last_modified_ledger": 17003, + "last_modified_time": "2021-09-16T10:02:27Z", + "claimants": [ + { + "destination": "GA7JV4FBCPRYLX6FD6PXE25VAL2MGIUQL54L4SNMZJOQLCXPUSQ75RFT", + "predicate": { + "and": [ + { + "not": { + "abs_before": "2021-09-17T10:02:25Z" + } + }, + { + "abs_before": "2021-10-17T10:02:25Z" + } + ] + } + }, + { + "destination": "GA7235CVJPX7Z6ONI5Q5JZMZS4GTN5AFNE7JN35QNULUZVSF55TBPNGE", + "predicate": { + "or": [ + { + "abs_before": "2021-09-17T10:02:25Z" + }, + { + "not": { + "abs_before": "2021-10-17T10:02:25Z" + } + } + ] + } + } + ], + "flags": { + "clawback_enabled": false + }, + "paging_token": "17003-000000004efb2bf92d0e67aa1095616779d00dcd00f8bad5c3ab9982de2849ad688417dc" + }, + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000003dcd5f7c9fd35736560af95c201a5e3df808e71f19a7e9f95a6ea7616795b6aa" + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000003dcd5f7c9fd35736560af95c201a5e3df808e71f19a7e9f95a6ea7616795b6aa/transactions{?cursor,limit,order}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000003dcd5f7c9fd35736560af95c201a5e3df808e71f19a7e9f95a6ea7616795b6aa/operations{?cursor,limit,order}", + "templated": true + } + }, + "id": "000000003dcd5f7c9fd35736560af95c201a5e3df808e71f19a7e9f95a6ea7616795b6aa", + "asset": "sYBX:GA3NTL5TTMWHFLL6FUZQRTONE2BP6WX5FVC466KO56QZVIVM3O47YSKD", + "amount": "50.0000000", + "sponsor": "GD2KIXZ7A7ULC5X2NMJAS4HLBUIKMA4AXHJXHVYT5EXXN7VT5CFAE5PS", + "last_modified_ledger": 21694, + "last_modified_time": "2021-09-16T16:53:33Z", + "claimants": [ + { + "destination": "GD2KIXZ7A7ULC5X2NMJAS4HLBUIKMA4AXHJXHVYT5EXXN7VT5CFAE5PS", + "predicate": { + "not": { + "unconditional": true + } + } + }, + { + "destination": "GA3NTL5TTMWHFLL6FUZQRTONE2BP6WX5FVC466KO56QZVIVM3O47YSKD", + "predicate": { + "unconditional": true + } + }, + { + "destination": "GAXXZCBJKMIGPGNVGPWJMQEJA4KFOTOTDQK376NKCYRDEHD4DS4JBE6R", + "predicate": { + "not": { + "abs_before": "2022-03-18T08:13:33Z" + } + } + } + ], + "flags": { + "clawback_enabled": false + }, + "paging_token": "21694-000000003dcd5f7c9fd35736560af95c201a5e3df808e71f19a7e9f95a6ea7616795b6aa" + }, + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000dac983d760f7c7c9aec7b25d44e85d120e6553c6ffce8639af635edb481178cb" + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000dac983d760f7c7c9aec7b25d44e85d120e6553c6ffce8639af635edb481178cb/transactions{?cursor,limit,order}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000dac983d760f7c7c9aec7b25d44e85d120e6553c6ffce8639af635edb481178cb/operations{?cursor,limit,order}", + "templated": true + } + }, + "id": "00000000dac983d760f7c7c9aec7b25d44e85d120e6553c6ffce8639af635edb481178cb", + "asset": "YBX:GAK6NV6HOPPEVY3DOAEH3YVOCDSI2YCMJCJ37THUZUMXDQHAZHQPHNDT", + "amount": "100.0000000", + "sponsor": "GD2KIXZ7A7ULC5X2NMJAS4HLBUIKMA4AXHJXHVYT5EXXN7VT5CFAE5PS", + "last_modified_ledger": 21694, + "last_modified_time": "2021-09-16T16:53:33Z", + "claimants": [ + { + "destination": "GD2KIXZ7A7ULC5X2NMJAS4HLBUIKMA4AXHJXHVYT5EXXN7VT5CFAE5PS", + "predicate": { + "not": { + "unconditional": true + } + } + }, + { + "destination": "GA7SWHODKGVLY5SYLSZ2B43EYLH46ZTZWCJ7DVGHOW5YDFZD4R2DJCMT", + "predicate": { + "unconditional": true + } + }, + { + "destination": "GAXXZCBJKMIGPGNVGPWJMQEJA4KFOTOTDQK376NKCYRDEHD4DS4JBE6R", + "predicate": { + "not": { + "abs_before": "2022-03-18T08:13:33Z" + } + } + } + ], + "flags": { + "clawback_enabled": false + }, + "paging_token": "21694-00000000dac983d760f7c7c9aec7b25d44e85d120e6553c6ffce8639af635edb481178cb" + }, + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000668b7e1d57dbc0165deea740737dbb0a914601d0c5515128a0d301a307075c3f" + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000668b7e1d57dbc0165deea740737dbb0a914601d0c5515128a0d301a307075c3f/transactions{?cursor,limit,order}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000668b7e1d57dbc0165deea740737dbb0a914601d0c5515128a0d301a307075c3f/operations{?cursor,limit,order}", + "templated": true + } + }, + "id": "00000000668b7e1d57dbc0165deea740737dbb0a914601d0c5515128a0d301a307075c3f", + "asset": "y01USDC:GA7SWHODKGVLY5SYLSZ2B43EYLH46ZTZWCJ7DVGHOW5YDFZD4R2DJCMT", + "amount": "100000.0000000", + "sponsor": "GD2KIXZ7A7ULC5X2NMJAS4HLBUIKMA4AXHJXHVYT5EXXN7VT5CFAE5PS", + "last_modified_ledger": 21810, + "last_modified_time": "2021-09-16T17:03:44Z", + "claimants": [ + { + "destination": "GD2KIXZ7A7ULC5X2NMJAS4HLBUIKMA4AXHJXHVYT5EXXN7VT5CFAE5PS", + "predicate": { + "not": { + "unconditional": true + } + } + }, + { + "destination": "GA7SWHODKGVLY5SYLSZ2B43EYLH46ZTZWCJ7DVGHOW5YDFZD4R2DJCMT", + "predicate": { + "unconditional": true + } + } + ], + "flags": { + "clawback_enabled": false + }, + "paging_token": "21810-00000000668b7e1d57dbc0165deea740737dbb0a914601d0c5515128a0d301a307075c3f" + }, + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000581ff7b80dd5c61ea3c92fe3a4753df81c22c63e002e8eede63a348ae4aaf7da" + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000581ff7b80dd5c61ea3c92fe3a4753df81c22c63e002e8eede63a348ae4aaf7da/transactions{?cursor,limit,order}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000581ff7b80dd5c61ea3c92fe3a4753df81c22c63e002e8eede63a348ae4aaf7da/operations{?cursor,limit,order}", + "templated": true + } + }, + "id": "00000000581ff7b80dd5c61ea3c92fe3a4753df81c22c63e002e8eede63a348ae4aaf7da", + "asset": "l01USDC:GA7SWHODKGVLY5SYLSZ2B43EYLH46ZTZWCJ7DVGHOW5YDFZD4R2DJCMT", + "amount": "1500.0000000", + "sponsor": "GACXXEZNUCSS5ABWALBERU4SU36SYTQQPOQR4UM3OPHXT3LQO7NLGIHG", + "last_modified_ledger": 21874, + "last_modified_time": "2021-09-16T17:09:16Z", + "claimants": [ + { + "destination": "GACXXEZNUCSS5ABWALBERU4SU36SYTQQPOQR4UM3OPHXT3LQO7NLGIHG", + "predicate": { + "not": { + "unconditional": true + } + } + }, + { + "destination": "GA7SWHODKGVLY5SYLSZ2B43EYLH46ZTZWCJ7DVGHOW5YDFZD4R2DJCMT", + "predicate": { + "unconditional": true + } + }, + { + "destination": "GA3NTL5TTMWHFLL6FUZQRTONE2BP6WX5FVC466KO56QZVIVM3O47YSKD", + "predicate": { + "abs_before": "1970-01-01T00:00:00Z" + } + } + ], + "flags": { + "clawback_enabled": false + }, + "paging_token": "21874-00000000581ff7b80dd5c61ea3c92fe3a4753df81c22c63e002e8eede63a348ae4aaf7da" + }, + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000b83109c0d7714120e408d55019bb84277f00a018d5334810bf0e6a7a0b1b1d4f" + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000b83109c0d7714120e408d55019bb84277f00a018d5334810bf0e6a7a0b1b1d4f/transactions{?cursor,limit,order}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000b83109c0d7714120e408d55019bb84277f00a018d5334810bf0e6a7a0b1b1d4f/operations{?cursor,limit,order}", + "templated": true + } + }, + "id": "00000000b83109c0d7714120e408d55019bb84277f00a018d5334810bf0e6a7a0b1b1d4f", + "asset": "y00XLM:GA7SWHODKGVLY5SYLSZ2B43EYLH46ZTZWCJ7DVGHOW5YDFZD4R2DJCMT", + "amount": "10000.0000000", + "sponsor": "GACXXEZNUCSS5ABWALBERU4SU36SYTQQPOQR4UM3OPHXT3LQO7NLGIHG", + "last_modified_ledger": 21874, + "last_modified_time": "2021-09-16T17:09:16Z", + "claimants": [ + { + "destination": "GACXXEZNUCSS5ABWALBERU4SU36SYTQQPOQR4UM3OPHXT3LQO7NLGIHG", + "predicate": { + "not": { + "unconditional": true + } + } + }, + { + "destination": "GA7SWHODKGVLY5SYLSZ2B43EYLH46ZTZWCJ7DVGHOW5YDFZD4R2DJCMT", + "predicate": { + "unconditional": true + } + } + ], + "flags": { + "clawback_enabled": false + }, + "paging_token": "21874-00000000b83109c0d7714120e408d55019bb84277f00a018d5334810bf0e6a7a0b1b1d4f" + }, + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000734d6099f19c78aaced13e4aa312f6f59071470dc59f33cd0201de9d3f768aa3" + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000734d6099f19c78aaced13e4aa312f6f59071470dc59f33cd0201de9d3f768aa3/transactions{?cursor,limit,order}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000734d6099f19c78aaced13e4aa312f6f59071470dc59f33cd0201de9d3f768aa3/operations{?cursor,limit,order}", + "templated": true + } + }, + "id": "00000000734d6099f19c78aaced13e4aa312f6f59071470dc59f33cd0201de9d3f768aa3", + "asset": "USDPEND:GBMN3TR7M56LHLFYKL2QOUWE466MF2BRR5DHAGYYCGID7DK35LTF7ZOB", + "amount": "10000.0000000", + "sponsor": "GCGDQP6CI2UI2KOR42YIR44SKQEDCDCKGJ6X55K7CIXAQRMAALMB5J7J", + "last_modified_ledger": 22475, + "last_modified_time": "2021-09-16T18:01:38Z", + "claimants": [ + { + "destination": "GCGIU3GJWBSZN3KK7NJZVVINCFZIPPL5M35ISQUTGSOOIRF2RXIE2TBZ", + "predicate": { + "unconditional": true + } + }, + { + "destination": "GBMN3TR7M56LHLFYKL2QOUWE466MF2BRR5DHAGYYCGID7DK35LTF7ZOB", + "predicate": { + "not": { + "abs_before": "2021-09-16T04:00:00Z" + } + } + } + ], + "flags": { + "clawback_enabled": false + }, + "paging_token": "22475-00000000734d6099f19c78aaced13e4aa312f6f59071470dc59f33cd0201de9d3f768aa3" + }, + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000ce94cb2b1079e6c1901b87de0ea1d3f5606cbdff62aa01301d4ced47e8736a79" + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000ce94cb2b1079e6c1901b87de0ea1d3f5606cbdff62aa01301d4ced47e8736a79/transactions{?cursor,limit,order}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000ce94cb2b1079e6c1901b87de0ea1d3f5606cbdff62aa01301d4ced47e8736a79/operations{?cursor,limit,order}", + "templated": true + } + }, + "id": "00000000ce94cb2b1079e6c1901b87de0ea1d3f5606cbdff62aa01301d4ced47e8736a79", + "asset": "USDPEND:GBMN3TR7M56LHLFYKL2QOUWE466MF2BRR5DHAGYYCGID7DK35LTF7ZOB", + "amount": "10000.0000000", + "sponsor": "GCGDQP6CI2UI2KOR42YIR44SKQEDCDCKGJ6X55K7CIXAQRMAALMB5J7J", + "last_modified_ledger": 22578, + "last_modified_time": "2021-09-16T18:10:34Z", + "claimants": [ + { + "destination": "GDPTRBLM6UCRBENCLEGEKPQ4ZVQ7J5LAQ2O2QQV4OS26DVWFPJ6YERIJ", + "predicate": { + "unconditional": true + } + }, + { + "destination": "GBMN3TR7M56LHLFYKL2QOUWE466MF2BRR5DHAGYYCGID7DK35LTF7ZOB", + "predicate": { + "not": { + "abs_before": "2021-09-16T04:00:00Z" + } + } + } + ], + "flags": { + "clawback_enabled": false + }, + "paging_token": "22578-00000000ce94cb2b1079e6c1901b87de0ea1d3f5606cbdff62aa01301d4ced47e8736a79" + } + ] + } + } + recorded_at: Wed, 17 Nov 2021 09:55:23 GMT +recorded_with: VCR 6.0.0 diff --git a/horizon/spec/fixtures/vcr_cassettes/Stellar_Horizon_Client/_claimable_balances/with_default_parameters/fetches_claimable_balances.yml b/horizon/spec/fixtures/vcr_cassettes/Stellar_Horizon_Client/_claimable_balances/with_default_parameters/fetches_claimable_balances.yml new file mode 100644 index 00000000..eff7312d --- /dev/null +++ b/horizon/spec/fixtures/vcr_cassettes/Stellar_Horizon_Client/_claimable_balances/with_default_parameters/fetches_claimable_balances.yml @@ -0,0 +1,670 @@ +--- +http_interactions: +- request: + method: get + uri: https://horizon-testnet.stellar.org/ + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Faraday v1.8.0 + Accept: + - application/hal+json,application/problem+json,application/json + X-Client-Name: + - ruby-stellar-sdk + X-Client-Version: + - 0.30.0 + response: + status: + code: 200 + message: OK + headers: + Date: + - Wed, 17 Nov 2021 09:48:45 GMT + Content-Type: + - application/hal+json; charset=utf-8 + Connection: + - keep-alive + Cache-Control: + - no-cache, no-store, max-age=0 + Content-Disposition: + - inline + Vary: + - Origin + X-Ratelimit-Limit: + - '101' + X-Ratelimit-Remaining: + - '100' + X-Ratelimit-Reset: + - '1' + body: + encoding: ASCII-8BIT + string: |- + { + "_links": { + "account": { + "href": "https://horizon-testnet.stellar.org/accounts/{account_id}", + "templated": true + }, + "accounts": { + "href": "https://horizon-testnet.stellar.org/accounts{?signer,sponsor,asset,liquidity_pool,cursor,limit,order}", + "templated": true + }, + "account_transactions": { + "href": "https://horizon-testnet.stellar.org/accounts/{account_id}/transactions{?cursor,limit,order}", + "templated": true + }, + "claimable_balances": { + "href": "https://horizon-testnet.stellar.org/claimable_balances?{asset,claimant,sponsor}", + "templated": true + }, + "assets": { + "href": "https://horizon-testnet.stellar.org/assets{?asset_code,asset_issuer,cursor,limit,order}", + "templated": true + }, + "effects": { + "href": "https://horizon-testnet.stellar.org/effects{?cursor,limit,order}", + "templated": true + }, + "fee_stats": { + "href": "https://horizon-testnet.stellar.org/fee_stats" + }, + "friendbot": { + "href": "https://friendbot.stellar.org/{?addr}", + "templated": true + }, + "ledger": { + "href": "https://horizon-testnet.stellar.org/ledger/{sequence}", + "templated": true + }, + "ledgers": { + "href": "https://horizon-testnet.stellar.org/ledgers{?cursor,limit,order}", + "templated": true + }, + "liquidity_pools": { + "href": "https://horizon-testnet.stellar.org/liquidity_pools?{?reserves,account}", + "templated": true + }, + "offer": { + "href": "https://horizon-testnet.stellar.org/offers/{offer_id}", + "templated": true + }, + "offers": { + "href": "https://horizon-testnet.stellar.org/offers{?selling,buying,seller,sponsor,cursor,limit,order}", + "templated": true + }, + "operation": { + "href": "https://horizon-testnet.stellar.org/operations/{id}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/operations{?cursor,limit,order,include_failed}", + "templated": true + }, + "order_book": { + "href": "https://horizon-testnet.stellar.org/order_book{?selling_asset_type,selling_asset_code,selling_asset_issuer,buying_asset_type,buying_asset_code,buying_asset_issuer,limit}", + "templated": true + }, + "payments": { + "href": "https://horizon-testnet.stellar.org/payments{?cursor,limit,order,include_failed}", + "templated": true + }, + "self": { + "href": "https://horizon-testnet.stellar.org/" + }, + "strict_receive_paths": { + "href": "https://horizon-testnet.stellar.org/paths/strict-receive{?source_assets,source_account,destination_account,destination_asset_type,destination_asset_issuer,destination_asset_code,destination_amount}", + "templated": true + }, + "strict_send_paths": { + "href": "https://horizon-testnet.stellar.org/paths/strict-send{?destination_account,destination_assets,source_asset_type,source_asset_issuer,source_asset_code,source_amount}", + "templated": true + }, + "trade_aggregations": { + "href": "https://horizon-testnet.stellar.org/trade_aggregations?base_asset_type={base_asset_type}\u0026base_asset_code={base_asset_code}\u0026base_asset_issuer={base_asset_issuer}\u0026counter_asset_type={counter_asset_type}\u0026counter_asset_code={counter_asset_code}\u0026counter_asset_issuer={counter_asset_issuer}", + "templated": true + }, + "trades": { + "href": "https://horizon-testnet.stellar.org/trades?base_asset_type={base_asset_type}\u0026base_asset_code={base_asset_code}\u0026base_asset_issuer={base_asset_issuer}\u0026counter_asset_type={counter_asset_type}\u0026counter_asset_code={counter_asset_code}\u0026counter_asset_issuer={counter_asset_issuer}", + "templated": true + }, + "transaction": { + "href": "https://horizon-testnet.stellar.org/transactions/{hash}", + "templated": true + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/transactions{?cursor,limit,order}", + "templated": true + } + }, + "horizon_version": "2.11.0-07dcbb1e43d9ee991461e1284af1d11dcae645d7", + "core_version": "stellar-core 18.1.0 (dc5f5a392098b82bd9453a2aa4259e7af600ad9d)", + "ingest_latest_ledger": 1036092, + "history_latest_ledger": 1036092, + "history_latest_ledger_closed_at": "2021-11-17T09:48:39Z", + "history_elder_ledger": 2, + "core_latest_ledger": 1036092, + "network_passphrase": "Test SDF Network ; September 2015", + "current_protocol_version": 18, + "core_supported_protocol_version": 18 + } + recorded_at: Wed, 17 Nov 2021 09:48:45 GMT +- request: + method: get + uri: https://horizon-testnet.stellar.org/claimable_balances + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Faraday v1.8.0 + Accept: + - application/hal+json,application/problem+json,application/json + X-Client-Name: + - ruby-stellar-sdk + X-Client-Version: + - 0.30.0 + response: + status: + code: 200 + message: OK + headers: + Date: + - Wed, 17 Nov 2021 09:48:46 GMT + Content-Type: + - application/hal+json; charset=utf-8 + Connection: + - keep-alive + Cache-Control: + - no-cache, no-store, max-age=0 + Content-Disposition: + - inline + Latest-Ledger: + - '1036093' + Vary: + - Origin + X-Ratelimit-Limit: + - '101' + X-Ratelimit-Remaining: + - '100' + X-Ratelimit-Reset: + - '1' + body: + encoding: ASCII-8BIT + string: |- + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances?cursor=\u0026limit=10\u0026order=asc" + }, + "next": { + "href": "https://horizon-testnet.stellar.org/claimable_balances?cursor=22578-00000000ce94cb2b1079e6c1901b87de0ea1d3f5606cbdff62aa01301d4ced47e8736a79\u0026limit=10\u0026order=asc" + }, + "prev": { + "href": "https://horizon-testnet.stellar.org/claimable_balances?cursor=4776-000000004c251ddca2bc4dddf22ca8548a45ea977a11e301b748e89f45d08903bb74dd49\u0026limit=10\u0026order=desc" + } + }, + "_embedded": { + "records": [ + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000004c251ddca2bc4dddf22ca8548a45ea977a11e301b748e89f45d08903bb74dd49" + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000004c251ddca2bc4dddf22ca8548a45ea977a11e301b748e89f45d08903bb74dd49/transactions{?cursor,limit,order}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000004c251ddca2bc4dddf22ca8548a45ea977a11e301b748e89f45d08903bb74dd49/operations{?cursor,limit,order}", + "templated": true + } + }, + "id": "000000004c251ddca2bc4dddf22ca8548a45ea977a11e301b748e89f45d08903bb74dd49", + "asset": "native", + "amount": "0.0000001", + "sponsor": "GAEWLPWMXYCVSHJR7ONIP7IBCWFLVB27P43YKLSNLBDMEW4WBAXKVCV3", + "last_modified_ledger": 4776, + "last_modified_time": "2021-09-15T16:11:26Z", + "claimants": [ + { + "destination": "GAEWLPWMXYCVSHJR7ONIP7IBCWFLVB27P43YKLSNLBDMEW4WBAXKVCV3", + "predicate": { + "unconditional": true + } + } + ], + "flags": { + "clawback_enabled": false + }, + "paging_token": "4776-000000004c251ddca2bc4dddf22ca8548a45ea977a11e301b748e89f45d08903bb74dd49" + }, + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000006c08443899e3e5d3a4c0c93881dc70c4a35c93a4d35bf8bbfd4dd57770b58365" + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000006c08443899e3e5d3a4c0c93881dc70c4a35c93a4d35bf8bbfd4dd57770b58365/transactions{?cursor,limit,order}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000006c08443899e3e5d3a4c0c93881dc70c4a35c93a4d35bf8bbfd4dd57770b58365/operations{?cursor,limit,order}", + "templated": true + } + }, + "id": "000000006c08443899e3e5d3a4c0c93881dc70c4a35c93a4d35bf8bbfd4dd57770b58365", + "asset": "XXX:GCGQMVO4AOOQ3BQHGUGT52Y3XOMME6DPEB6QQDX44MC466FMDW2QTMRE", + "amount": "10.0000000", + "sponsor": "GDCMAMQQEF762HKWOILEVRTMC36UXC32LXV3XK4QI4POYQ5SUWZAVFSR", + "last_modified_ledger": 16971, + "last_modified_time": "2021-09-16T09:59:36Z", + "claimants": [ + { + "destination": "GBGKGC6U6NAWFHBXQV4KKFMUA4JLTNB4R6AABAHIHUIT2ZCWSR5HKGZB", + "predicate": { + "and": [ + { + "not": { + "abs_before": "2021-09-17T09:59:34Z" + } + }, + { + "abs_before": "2021-10-17T09:59:34Z" + } + ] + } + }, + { + "destination": "GDCMAMQQEF762HKWOILEVRTMC36UXC32LXV3XK4QI4POYQ5SUWZAVFSR", + "predicate": { + "or": [ + { + "abs_before": "2021-09-17T09:59:34Z" + }, + { + "not": { + "abs_before": "2021-10-17T09:59:34Z" + } + } + ] + } + } + ], + "flags": { + "clawback_enabled": false + }, + "paging_token": "16971-000000006c08443899e3e5d3a4c0c93881dc70c4a35c93a4d35bf8bbfd4dd57770b58365" + }, + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000004efb2bf92d0e67aa1095616779d00dcd00f8bad5c3ab9982de2849ad688417dc" + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000004efb2bf92d0e67aa1095616779d00dcd00f8bad5c3ab9982de2849ad688417dc/transactions{?cursor,limit,order}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000004efb2bf92d0e67aa1095616779d00dcd00f8bad5c3ab9982de2849ad688417dc/operations{?cursor,limit,order}", + "templated": true + } + }, + "id": "000000004efb2bf92d0e67aa1095616779d00dcd00f8bad5c3ab9982de2849ad688417dc", + "asset": "XXX:GDZULQEIJV2SJEW4UIJL4O7JCWCZD2YKBYRA7Z32JNEORA4U42ZLKLSZ", + "amount": "10.0000000", + "sponsor": "GA7235CVJPX7Z6ONI5Q5JZMZS4GTN5AFNE7JN35QNULUZVSF55TBPNGE", + "last_modified_ledger": 17003, + "last_modified_time": "2021-09-16T10:02:27Z", + "claimants": [ + { + "destination": "GA7JV4FBCPRYLX6FD6PXE25VAL2MGIUQL54L4SNMZJOQLCXPUSQ75RFT", + "predicate": { + "and": [ + { + "not": { + "abs_before": "2021-09-17T10:02:25Z" + } + }, + { + "abs_before": "2021-10-17T10:02:25Z" + } + ] + } + }, + { + "destination": "GA7235CVJPX7Z6ONI5Q5JZMZS4GTN5AFNE7JN35QNULUZVSF55TBPNGE", + "predicate": { + "or": [ + { + "abs_before": "2021-09-17T10:02:25Z" + }, + { + "not": { + "abs_before": "2021-10-17T10:02:25Z" + } + } + ] + } + } + ], + "flags": { + "clawback_enabled": false + }, + "paging_token": "17003-000000004efb2bf92d0e67aa1095616779d00dcd00f8bad5c3ab9982de2849ad688417dc" + }, + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000003dcd5f7c9fd35736560af95c201a5e3df808e71f19a7e9f95a6ea7616795b6aa" + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000003dcd5f7c9fd35736560af95c201a5e3df808e71f19a7e9f95a6ea7616795b6aa/transactions{?cursor,limit,order}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000003dcd5f7c9fd35736560af95c201a5e3df808e71f19a7e9f95a6ea7616795b6aa/operations{?cursor,limit,order}", + "templated": true + } + }, + "id": "000000003dcd5f7c9fd35736560af95c201a5e3df808e71f19a7e9f95a6ea7616795b6aa", + "asset": "sYBX:GA3NTL5TTMWHFLL6FUZQRTONE2BP6WX5FVC466KO56QZVIVM3O47YSKD", + "amount": "50.0000000", + "sponsor": "GD2KIXZ7A7ULC5X2NMJAS4HLBUIKMA4AXHJXHVYT5EXXN7VT5CFAE5PS", + "last_modified_ledger": 21694, + "last_modified_time": "2021-09-16T16:53:33Z", + "claimants": [ + { + "destination": "GD2KIXZ7A7ULC5X2NMJAS4HLBUIKMA4AXHJXHVYT5EXXN7VT5CFAE5PS", + "predicate": { + "not": { + "unconditional": true + } + } + }, + { + "destination": "GA3NTL5TTMWHFLL6FUZQRTONE2BP6WX5FVC466KO56QZVIVM3O47YSKD", + "predicate": { + "unconditional": true + } + }, + { + "destination": "GAXXZCBJKMIGPGNVGPWJMQEJA4KFOTOTDQK376NKCYRDEHD4DS4JBE6R", + "predicate": { + "not": { + "abs_before": "2022-03-18T08:13:33Z" + } + } + } + ], + "flags": { + "clawback_enabled": false + }, + "paging_token": "21694-000000003dcd5f7c9fd35736560af95c201a5e3df808e71f19a7e9f95a6ea7616795b6aa" + }, + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000dac983d760f7c7c9aec7b25d44e85d120e6553c6ffce8639af635edb481178cb" + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000dac983d760f7c7c9aec7b25d44e85d120e6553c6ffce8639af635edb481178cb/transactions{?cursor,limit,order}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000dac983d760f7c7c9aec7b25d44e85d120e6553c6ffce8639af635edb481178cb/operations{?cursor,limit,order}", + "templated": true + } + }, + "id": "00000000dac983d760f7c7c9aec7b25d44e85d120e6553c6ffce8639af635edb481178cb", + "asset": "YBX:GAK6NV6HOPPEVY3DOAEH3YVOCDSI2YCMJCJ37THUZUMXDQHAZHQPHNDT", + "amount": "100.0000000", + "sponsor": "GD2KIXZ7A7ULC5X2NMJAS4HLBUIKMA4AXHJXHVYT5EXXN7VT5CFAE5PS", + "last_modified_ledger": 21694, + "last_modified_time": "2021-09-16T16:53:33Z", + "claimants": [ + { + "destination": "GD2KIXZ7A7ULC5X2NMJAS4HLBUIKMA4AXHJXHVYT5EXXN7VT5CFAE5PS", + "predicate": { + "not": { + "unconditional": true + } + } + }, + { + "destination": "GA7SWHODKGVLY5SYLSZ2B43EYLH46ZTZWCJ7DVGHOW5YDFZD4R2DJCMT", + "predicate": { + "unconditional": true + } + }, + { + "destination": "GAXXZCBJKMIGPGNVGPWJMQEJA4KFOTOTDQK376NKCYRDEHD4DS4JBE6R", + "predicate": { + "not": { + "abs_before": "2022-03-18T08:13:33Z" + } + } + } + ], + "flags": { + "clawback_enabled": false + }, + "paging_token": "21694-00000000dac983d760f7c7c9aec7b25d44e85d120e6553c6ffce8639af635edb481178cb" + }, + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000668b7e1d57dbc0165deea740737dbb0a914601d0c5515128a0d301a307075c3f" + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000668b7e1d57dbc0165deea740737dbb0a914601d0c5515128a0d301a307075c3f/transactions{?cursor,limit,order}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000668b7e1d57dbc0165deea740737dbb0a914601d0c5515128a0d301a307075c3f/operations{?cursor,limit,order}", + "templated": true + } + }, + "id": "00000000668b7e1d57dbc0165deea740737dbb0a914601d0c5515128a0d301a307075c3f", + "asset": "y01USDC:GA7SWHODKGVLY5SYLSZ2B43EYLH46ZTZWCJ7DVGHOW5YDFZD4R2DJCMT", + "amount": "100000.0000000", + "sponsor": "GD2KIXZ7A7ULC5X2NMJAS4HLBUIKMA4AXHJXHVYT5EXXN7VT5CFAE5PS", + "last_modified_ledger": 21810, + "last_modified_time": "2021-09-16T17:03:44Z", + "claimants": [ + { + "destination": "GD2KIXZ7A7ULC5X2NMJAS4HLBUIKMA4AXHJXHVYT5EXXN7VT5CFAE5PS", + "predicate": { + "not": { + "unconditional": true + } + } + }, + { + "destination": "GA7SWHODKGVLY5SYLSZ2B43EYLH46ZTZWCJ7DVGHOW5YDFZD4R2DJCMT", + "predicate": { + "unconditional": true + } + } + ], + "flags": { + "clawback_enabled": false + }, + "paging_token": "21810-00000000668b7e1d57dbc0165deea740737dbb0a914601d0c5515128a0d301a307075c3f" + }, + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000581ff7b80dd5c61ea3c92fe3a4753df81c22c63e002e8eede63a348ae4aaf7da" + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000581ff7b80dd5c61ea3c92fe3a4753df81c22c63e002e8eede63a348ae4aaf7da/transactions{?cursor,limit,order}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000581ff7b80dd5c61ea3c92fe3a4753df81c22c63e002e8eede63a348ae4aaf7da/operations{?cursor,limit,order}", + "templated": true + } + }, + "id": "00000000581ff7b80dd5c61ea3c92fe3a4753df81c22c63e002e8eede63a348ae4aaf7da", + "asset": "l01USDC:GA7SWHODKGVLY5SYLSZ2B43EYLH46ZTZWCJ7DVGHOW5YDFZD4R2DJCMT", + "amount": "1500.0000000", + "sponsor": "GACXXEZNUCSS5ABWALBERU4SU36SYTQQPOQR4UM3OPHXT3LQO7NLGIHG", + "last_modified_ledger": 21874, + "last_modified_time": "2021-09-16T17:09:16Z", + "claimants": [ + { + "destination": "GACXXEZNUCSS5ABWALBERU4SU36SYTQQPOQR4UM3OPHXT3LQO7NLGIHG", + "predicate": { + "not": { + "unconditional": true + } + } + }, + { + "destination": "GA7SWHODKGVLY5SYLSZ2B43EYLH46ZTZWCJ7DVGHOW5YDFZD4R2DJCMT", + "predicate": { + "unconditional": true + } + }, + { + "destination": "GA3NTL5TTMWHFLL6FUZQRTONE2BP6WX5FVC466KO56QZVIVM3O47YSKD", + "predicate": { + "abs_before": "1970-01-01T00:00:00Z" + } + } + ], + "flags": { + "clawback_enabled": false + }, + "paging_token": "21874-00000000581ff7b80dd5c61ea3c92fe3a4753df81c22c63e002e8eede63a348ae4aaf7da" + }, + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000b83109c0d7714120e408d55019bb84277f00a018d5334810bf0e6a7a0b1b1d4f" + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000b83109c0d7714120e408d55019bb84277f00a018d5334810bf0e6a7a0b1b1d4f/transactions{?cursor,limit,order}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000b83109c0d7714120e408d55019bb84277f00a018d5334810bf0e6a7a0b1b1d4f/operations{?cursor,limit,order}", + "templated": true + } + }, + "id": "00000000b83109c0d7714120e408d55019bb84277f00a018d5334810bf0e6a7a0b1b1d4f", + "asset": "y00XLM:GA7SWHODKGVLY5SYLSZ2B43EYLH46ZTZWCJ7DVGHOW5YDFZD4R2DJCMT", + "amount": "10000.0000000", + "sponsor": "GACXXEZNUCSS5ABWALBERU4SU36SYTQQPOQR4UM3OPHXT3LQO7NLGIHG", + "last_modified_ledger": 21874, + "last_modified_time": "2021-09-16T17:09:16Z", + "claimants": [ + { + "destination": "GACXXEZNUCSS5ABWALBERU4SU36SYTQQPOQR4UM3OPHXT3LQO7NLGIHG", + "predicate": { + "not": { + "unconditional": true + } + } + }, + { + "destination": "GA7SWHODKGVLY5SYLSZ2B43EYLH46ZTZWCJ7DVGHOW5YDFZD4R2DJCMT", + "predicate": { + "unconditional": true + } + } + ], + "flags": { + "clawback_enabled": false + }, + "paging_token": "21874-00000000b83109c0d7714120e408d55019bb84277f00a018d5334810bf0e6a7a0b1b1d4f" + }, + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000734d6099f19c78aaced13e4aa312f6f59071470dc59f33cd0201de9d3f768aa3" + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000734d6099f19c78aaced13e4aa312f6f59071470dc59f33cd0201de9d3f768aa3/transactions{?cursor,limit,order}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000734d6099f19c78aaced13e4aa312f6f59071470dc59f33cd0201de9d3f768aa3/operations{?cursor,limit,order}", + "templated": true + } + }, + "id": "00000000734d6099f19c78aaced13e4aa312f6f59071470dc59f33cd0201de9d3f768aa3", + "asset": "USDPEND:GBMN3TR7M56LHLFYKL2QOUWE466MF2BRR5DHAGYYCGID7DK35LTF7ZOB", + "amount": "10000.0000000", + "sponsor": "GCGDQP6CI2UI2KOR42YIR44SKQEDCDCKGJ6X55K7CIXAQRMAALMB5J7J", + "last_modified_ledger": 22475, + "last_modified_time": "2021-09-16T18:01:38Z", + "claimants": [ + { + "destination": "GCGIU3GJWBSZN3KK7NJZVVINCFZIPPL5M35ISQUTGSOOIRF2RXIE2TBZ", + "predicate": { + "unconditional": true + } + }, + { + "destination": "GBMN3TR7M56LHLFYKL2QOUWE466MF2BRR5DHAGYYCGID7DK35LTF7ZOB", + "predicate": { + "not": { + "abs_before": "2021-09-16T04:00:00Z" + } + } + } + ], + "flags": { + "clawback_enabled": false + }, + "paging_token": "22475-00000000734d6099f19c78aaced13e4aa312f6f59071470dc59f33cd0201de9d3f768aa3" + }, + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000ce94cb2b1079e6c1901b87de0ea1d3f5606cbdff62aa01301d4ced47e8736a79" + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000ce94cb2b1079e6c1901b87de0ea1d3f5606cbdff62aa01301d4ced47e8736a79/transactions{?cursor,limit,order}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/00000000ce94cb2b1079e6c1901b87de0ea1d3f5606cbdff62aa01301d4ced47e8736a79/operations{?cursor,limit,order}", + "templated": true + } + }, + "id": "00000000ce94cb2b1079e6c1901b87de0ea1d3f5606cbdff62aa01301d4ced47e8736a79", + "asset": "USDPEND:GBMN3TR7M56LHLFYKL2QOUWE466MF2BRR5DHAGYYCGID7DK35LTF7ZOB", + "amount": "10000.0000000", + "sponsor": "GCGDQP6CI2UI2KOR42YIR44SKQEDCDCKGJ6X55K7CIXAQRMAALMB5J7J", + "last_modified_ledger": 22578, + "last_modified_time": "2021-09-16T18:10:34Z", + "claimants": [ + { + "destination": "GDPTRBLM6UCRBENCLEGEKPQ4ZVQ7J5LAQ2O2QQV4OS26DVWFPJ6YERIJ", + "predicate": { + "unconditional": true + } + }, + { + "destination": "GBMN3TR7M56LHLFYKL2QOUWE466MF2BRR5DHAGYYCGID7DK35LTF7ZOB", + "predicate": { + "not": { + "abs_before": "2021-09-16T04:00:00Z" + } + } + } + ], + "flags": { + "clawback_enabled": false + }, + "paging_token": "22578-00000000ce94cb2b1079e6c1901b87de0ea1d3f5606cbdff62aa01301d4ced47e8736a79" + } + ] + } + } + recorded_at: Wed, 17 Nov 2021 09:48:46 GMT +recorded_with: VCR 6.0.0 diff --git a/horizon/spec/fixtures/vcr_cassettes/Stellar_Horizon_Client/_claimable_balances/with_sponsor_set/fetches_only_balances_with_given_sponsor.yml b/horizon/spec/fixtures/vcr_cassettes/Stellar_Horizon_Client/_claimable_balances/with_sponsor_set/fetches_only_balances_with_given_sponsor.yml new file mode 100644 index 00000000..75233901 --- /dev/null +++ b/horizon/spec/fixtures/vcr_cassettes/Stellar_Horizon_Client/_claimable_balances/with_sponsor_set/fetches_only_balances_with_given_sponsor.yml @@ -0,0 +1,271 @@ +--- +http_interactions: +- request: + method: get + uri: https://horizon-testnet.stellar.org/ + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Faraday v1.8.0 + Accept: + - application/hal+json,application/problem+json,application/json + X-Client-Name: + - ruby-stellar-sdk + X-Client-Version: + - 0.30.0 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Nov 2021 18:17:12 GMT + Content-Type: + - application/hal+json; charset=utf-8 + Connection: + - keep-alive + Cache-Control: + - no-cache, no-store, max-age=0 + Content-Disposition: + - inline + Vary: + - Origin + X-Ratelimit-Limit: + - '101' + X-Ratelimit-Remaining: + - '100' + X-Ratelimit-Reset: + - '1' + body: + encoding: ASCII-8BIT + string: |- + { + "_links": { + "account": { + "href": "https://horizon-testnet.stellar.org/accounts/{account_id}", + "templated": true + }, + "accounts": { + "href": "https://horizon-testnet.stellar.org/accounts{?signer,sponsor,asset,liquidity_pool,cursor,limit,order}", + "templated": true + }, + "account_transactions": { + "href": "https://horizon-testnet.stellar.org/accounts/{account_id}/transactions{?cursor,limit,order}", + "templated": true + }, + "claimable_balances": { + "href": "https://horizon-testnet.stellar.org/claimable_balances{?asset,claimant,sponsor}", + "templated": true + }, + "assets": { + "href": "https://horizon-testnet.stellar.org/assets{?asset_code,asset_issuer,cursor,limit,order}", + "templated": true + }, + "effects": { + "href": "https://horizon-testnet.stellar.org/effects{?cursor,limit,order}", + "templated": true + }, + "fee_stats": { + "href": "https://horizon-testnet.stellar.org/fee_stats" + }, + "friendbot": { + "href": "https://friendbot.stellar.org/{?addr}", + "templated": true + }, + "ledger": { + "href": "https://horizon-testnet.stellar.org/ledger/{sequence}", + "templated": true + }, + "ledgers": { + "href": "https://horizon-testnet.stellar.org/ledgers{?cursor,limit,order}", + "templated": true + }, + "liquidity_pools": { + "href": "https://horizon-testnet.stellar.org/liquidity_pools?{?reserves,account}", + "templated": true + }, + "offer": { + "href": "https://horizon-testnet.stellar.org/offers/{offer_id}", + "templated": true + }, + "offers": { + "href": "https://horizon-testnet.stellar.org/offers{?selling,buying,seller,sponsor,cursor,limit,order}", + "templated": true + }, + "operation": { + "href": "https://horizon-testnet.stellar.org/operations/{id}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/operations{?cursor,limit,order,include_failed}", + "templated": true + }, + "order_book": { + "href": "https://horizon-testnet.stellar.org/order_book{?selling_asset_type,selling_asset_code,selling_asset_issuer,buying_asset_type,buying_asset_code,buying_asset_issuer,limit}", + "templated": true + }, + "payments": { + "href": "https://horizon-testnet.stellar.org/payments{?cursor,limit,order,include_failed}", + "templated": true + }, + "self": { + "href": "https://horizon-testnet.stellar.org/" + }, + "strict_receive_paths": { + "href": "https://horizon-testnet.stellar.org/paths/strict-receive{?source_assets,source_account,destination_account,destination_asset_type,destination_asset_issuer,destination_asset_code,destination_amount}", + "templated": true + }, + "strict_send_paths": { + "href": "https://horizon-testnet.stellar.org/paths/strict-send{?destination_account,destination_assets,source_asset_type,source_asset_issuer,source_asset_code,source_amount}", + "templated": true + }, + "trade_aggregations": { + "href": "https://horizon-testnet.stellar.org/trade_aggregations?base_asset_type={base_asset_type}\u0026base_asset_code={base_asset_code}\u0026base_asset_issuer={base_asset_issuer}\u0026counter_asset_type={counter_asset_type}\u0026counter_asset_code={counter_asset_code}\u0026counter_asset_issuer={counter_asset_issuer}", + "templated": true + }, + "trades": { + "href": "https://horizon-testnet.stellar.org/trades?base_asset_type={base_asset_type}\u0026base_asset_code={base_asset_code}\u0026base_asset_issuer={base_asset_issuer}\u0026counter_asset_type={counter_asset_type}\u0026counter_asset_code={counter_asset_code}\u0026counter_asset_issuer={counter_asset_issuer}", + "templated": true + }, + "transaction": { + "href": "https://horizon-testnet.stellar.org/transactions/{hash}", + "templated": true + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/transactions{?cursor,limit,order}", + "templated": true + } + }, + "horizon_version": "2.11.0-07dcbb1e43d9ee991461e1284af1d11dcae645d7", + "core_version": "stellar-core 18.1.0 (dc5f5a392098b82bd9453a2aa4259e7af600ad9d)", + "ingest_latest_ledger": 1239160, + "history_latest_ledger": 1239160, + "history_latest_ledger_closed_at": "2021-11-29T18:17:07Z", + "history_elder_ledger": 2, + "core_latest_ledger": 1239160, + "network_passphrase": "Test SDF Network ; September 2015", + "current_protocol_version": 18, + "core_supported_protocol_version": 18 + } + recorded_at: Mon, 29 Nov 2021 18:17:11 GMT +- request: + method: get + uri: https://horizon-testnet.stellar.org/claimable_balances?sponsor=GDCMAMQQEF762HKWOILEVRTMC36UXC32LXV3XK4QI4POYQ5SUWZAVFSR + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Faraday v1.8.0 + Accept: + - application/hal+json,application/problem+json,application/json + X-Client-Name: + - ruby-stellar-sdk + X-Client-Version: + - 0.30.0 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Nov 2021 18:17:12 GMT + Content-Type: + - application/hal+json; charset=utf-8 + Connection: + - keep-alive + Cache-Control: + - no-cache, no-store, max-age=0 + Content-Disposition: + - inline + Latest-Ledger: + - '1239161' + Vary: + - Origin + X-Ratelimit-Limit: + - '101' + X-Ratelimit-Remaining: + - '100' + X-Ratelimit-Reset: + - '1' + body: + encoding: ASCII-8BIT + string: |- + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances?cursor=&;limit=10&order=asc&sponsor=GDCMAMQQEF762HKWOILEVRTMC36UXC32LXV3XK4QI4POYQ5SUWZAVFSR" + }, + "next": { + "href": "https://horizon-testnet.stellar.org/claimable_balances?cursor=16971-000000006c08443899e3e5d3a4c0c93881dc70c4a35c93a4d35bf8bbfd4dd57770b58365&;limit=10&order=asc&sponsor=GDCMAMQQEF762HKWOILEVRTMC36UXC32LXV3XK4QI4POYQ5SUWZAVFSR" + }, + "prev": { + "href": "https://horizon-testnet.stellar.org/claimable_balances?cursor=16971-000000006c08443899e3e5d3a4c0c93881dc70c4a35c93a4d35bf8bbfd4dd57770b58365&;limit=10&order=desc&sponsor=GDCMAMQQEF762HKWOILEVRTMC36UXC32LXV3XK4QI4POYQ5SUWZAVFSR" + } + }, + "_embedded": { + "records": [ + { + "_links": { + "self": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000006c08443899e3e5d3a4c0c93881dc70c4a35c93a4d35bf8bbfd4dd57770b58365" + }, + "transactions": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000006c08443899e3e5d3a4c0c93881dc70c4a35c93a4d35bf8bbfd4dd57770b58365/transactions{?cursor,limit,order}", + "templated": true + }, + "operations": { + "href": "https://horizon-testnet.stellar.org/claimable_balances/000000006c08443899e3e5d3a4c0c93881dc70c4a35c93a4d35bf8bbfd4dd57770b58365/operations{?cursor,limit,order}", + "templated": true + } + }, + "id": "000000006c08443899e3e5d3a4c0c93881dc70c4a35c93a4d35bf8bbfd4dd57770b58365", + "asset": "XXX:GCGQMVO4AOOQ3BQHGUGT52Y3XOMME6DPEB6QQDX44MC466FMDW2QTMRE", + "amount": "10.0000000", + "sponsor": "GDCMAMQQEF762HKWOILEVRTMC36UXC32LXV3XK4QI4POYQ5SUWZAVFSR", + "last_modified_ledger": 16971, + "last_modified_time": "2021-09-16T09:59:36Z", + "claimants": [ + { + "destination": "GBGKGC6U6NAWFHBXQV4KKFMUA4JLTNB4R6AABAHIHUIT2ZCWSR5HKGZB", + "predicate": { + "and": [ + { + "not": { + "abs_before": "2021-09-17T09:59:34Z" + } + }, + { + "abs_before": "2021-10-17T09:59:34Z" + } + ] + } + }, + { + "destination": "GDCMAMQQEF762HKWOILEVRTMC36UXC32LXV3XK4QI4POYQ5SUWZAVFSR", + "predicate": { + "or": [ + { + "abs_before": "2021-09-17T09:59:34Z" + }, + { + "not": { + "abs_before": "2021-10-17T09:59:34Z" + } + } + ] + } + } + ], + "flags": { + "clawback_enabled": false + }, + "paging_token": "16971-000000006c08443899e3e5d3a4c0c93881dc70c4a35c93a4d35bf8bbfd4dd57770b58365" + } + ] + } + } + recorded_at: Mon, 29 Nov 2021 18:17:12 GMT +recorded_with: VCR 6.0.0 diff --git a/horizon/spec/lib/stellar/horizon/client_spec.rb b/horizon/spec/lib/stellar/horizon/client_spec.rb index 3d257cc6..bc8a4967 100644 --- a/horizon/spec/lib/stellar/horizon/client_spec.rb +++ b/horizon/spec/lib/stellar/horizon/client_spec.rb @@ -89,6 +89,60 @@ end end + describe "#claimable_balances" do + context "with default parameters" do + it "fetches claimable balances", :vcr do + balances = client.claimable_balances + + expect(balances).to be_an_instance_of(Stellar::Horizon::ClaimableBalancePage) + expect(balances).to all(be_an_instance_of(Stellar::ClaimableBalanceEntry)) + expect(balances.entries.size).to eq(10) + + balance = balances.first + + expect(balance.balance_id).to eq("000000004c251ddca2bc4dddf22ca8548a45ea977a11e301b748e89f45d08903bb74dd49") + expect(balance.asset).to eq(Stellar::Asset.native) + expect(balance.amount).to eq("0.0000001") + expect(balance.claimants.size).to eq(1) + + claimant = balance.claimants.first + expect(Account(claimant.destination).address).to eq("GAEWLPWMXYCVSHJR7ONIP7IBCWFLVB27P43YKLSNLBDMEW4WBAXKVCV3") + expect(claimant.predicate.type).to eq(Stellar::ClaimPredicateType::UNCONDITIONAL) + end + end + + context "with asset set" do + let(:asset) { "XXX:GCGQMVO4AOOQ3BQHGUGT52Y3XOMME6DPEB6QQDX44MC466FMDW2QTMRE" } + + it "fetches only balances with given asset", :vcr do + balances = client.claimable_balances(asset: asset) + expect(balances.entries.map { |b| b.asset.to_s }).to all(eq(asset)) + end + end + + context "with claimant set" do + let(:claimant) { "GAEWLPWMXYCVSHJR7ONIP7IBCWFLVB27P43YKLSNLBDMEW4WBAXKVCV3" } + + it "fetches only balances with given claimant", :vcr do + balances = client.claimable_balances(claimant: claimant) + claimants = balances.entries.flat_map(&:claimants).map { |c| Account(c.destination).address } + + expect(claimants.uniq).to eq([claimant]) + end + end + + context "with sponsor set" do + let(:sponsor) { "GDCMAMQQEF762HKWOILEVRTMC36UXC32LXV3XK4QI4POYQ5SUWZAVFSR" } + + it "fetches only balances with given sponsor", :vcr do + balances = client.claimable_balances(sponsor: sponsor) + + expect(balances.entries.size).to eq(1) + expect(balances.first.balance_id).to eq("000000006c08443899e3e5d3a4c0c93881dc70c4a35c93a4d35bf8bbfd4dd57770b58365") + end + end + end + describe "#account_info" do let(:account) { Stellar::Account.from_seed(CONFIG[:source_seed]) } let(:client) { described_class.default_testnet } @@ -343,24 +397,24 @@ it "returns a list of transaction for an account", vcr: {record: :once, match_requests_on: [:method]} do response = client.transactions(account: account) - expect(response).to be_a(Stellar::Horizon::TransactionPage) + expect(response).to be_a(Stellar::Horizon::ResourcePage) end it "accepts a cursor to return less data", vcr: {record: :once, match_requests_on: [:method]} do response = client.transactions(account: account, cursor: cursor) - expect(response).to be_a(Stellar::Horizon::TransactionPage) + expect(response).to be_a(Stellar::Horizon::ResourcePage) end end context "all transactions" do it "returns a list of transactions", vcr: {record: :once, match_requests_on: [:method]} do response = client.transactions - expect(response).to be_a(Stellar::Horizon::TransactionPage) + expect(response).to be_a(Stellar::Horizon::ResourcePage) end it "accepts a cursor to return less data", vcr: {record: :once, match_requests_on: [:method]} do response = client.transactions(cursor: cursor) - expect(response).to be_a(Stellar::Horizon::TransactionPage) + expect(response).to be_a(Stellar::Horizon::ResourcePage) end end end From 1d5933c3ce0dbf84e816e55d8043df47b59f94d6 Mon Sep 17 00:00:00 2001 From: Timur Ramazanov Date: Tue, 30 Nov 2021 12:55:26 +0300 Subject: [PATCH 2/2] chore: make linter happy :cop: --- base/lib/stellar/claim_predicate.rb | 6 +++--- base/lib/stellar/dsl.rb | 2 +- base/spec/lib/stellar/claim_predicate_spec.rb | 12 ++++++------ .../lib/stellar/horizon/claimable_balance_page.rb | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/base/lib/stellar/claim_predicate.rb b/base/lib/stellar/claim_predicate.rb index 2e131672..9fdb065d 100644 --- a/base/lib/stellar/claim_predicate.rb +++ b/base/lib/stellar/claim_predicate.rb @@ -1,7 +1,7 @@ # frozen_string_literals: true require "active_support/core_ext/integer/time" require "active_support/core_ext/string/conversions" -require "active_support/core_ext/hash/indifferent_access.rb" +require "active_support/core_ext/hash/indifferent_access" module Stellar # Represents claim predicate on Stellar network. @@ -102,7 +102,7 @@ def parse(object) method, args = object.to_a.first - if %w(and or).include?(method) + if %w[and or].include?(method) unless args.is_a?(Array) raise ArgumentError, "invalid arguments #{args} for predicate '#{method}'" end @@ -111,7 +111,7 @@ def parse(object) else callable_method = { "abs_before" => :before_absolute_time, - "rel_before" => :before_relative_time, + "rel_before" => :before_relative_time }[method] if callable_method.blank? diff --git a/base/lib/stellar/dsl.rb b/base/lib/stellar/dsl.rb index d95c9991..c4a7a09a 100644 --- a/base/lib/stellar/dsl.rb +++ b/base/lib/stellar/dsl.rb @@ -29,7 +29,7 @@ def Claimant(destination, &block) ) end - def ClaimableBalance(id:, claimants: [], asset:, amount:) + def ClaimableBalance(id:, asset:, amount:, claimants: []) Stellar::ClaimableBalanceEntry.new( balance_id: id, asset: Asset(asset), diff --git a/base/spec/lib/stellar/claim_predicate_spec.rb b/base/spec/lib/stellar/claim_predicate_spec.rb index 0c452413..2fec51c6 100644 --- a/base/spec/lib/stellar/claim_predicate_spec.rb +++ b/base/spec/lib/stellar/claim_predicate_spec.rb @@ -61,7 +61,7 @@ def self.specify_claim(created_at:, claimable_at:, not_claimable_at:) describe ".parse" do context "unconditional" do - let(:predicate) { { "unconditional" => true } } + let(:predicate) { {"unconditional" => true} } subject { described_class.parse(predicate) } it { is_expected.to be_a(Stellar::ClaimPredicate) } @@ -70,7 +70,7 @@ def self.specify_claim(created_at:, claimable_at:, not_claimable_at:) context "abs before" do let(:timestamp) { "2022-11-16T00:00:00Z" } - let(:predicate) { { "abs_before" => timestamp } } + let(:predicate) { {"abs_before" => timestamp} } subject { described_class.parse(predicate) } it { is_expected.to be_a(Stellar::ClaimPredicate) } @@ -79,7 +79,7 @@ def self.specify_claim(created_at:, claimable_at:, not_claimable_at:) end context "rel before" do - let(:predicate) { { "rel_before" => "3600" } } + let(:predicate) { {"rel_before" => "3600"} } subject { described_class.parse(predicate) } it { is_expected.to be_a(Stellar::ClaimPredicate) } @@ -91,8 +91,8 @@ def self.specify_claim(created_at:, claimable_at:, not_claimable_at:) let(:predicate) do described_class.parse({ "and" => [ - { "not" => { "abs_before" => "2021-09-17T09:59:34Z" } }, - { "abs_before" => "2021-10-17T09:59:34Z" } + {"not" => {"abs_before" => "2021-09-17T09:59:34Z"}}, + {"abs_before" => "2021-10-17T09:59:34Z"} ] }) end @@ -107,7 +107,7 @@ def self.specify_claim(created_at:, claimable_at:, not_claimable_at:) not_claimable_at: [ -2.days, +2.months, - "2021-10-17 12:59:34", + "2021-10-17 12:59:34" ] ) end diff --git a/horizon/lib/stellar/horizon/claimable_balance_page.rb b/horizon/lib/stellar/horizon/claimable_balance_page.rb index 429402f2..b77e2b58 100644 --- a/horizon/lib/stellar/horizon/claimable_balance_page.rb +++ b/horizon/lib/stellar/horizon/claimable_balance_page.rb @@ -3,7 +3,7 @@ class ClaimableBalancePage < ResourcePage private def objectify(record) - attributes = %i(id claimants asset amount) + attributes = %i[id claimants asset amount] hash = record.to_hash.deep_symbolize_keys.slice(*attributes) ClaimableBalance(**hash) end