├── .dockerignore ├── .github ├── actions │ └── setup-go │ │ └── action.yml ├── pull_request_template.md └── workflows │ ├── codeql-analysis.yml │ ├── galexie-release.yml │ ├── galexie.yml │ ├── go.yml │ ├── golangci-lint.yml │ ├── horizon-release.yml │ ├── horizon.yml │ └── update-completed-sprint-on-issue-closed.yml ├── .gitignore ├── .golangci.yml ├── CHANGELOG.md ├── CONTRIBUTING.md ├── COPYING ├── DEVELOPING.md ├── LICENSE ├── Makefile ├── README.md ├── address ├── main.go └── main_test.go ├── amount ├── main.go └── main_test.go ├── benchmarks └── xdr_test.go ├── clients ├── README.md ├── doc.go ├── federation │ ├── client.go │ ├── client_test.go │ └── main.go ├── horizonclient │ ├── CHANGELOG.md │ ├── README.md │ ├── account_request.go │ ├── account_request_test.go │ ├── accounts_request.go │ ├── accounts_request_test.go │ ├── admin_client.go │ ├── admin_client_test.go │ ├── asset_request.go │ ├── asset_request_test.go │ ├── claimable_balance_request.go │ ├── claimable_balance_request_test.go │ ├── client.go │ ├── client_fund_test.go │ ├── client_test.go │ ├── effect_request.go │ ├── effect_request_test.go │ ├── error.go │ ├── error_helpers.go │ ├── error_helpers_test.go │ ├── error_test.go │ ├── examples_test.go │ ├── fee_stats_request.go │ ├── internal.go │ ├── internal_test.go │ ├── ledger_request.go │ ├── ledger_request_test.go │ ├── liquidity_pool_request.go │ ├── liquidity_pool_request_test.go │ ├── liquidity_pools_request.go │ ├── liquidity_pools_request_test.go │ ├── main.go │ ├── main_test.go │ ├── mocks.go │ ├── offer_request.go │ ├── offer_request_test.go │ ├── operation_request.go │ ├── operation_request_test.go │ ├── order_book_request.go │ ├── order_book_request_test.go │ ├── paths_request.go │ ├── paths_request_test.go │ ├── root_test.go │ ├── strict_send_paths_request.go │ ├── strict_send_paths_request_test.go │ ├── submit_request.go │ ├── submit_request_test.go │ ├── trade_aggregation_request.go │ ├── trade_aggregation_request_test.go │ ├── trade_request.go │ ├── trade_request_test.go │ ├── transaction_request.go │ ├── transaction_request_test.go │ └── version.go ├── stellarcore │ ├── client.go │ ├── client_test.go │ ├── main.go │ ├── main_test.go │ └── metrics_client.go └── stellartoml │ ├── client.go │ ├── client_test.go │ ├── main.go │ ├── main_test.go │ └── mocks.go ├── docs └── reference │ ├── examples.md │ └── readme.md ├── exp ├── README.md ├── crypto │ └── derivation │ │ ├── doc.go │ │ ├── main.go │ │ └── main_test.go ├── doc.go ├── orderbook │ ├── batch.go │ ├── edges.go │ ├── edges_test.go │ ├── graph.go │ ├── graph_benchmark_test.go │ ├── graph_test.go │ ├── pools.go │ ├── pools_test.go │ ├── search.go │ ├── testdata │ │ └── sample-requests │ └── utils.go ├── services │ ├── market-tracker │ │ ├── README.md │ │ ├── calc.go │ │ ├── calc_test.go │ │ ├── client.go │ │ ├── config.go │ │ ├── config_sample.json │ │ ├── go.mod │ │ ├── go.sum │ │ ├── main.go │ │ ├── orders.go │ │ ├── orders_test.go │ │ ├── price.go │ │ ├── price_test.go │ │ ├── spread.go │ │ ├── volume.go │ │ ├── volume_test.go │ │ └── watchers.go │ ├── recoverysigner │ │ ├── Makefile │ │ ├── README-Firebase.md │ │ ├── README.md │ │ ├── cmd │ │ │ ├── db.go │ │ │ ├── db_test.go │ │ │ └── serve.go │ │ ├── docker │ │ │ └── Dockerfile │ │ ├── internal │ │ │ ├── account │ │ │ │ ├── account.go │ │ │ │ ├── db_store.go │ │ │ │ ├── db_store_add.go │ │ │ │ ├── db_store_add_test.go │ │ │ │ ├── db_store_count.go │ │ │ │ ├── db_store_count_test.go │ │ │ │ ├── db_store_delete.go │ │ │ │ ├── db_store_delete_test.go │ │ │ │ ├── db_store_find_with_identity.go │ │ │ │ ├── db_store_find_with_identity_test.go │ │ │ │ ├── db_store_get.go │ │ │ │ ├── db_store_get_test.go │ │ │ │ ├── db_store_update.go │ │ │ │ ├── db_store_update_test.go │ │ │ │ └── store.go │ │ │ ├── db │ │ │ │ ├── db.go │ │ │ │ ├── db_audit_test.go │ │ │ │ ├── db_test.go │ │ │ │ ├── dbmigrate │ │ │ │ │ ├── dbmigrate.go │ │ │ │ │ ├── dbmigrate_generated.go │ │ │ │ │ ├── dbmigrate_test.go │ │ │ │ │ └── migrations │ │ │ │ │ │ ├── 20200309000000-initial-1.sql │ │ │ │ │ │ ├── 20200309000001-initial-2.sql │ │ │ │ │ │ ├── 20200311000000-create-accounts.sql │ │ │ │ │ │ ├── 20200311000001-create-identities.sql │ │ │ │ │ │ ├── 20200311000002-create-auth-methods.sql │ │ │ │ │ │ ├── 20200320000000-create-accounts-audit.sql │ │ │ │ │ │ ├── 20200320000001-create-identities-audit.sql │ │ │ │ │ │ └── 20200320000002-create-auth-methods-audit.sql │ │ │ │ └── dbtest │ │ │ │ │ ├── dbtest.go │ │ │ │ │ └── dbtest_test.go │ │ │ └── serve │ │ │ │ ├── account_delete.go │ │ │ │ ├── account_delete_test.go │ │ │ │ ├── account_get.go │ │ │ │ ├── account_get_test.go │ │ │ │ ├── account_list.go │ │ │ │ ├── account_list_test.go │ │ │ │ ├── account_post.go │ │ │ │ ├── account_post_test.go │ │ │ │ ├── account_put.go │ │ │ │ ├── account_put_test.go │ │ │ │ ├── account_response.go │ │ │ │ ├── account_sign.go │ │ │ │ ├── account_sign_signing_address_test.go │ │ │ │ ├── auth │ │ │ │ ├── auth.go │ │ │ │ ├── firebase.go │ │ │ │ ├── firebase_test.go │ │ │ │ ├── sep10.go │ │ │ │ └── sep10_test.go │ │ │ │ ├── errors.go │ │ │ │ ├── errors_test.go │ │ │ │ ├── metrics_accounts_count.go │ │ │ │ ├── serve.go │ │ │ │ ├── serve_admin.go │ │ │ │ ├── serve_admin_test.go │ │ │ │ └── serve_test.go │ │ └── main.go │ ├── soroban-rpc │ │ └── README.md │ └── webauth │ │ ├── Makefile │ │ ├── README.md │ │ ├── cmd │ │ ├── genjwk.go │ │ └── serve.go │ │ ├── docker │ │ └── Dockerfile │ │ ├── internal │ │ └── serve │ │ │ ├── challenge.go │ │ │ ├── challenge_test.go │ │ │ ├── errors.go │ │ │ ├── errors_test.go │ │ │ ├── serve.go │ │ │ ├── token.go │ │ │ └── token_test.go │ │ └── main.go ├── support │ ├── jwtkey │ │ ├── jwtkey.go │ │ └── jwtkey_test.go │ └── pipeline │ │ ├── buffered_read_writer.go │ │ ├── buffered_read_writer_test.go │ │ ├── doc.go │ │ ├── main.go │ │ ├── multi_writer.go │ │ ├── pipeline.go │ │ ├── pipeline_node.go │ │ ├── pipeline_test.go │ │ ├── store.go │ │ └── store_test.go └── tools │ ├── captive-core-start-tester │ └── main.go │ └── dump-orderbook │ └── main.go ├── go.mod ├── go.sum ├── gofmt.sh ├── gogenerate.sh ├── gomod.sh ├── goshadow.sh ├── govet.sh ├── gxdr ├── dump.go ├── generate.go └── xdr_generated.go ├── handlers └── federation │ ├── handler.go │ ├── handler_test.go │ ├── main.go │ ├── reverse_sql_driver.go │ └── sql_driver.go ├── hash ├── main.go └── main_test.go ├── historyarchive ├── archive.go ├── archive_cache.go ├── archive_pool.go ├── archive_pool_test.go ├── archive_test.go ├── dirprefix.go ├── dirprefix_test.go ├── failing_mock_archive.go ├── hash.go ├── hash_test.go ├── history_archive_state.go ├── history_archive_state_test.go ├── json.go ├── log.go ├── mirror.go ├── mock_archive.go ├── mocks.go ├── range.go ├── range_test.go ├── repair.go ├── scan.go ├── stats.go ├── util.go └── verify.go ├── ingest ├── CHANGELOG.md ├── README.md ├── address │ └── address.pb.go ├── asset │ ├── asset.go │ ├── asset.pb.go │ └── asset_test.go ├── cdp │ ├── producer.go │ └── producer_test.go ├── change.go ├── change_compactor.go ├── change_compactor_test.go ├── change_test.go ├── checkpoint_change_reader.go ├── checkpoint_change_reader_test.go ├── doc.go ├── doc_test.go ├── errors.go ├── ledger │ ├── ledger.go │ └── ledger_test.go ├── ledger_change_reader.go ├── ledger_change_reader_test.go ├── ledger_transaction.go ├── ledger_transaction_reader.go ├── ledger_transaction_reader_test.go ├── ledger_transaction_test.go ├── ledgerbackend │ ├── buffered_meta_pipe_reader.go │ ├── buffered_storage_backend.go │ ├── buffered_storage_backend_test.go │ ├── captive_core_backend.go │ ├── captive_core_backend_test.go │ ├── catchup.go │ ├── cmd.go │ ├── cmd_posix.go │ ├── cmd_windows.go │ ├── configs │ │ ├── captive-core-pubnet.cfg │ │ └── captive-core-testnet.cfg │ ├── core_log.go │ ├── dir.go │ ├── file_watcher.go │ ├── file_watcher_test.go │ ├── ledger_backend.go │ ├── ledger_buffer.go │ ├── ledger_hash_store.go │ ├── metrics.go │ ├── mock_cmd_test.go │ ├── mock_database_backend.go │ ├── mock_system_caller_test.go │ ├── range.go │ ├── run_from.go │ ├── stellar_core_runner.go │ ├── stellar_core_runner_test.go │ ├── stellar_core_version.go │ ├── stellar_core_version_test.go │ ├── testdata │ │ ├── appendix-disable-diagnostic-events-and-metav1.cfg │ │ ├── appendix-with-bucket-dir-path.cfg │ │ ├── appendix-with-fields.cfg │ │ ├── appendix-with-minimum-persistent-entry.cfg │ │ ├── duplicate-home-domain.cfg │ │ ├── duplicate-validator.cfg │ │ ├── empty-home-domain-quality.cfg │ │ ├── empty-home-domain.cfg │ │ ├── expected-bucketlistdb-core.cfg │ │ ├── expected-default-bucketlistdb-core.cfg │ │ ├── expected-in-mem-core.cfg │ │ ├── expected-offline-core.cfg │ │ ├── expected-offline-enforce-diag-events-and-metav1.cfg │ │ ├── expected-offline-enforce-disabled-diagnostic-events.cfg │ │ ├── expected-offline-with-appendix-core.cfg │ │ ├── expected-offline-with-extra-fields.cfg │ │ ├── expected-offline-with-no-peer-port.cfg │ │ ├── expected-online-core.cfg │ │ ├── expected-online-with-appendix-minimum-persistent-entry.cfg │ │ ├── expected-online-with-no-http-port-diag-events-metav1.cfg │ │ ├── expected-online-with-no-http-port.cfg │ │ ├── expected-online-with-no-peer-port.cfg │ │ ├── expected-query-params.cfg │ │ ├── invalid-captive-core-database-field.cfg │ │ ├── invalid-captive-core-field.cfg │ │ ├── invalid-home-domain-quality.cfg │ │ ├── sample-appendix-bucketlistdb.cfg │ │ ├── sample-appendix-in-memory.cfg │ │ ├── sample-appendix-on-disk.cfg │ │ ├── sample-appendix-query-params.cfg │ │ ├── sample-appendix.cfg │ │ ├── validator-has-invalid-public-key.cfg │ │ ├── validator-has-invalid-quality.cfg │ │ ├── validator-missing-home-domain.cfg │ │ ├── validator-missing-name.cfg │ │ ├── validator-missing-public-key.cfg │ │ └── validator-missing-quality.cfg │ ├── toml.go │ └── toml_test.go ├── loadtest │ └── ledger_backend.go ├── mock_change_reader.go ├── processors │ ├── account_processor │ │ ├── account.go │ │ ├── account_signer.go │ │ ├── account_signer_test.go │ │ └── account_test.go │ ├── asset_processor │ │ ├── asset.go │ │ └── asset_test.go │ ├── claimable_balance_processor │ │ ├── claimable_balance.go │ │ └── claimable_balance_test.go │ ├── config_setting_processor │ │ ├── config_setting.go │ │ └── config_setting_test.go │ ├── contract_processor │ │ ├── contract_code.go │ │ ├── contract_code_test.go │ │ ├── contract_data.go │ │ ├── contract_data_test.go │ │ ├── contract_events.go │ │ ├── contract_events_test.go │ │ ├── ttl.go │ │ └── ttl_test.go │ ├── effects_processor │ │ ├── effects.go │ │ └── effects_test.go │ ├── ledger_processor │ │ ├── ledger.go │ │ └── ledger_test.go │ ├── liquidity_pool_processor │ │ ├── liquidity_pool.go │ │ └── liquidity_pool_test.go │ ├── offer_processor │ │ ├── offer.go │ │ ├── offer_normalized.go │ │ ├── offer_normalized_test.go │ │ └── offer_test.go │ ├── operation_processor │ │ ├── operation.go │ │ └── operation_test.go │ ├── processor_utils │ │ ├── schema.go │ │ └── utils.go │ ├── token_transfer │ │ ├── token_transfer_event.go │ │ ├── token_transfer_event.pb.go │ │ └── token_transfer_event_test.go │ ├── trade_processor │ │ ├── trade.go │ │ └── trade_test.go │ ├── transaction_processor │ │ ├── transaction.go │ │ └── transaction_test.go │ └── trustline_processor │ │ ├── trustline.go │ │ └── trustline_test.go ├── stats_change_processor.go ├── stats_change_processor_test.go ├── tutorial │ ├── captive-core-stub.toml │ ├── example_claimables.go │ ├── example_common.go │ ├── example_hello.go │ ├── example_main.go │ └── example_statistics.go └── verify │ ├── main.go │ └── main_test.go ├── install-core.sh ├── integration.sh ├── keypair ├── benchmarks_test.go ├── from_address.go ├── from_address_test.go ├── full.go ├── full_test.go ├── main.go └── main_test.go ├── network ├── main.go └── main_test.go ├── price ├── main.go └── main_test.go ├── protocols ├── federation │ ├── main.go │ └── main_test.go ├── horizon │ ├── README.md │ ├── base │ │ └── main.go │ ├── effects │ │ ├── main.go │ │ └── signer_effects.go │ ├── main.go │ ├── main_test.go │ └── operations │ │ ├── main.go │ │ └── main_test.go └── stellarcore │ ├── getledgerentry_response.go │ ├── getledgerentryraw_response.go │ ├── info_response.go │ ├── info_response_test.go │ ├── preflight_response.go │ ├── tx_response.go │ └── tx_response_test.go ├── protos └── ingest │ ├── README.md │ ├── address │ └── address.proto │ ├── asset │ └── asset.proto │ └── processors │ └── token_transfer │ └── token_transfer_event.proto ├── randxdr ├── generator.go ├── generator_test.go ├── marshaller.go └── presets.go ├── services ├── README.md ├── doc.go ├── federation │ ├── CHANGELOG.md │ ├── README.md │ ├── build_sample.sh │ ├── federation-sqlite-sample │ ├── federation.cfg │ ├── main.go │ └── main_test.go ├── friendbot │ ├── CHANGELOG.md │ ├── Makefile │ ├── README.md │ ├── docker │ │ └── Dockerfile │ ├── friendbot.cfg │ ├── init_friendbot.go │ ├── init_friendbot_test.go │ ├── internal │ │ ├── account.go │ │ ├── friendbot.go │ │ ├── friendbot_handler.go │ │ ├── friendbot_test.go │ │ ├── minion.go │ │ └── minion_test.go │ ├── loadtest │ │ └── loadtest.go │ ├── main.go │ └── router_test.go ├── galexie │ ├── CHANGELOG.md │ ├── DEVELOPER_GUIDE.md │ ├── Makefile │ ├── README.md │ ├── architecture.png │ ├── config.example.toml │ ├── docker │ │ ├── Dockerfile │ │ └── config.test.toml │ ├── internal │ │ ├── app.go │ │ ├── app_test.go │ │ ├── config.go │ │ ├── config_test.go │ │ ├── exportmanager.go │ │ ├── exportmanager_test.go │ │ ├── integration_test.go │ │ ├── ledger_meta_archive.go │ │ ├── ledger_meta_archive_test.go │ │ ├── main.go │ │ ├── main_test.go │ │ ├── queue.go │ │ ├── queue_test.go │ │ ├── test │ │ │ ├── 10perfile.toml │ │ │ ├── 15perfile.toml │ │ │ ├── 1perfile.toml │ │ │ ├── 64perfile.toml │ │ │ ├── captive-core-test.cfg │ │ │ ├── integration_captive_core.cfg │ │ │ ├── integration_config_template.toml │ │ │ ├── invalid_captive_core_toml_path.toml │ │ │ ├── invalid_empty.toml │ │ │ ├── invalid_preconfigured_network.toml │ │ │ ├── no_core_bin.toml │ │ │ ├── no_network.toml │ │ │ ├── test.toml │ │ │ ├── useragent.toml │ │ │ ├── valid_captive_core_manual.toml │ │ │ ├── valid_captive_core_override.toml │ │ │ ├── valid_captive_core_override_archives.toml │ │ │ ├── valid_captive_core_preconfigured.toml │ │ │ └── validate_start_end.toml │ │ ├── uploader.go │ │ └── uploader_test.go │ └── main.go ├── horizon │ ├── .gitignore │ ├── .projections.json │ ├── CHANGELOG.md │ ├── CONTRIBUTING.md │ ├── Makefile │ ├── README.md │ ├── cmd │ │ ├── db.go │ │ ├── db_test.go │ │ ├── ingest.go │ │ ├── record_metrics.go │ │ ├── root.go │ │ ├── serve.go │ │ └── version.go │ ├── docker │ │ ├── .gitignore │ │ ├── Dockerfile │ │ ├── Dockerfile.core-testing │ │ ├── Dockerfile.dev │ │ ├── Dockerfile.stable │ │ ├── Makefile │ │ ├── captive-core-standalone.cfg │ │ ├── core-start.sh │ │ ├── docker-compose.integration-tests.yml │ │ ├── docker-compose.pubnet.yml │ │ ├── docker-compose.standalone.yml │ │ ├── docker-compose.yml │ │ ├── start.sh │ │ ├── stellar-core-pubnet.cfg │ │ ├── stellar-core-standalone.cfg │ │ ├── stellar-core-testnet.cfg │ │ └── verify-range │ │ │ ├── Dockerfile │ │ │ ├── README.md │ │ │ ├── captive-core-pubnet.cfg │ │ │ ├── dependencies │ │ │ ├── start │ │ │ └── stellar-core.cfg │ ├── internal │ │ ├── action_offers_test.go │ │ ├── actions │ │ │ ├── account.go │ │ │ ├── account_data.go │ │ │ ├── account_test.go │ │ │ ├── asset.go │ │ │ ├── asset_test.go │ │ │ ├── claimable_balance.go │ │ │ ├── claimable_balance_test.go │ │ │ ├── doc.go │ │ │ ├── effects.go │ │ │ ├── effects_test.go │ │ │ ├── fee_stats.go │ │ │ ├── filter_rules.go │ │ │ ├── filter_rules_test.go │ │ │ ├── helpers.go │ │ │ ├── helpers_test.go │ │ │ ├── ledger.go │ │ │ ├── liquidity_pool.go │ │ │ ├── liquidity_pool_test.go │ │ │ ├── main.go │ │ │ ├── offer.go │ │ │ ├── offer_test.go │ │ │ ├── operation.go │ │ │ ├── operation_test.go │ │ │ ├── orderbook.go │ │ │ ├── orderbook_test.go │ │ │ ├── path.go │ │ │ ├── path_test.go │ │ │ ├── query_params.go │ │ │ ├── query_params_test.go │ │ │ ├── root.go │ │ │ ├── submit_transaction.go │ │ │ ├── submit_transaction_async.go │ │ │ ├── submit_transaction_async_test.go │ │ │ ├── submit_transaction_test.go │ │ │ ├── trade.go │ │ │ ├── transaction.go │ │ │ ├── transaction_test.go │ │ │ ├── validators.go │ │ │ └── validators_test.go │ │ ├── actions_account_test.go │ │ ├── actions_data_test.go │ │ ├── actions_effects_test.go │ │ ├── actions_ledger_test.go │ │ ├── actions_operation_fee_stats_test.go │ │ ├── actions_operation_test.go │ │ ├── actions_path_test.go │ │ ├── actions_payment_test.go │ │ ├── actions_root_test.go │ │ ├── actions_trade_test.go │ │ ├── actions_transaction_test.go │ │ ├── app.go │ │ ├── app_test.go │ │ ├── assets │ │ │ ├── main.go │ │ │ └── main_test.go │ │ ├── codes │ │ │ ├── main.go │ │ │ └── main_test.go │ │ ├── config.go │ │ ├── context │ │ │ └── context.go │ │ ├── corestate │ │ │ └── main.go │ │ ├── db2 │ │ │ ├── history │ │ │ │ ├── account.go │ │ │ │ ├── account_data.go │ │ │ │ ├── account_data_batch_insert_builder.go │ │ │ │ ├── account_data_test.go │ │ │ │ ├── account_data_value.go │ │ │ │ ├── account_loader.go │ │ │ │ ├── account_loader_test.go │ │ │ │ ├── account_signers.go │ │ │ │ ├── account_signers_batch_insert_builder.go │ │ │ │ ├── account_signers_test.go │ │ │ │ ├── account_test.go │ │ │ │ ├── accounts.go │ │ │ │ ├── accounts_batch_insert_builder.go │ │ │ │ ├── accounts_test.go │ │ │ │ ├── asset.go │ │ │ │ ├── asset_loader.go │ │ │ │ ├── asset_loader_test.go │ │ │ │ ├── asset_stats.go │ │ │ │ ├── asset_stats_test.go │ │ │ │ ├── asset_test.go │ │ │ │ ├── claimable_balance_batch_insert_builder.go │ │ │ │ ├── claimable_balance_claimant_batch_insert_builder.go │ │ │ │ ├── claimable_balance_loader.go │ │ │ │ ├── claimable_balance_loader_test.go │ │ │ │ ├── claimable_balances.go │ │ │ │ ├── claimable_balances_test.go │ │ │ │ ├── effect.go │ │ │ │ ├── effect_batch_insert_builder.go │ │ │ │ ├── effect_batch_insert_builder_test.go │ │ │ │ ├── effect_test.go │ │ │ │ ├── fee_bump_scenario.go │ │ │ │ ├── filter_rules.go │ │ │ │ ├── filter_rules_test.go │ │ │ │ ├── history_claimable_balances.go │ │ │ │ ├── history_liquidity_pools.go │ │ │ │ ├── ingestion.go │ │ │ │ ├── key_value.go │ │ │ │ ├── ledger.go │ │ │ │ ├── ledger_cache.go │ │ │ │ ├── ledger_cache_test.go │ │ │ │ ├── ledger_test.go │ │ │ │ ├── liquidity_pool_loader.go │ │ │ │ ├── liquidity_pool_loader_test.go │ │ │ │ ├── liquidity_pools.go │ │ │ │ ├── liquidity_pools_test.go │ │ │ │ ├── loader.go │ │ │ │ ├── loader_concurrency_test.go │ │ │ │ ├── main.go │ │ │ │ ├── main_test.go │ │ │ │ ├── mock_account_data_batch_insert_builder.go │ │ │ │ ├── mock_account_signers_batch_insert_builder.go │ │ │ │ ├── mock_accounts_batch_insert_builder.go │ │ │ │ ├── mock_claimable_balance_batch_insert_builder.go │ │ │ │ ├── mock_claimable_balance_claimant_batch_insert_builder.go │ │ │ │ ├── mock_effect_batch_insert_builder.go │ │ │ │ ├── mock_offers_batch_insert_builder.go │ │ │ │ ├── mock_operation_participant_batch_insert_builder.go │ │ │ │ ├── mock_operations_batch_insert_builder.go │ │ │ │ ├── mock_q_accounts.go │ │ │ │ ├── mock_q_asset_stats.go │ │ │ │ ├── mock_q_claimable_balances.go │ │ │ │ ├── mock_q_data.go │ │ │ │ ├── mock_q_effects.go │ │ │ │ ├── mock_q_filter.go │ │ │ │ ├── mock_q_history_claimable_balances.go │ │ │ │ ├── mock_q_history_liquidity_pools.go │ │ │ │ ├── mock_q_ledgers.go │ │ │ │ ├── mock_q_liquidity_pools.go │ │ │ │ ├── mock_q_offers.go │ │ │ │ ├── mock_q_operations.go │ │ │ │ ├── mock_q_participants.go │ │ │ │ ├── mock_q_signers.go │ │ │ │ ├── mock_q_trades.go │ │ │ │ ├── mock_q_transactions.go │ │ │ │ ├── mock_q_trust_lines.go │ │ │ │ ├── mock_transactions_batch_insert_builder.go │ │ │ │ ├── mock_trust_lines_batch_insert_builder.go │ │ │ │ ├── offers.go │ │ │ │ ├── offers_batch_insert_builder.go │ │ │ │ ├── offers_test.go │ │ │ │ ├── operation.go │ │ │ │ ├── operation_batch_insert_builder.go │ │ │ │ ├── operation_batch_insert_builder_test.go │ │ │ │ ├── operation_participant_batch_insert_builder.go │ │ │ │ ├── operation_participant_batch_insert_builder_test.go │ │ │ │ ├── operation_test.go │ │ │ │ ├── orderbook.go │ │ │ │ ├── orderbook_test.go │ │ │ │ ├── participants.go │ │ │ │ ├── participants_test.go │ │ │ │ ├── reap_test.go │ │ │ │ ├── sequence_provider.go │ │ │ │ ├── sequence_provider_test.go │ │ │ │ ├── total_order_id.go │ │ │ │ ├── trade.go │ │ │ │ ├── trade_aggregation.go │ │ │ │ ├── trade_batch_insert_builder.go │ │ │ │ ├── trade_scenario.go │ │ │ │ ├── trade_test.go │ │ │ │ ├── transaction.go │ │ │ │ ├── transaction_batch_insert_builder.go │ │ │ │ ├── transaction_batch_insert_builder_test.go │ │ │ │ ├── transaction_ledger_bounds.go │ │ │ │ ├── transaction_test.go │ │ │ │ ├── transaction_time_bounds.go │ │ │ │ ├── trust_lines.go │ │ │ │ ├── trust_lines_batch_insert_builder.go │ │ │ │ ├── trust_lines_test.go │ │ │ │ ├── verify_lock.go │ │ │ │ └── verify_lock_test.go │ │ │ ├── main.go │ │ │ ├── page_query.go │ │ │ ├── page_query_test.go │ │ │ └── schema │ │ │ │ ├── bindata.go │ │ │ │ ├── main.go │ │ │ │ ├── main_test.go │ │ │ │ └── migrations │ │ │ │ ├── 10_add_trades_price.sql │ │ │ │ ├── 11_add_trades_account_index.sql │ │ │ │ ├── 12_asset_stats_amount_string.sql │ │ │ │ ├── 13_trade_offer_ids.sql │ │ │ │ ├── 14_fix_asset_toml_field.sql │ │ │ │ ├── 15_ledger_failed_txs.sql │ │ │ │ ├── 16_ingest_failed_transactions.sql │ │ │ │ ├── 17_transaction_fee_paid.sql │ │ │ │ ├── 18_account_for_signers.sql │ │ │ │ ├── 19_offers.sql │ │ │ │ ├── 1_initial_schema.sql │ │ │ │ ├── 20_account_for_signer_index.sql │ │ │ │ ├── 21_trades_remove_zero_amount_constraints.sql │ │ │ │ ├── 22_trust_lines.sql │ │ │ │ ├── 23_exp_asset_stats.sql │ │ │ │ ├── 24_accounts.sql │ │ │ │ ├── 25_expingest_rename_columns.sql │ │ │ │ ├── 26_exp_history_ledgers.sql │ │ │ │ ├── 27_exp_history_transactions.sql │ │ │ │ ├── 28_exp_history_operations.sql │ │ │ │ ├── 29_exp_history_assets.sql │ │ │ │ ├── 2_index_participants_by_toid.sql │ │ │ │ ├── 30_exp_history_trades.sql │ │ │ │ ├── 31_exp_history_effects.sql │ │ │ │ ├── 32_drop_exp_history_tables.sql │ │ │ │ ├── 33_remove_unused.sql │ │ │ │ ├── 34_fee_bump_transactions.sql │ │ │ │ ├── 35_drop_participant_id.sql │ │ │ │ ├── 36_deleted_offers.sql │ │ │ │ ├── 37_add_tx_set_operation_count_to_ledgers.sql │ │ │ │ ├── 38_add_constraints.sql │ │ │ │ ├── 39_claimable_balances.sql │ │ │ │ ├── 39_history_trades_indices.sql │ │ │ │ ├── 3_use_sequence_in_history_accounts.sql │ │ │ │ ├── 40_fix_inner_tx_max_fee_constraint.sql │ │ │ │ ├── 41_add_sponsor_to_state_tables.sql │ │ │ │ ├── 42_add_num_sponsored_and_num_sponsoring_to_accounts.sql │ │ │ │ ├── 43_add_claimable_balances_flags.sql │ │ │ │ ├── 44_asset_stat_accounts_and_balances.sql │ │ │ │ ├── 45_add_claimable_balances_history.sql │ │ │ │ ├── 46_add_muxed_accounts.sql │ │ │ │ ├── 47_precompute_trade_aggregations.sql │ │ │ │ ├── 48_rebuild_trade_aggregations.sql │ │ │ │ ├── 49_add_brin_index_trade_aggregations.sql │ │ │ │ ├── 4_add_protocol_version.sql │ │ │ │ ├── 50_liquidity_pools.sql │ │ │ │ ├── 51_remove_ht_unused_indexes.sql │ │ │ │ ├── 52_add_trade_type_index.sql │ │ │ │ ├── 53_add_trades_rounding_slippage.sql │ │ │ │ ├── 54_tx_preconditions_and_account_fields.sql │ │ │ │ ├── 55_filter_rules.sql │ │ │ │ ├── 56_txsub_read_only.sql │ │ │ │ ├── 57_trade_aggregation_autovac.sql │ │ │ │ ├── 58_add_index_by_id_optimization.sql │ │ │ │ ├── 59_remove_foreign_key_constraints.sql │ │ │ │ ├── 5_create_trades_table.sql │ │ │ │ ├── 60_add_asset_id_indexes.sql │ │ │ │ ├── 61_trust_lines_by_account_type_code_issuer.sql │ │ │ │ ├── 62_claimable_balance_claimants.sql │ │ │ │ ├── 63_add_contract_id_to_asset_stats.sql │ │ │ │ ├── 64_add_payment_flag_history_ops.sql │ │ │ │ ├── 65_drop_payment_index.sql │ │ │ │ ├── 66_contract_asset_stats.sql │ │ │ │ ├── 67_remove_unused_indexes.sql │ │ │ │ ├── 68_remove_deprecated_fields_from_exp_asset_stats.sql │ │ │ │ ├── 6_create_assets_table.sql │ │ │ │ ├── 7_modify_trades_table.sql │ │ │ │ ├── 8_add_aggregators.sql │ │ │ │ ├── 8_create_asset_stats_table.sql │ │ │ │ └── 9_add_header_xdr.sql │ │ ├── docs │ │ │ ├── GUIDE_FOR_DEVELOPERS.md │ │ │ └── TESTING_NOTES.md │ │ ├── errors │ │ │ └── main.go │ │ ├── flags.go │ │ ├── flags_test.go │ │ ├── hchi │ │ │ ├── context.go │ │ │ └── context_test.go │ │ ├── health.go │ │ ├── health_test.go │ │ ├── helpers_test.go │ │ ├── httpt_test.go │ │ ├── httpx │ │ │ ├── handler.go │ │ │ ├── main.go │ │ │ ├── middleware.go │ │ │ ├── rate_limiter.go │ │ │ ├── router.go │ │ │ ├── server.go │ │ │ ├── static │ │ │ │ ├── admin_oapi.yml │ │ │ │ └── txsub_async_oapi.yaml │ │ │ └── stream_handler_test.go │ │ ├── ingest │ │ │ ├── README.md │ │ │ ├── TESTING.md │ │ │ ├── build_state_test.go │ │ │ ├── change_processors_test.go │ │ │ ├── db_integration_test.go │ │ │ ├── fake_ledger_backend.go │ │ │ ├── filters │ │ │ │ ├── account.go │ │ │ │ ├── account_test.go │ │ │ │ ├── asset.go │ │ │ │ ├── asset_test.go │ │ │ │ ├── main.go │ │ │ │ └── main_test.go │ │ │ ├── fsm.go │ │ │ ├── fsm_history_range_state.go │ │ │ ├── fsm_reingest_history_range_state.go │ │ │ ├── group_processors.go │ │ │ ├── group_processors_test.go │ │ │ ├── history_archive_adapter.go │ │ │ ├── history_archive_adapter_test.go │ │ │ ├── ingest_history_range_state_test.go │ │ │ ├── init_state_test.go │ │ │ ├── logger_change_reader_test.go │ │ │ ├── logging_change_reader.go │ │ │ ├── main.go │ │ │ ├── main_test.go │ │ │ ├── mock_filter.go │ │ │ ├── mock_orderbook_graph.go │ │ │ ├── orderbook.go │ │ │ ├── orderbook_test.go │ │ │ ├── parallel.go │ │ │ ├── parallel_test.go │ │ │ ├── processor_runner.go │ │ │ ├── processor_runner_test.go │ │ │ ├── processors │ │ │ │ ├── account_data_processor.go │ │ │ │ ├── accounts_data_processor_test.go │ │ │ │ ├── accounts_processor.go │ │ │ │ ├── accounts_processor_test.go │ │ │ │ ├── asset_stats_processor.go │ │ │ │ ├── asset_stats_processor_test.go │ │ │ │ ├── asset_stats_set.go │ │ │ │ ├── asset_stats_set_test.go │ │ │ │ ├── claimable_balances_change_processor.go │ │ │ │ ├── claimable_balances_change_processor_test.go │ │ │ │ ├── claimable_balances_transaction_processor.go │ │ │ │ ├── claimable_balances_transaction_processor_test.go │ │ │ │ ├── contract_asset_stats.go │ │ │ │ ├── contract_asset_stats_test.go │ │ │ │ ├── contract_data.go │ │ │ │ ├── effects_processor.go │ │ │ │ ├── effects_processor_test.go │ │ │ │ ├── ledgers_processor.go │ │ │ │ ├── ledgers_processor_test.go │ │ │ │ ├── liquidity_pools_change_processor.go │ │ │ │ ├── liquidity_pools_change_processor_test.go │ │ │ │ ├── liquidity_pools_transaction_processor.go │ │ │ │ ├── liquidity_pools_transaction_processor_test.go │ │ │ │ ├── main.go │ │ │ │ ├── mock_change_processor.go │ │ │ │ ├── offers_processor.go │ │ │ │ ├── offers_processor_test.go │ │ │ │ ├── operations_processor.go │ │ │ │ ├── operations_processor_test.go │ │ │ │ ├── participants_processor.go │ │ │ │ ├── participants_processor_test.go │ │ │ │ ├── participants_test.go │ │ │ │ ├── signer_processor_test.go │ │ │ │ ├── signers_diff_test.go │ │ │ │ ├── signers_processor.go │ │ │ │ ├── stats_ledger_transaction_processor.go │ │ │ │ ├── stats_ledger_transaction_processor_test.go │ │ │ │ ├── synt_offer_id.go │ │ │ │ ├── trades_processor.go │ │ │ │ ├── trades_processor_test.go │ │ │ │ ├── transaction_operation_wrapper_test.go │ │ │ │ ├── transactions_processor.go │ │ │ │ ├── transactions_processor_test.go │ │ │ │ ├── trust_lines_processor.go │ │ │ │ └── trust_lines_processor_test.go │ │ │ ├── reap.go │ │ │ ├── reap_test.go │ │ │ ├── resume_state_test.go │ │ │ ├── sample_changes_test.go │ │ │ ├── states.jpg │ │ │ ├── stress_test.go │ │ │ ├── testdata │ │ │ │ ├── config.storagebackend.toml │ │ │ │ ├── sample-changes.xdr │ │ │ │ └── test_asset_filter_params.json │ │ │ ├── verify.go │ │ │ ├── verify_range_state_test.go │ │ │ └── verify_test.go │ │ ├── init.go │ │ ├── integration │ │ │ ├── bad_seq_txsub_test.go │ │ │ ├── change_test.go │ │ │ ├── claimable_balance_ops_test.go │ │ │ ├── claimable_balance_test.go │ │ │ ├── clawback_test.go │ │ │ ├── contracts │ │ │ │ ├── .gitignore │ │ │ │ ├── Cargo.lock │ │ │ │ ├── Cargo.toml │ │ │ │ ├── README.md │ │ │ │ ├── add_u64 │ │ │ │ │ ├── Cargo.toml │ │ │ │ │ └── src │ │ │ │ │ │ └── lib.rs │ │ │ │ ├── bulk │ │ │ │ │ ├── Cargo.toml │ │ │ │ │ └── src │ │ │ │ │ │ └── lib.rs │ │ │ │ ├── constructor │ │ │ │ ├── increment │ │ │ │ │ ├── Cargo.toml │ │ │ │ │ └── src │ │ │ │ │ │ ├── lib.rs │ │ │ │ │ │ └── test.rs │ │ │ │ ├── sac_test │ │ │ │ │ ├── Cargo.toml │ │ │ │ │ └── src │ │ │ │ │ │ └── lib.rs │ │ │ │ └── store │ │ │ │ │ ├── Cargo.toml │ │ │ │ │ └── src │ │ │ │ │ └── lib.rs │ │ │ ├── db_test.go │ │ │ ├── extend_footprint_ttl_test.go │ │ │ ├── generate_ledgers_test.go │ │ │ ├── ingestion_filtering_test.go │ │ │ ├── ingestion_load_test.go │ │ │ ├── invokehostfunction_test.go │ │ │ ├── liquidity_pool_test.go │ │ │ ├── muxed_account_details_test.go │ │ │ ├── muxed_operations_test.go │ │ │ ├── parameters_test.go │ │ │ ├── protocol_19_upgrade_test.go │ │ │ ├── sac_test.go │ │ │ ├── sponsorship_test.go │ │ │ ├── state_verifier_test.go │ │ │ ├── testdata │ │ │ │ ├── load-test-accounts.xdr.zstd │ │ │ │ ├── load-test-ledgers.xdr.zstd │ │ │ │ ├── soroban_add_u64.wasm │ │ │ │ ├── soroban_bulk.wasm │ │ │ │ ├── soroban_constructor_contract.wasm │ │ │ │ ├── soroban_increment_contract.wasm │ │ │ │ ├── soroban_sac_test.wasm │ │ │ │ ├── soroban_store.wasm │ │ │ │ ├── testbucket │ │ │ │ │ ├── FFFFFC18--999.xdr.zstd │ │ │ │ │ ├── FFFFFC19--998.xdr.zstd │ │ │ │ │ └── FFFFFC1A--997.xdr.zstd │ │ │ │ └── unlimited-config.xdr │ │ │ ├── trade_aggregations_test.go │ │ │ ├── transaction_preconditions_test.go │ │ │ ├── transaction_test.go │ │ │ ├── txsub_async_test.go │ │ │ └── txsub_test.go │ │ ├── ledger │ │ │ ├── ledger_source.go │ │ │ ├── ledger_source_test.go │ │ │ └── main.go │ │ ├── middleware_test.go │ │ ├── operationfeestats │ │ │ └── main.go │ │ ├── paths │ │ │ ├── doc.go │ │ │ ├── main.go │ │ │ ├── mock_finder.go │ │ │ ├── ratelimit.go │ │ │ └── ratelimit_test.go │ │ ├── render │ │ │ ├── main.go │ │ │ ├── main_test.go │ │ │ ├── mime.go │ │ │ ├── problem │ │ │ │ ├── problem.go │ │ │ │ └── problem_test.go │ │ │ └── sse │ │ │ │ ├── doc.go │ │ │ │ ├── main.go │ │ │ │ ├── main_test.go │ │ │ │ ├── stream.go │ │ │ │ ├── stream_handler.go │ │ │ │ ├── stream_handler_test.go │ │ │ │ └── stream_test.go │ │ ├── resourceadapter │ │ │ ├── account_entry.go │ │ │ ├── account_entry_test.go │ │ │ ├── asset.go │ │ │ ├── asset_stat.go │ │ │ ├── asset_stat_test.go │ │ │ ├── balance.go │ │ │ ├── balance_test.go │ │ │ ├── claimable_balances.go │ │ │ ├── claimable_balances_test.go │ │ │ ├── effects.go │ │ │ ├── effects_test.go │ │ │ ├── ledger.go │ │ │ ├── liquidity_pool.go │ │ │ ├── offer.go │ │ │ ├── operations.go │ │ │ ├── operations_test.go │ │ │ ├── path.go │ │ │ ├── path_test.go │ │ │ ├── root.go │ │ │ ├── root_test.go │ │ │ ├── trade.go │ │ │ ├── trade_aggregation.go │ │ │ ├── transaction.go │ │ │ ├── transaction_result_codes.go │ │ │ └── transaction_test.go │ │ ├── scripts │ │ │ ├── check_release_hash │ │ │ │ ├── Dockerfile │ │ │ │ ├── README.md │ │ │ │ └── check.sh │ │ │ ├── current_os.go │ │ │ ├── dev.bash │ │ │ └── rebuild_schema.bash │ │ ├── simplepath │ │ │ ├── doc.go │ │ │ └── inmemory.go │ │ ├── test │ │ │ ├── assertion.go │ │ │ ├── db │ │ │ │ └── main.go │ │ │ ├── environment.go │ │ │ ├── http.go │ │ │ ├── integration │ │ │ │ ├── core_config.go │ │ │ │ └── integration.go │ │ │ ├── log.go │ │ │ ├── main.go │ │ │ ├── scenarios │ │ │ │ ├── account_merge-core.sql │ │ │ │ ├── account_merge-horizon.sql │ │ │ │ ├── base-core.sql │ │ │ │ ├── base-horizon.sql │ │ │ │ ├── bindata.go │ │ │ │ ├── failed_transactions-core.sql │ │ │ │ ├── failed_transactions-horizon.sql │ │ │ │ ├── ingest_asset_stats-core.sql │ │ │ │ ├── ingest_asset_stats-horizon.sql │ │ │ │ ├── kahuna-core.sql │ │ │ │ ├── kahuna-horizon.sql │ │ │ │ ├── main.go │ │ │ │ ├── main_test.go │ │ │ │ ├── offer_ids-core.sql │ │ │ │ ├── offer_ids-horizon.sql │ │ │ │ ├── operation_fee_stats_1-core.sql │ │ │ │ ├── operation_fee_stats_1-horizon.sql │ │ │ │ ├── operation_fee_stats_2-core.sql │ │ │ │ ├── operation_fee_stats_2-horizon.sql │ │ │ │ ├── operation_fee_stats_3-core.sql │ │ │ │ ├── operation_fee_stats_3-horizon.sql │ │ │ │ ├── pathed_payment-core.sql │ │ │ │ ├── pathed_payment-horizon.sql │ │ │ │ ├── paths_strict_send-core.sql │ │ │ │ └── paths_strict_send-horizon.sql │ │ │ ├── static_mock_server.go │ │ │ ├── t.go │ │ │ └── transactions │ │ │ │ └── main.go │ │ ├── tls │ │ │ ├── localhost.conf │ │ │ └── regen.sh │ │ ├── txsub │ │ │ ├── doc.go │ │ │ ├── errors.go │ │ │ ├── helpers_test.go │ │ │ ├── main.go │ │ │ ├── open_submission_list.go │ │ │ ├── open_submission_list_test.go │ │ │ ├── results.go │ │ │ ├── results_test.go │ │ │ ├── submitter.go │ │ │ ├── submitter_test.go │ │ │ ├── system.go │ │ │ └── system_test.go │ │ └── utf8 │ │ │ ├── main.go │ │ │ └── main_test.go │ └── main.go ├── keystore │ ├── CHANGELOG.md │ ├── Makefile │ ├── README.md │ ├── api.go │ ├── api_test.go │ ├── attachments │ │ └── 2019-07-10-keystore-auth.png │ ├── cmd │ │ └── keystored │ │ │ ├── README.md │ │ │ ├── dev.go │ │ │ └── main.go │ ├── context.go │ ├── db_test.go │ ├── docker │ │ └── Dockerfile │ ├── keys.go │ ├── keys_test.go │ ├── migrations │ │ ├── 2019-05-23.0.initial-migrations.sql │ │ └── 2019-08-20.0.update-encrypted-keys.sql │ ├── problems.go │ ├── service.go │ ├── spec.md │ └── tls │ │ ├── localhost.conf │ │ └── regen.sh ├── regulated-assets-approval-server │ ├── .gitignore │ ├── CHANGELOG.md │ ├── Makefile │ ├── README.md │ ├── cmd │ │ ├── configureissuer.go │ │ ├── migrate.go │ │ └── serve.go │ ├── docker │ │ └── Dockerfile │ ├── internal │ │ ├── configureissuer │ │ │ ├── configureissuer.go │ │ │ └── configureissuer_test.go │ │ ├── db │ │ │ ├── db.go │ │ │ ├── db_test.go │ │ │ ├── dbmigrate │ │ │ │ ├── dbmigrate.go │ │ │ │ ├── dbmigrate_generated.go │ │ │ │ ├── dbmigrate_test.go │ │ │ │ └── migrations │ │ │ │ │ ├── 2021-05-05.0.initial.sql │ │ │ │ │ ├── 2021-05-18.0.accounts-kyc-status.sql │ │ │ │ │ └── 2021-06-08.0.pending-kyc-status.sql │ │ │ └── dbtest │ │ │ │ ├── dbtest.go │ │ │ │ └── dbtest_test.go │ │ └── serve │ │ │ ├── api_kyc_status_test.go │ │ │ ├── api_tx_approve_test.go │ │ │ ├── friendbot.go │ │ │ ├── friendbot_test.go │ │ │ ├── httperror │ │ │ ├── http_error.go │ │ │ └── http_error_test.go │ │ │ ├── kycstatus │ │ │ ├── delete_handler.go │ │ │ ├── delete_handler_test.go │ │ │ ├── get_detail_handler.go │ │ │ ├── get_detail_handler_test.go │ │ │ ├── post_handler.go │ │ │ └── post_handler_test.go │ │ │ ├── middleware.go │ │ │ ├── serve.go │ │ │ ├── serve_test.go │ │ │ ├── toml.go │ │ │ ├── toml_test.go │ │ │ ├── tx_approve.go │ │ │ ├── tx_approve_response.go │ │ │ └── tx_approve_test.go │ └── main.go └── ticker │ ├── .gitignore │ ├── .gqlconfig │ ├── CHANGELOG.md │ ├── Makefile │ ├── README.md │ ├── cmd │ ├── clean.go │ ├── generate.go │ ├── ingest.go │ ├── migrate.go │ ├── root.go │ └── serve.go │ ├── dbconfig.yml │ ├── docker │ ├── Dockerfile │ ├── Dockerfile-dev │ ├── conf │ │ ├── .pgpass │ │ ├── crontab.txt │ │ ├── nginx.conf │ │ ├── pg_hba.conf │ │ ├── pg_ident.conf │ │ ├── postgresql.conf │ │ └── supervisord.conf │ ├── dependencies │ ├── setup │ └── start │ ├── docs │ ├── API.md │ ├── Architecture.md │ └── images │ │ └── StellarTicker.png │ ├── internal │ ├── actions_asset.go │ ├── actions_graphql.go │ ├── actions_issuer.go │ ├── actions_market.go │ ├── actions_orderbook.go │ ├── actions_trade.go │ ├── actions_trade_test.go │ ├── gql │ │ ├── bigint.go │ │ ├── graphiql.go │ │ ├── main.go │ │ ├── main_test.go │ │ ├── resolvers_asset.go │ │ ├── resolvers_issuer.go │ │ ├── resolvers_market.go │ │ └── static │ │ │ ├── bindata.go │ │ │ ├── graphiql.html │ │ │ ├── schema.go │ │ │ ├── schema.gql │ │ │ └── schema_test.go │ ├── graphql_test.go │ ├── main.go │ ├── scraper │ │ ├── asset_scraper.go │ │ ├── asset_scraper_test.go │ │ ├── helpers.go │ │ ├── main.go │ │ ├── main_test.go │ │ ├── orderbook_scraper.go │ │ ├── toml_cache.go │ │ ├── toml_cache_test.go │ │ ├── trade_scraper.go │ │ └── trade_scraper_test.go │ ├── tickerdb │ │ ├── helpers.go │ │ ├── helpers_test.go │ │ ├── main.go │ │ ├── migrations │ │ │ ├── 20190404184050-initial.sql │ │ │ ├── 20190405112544-increase_asset_code_size.sql │ │ │ ├── 20190408115724-add_new_asset_fields.sql │ │ │ ├── 20190408155841-add_issuers_table.sql │ │ │ ├── 20190409152216-add_trades_table.sql │ │ │ ├── 20190409172610-rename_assets_desc_description.sql │ │ │ ├── 20190410094830-add_assets_issuer_account_field.sql │ │ │ ├── 20190411165735-data_seed_and_indices.sql │ │ │ ├── 20190425110313-add_orderbook_stats.sql │ │ │ ├── 20190426092321-add_aggregated_orderbook_view.sql │ │ │ ├── 20220909100700-trades_pk_to_bigint.sql │ │ │ └── bindata.go │ │ ├── migrations_test.go │ │ ├── queries_asset.go │ │ ├── queries_asset_test.go │ │ ├── queries_issuer.go │ │ ├── queries_issuer_test.go │ │ ├── queries_market.go │ │ ├── queries_market_test.go │ │ ├── queries_orderbook.go │ │ ├── queries_orderbook_test.go │ │ ├── queries_trade.go │ │ ├── queries_trade_test.go │ │ └── tickerdbtest │ │ │ └── tickerdbtest.go │ └── utils │ │ ├── main.go │ │ └── main_test.go │ └── main.go ├── src └── constants.go ├── staticcheck.sh ├── strkey ├── benchmark_test.go ├── decode_test.go ├── doc.go ├── encode_test.go ├── internal │ └── crc16 │ │ ├── main.go │ │ └── main_test.go ├── main.go ├── main_test.go ├── muxed_account.go ├── muxed_account_test.go ├── signed_payload.go └── signed_payload_test.go ├── support ├── app │ └── main.go ├── clock │ ├── clocktest │ │ ├── fixed.go │ │ └── fixed_test.go │ ├── main.go │ └── main_test.go ├── collections │ ├── heap │ │ ├── heap.go │ │ └── heap_test.go │ ├── maps │ │ ├── map.go │ │ └── map_test.go │ └── set │ │ ├── iset.go │ │ ├── safeset.go │ │ ├── set.go │ │ └── set_test.go ├── compressxdr │ ├── compress_xdr.go │ ├── compress_xdr_test.go │ ├── compressor.go │ ├── mocks.go │ └── testdata │ │ └── FCD285FF--53312000.xdr.zstd ├── config │ ├── broken_test.go │ ├── config_option.go │ ├── config_option_test.go │ ├── invalid_config_error.go │ ├── main.go │ └── main_test.go ├── contractevents │ ├── burn.go │ ├── clawback.go │ ├── event.go │ ├── event_test.go │ ├── fixtures │ │ └── transfer_event_xdr.bin │ ├── generate.go │ ├── mint.go │ ├── transfer.go │ └── utils.go ├── datastore │ ├── datastore.go │ ├── datastore_test.go │ ├── gcs_datastore.go │ ├── gcs_test.go │ ├── ledgerbatch_config.go │ ├── ledgerbatch_config_test.go │ ├── metadata.go │ ├── metadata_test.go │ ├── mocks.go │ ├── resumablemanager_test.go │ └── resumeablemanager.go ├── db │ ├── batch_insert_builder.go │ ├── batch_insert_builder_test.go │ ├── dbtest │ │ ├── db.go │ │ └── postgres_test.go │ ├── delete_builder.go │ ├── delete_builder_test.go │ ├── errors.go │ ├── fast_batch_insert_builder.go │ ├── fast_batch_insert_builder_test.go │ ├── get_builder.go │ ├── get_builder_test.go │ ├── insert_builder.go │ ├── insert_builder_test.go │ ├── internal.go │ ├── internal_test.go │ ├── main.go │ ├── main_test.go │ ├── metrics.go │ ├── mock_session.go │ ├── pg │ │ └── pg.go │ ├── round_trip_probe.go │ ├── schema │ │ └── main.go │ ├── select_builder.go │ ├── select_builder_test.go │ ├── session.go │ ├── session_test.go │ ├── sqlutils │ │ └── main.go │ ├── table.go │ └── update_builder.go ├── env │ ├── env.go │ └── env_test.go ├── errors │ └── main.go ├── http │ ├── fs.go │ ├── headers_middleware.go │ ├── httpauthz │ │ ├── httpauthz.go │ │ └── httpauthz_test.go │ ├── httpdecode │ │ ├── httpdecode.go │ │ └── httpdecode_test.go │ ├── httptest │ │ ├── client.go │ │ ├── client_expectation.go │ │ └── main.go │ ├── logging_middleware.go │ ├── logging_middleware_test.go │ ├── main.go │ ├── main_test.go │ ├── mutil │ │ ├── LICENSE.txt │ │ ├── main.go │ │ └── writer_proxy.go │ ├── mux.go │ ├── sanitize_route_test.go │ ├── strip_trailing_slash_middleware.go │ ├── xff_middleware.go │ └── xff_middleware_test.go ├── keypairgen │ ├── keypairgen.go │ ├── keypairgen_test.go │ └── keypairgentest │ │ ├── slice.go │ │ └── slice_test.go ├── log │ ├── doc.go │ ├── entry.go │ ├── entry_test.go │ ├── loggly_hook.go │ ├── main.go │ └── main_test.go ├── logmetrics │ ├── main.go │ └── main_test.go ├── ordered │ ├── math.go │ └── math_test.go ├── render │ ├── hal │ │ ├── handler.go │ │ ├── io.go │ │ ├── link.go │ │ ├── link_builder.go │ │ ├── link_builder_test.go │ │ ├── page.go │ │ └── paging_token.go │ ├── health │ │ ├── doc.go │ │ ├── example_test.go │ │ ├── handler.go │ │ ├── handler_test.go │ │ ├── response.go │ │ └── status.go │ ├── httpjson │ │ ├── encoding.go │ │ ├── encoding_test.go │ │ ├── handler.go │ │ ├── handler_test.go │ │ ├── io.go │ │ └── io_test.go │ └── problem │ │ ├── default.go │ │ ├── default_test.go │ │ ├── problem.go │ │ └── problem_test.go ├── scripts │ ├── README.md │ └── build_release_artifacts │ │ ├── main.go │ │ └── main_test.go ├── storage │ ├── filesystem.go │ ├── gcs.go │ ├── http.go │ ├── main.go │ ├── ondisk_cache.go │ ├── s3.go │ └── s3_test.go ├── strutils │ ├── main.go │ └── main_test.go ├── test │ └── main.go ├── time │ ├── main.go │ └── main_test.go └── url │ ├── main.go │ └── main_test.go ├── toid ├── main.go ├── main_test.go └── synt_offer_id.go ├── tools ├── alb-replay │ ├── CHANGELOG.md │ ├── README.md │ └── main.go ├── archive-reader │ ├── CHANGELOG.md │ ├── README.md │ └── archive_reader.go ├── goreplay-middleware │ ├── CHANGELOG.md │ ├── README.md │ ├── main.go │ ├── main_test.go │ ├── request.go │ └── request_test.go ├── horizon-cmp │ ├── CHANGELOG.md │ ├── README.md │ ├── history.go │ ├── init_paths.go │ ├── init_routes.go │ ├── internal │ │ ├── paths.go │ │ ├── response.go │ │ ├── route_counter.go │ │ ├── route_counter_test.go │ │ └── scanner.go │ └── main.go ├── horizon-verify │ ├── CHANGELOG.md │ ├── README.md │ └── main.go ├── stellar-archivist │ ├── CHANGELOG.md │ ├── README.md │ ├── main.go │ └── main_test.go ├── stellar-hd-wallet │ ├── CHANGELOG.md │ ├── README.md │ ├── commands │ │ ├── accounts.go │ │ ├── accounts_test.go │ │ ├── io.go │ │ └── new.go │ └── main.go ├── stellar-key-gen │ ├── CHANGELOG.md │ ├── README.md │ ├── main.go │ └── main_test.go ├── stellar-sign │ ├── CHANGELOG.md │ ├── README.md │ └── main.go ├── stellar-vanity-gen │ ├── CHANGELOG.md │ ├── README.md │ └── main.go └── xdr2go │ ├── CHANGELOG.md │ ├── README.md │ └── main.go ├── txnbuild ├── CHANGELOG.md ├── README.md ├── account_merge.go ├── account_merge_test.go ├── allow_trust.go ├── allow_trust_test.go ├── asset.go ├── asset_amount.go ├── asset_test.go ├── assets.go ├── assets_test.go ├── begin_sponsoring_future_reserves.go ├── begin_sponsoring_future_reserves_test.go ├── bump_sequence.go ├── bump_sequence_test.go ├── change_trust.go ├── change_trust_asset.go ├── change_trust_test.go ├── claim_claimable_balance.go ├── claim_claimable_balance_test.go ├── clawback.go ├── clawback_claimable_balance.go ├── clawback_claimable_balance_test.go ├── clawback_test.go ├── cmd │ └── demo │ │ ├── cmd │ │ ├── init.go │ │ ├── reset.go │ │ ├── root.go │ │ └── txerror.go │ │ ├── main.go │ │ └── operations │ │ └── demo.go ├── create_account.go ├── create_account_test.go ├── create_claimable_balance.go ├── create_claimable_balance_test.go ├── create_passive_offer.go ├── create_passive_offer_test.go ├── end_sponsoring_future_reserves.go ├── end_sponsoring_future_reserves_test.go ├── example_test.go ├── examplehorizonclient │ └── examplehorizonclient.go ├── extend_footprint_ttl.go ├── fee_bump_test.go ├── helpers.go ├── helpers_test.go ├── inflation.go ├── inflation_test.go ├── invoke_host_function.go ├── invoke_host_function_test.go ├── ledgerbounds.go ├── liquidity_pool_deposit.go ├── liquidity_pool_deposit_test.go ├── liquidity_pool_id.go ├── liquidity_pool_id_test.go ├── liquidity_pool_parameters.go ├── liquidity_pool_withdraw.go ├── liquidity_pool_withdraw_test.go ├── manage_buy_offer.go ├── manage_buy_offer_test.go ├── manage_data.go ├── manage_data_test.go ├── manage_offer.go ├── manage_offer_test.go ├── memo.go ├── memo_test.go ├── operation.go ├── operation_test.go ├── path_payment.go ├── path_payment_strict_send.go ├── path_payment_strict_send_test.go ├── path_payment_test.go ├── payment.go ├── payment_test.go ├── preconditions.go ├── preconditions_test.go ├── restore_footprint.go ├── revoke_sponsorship.go ├── revoke_sponsorship_test.go ├── set_options.go ├── set_options_test.go ├── set_trust_line_flags.go ├── set_trustline_flags_test.go ├── signer_summary.go ├── signers_test.go ├── simple_account.go ├── timebounds.go ├── timebounds_test.go ├── transaction.go ├── transaction_challenge_example_test.go ├── transaction_fee_test.go ├── transaction_test.go └── trust_line_asset.go ├── utils └── apiclient │ ├── client.go │ ├── client_test.go │ ├── main.go │ ├── request.go │ └── request_test.go └── xdr ├── README.md ├── Stellar-SCP.x ├── Stellar-contract-config-setting.x ├── Stellar-contract-env-meta.x ├── Stellar-contract-meta.x ├── Stellar-contract-spec.x ├── Stellar-contract.x ├── Stellar-exporter.x ├── Stellar-internal.x ├── Stellar-ledger-entries.x ├── Stellar-ledger.x ├── Stellar-overlay.x ├── Stellar-transaction.x ├── Stellar-types.x ├── account_entry.go ├── account_entry_test.go ├── account_flags.go ├── account_flags_test.go ├── account_id.go ├── account_id_test.go ├── account_thresholds.go ├── accounts_thesholds_test.go ├── asset.go ├── asset_code.go ├── asset_code_test.go ├── asset_test.go ├── change_trust_asset.go ├── claim_atom.go ├── claimable_balance_entry.go ├── claimable_balance_entry_test.go ├── claimable_balance_flags.go ├── claimable_balance_flags_test.go ├── claimable_balance_id.go ├── claimant.go ├── claimant_test.go ├── db.go ├── db_test.go ├── decorated_signature.go ├── decorated_signature_test.go ├── equals.go ├── event.go ├── fuzz └── jsonclaimpredicate │ ├── corpus │ ├── 0 │ ├── 059ce73797da3779f67d67b27fbbe1586fb5af4c-11 │ ├── 06b5aa65dd57296c5d7d71c34e4458704c9d8504-24 │ ├── 070fdb451a68170438d23544e162edbe0c53831c-24 │ ├── 0738efae9b6af6dd2f5b47ee3670e79e120bf8ff-5 │ ├── 0c11486742bca82a11751928390f3c143964bae5-4 │ ├── 0c52a7776c7b6699bbb73b57fcd48c92d5861814-1 │ ├── 0e7786143ce4b5034c1df4f0bf398198b7880a06-1 │ ├── 0e92db53270df55314b1629bb2362d00be9ae485-27 │ ├── 17b83232cd0cb2405c3e44f22c1a449dd321bab1-14 │ ├── 18d6cfc1fee128a9ed89b45c644fefb1a67c557f-4 │ ├── 1dd0e81c3f135bbfcdf5e306727f1fdaa954c4b5-20 │ ├── 1ffd4bb29dbaf9a8b23a80410b7dcf6d160f20f5-5 │ ├── 22059050a2075418d91ab3d94cb5b5202dcb5449-10 │ ├── 22afe6d1107dc8421df2d27cf51c1e644c02c61c-18 │ ├── 23d671738a3514e6addb20280a0bd45d04991f35-9 │ ├── 24196ca658a9c921b531ee7000b268a21a630b9e-9 │ ├── 2ad5aa06b6a21b80102b70f792a6f5182b1e795e-26 │ ├── 2c4456e3a9606ff70b52b741d60629fc0aff6670-24 │ ├── 33081e04522f2adea4af265daeb32b9be88972ba-16 │ ├── 33ede038ddd6a6b2f2db89f2ead0338defbd68bb-26 │ ├── 34dabb7d96c82c2808d791c0267e28e79bfac2bf-19 │ ├── 3506b22eae67d429090fc709a72819b833c6d96f-25 │ ├── 35e0ed07d721971cb22d5957dee80f25ead2cb42-22 │ ├── 377545c22c2ee8e37810716409b46536e840f56b-20 │ ├── 3e9f514f89306765a02fba331f057ca66961dd71-17 │ ├── 3f2b6cbcae547826b84ba42a9e6ea0b1a3339aa4-2 │ ├── 3f6582b3dcb15d99dab3789e997aa26f721ecbfe-16 │ ├── 4079505f0bc61228e001bc6471699238dde274f4-4 │ ├── 48afcfe2230cea5d2d3ee438fa0b7a74e372d158-12 │ ├── 4f3bde9486d6faa2790e56aedf58b4ac44aec8b5-20 │ ├── 4fe56699612c2cf2ff3f386e7c555f560deadf9a-15 │ ├── 60b8e1cbf32b5ca3b1ec60572dab334951058d0b-6 │ ├── 61cb9be335a9ed20ab522fc29a6e6dfbcb33a601-1 │ ├── 63ab224880353a2b49f80077e9da722c18329ac1-10 │ ├── 658c4a6cc7e274ed79d0ce7ed12a2c7b8c57e601-5 │ ├── 6adde074d4fe03d42ba8caab1516c4ceb97da570-11 │ ├── 6b12dad633f25444a712e5fd0bb47ec718950a18-20 │ ├── 6cd24a62b01b2c0e4dcc1304817ca6700054b339-21 │ ├── 76ac82e6a9d81c206c98f8305978f3ceb003ef29-2 │ ├── 7704823d2993cac4543740727aadf0da46f0b187-19 │ ├── 78eb7d11840d3521ebdf34aa850c275d1f48bae8-12 │ ├── 7ff2c71aacf7b64291948dfb49369e5d1fee5e1c-2 │ ├── 802c4d37a41acc0a65a47dd9260578db8a91c7b0-2 │ ├── 80bce1575cf091d64032193bf508ef39b9a2c929-13 │ ├── 8167706299d763d2680aafb67be0c1de500bd577-1 │ ├── 836ccf6afc61a555e6c77db43e9972e14e018db3-17 │ ├── 8415b311a622e944074e28ca77d538f483201a43-3 │ ├── 8700a406939d1a113038c778808c81c32dc3bc28-1 │ ├── 8997d68a77b10c3c9ec4196b33e64224b3241266-2 │ ├── 8b3e6618aa03e9c7959cfd5a68095cb4d6a203df-20 │ ├── 8b9538724414e6d819239a7c01199398fab43ffc-3 │ ├── 9069ca78e7450a285173431b3e52c5c25299e473-1 │ ├── 958cc6437a39b63f7396b0a71d04007b88c6379b-7 │ ├── 959ed41ac6a90cd2ebc4795df6ddd40ea0d75b0f-2 │ ├── 9a18ed489961b6bd472665166ae1b92fadb4a30d-25 │ ├── a01a7ff06434fa1552a81f30078b392e6d2bfad1-4 │ ├── a46d5ed7d68b26e1c5d9c1b88d657dafd2205150-23 │ ├── a7473f2a9f6d6c330457bf2de9d5969a55d0aee3-16 │ ├── a751ccd38c35877231ba5493bfc2616870c2988e-24 │ ├── a9d519b73acfc6693baa94caf8d3775d1b5c2e4d-3 │ ├── aaa626f320812eb78a7ef9b957db9e00792c2ae6-25 │ ├── ab8767081fee98bd3c608822c63599d9bb4cd7f0-15 │ ├── abdc9928a9e1d7dc324eba5e7bd9be3d3f648a58-14 │ ├── ac8f325e3a178437989e9fb6d577d8b3ec57cfd8-9 │ ├── ae48c762a25dc2b03889d5830768edd235ec5b9e-10 │ ├── b1a3550eaa19cc0fee2e869c5e126f433910d1d3-12 │ ├── b20ec8a5c170be3a45ebb6d7736ef7e2450bcfc8-19 │ ├── b283d6eafb57f10081d075a1e513297d0f003dda-4 │ ├── b2af21ff16013174e8b940aeea46a5d2b7ebe959-3 │ ├── b43d6499a479a144d48743aceab226ae04b084b3-27 │ ├── b975870c79205eb51bb870470dc43a2247a840b4-2 │ ├── ba38988d5c5dcc1ac3a71cd384361208fe07b52b-3 │ ├── ba66c7f545d45a2f9e3a0ccdf3c890d599be0c04-23 │ ├── bdc41f8d992fb63574a3502310f8da8fa2f46ecb-6 │ ├── c0113ad49c1ab5cb58850b98f057361b51a07de9-19 │ ├── c04c37d97e7d5f40e778a9f4f2798e79d67b2894-13 │ ├── c3e528e0864bdeabc3a493347d081458107d6d02-8 │ ├── c8e6898a08dcd50eb9d4277f52b5a1316363b1ce-8 │ ├── cd9e58d3d455ad5a8dbe295c15bcc497ad0a5b3f-6 │ ├── d1c5c02b37cee617709474c716cff28931a83f0a-1 │ ├── d1c92868d562107bef8080a1e36abb5118cd6c1f-1 │ ├── d47aadd63b71c1edf2560bd7790b6ece114ac150-4 │ ├── d4e6caed58ca3f001ee3f9b719e72f48af941e69-8 │ ├── dd2292f040e7417fd33bffef779136045e3e42e9-8 │ ├── e1e0b62f78224847064adfb1db88db5c2ad7314f-22 │ ├── e496e6bcb958104db803f6987f7463e64dd03c36-3 │ ├── e6d28f2def888dd7b4e3e7bb0602a9a54032fc25-14 │ ├── e9ae6ca39d51bd4198dc8b4f2ed429dd7464a1b7-15 │ ├── ea5ef46f0ad1b2f1477437d6a8fea4a05bf589f9-21 │ ├── ec7ef371ebfc7964bd80d7783b5e4eb0f614b9f2-18 │ ├── ed23eb5f747659b11a5505b08e56624399351eb3-16 │ ├── efad3ce838161e85a374929a9c0fd4d51812cc5f-2 │ ├── f4e16e4477ecc1f88f51319373564404a1e9b03d-7 │ ├── f54b8d6090a285885734d804129213715c3c5b55-10 │ ├── f54d55cac405aed2c99ca12e5f630db204f46b67-2 │ ├── f76bac376810acce74267a853b664a0a29d47d2b-5 │ ├── f816b4e064d14656872cadca92ecb1f5179a6319-5 │ ├── fb1c8df7fa2faac955b0e03fbc7423030d6ab8ae-1 │ ├── fb4933de8b968e1cda99b1d7d8dfb600d60123ce-7 │ ├── fbfab2089beccd80677b39f984d4a2e1151000e4-18 │ ├── fd447488be54b05d69fa33e39e3754eb7b34a5ba-5 │ └── fef930fcbbe7b532642eb9bed98dd04d6bbff761-11 │ └── fuzz.go ├── go_string.go ├── go_string_test.go ├── hash.go ├── json.go ├── json_test.go ├── ledger_close_meta.go ├── ledger_close_meta_batch.go ├── ledger_close_meta_batch_test.go ├── ledger_close_meta_test.go ├── ledger_entry.go ├── ledger_entry_change.go ├── ledger_entry_test.go ├── ledger_key.go ├── ledger_key_test.go ├── liquidity_pool.go ├── main.go ├── main_test.go ├── memo.go ├── muxed_account.go ├── muxed_account_test.go ├── node_id.go ├── path_payment_result.go ├── pool_id.go ├── pool_id_test.go ├── preconditions.go ├── price.go ├── price_test.go ├── scval.go ├── scval_test.go ├── signer_key.go ├── signer_key_test.go ├── signers.go ├── string.go ├── transaction.go ├── transaction_envelope.go ├── transaction_envelope_test.go ├── transaction_meta.go ├── transaction_result.go ├── transaction_result_test.go ├── trust_line_asset.go ├── trust_line_entry.go ├── trust_line_flags.go ├── trust_line_flags_test.go ├── uint256.go ├── uint256_test.go ├── xdr_commit_generated.txt ├── xdr_generated.go ├── xdr_suite_test.go ├── xdrstream.go └── xdrstream_test.go /.dockerignore: -------------------------------------------------------------------------------- 1 | vendor 2 | dist -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /vendor 3 | /dist 4 | /local-archive 5 | /services/horizon/captive-core 6 | /services/horizon/horizon 7 | /services/horizon/stellar-horizon 8 | **bucket-cache/ 9 | .vscode 10 | .idea 11 | debug 12 | .bundle 13 | *.swp 14 | *.crt 15 | *.csr 16 | *.key 17 | *.prof 18 | *.test 19 | *.index 20 | *.xdr 21 | *.db 22 | *.conf 23 | *.lock 24 | .proto_checksums 25 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | Copyright 2016 Stellar Development Foundation and contributors. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | As well as the file LICENSE adjacent to this file. 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | -------------------------------------------------------------------------------- /clients/doc.go: -------------------------------------------------------------------------------- 1 | // Package clients contains sub-packages that provide client access to the 2 | // various stellar services. 3 | package clients 4 | -------------------------------------------------------------------------------- /clients/horizonclient/submit_request_test.go: -------------------------------------------------------------------------------- 1 | package horizonclient 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/assert" 7 | "github.com/stretchr/testify/require" 8 | ) 9 | 10 | func TestSubmitRequestBuildUrl(t *testing.T) { 11 | sr := submitRequest{endpoint: "transactions", transactionXdr: "xyzabc"} 12 | endpoint, err := sr.BuildURL() 13 | 14 | // It should return valid endpoint and no errors 15 | require.NoError(t, err) 16 | assert.Equal(t, "transactions?tx=xyzabc", endpoint) 17 | 18 | sr = submitRequest{} 19 | _, err = sr.BuildURL() 20 | 21 | // It should return errors 22 | if assert.Error(t, err) { 23 | assert.Contains(t, err.Error(), "invalid request: too few parameters") 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /clients/horizonclient/version.go: -------------------------------------------------------------------------------- 1 | package horizonclient 2 | 3 | // version is the current version of the horizonclient. 4 | // This is updated for every release. 5 | const version = "2.1.0" 6 | -------------------------------------------------------------------------------- /clients/stellarcore/main.go: -------------------------------------------------------------------------------- 1 | // Package stellarcore is a client library for communicating with an 2 | // instance of stellar-core using through the server's HTTP port. 3 | package stellarcore 4 | 5 | import "net/http" 6 | 7 | // SetCursorDone is the success message returned by stellar-core when a cursor 8 | // update succeeds. 9 | const SetCursorDone = "Done" 10 | 11 | // HTTP represents the http client that a stellarcore client uses to make http 12 | // requests. 13 | type HTTP interface { 14 | Do(req *http.Request) (*http.Response, error) 15 | } 16 | 17 | // confirm interface conformity 18 | var _ HTTP = http.DefaultClient 19 | -------------------------------------------------------------------------------- /clients/stellarcore/main_test.go: -------------------------------------------------------------------------------- 1 | package stellarcore 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | ) 7 | 8 | func ExampleClient_Info() { 9 | client := &Client{URL: "http://localhost:11626"} 10 | 11 | info, err := client.Info(context.Background()) 12 | 13 | if err != nil { 14 | panic(err) 15 | } 16 | 17 | fmt.Printf("synced: %v", info.IsSynced()) 18 | } 19 | -------------------------------------------------------------------------------- /clients/stellartoml/main_test.go: -------------------------------------------------------------------------------- 1 | package stellartoml 2 | 3 | import "log" 4 | 5 | // ExampleGetTOML gets the stellar.toml file for coins.asia 6 | func ExampleClient_GetStellarToml() { 7 | _, err := DefaultClient.GetStellarToml("coins.asia") 8 | if err != nil { 9 | log.Fatal(err) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /clients/stellartoml/mocks.go: -------------------------------------------------------------------------------- 1 | package stellartoml 2 | 3 | import "github.com/stretchr/testify/mock" 4 | 5 | // MockClient is a mockable stellartoml client. 6 | type MockClient struct { 7 | mock.Mock 8 | } 9 | 10 | // GetStellarToml is a mocking a method 11 | func (m *MockClient) GetStellarToml(domain string) (*Response, error) { 12 | a := m.Called(domain) 13 | return a.Get(0).(*Response), a.Error(1) 14 | } 15 | 16 | // GetStellarTomlByAddress is a mocking a method 17 | func (m *MockClient) GetStellarTomlByAddress(address string) (*Response, error) { 18 | a := m.Called(address) 19 | return a.Get(0).(*Response), a.Error(1) 20 | } 21 | -------------------------------------------------------------------------------- /exp/README.md: -------------------------------------------------------------------------------- 1 | # Experimental packages 2 | 3 | Packages contained within this folder are considered experimental, and may be buggy or broken. This provides a location where developers can experiment with new APIs, 4 | 5 | See [godoc](https://godoc.org/github.com/stellar/go/exp) for details about each package. 6 | 7 | ## Adding experimental services, clients, tools, etc. 8 | 9 | Just as with the non-experimental portion of this repo, the `exp` package uses a well-defined package structure for a few common activities. An experimental service would go in `github.com/stellar/go/exp/services`, for example. 10 | -------------------------------------------------------------------------------- /exp/crypto/derivation/doc.go: -------------------------------------------------------------------------------- 1 | // Package derivation provides functions for ed25519 key derivation as described in: 2 | // https://github.com/satoshilabs/slips/blob/master/slip-0010.md 3 | package derivation 4 | -------------------------------------------------------------------------------- /exp/doc.go: -------------------------------------------------------------------------------- 1 | // Package exp houses experimental packages related to Stellar developement 2 | package exp 3 | -------------------------------------------------------------------------------- /exp/orderbook/utils.go: -------------------------------------------------------------------------------- 1 | package orderbook 2 | 3 | import ( 4 | "github.com/stellar/go/xdr" 5 | ) 6 | 7 | // getPoolAssets retrieves string representations of a pool's reserves 8 | func getPoolAssets(pool xdr.LiquidityPoolEntry) (xdr.Asset, xdr.Asset) { 9 | params := pool.Body.MustConstantProduct().Params 10 | return params.AssetA, params.AssetB 11 | } 12 | 13 | // positiveMin returns the smallest positive value possible 14 | func positiveMin(a, b xdr.Int64) xdr.Int64 { 15 | if b <= 0 { 16 | return a 17 | } 18 | 19 | if b < a || a <= 0 { 20 | return b 21 | } 22 | 23 | return a 24 | } 25 | -------------------------------------------------------------------------------- /exp/services/market-tracker/config_sample.json: -------------------------------------------------------------------------------- 1 | { 2 | "tradePairs": [ 3 | { 4 | "buyingAsset": { 5 | "code": "USD", 6 | "issuerAddress": "GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX", 7 | "issuerName": "AnchorUSD", 8 | "type": "AssetType4", 9 | "currency": "USD" 10 | }, 11 | "sellingAsset": { 12 | "code": "XLM", 13 | "issuerAddress": "native", 14 | "type": "AssetTypeNative" 15 | } 16 | } 17 | ], 18 | "checkIntervalSeconds": 10 19 | } -------------------------------------------------------------------------------- /exp/services/market-tracker/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/stellar/market-tracker 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927 // indirect 7 | github.com/joho/godotenv v1.3.0 8 | github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 // indirect 9 | github.com/klauspost/compress v1.15.1 // indirect 10 | github.com/matryer/try v0.0.0-20161228173917-9ac251b645a2 // indirect 11 | github.com/prometheus/client_golang v1.11.1 12 | github.com/stellar/go v0.0.0-20211208234857-bf7909b45bd4 13 | github.com/stretchr/testify v1.7.0 14 | github.com/valyala/fasthttp v1.35.0 // indirect 15 | gopkg.in/matryer/try.v1 v1.0.0-20150601225556-312d2599e12e 16 | ) 17 | -------------------------------------------------------------------------------- /exp/services/recoverysigner/Makefile: -------------------------------------------------------------------------------- 1 | # Check if we need to prepend docker commands with sudo 2 | SUDO := $(shell docker version >/dev/null 2>&1 || echo "sudo") 3 | 4 | # If TAG is not provided set default value 5 | TAG ?= stellar/recoverysigner:$(shell git rev-parse --short HEAD)$(and $(shell git status -s),-dirty-$(shell id -u -n)) 6 | # https://github.com/opencontainers/image-spec/blob/master/annotations.md 7 | BUILD_DATE := $(shell date -u +%FT%TZ) 8 | 9 | docker-build: 10 | cd ../../../ && \ 11 | $(SUDO) docker build --pull --label org.opencontainers.image.created="$(BUILD_DATE)" \ 12 | -f exp/services/recoverysigner/docker/Dockerfile -t $(TAG) . 13 | 14 | docker-push: 15 | cd ../../../ && \ 16 | $(SUDO) docker push $(TAG) 17 | -------------------------------------------------------------------------------- /exp/services/recoverysigner/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.23-bullseye as build 2 | 3 | ADD . /src/recoverysigner 4 | WORKDIR /src/recoverysigner 5 | RUN go build -o /bin/recoverysigner ./exp/services/recoverysigner 6 | 7 | 8 | FROM ubuntu:22.04 9 | 10 | RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates 11 | COPY --from=build /bin/recoverysigner /app/ 12 | EXPOSE 8000 13 | ENTRYPOINT ["/app/recoverysigner"] 14 | CMD ["serve"] 15 | -------------------------------------------------------------------------------- /exp/services/recoverysigner/internal/account/db_store.go: -------------------------------------------------------------------------------- 1 | package account 2 | 3 | import ( 4 | "github.com/jmoiron/sqlx" 5 | ) 6 | 7 | type DBStore struct { 8 | DB *sqlx.DB 9 | } 10 | -------------------------------------------------------------------------------- /exp/services/recoverysigner/internal/account/db_store_count.go: -------------------------------------------------------------------------------- 1 | package account 2 | 3 | func (s *DBStore) Count() (int, error) { 4 | count := int(0) 5 | err := s.DB.Get(&count, `SELECT COUNT(*) FROM accounts`) 6 | if err != nil { 7 | return 0, err 8 | } 9 | return count, nil 10 | } 11 | -------------------------------------------------------------------------------- /exp/services/recoverysigner/internal/account/db_store_delete.go: -------------------------------------------------------------------------------- 1 | package account 2 | 3 | func (s *DBStore) Delete(address string) error { 4 | // Delete an account will delete the associated identities and auth methods because of the ON DELETE CASCADE references. 5 | result, err := s.DB.Exec( 6 | `DELETE FROM accounts 7 | WHERE address = $1`, 8 | address, 9 | ) 10 | if err != nil { 11 | return err 12 | } 13 | rowsAffected, err := result.RowsAffected() 14 | if err != nil { 15 | return err 16 | } 17 | if rowsAffected == 0 { 18 | return ErrNotFound 19 | } 20 | 21 | return nil 22 | } 23 | -------------------------------------------------------------------------------- /exp/services/recoverysigner/internal/account/store.go: -------------------------------------------------------------------------------- 1 | package account 2 | 3 | import "errors" 4 | 5 | type Store interface { 6 | Add(a Account) error 7 | Delete(address string) error 8 | Get(address string) (Account, error) 9 | Update(a Account) error 10 | FindWithIdentityAddress(address string) ([]Account, error) 11 | FindWithIdentityPhoneNumber(phoneNumber string) ([]Account, error) 12 | FindWithIdentityEmail(email string) ([]Account, error) 13 | Count() (int, error) 14 | } 15 | 16 | var ErrNotFound = errors.New("account not found") 17 | var ErrAlreadyExists = errors.New("account already exists") 18 | -------------------------------------------------------------------------------- /exp/services/recoverysigner/internal/db/db.go: -------------------------------------------------------------------------------- 1 | package db 2 | 3 | import ( 4 | "github.com/jmoiron/sqlx" 5 | ) 6 | 7 | func Open(dataSourceName string) (*sqlx.DB, error) { 8 | return sqlx.Open("postgres", dataSourceName) 9 | } 10 | -------------------------------------------------------------------------------- /exp/services/recoverysigner/internal/db/dbmigrate/migrations/20200309000000-initial-1.sql: -------------------------------------------------------------------------------- 1 | -- This migration file is intentionally empty and is a first starting point for 2 | -- our migrations before we yet have a schema. 3 | 4 | -- +migrate Up 5 | 6 | -- +migrate Down 7 | 8 | -------------------------------------------------------------------------------- /exp/services/recoverysigner/internal/db/dbmigrate/migrations/20200309000001-initial-2.sql: -------------------------------------------------------------------------------- 1 | -- This migration file is intentionally empty and is a first starting point for 2 | -- our migrations before we yet have a schema. 3 | 4 | -- +migrate Up 5 | 6 | -- +migrate Down 7 | 8 | -------------------------------------------------------------------------------- /exp/services/recoverysigner/internal/db/dbmigrate/migrations/20200311000000-create-accounts.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | CREATE TABLE accounts ( 4 | id BIGINT NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY, 5 | 6 | created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), 7 | updated_at TIMESTAMP WITH TIME ZONE, 8 | 9 | address TEXT NOT NULL 10 | ); 11 | 12 | CREATE UNIQUE INDEX ON accounts (UPPER(address)); 13 | 14 | -- +migrate Down 15 | 16 | DROP TABLE accounts; 17 | -------------------------------------------------------------------------------- /exp/services/recoverysigner/internal/db/dbmigrate/migrations/20200311000001-create-identities.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | CREATE TABLE identities ( 4 | account_id BIGINT NOT NULL REFERENCES accounts (id) ON DELETE CASCADE, 5 | id BIGINT NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY, 6 | 7 | created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), 8 | updated_at TIMESTAMP WITH TIME ZONE, 9 | 10 | role TEXT NOT NULL 11 | ); 12 | 13 | CREATE INDEX ON identities (account_id); 14 | 15 | -- +migrate Down 16 | 17 | DROP TABLE identities; 18 | -------------------------------------------------------------------------------- /exp/services/recoverysigner/internal/db/dbtest/dbtest_test.go: -------------------------------------------------------------------------------- 1 | package dbtest 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/assert" 7 | "github.com/stretchr/testify/require" 8 | ) 9 | 10 | func TestOpen(t *testing.T) { 11 | db := Open(t) 12 | session := db.Open() 13 | 14 | count := 0 15 | err := session.Get(&count, `SELECT COUNT(*) FROM gorp_migrations`) 16 | require.NoError(t, err) 17 | assert.Greater(t, count, 0) 18 | } 19 | -------------------------------------------------------------------------------- /exp/services/recoverysigner/internal/serve/account_response.go: -------------------------------------------------------------------------------- 1 | package serve 2 | 3 | import "time" 4 | 5 | type accountResponse struct { 6 | Address string `json:"address"` 7 | Identities []accountResponseIdentity `json:"identities"` 8 | Signers []accountResponseSigner `json:"signers"` 9 | } 10 | 11 | type accountResponseIdentity struct { 12 | Role string `json:"role"` 13 | Authenticated bool `json:"authenticated,omitempty"` 14 | } 15 | 16 | type accountResponseSigner struct { 17 | Key string `json:"key"` 18 | AddedAt time.Time `json:"added_at"` 19 | } 20 | -------------------------------------------------------------------------------- /exp/services/soroban-rpc/README.md: -------------------------------------------------------------------------------- 1 | The soroban-rpc project was moved to the soroban-tools repository. 2 | You can find it at https://github.com/stellar/soroban-tools/tree/main/cmd/soroban-rpc. 3 | -------------------------------------------------------------------------------- /exp/services/webauth/Makefile: -------------------------------------------------------------------------------- 1 | # Check if we need to prepend docker commands with sudo 2 | SUDO := $(shell docker version >/dev/null 2>&1 || echo "sudo") 3 | 4 | # If TAG is not provided set default value 5 | TAG ?= stellar/webauth:$(shell git rev-parse --short HEAD)$(and $(shell git status -s),-dirty-$(shell id -u -n)) 6 | # https://github.com/opencontainers/image-spec/blob/master/annotations.md 7 | BUILD_DATE := $(shell date -u +%FT%TZ) 8 | 9 | docker-build: 10 | cd ../../../ && \ 11 | $(SUDO) docker build --pull --label org.opencontainers.image.created="$(BUILD_DATE)" \ 12 | -f exp/services/webauth/docker/Dockerfile -t $(TAG) . 13 | 14 | docker-push: 15 | cd ../../../ && \ 16 | $(SUDO) docker push $(TAG) 17 | -------------------------------------------------------------------------------- /exp/services/webauth/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.23-bullseye as build 2 | 3 | ADD . /src/webauth 4 | WORKDIR /src/webauth 5 | RUN go build -o /bin/webauth ./exp/services/webauth 6 | 7 | 8 | FROM ubuntu:22.04 9 | 10 | RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates 11 | COPY --from=build /bin/webauth /app/ 12 | EXPOSE 8000 13 | ENTRYPOINT ["/app/webauth"] 14 | CMD ["serve"] 15 | -------------------------------------------------------------------------------- /exp/support/jwtkey/jwtkey_test.go: -------------------------------------------------------------------------------- 1 | package jwtkey 2 | 3 | import ( 4 | "crypto/elliptic" 5 | "testing" 6 | 7 | "github.com/stretchr/testify/assert" 8 | "github.com/stretchr/testify/require" 9 | ) 10 | 11 | func TestGenerate(t *testing.T) { 12 | key, err := GenerateKey() 13 | require.NoError(t, err) 14 | assert.Equal(t, elliptic.P256(), key.Curve) 15 | } 16 | -------------------------------------------------------------------------------- /exp/support/pipeline/doc.go: -------------------------------------------------------------------------------- 1 | // TODO explain here how to write wrappers to use without casting from `interface{}`. 2 | package pipeline 3 | -------------------------------------------------------------------------------- /exp/support/pipeline/pipeline_node.go: -------------------------------------------------------------------------------- 1 | package pipeline 2 | 3 | func (p *PipelineNode) Pipe(children ...*PipelineNode) *PipelineNode { 4 | p.Children = children 5 | return p 6 | } 7 | 8 | func (p *PipelineNode) reset() { 9 | p.Processor.Reset() 10 | 11 | p.readEntries = 0 12 | p.readsPerSecond = 0 13 | p.queuedEntries = 0 14 | p.wroteEntries = 0 15 | p.writesPerSecond = 0 16 | } 17 | -------------------------------------------------------------------------------- /exp/support/pipeline/store.go: -------------------------------------------------------------------------------- 1 | package pipeline 2 | 3 | func (s *Store) init() { 4 | s.values = make(map[string]interface{}) 5 | } 6 | 7 | func (s *Store) Put(name string, value interface{}) { 8 | s.initOnce.Do(s.init) 9 | s.values[name] = value 10 | } 11 | 12 | func (s *Store) Get(name string) interface{} { 13 | s.initOnce.Do(s.init) 14 | return s.values[name] 15 | } 16 | -------------------------------------------------------------------------------- /exp/support/pipeline/store_test.go: -------------------------------------------------------------------------------- 1 | package pipeline 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/assert" 7 | ) 8 | 9 | func TestStore(t *testing.T) { 10 | var s Store 11 | 12 | s.Lock() 13 | s.Put("value", 0) 14 | s.Unlock() 15 | 16 | s.Lock() 17 | v := s.Get("value") 18 | s.Put("value", v.(int)+1) 19 | s.Unlock() 20 | 21 | assert.Equal(t, 1, s.Get("value")) 22 | } 23 | -------------------------------------------------------------------------------- /gofmt.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | set -e 3 | 4 | printf "Running gofmt checks...\n" 5 | OUTPUT=$(gofmt -d -s .) 6 | 7 | if [[ $OUTPUT ]]; then 8 | printf "gofmt found unformatted files:\n\n" 9 | echo "$OUTPUT" 10 | exit 1 11 | fi 12 | -------------------------------------------------------------------------------- /gogenerate.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | set -e 3 | 4 | printf "Running go generate...\n" 5 | go generate ./... && gofmt -s -w -d . 6 | 7 | printf "Checking for no diff...\n" 8 | git diff --exit-code || (echo "Files changed after running go generate. Run go generate ./... locally and update generated files." && exit 1) 9 | -------------------------------------------------------------------------------- /gomod.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | set -e 3 | 4 | go mod tidy 5 | git diff --exit-code -- go.mod || (echo "Go file go.mod is dirty, update the file with 'go mod tidy' locally." && exit 1) 6 | git diff --exit-code -- go.sum || (echo "Go file go.sum is dirty, update the file with 'go mod tidy' locally." && exit 1) 7 | go mod verify || (echo "One or more Go dependencies failed verification. Either a version is no longer available, or the author or someone else has modified the version so it no longer points to the same code." && exit 1) 8 | -------------------------------------------------------------------------------- /goshadow.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | set -e 3 | 4 | go run golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@latest "$@" 5 | -------------------------------------------------------------------------------- /govet.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | set -e 3 | 4 | printf "Running go vet...\n" 5 | go vet -all -composites=false -unreachable=false -tests=false ./... 6 | 7 | printf "Running go vet shadow...\n" 8 | 9 | go vet -vettool="$(dirname "$0")/goshadow.sh" ./... 10 | -------------------------------------------------------------------------------- /gxdr/generate.go: -------------------------------------------------------------------------------- 1 | package gxdr 2 | 3 | //go:generate rm -f xdr_generated.go 4 | //go:generate make -C ../ gxdr/xdr_generated.go 5 | -------------------------------------------------------------------------------- /hash/main.go: -------------------------------------------------------------------------------- 1 | package hash 2 | 3 | import ( 4 | "crypto/sha256" 5 | ) 6 | 7 | // Hash returns a 32-byte hash for the provided message using the secure hash 8 | // algorithm chosen for the Stellar network (SHA-256) 9 | func Hash(message []byte) [32]byte { 10 | return sha256.Sum256(message) 11 | } 12 | -------------------------------------------------------------------------------- /historyarchive/hash_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Stellar Development Foundation and contributors. Licensed 2 | // under the Apache License, Version 2.0. See the COPYING file at the root 3 | // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 4 | 5 | package historyarchive 6 | 7 | import ( 8 | "testing" 9 | 10 | "github.com/stretchr/testify/assert" 11 | ) 12 | 13 | func TestHashDecode(t *testing.T) { 14 | d, err := DecodeHash("f8acbd8c9a901e17ed5488d7ebf44781dc82924457f488b75ba577911c4e2656") 15 | assert.Nil(t, err) 16 | assert.Equal(t, []byte{0xf8, 0xac, 0xbd}, d[:3]) 17 | } 18 | -------------------------------------------------------------------------------- /ingest/asset/asset.go: -------------------------------------------------------------------------------- 1 | package asset 2 | 3 | // NewNativeAsset creates an Asset representing the native token (XLM). 4 | func NewNativeAsset() *Asset { 5 | return &Asset{AssetType: &Asset_Native{Native: true}} 6 | } 7 | 8 | // NewIssuedAsset creates an Asset with an asset code and issuer. 9 | func NewIssuedAsset(assetCode, issuer string) *Asset { 10 | return &Asset{ 11 | AssetType: &Asset_IssuedAsset{ 12 | IssuedAsset: &IssuedAsset{ 13 | AssetCode: assetCode, 14 | Issuer: issuer, 15 | }, 16 | }, 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ingest/errors.go: -------------------------------------------------------------------------------- 1 | package ingest 2 | 3 | import ( 4 | "github.com/stellar/go/support/errors" 5 | ) 6 | 7 | // ErrNotFound is returned when the requested ledger is not found 8 | var ErrNotFound = errors.New("ledger not found") 9 | 10 | // StateError is a fatal error indicating that the Change stream 11 | // produced a result which violates fundamental invariants (e.g. an account 12 | // transferred more XLM than the account held in its balance). 13 | type StateError struct { 14 | error 15 | } 16 | 17 | // NewStateError creates a new StateError. 18 | func NewStateError(err error) StateError { 19 | return StateError{err} 20 | } 21 | -------------------------------------------------------------------------------- /ingest/ledgerbackend/testdata/appendix-disable-diagnostic-events-and-metav1.cfg: -------------------------------------------------------------------------------- 1 | EMIT_SOROBAN_TRANSACTION_META_EXT_V1=false 2 | ENABLE_SOROBAN_DIAGNOSTIC_EVENTS=false 3 | ENABLE_DIAGNOSTICS_FOR_TX_SUBMISSION=false -------------------------------------------------------------------------------- /ingest/ledgerbackend/testdata/appendix-with-bucket-dir-path.cfg: -------------------------------------------------------------------------------- 1 | BUCKET_DIR_PATH="test-buckets" 2 | 3 | -------------------------------------------------------------------------------- /ingest/ledgerbackend/testdata/appendix-with-minimum-persistent-entry.cfg: -------------------------------------------------------------------------------- 1 | TESTING_MINIMUM_PERSISTENT_ENTRY_LIFETIME=16 2 | 3 | [[HOME_DOMAINS]] 4 | HOME_DOMAIN="testnet.stellar.org" 5 | QUALITY="MEDIUM" 6 | 7 | [[VALIDATORS]] 8 | NAME="sdf_testnet_1" 9 | HOME_DOMAIN="testnet.stellar.org" 10 | PUBLIC_KEY="GDKXE2OZMJIPOSLNA6N6F2BVCI3O777I2OOC4BV7VOYUEHYX7RTRYA7Y" 11 | ADDRESS="localhost:123" 12 | -------------------------------------------------------------------------------- /ingest/ledgerbackend/testdata/duplicate-home-domain.cfg: -------------------------------------------------------------------------------- 1 | [[HOME_DOMAINS]] 2 | HOME_DOMAIN="testnet.stellar.org" 3 | QUALITY="MEDIUM" 4 | 5 | [[HOME_DOMAINS]] 6 | HOME_DOMAIN="testnet.stellar.org" 7 | QUALITY="MEDIUM" 8 | 9 | [[VALIDATORS]] 10 | NAME="sdf_testnet_1" 11 | HOME_DOMAIN="testnet.stellar.org" 12 | PUBLIC_KEY="GDKXE2OZMJIPOSLNA6N6F2BVCI3O777I2OOC4BV7VOYUEHYX7RTRYA7Y" 13 | ADDRESS="localhost:123" 14 | -------------------------------------------------------------------------------- /ingest/ledgerbackend/testdata/duplicate-validator.cfg: -------------------------------------------------------------------------------- 1 | [[HOME_DOMAINS]] 2 | HOME_DOMAIN="testnet.stellar.org" 3 | QUALITY="MEDIUM" 4 | 5 | [[VALIDATORS]] 6 | NAME="sdf_testnet_1" 7 | HOME_DOMAIN="testnet.stellar.org" 8 | PUBLIC_KEY="GDKXE2OZMJIPOSLNA6N6F2BVCI3O777I2OOC4BV7VOYUEHYX7RTRYA7Y" 9 | ADDRESS="localhost:123" 10 | 11 | [[VALIDATORS]] 12 | NAME="sdf_testnet_1" 13 | HOME_DOMAIN="pubnet.stellar.org" 14 | PUBLIC_KEY="GDV46EIEF57TDL4W27UFDAUVPDDCKJNVBYB3WIV2WYUYUG753FCFU6EJ" 15 | ADDRESS="localhost:9834" 16 | QUALITY="HIGH" -------------------------------------------------------------------------------- /ingest/ledgerbackend/testdata/empty-home-domain-quality.cfg: -------------------------------------------------------------------------------- 1 | [[HOME_DOMAINS]] 2 | HOME_DOMAIN="testnet.stellar.org" 3 | 4 | [[VALIDATORS]] 5 | NAME="sdf_testnet_1" 6 | HOME_DOMAIN="testnet.stellar.org" 7 | PUBLIC_KEY="GDKXE2OZMJIPOSLNA6N6F2BVCI3O777I2OOC4BV7VOYUEHYX7RTRYA7Y" 8 | ADDRESS="localhost:123" 9 | -------------------------------------------------------------------------------- /ingest/ledgerbackend/testdata/empty-home-domain.cfg: -------------------------------------------------------------------------------- 1 | [[HOME_DOMAINS]] 2 | QUALITY="MEDIUM" 3 | 4 | [[HOME_DOMAINS]] 5 | HOME_DOMAIN="testnet.stellar.org" 6 | QUALITY="MEDIUM" 7 | 8 | [[VALIDATORS]] 9 | NAME="sdf_testnet_1" 10 | HOME_DOMAIN="testnet.stellar.org" 11 | PUBLIC_KEY="GDKXE2OZMJIPOSLNA6N6F2BVCI3O777I2OOC4BV7VOYUEHYX7RTRYA7Y" 12 | ADDRESS="localhost:123" 13 | -------------------------------------------------------------------------------- /ingest/ledgerbackend/testdata/expected-default-bucketlistdb-core.cfg: -------------------------------------------------------------------------------- 1 | # Generated file, do not edit 2 | BUCKETLIST_DB_INDEX_PAGE_SIZE_EXPONENT = 12 3 | DATABASE = "sqlite3://stellar.db" 4 | DEPRECATED_SQL_LEDGER_STATE = false 5 | FAILURE_SAFETY = -1 6 | HTTP_PORT = 11626 7 | LOG_FILE_PATH = "" 8 | NETWORK_PASSPHRASE = "Public Global Stellar Network ; September 2015" 9 | 10 | [[HOME_DOMAINS]] 11 | HOME_DOMAIN = "testnet.stellar.org" 12 | QUALITY = "MEDIUM" 13 | 14 | [[VALIDATORS]] 15 | ADDRESS = "localhost:123" 16 | HOME_DOMAIN = "testnet.stellar.org" 17 | NAME = "sdf_testnet_1" 18 | PUBLIC_KEY = "GDKXE2OZMJIPOSLNA6N6F2BVCI3O777I2OOC4BV7VOYUEHYX7RTRYA7Y" 19 | 20 | [HISTORY.h0] 21 | get = "curl -sf http://localhost:1170/{0} -o {1}" 22 | -------------------------------------------------------------------------------- /ingest/ledgerbackend/testdata/expected-in-mem-core.cfg: -------------------------------------------------------------------------------- 1 | # Generated file, do not edit 2 | DEPRECATED_SQL_LEDGER_STATE = true 3 | FAILURE_SAFETY = -1 4 | HTTP_PORT = 11626 5 | LOG_FILE_PATH = "" 6 | NETWORK_PASSPHRASE = "Public Global Stellar Network ; September 2015" 7 | 8 | [[HOME_DOMAINS]] 9 | HOME_DOMAIN = "testnet.stellar.org" 10 | QUALITY = "MEDIUM" 11 | 12 | [[VALIDATORS]] 13 | ADDRESS = "localhost:123" 14 | HOME_DOMAIN = "testnet.stellar.org" 15 | NAME = "sdf_testnet_1" 16 | PUBLIC_KEY = "GDKXE2OZMJIPOSLNA6N6F2BVCI3O777I2OOC4BV7VOYUEHYX7RTRYA7Y" 17 | 18 | [HISTORY.h0] 19 | get = "curl -sf http://localhost:1170/{0} -o {1}" 20 | -------------------------------------------------------------------------------- /ingest/ledgerbackend/testdata/expected-offline-core.cfg: -------------------------------------------------------------------------------- 1 | # Generated file, do not edit 2 | BUCKETLIST_DB_INDEX_PAGE_SIZE_EXPONENT = 12 3 | DATABASE = "sqlite3://stellar.db" 4 | DEPRECATED_SQL_LEDGER_STATE = false 5 | FAILURE_SAFETY = 0 6 | HTTP_PORT = 0 7 | LOG_FILE_PATH = "" 8 | NETWORK_PASSPHRASE = "Public Global Stellar Network ; September 2015" 9 | PEER_PORT = 12345 10 | RUN_STANDALONE = true 11 | UNSAFE_QUORUM = true 12 | 13 | [HISTORY.h0] 14 | get = "curl -sf http://localhost:1170/{0} -o {1}" 15 | 16 | [QUORUM_SET] 17 | THRESHOLD_PERCENT = 100 18 | VALIDATORS = ["GCZBOIAY4HLKAJVNJORXZOZRAY2BJDBZHKPBHZCRAIUR5IHC2UHBGCQR"] 19 | -------------------------------------------------------------------------------- /ingest/ledgerbackend/testdata/expected-offline-enforce-diag-events-and-metav1.cfg: -------------------------------------------------------------------------------- 1 | # Generated file, do not edit 2 | DEPRECATED_SQL_LEDGER_STATE = true 3 | EMIT_SOROBAN_TRANSACTION_META_EXT_V1 = true 4 | ENABLE_DIAGNOSTICS_FOR_TX_SUBMISSION = true 5 | ENABLE_SOROBAN_DIAGNOSTIC_EVENTS = true 6 | FAILURE_SAFETY = 0 7 | HTTP_PORT = 0 8 | LOG_FILE_PATH = "" 9 | NETWORK_PASSPHRASE = "Public Global Stellar Network ; September 2015" 10 | RUN_STANDALONE = true 11 | UNSAFE_QUORUM = true 12 | 13 | [HISTORY.h0] 14 | get = "curl -sf http://localhost:1170/{0} -o {1}" 15 | 16 | [QUORUM_SET] 17 | THRESHOLD_PERCENT = 100 18 | VALIDATORS = ["GCZBOIAY4HLKAJVNJORXZOZRAY2BJDBZHKPBHZCRAIUR5IHC2UHBGCQR"] 19 | -------------------------------------------------------------------------------- /ingest/ledgerbackend/testdata/expected-offline-enforce-disabled-diagnostic-events.cfg: -------------------------------------------------------------------------------- 1 | # Generated file, do not edit 2 | DEPRECATED_SQL_LEDGER_STATE = true 3 | FAILURE_SAFETY = 0 4 | HTTP_PORT = 0 5 | LOG_FILE_PATH = "" 6 | NETWORK_PASSPHRASE = "Public Global Stellar Network ; September 2015" 7 | RUN_STANDALONE = true 8 | UNSAFE_QUORUM = true 9 | 10 | [HISTORY.h0] 11 | get = "curl -sf http://localhost:1170/{0} -o {1}" 12 | 13 | [QUORUM_SET] 14 | THRESHOLD_PERCENT = 100 15 | VALIDATORS = ["GCZBOIAY4HLKAJVNJORXZOZRAY2BJDBZHKPBHZCRAIUR5IHC2UHBGCQR"] 16 | -------------------------------------------------------------------------------- /ingest/ledgerbackend/testdata/expected-offline-with-appendix-core.cfg: -------------------------------------------------------------------------------- 1 | # Generated file, do not edit 2 | DEPRECATED_SQL_LEDGER_STATE = true 3 | FAILURE_SAFETY = 0 4 | HTTP_PORT = 0 5 | LOG_FILE_PATH = "" 6 | NETWORK_PASSPHRASE = "Public Global Stellar Network ; September 2015" 7 | PEER_PORT = 12345 8 | RUN_STANDALONE = true 9 | UNSAFE_QUORUM = true 10 | 11 | [[HOME_DOMAINS]] 12 | HOME_DOMAIN = "testnet.stellar.org" 13 | QUALITY = "MEDIUM" 14 | 15 | [[VALIDATORS]] 16 | ADDRESS = "localhost:123" 17 | HOME_DOMAIN = "testnet.stellar.org" 18 | NAME = "sdf_testnet_1" 19 | PUBLIC_KEY = "GDKXE2OZMJIPOSLNA6N6F2BVCI3O777I2OOC4BV7VOYUEHYX7RTRYA7Y" 20 | 21 | [HISTORY.h0] 22 | get = "curl -sf http://localhost:1170/{0} -o {1}" 23 | -------------------------------------------------------------------------------- /ingest/ledgerbackend/testdata/expected-offline-with-no-peer-port.cfg: -------------------------------------------------------------------------------- 1 | # Generated file, do not edit 2 | DEPRECATED_SQL_LEDGER_STATE = true 3 | FAILURE_SAFETY = 0 4 | HTTP_PORT = 0 5 | LOG_FILE_PATH = "/var/stellar-core/test.log" 6 | NETWORK_PASSPHRASE = "Public Global Stellar Network ; September 2015" 7 | RUN_STANDALONE = true 8 | UNSAFE_QUORUM = true 9 | 10 | [HISTORY.h0] 11 | get = "curl -sf http://localhost:1170/{0} -o {1}" 12 | 13 | [QUORUM_SET] 14 | THRESHOLD_PERCENT = 100 15 | VALIDATORS = ["GCZBOIAY4HLKAJVNJORXZOZRAY2BJDBZHKPBHZCRAIUR5IHC2UHBGCQR"] 16 | -------------------------------------------------------------------------------- /ingest/ledgerbackend/testdata/expected-online-core.cfg: -------------------------------------------------------------------------------- 1 | # Generated file, do not edit 2 | DEPRECATED_SQL_LEDGER_STATE = true 3 | FAILURE_SAFETY = -1 4 | HTTP_PORT = 6789 5 | LOG_FILE_PATH = "" 6 | NETWORK_PASSPHRASE = "Public Global Stellar Network ; September 2015" 7 | PEER_PORT = 12345 8 | 9 | [[HOME_DOMAINS]] 10 | HOME_DOMAIN = "testnet.stellar.org" 11 | QUALITY = "MEDIUM" 12 | 13 | [[VALIDATORS]] 14 | ADDRESS = "localhost:123" 15 | HOME_DOMAIN = "testnet.stellar.org" 16 | NAME = "sdf_testnet_1" 17 | PUBLIC_KEY = "GDKXE2OZMJIPOSLNA6N6F2BVCI3O777I2OOC4BV7VOYUEHYX7RTRYA7Y" 18 | 19 | [HISTORY.h0] 20 | get = "curl -sf http://localhost:1170/{0} -o {1}" 21 | -------------------------------------------------------------------------------- /ingest/ledgerbackend/testdata/expected-online-with-appendix-minimum-persistent-entry.cfg: -------------------------------------------------------------------------------- 1 | # Generated file, do not edit 2 | DEPRECATED_SQL_LEDGER_STATE = true 3 | FAILURE_SAFETY = -1 4 | HTTP_PORT = 11626 5 | LOG_FILE_PATH = "" 6 | NETWORK_PASSPHRASE = "Public Global Stellar Network ; September 2015" 7 | TESTING_MINIMUM_PERSISTENT_ENTRY_LIFETIME = 16 8 | 9 | [[HOME_DOMAINS]] 10 | HOME_DOMAIN = "testnet.stellar.org" 11 | QUALITY = "MEDIUM" 12 | 13 | [[VALIDATORS]] 14 | ADDRESS = "localhost:123" 15 | HOME_DOMAIN = "testnet.stellar.org" 16 | NAME = "sdf_testnet_1" 17 | PUBLIC_KEY = "GDKXE2OZMJIPOSLNA6N6F2BVCI3O777I2OOC4BV7VOYUEHYX7RTRYA7Y" 18 | 19 | [HISTORY.h0] 20 | get = "curl -sf http://localhost:1170/{0} -o {1}" 21 | -------------------------------------------------------------------------------- /ingest/ledgerbackend/testdata/expected-online-with-no-http-port.cfg: -------------------------------------------------------------------------------- 1 | # Generated file, do not edit 2 | DEPRECATED_SQL_LEDGER_STATE = true 3 | FAILURE_SAFETY = -1 4 | HTTP_PORT = 11626 5 | LOG_FILE_PATH = "" 6 | NETWORK_PASSPHRASE = "Public Global Stellar Network ; September 2015" 7 | PEER_PORT = 12345 8 | 9 | [[HOME_DOMAINS]] 10 | HOME_DOMAIN = "testnet.stellar.org" 11 | QUALITY = "MEDIUM" 12 | 13 | [[VALIDATORS]] 14 | ADDRESS = "localhost:123" 15 | HOME_DOMAIN = "testnet.stellar.org" 16 | NAME = "sdf_testnet_1" 17 | PUBLIC_KEY = "GDKXE2OZMJIPOSLNA6N6F2BVCI3O777I2OOC4BV7VOYUEHYX7RTRYA7Y" 18 | 19 | [HISTORY.h0] 20 | get = "curl -sf http://localhost:1170/{0} -o {1}" 21 | -------------------------------------------------------------------------------- /ingest/ledgerbackend/testdata/expected-online-with-no-peer-port.cfg: -------------------------------------------------------------------------------- 1 | # Generated file, do not edit 2 | DEPRECATED_SQL_LEDGER_STATE = true 3 | FAILURE_SAFETY = -1 4 | HTTP_PORT = 6789 5 | LOG_FILE_PATH = "/var/stellar-core/test.log" 6 | NETWORK_PASSPHRASE = "Public Global Stellar Network ; September 2015" 7 | 8 | [[HOME_DOMAINS]] 9 | HOME_DOMAIN = "testnet.stellar.org" 10 | QUALITY = "MEDIUM" 11 | 12 | [[VALIDATORS]] 13 | ADDRESS = "localhost:123" 14 | HOME_DOMAIN = "testnet.stellar.org" 15 | NAME = "sdf_testnet_1" 16 | PUBLIC_KEY = "GDKXE2OZMJIPOSLNA6N6F2BVCI3O777I2OOC4BV7VOYUEHYX7RTRYA7Y" 17 | 18 | [HISTORY.h0] 19 | get = "curl -sf http://localhost:1170/{0} -o {1}" 20 | -------------------------------------------------------------------------------- /ingest/ledgerbackend/testdata/invalid-captive-core-database-field.cfg: -------------------------------------------------------------------------------- 1 | # DATABASE limited to only be sqlite:// protocol 2 | DATABASE="postgres://mydb" 3 | 4 | [[HOME_DOMAINS]] 5 | HOME_DOMAIN="testnet.stellar.org" 6 | QUALITY="MEDIUM" 7 | 8 | [[VALIDATORS]] 9 | NAME="sdf_testnet_1" 10 | HOME_DOMAIN="testnet.stellar.org" 11 | PUBLIC_KEY="GDKXE2OZMJIPOSLNA6N6F2BVCI3O777I2OOC4BV7VOYUEHYX7RTRYA7Y" 12 | ADDRESS="localhost:123" 13 | -------------------------------------------------------------------------------- /ingest/ledgerbackend/testdata/invalid-captive-core-field.cfg: -------------------------------------------------------------------------------- 1 | # CATCHUP_RECENT is not supported by captive core 2 | CATCHUP_RECENT=100 3 | 4 | [[HOME_DOMAINS]] 5 | HOME_DOMAIN="testnet.stellar.org" 6 | QUALITY="MEDIUM" 7 | 8 | [[VALIDATORS]] 9 | NAME="sdf_testnet_1" 10 | HOME_DOMAIN="testnet.stellar.org" 11 | PUBLIC_KEY="GDKXE2OZMJIPOSLNA6N6F2BVCI3O777I2OOC4BV7VOYUEHYX7RTRYA7Y" 12 | ADDRESS="localhost:123" 13 | -------------------------------------------------------------------------------- /ingest/ledgerbackend/testdata/invalid-home-domain-quality.cfg: -------------------------------------------------------------------------------- 1 | [[HOME_DOMAINS]] 2 | HOME_DOMAIN="testnet.stellar.org" 3 | QUALITY="DECENT" 4 | 5 | [[VALIDATORS]] 6 | NAME="sdf_testnet_1" 7 | HOME_DOMAIN="testnet.stellar.org" 8 | PUBLIC_KEY="GDKXE2OZMJIPOSLNA6N6F2BVCI3O777I2OOC4BV7VOYUEHYX7RTRYA7Y" 9 | ADDRESS="localhost:123" 10 | -------------------------------------------------------------------------------- /ingest/ledgerbackend/testdata/sample-appendix-bucketlistdb.cfg: -------------------------------------------------------------------------------- 1 | BUCKETLIST_DB_INDEX_CUTOFF = 20 2 | BUCKETLIST_DB_INDEX_PAGE_SIZE_EXPONENT = 15 3 | 4 | [[HOME_DOMAINS]] 5 | HOME_DOMAIN="testnet.stellar.org" 6 | QUALITY="MEDIUM" 7 | 8 | [[VALIDATORS]] 9 | NAME="sdf_testnet_1" 10 | HOME_DOMAIN="testnet.stellar.org" 11 | PUBLIC_KEY="GDKXE2OZMJIPOSLNA6N6F2BVCI3O777I2OOC4BV7VOYUEHYX7RTRYA7Y" 12 | ADDRESS="localhost:123" 13 | -------------------------------------------------------------------------------- /ingest/ledgerbackend/testdata/sample-appendix-in-memory.cfg: -------------------------------------------------------------------------------- 1 | DEPRECATED_SQL_LEDGER_STATE = false 2 | 3 | [[HOME_DOMAINS]] 4 | HOME_DOMAIN="testnet.stellar.org" 5 | QUALITY="MEDIUM" 6 | 7 | [[VALIDATORS]] 8 | NAME="sdf_testnet_1" 9 | HOME_DOMAIN="testnet.stellar.org" 10 | PUBLIC_KEY="GDKXE2OZMJIPOSLNA6N6F2BVCI3O777I2OOC4BV7VOYUEHYX7RTRYA7Y" 11 | ADDRESS="localhost:123" 12 | -------------------------------------------------------------------------------- /ingest/ledgerbackend/testdata/sample-appendix-on-disk.cfg: -------------------------------------------------------------------------------- 1 | DEPRECATED_SQL_LEDGER_STATE = true 2 | 3 | [[HOME_DOMAINS]] 4 | HOME_DOMAIN="testnet.stellar.org" 5 | QUALITY="MEDIUM" 6 | 7 | [[VALIDATORS]] 8 | NAME="sdf_testnet_1" 9 | HOME_DOMAIN="testnet.stellar.org" 10 | PUBLIC_KEY="GDKXE2OZMJIPOSLNA6N6F2BVCI3O777I2OOC4BV7VOYUEHYX7RTRYA7Y" 11 | ADDRESS="localhost:123" 12 | -------------------------------------------------------------------------------- /ingest/ledgerbackend/testdata/sample-appendix-query-params.cfg: -------------------------------------------------------------------------------- 1 | # parameters to enable Captive Core's high-performance HTTP server 2 | HTTP_QUERY_PORT=11628 3 | QUERY_THREAD_POOL_SIZE=4 4 | QUERY_SNAPSHOT_LEDGERS=2 5 | 6 | [[HOME_DOMAINS]] 7 | HOME_DOMAIN="testnet.stellar.org" 8 | QUALITY="MEDIUM" 9 | 10 | [[VALIDATORS]] 11 | NAME="sdf_testnet_1" 12 | HOME_DOMAIN="testnet.stellar.org" 13 | PUBLIC_KEY="GDKXE2OZMJIPOSLNA6N6F2BVCI3O777I2OOC4BV7VOYUEHYX7RTRYA7Y" 14 | ADDRESS="localhost:123" 15 | -------------------------------------------------------------------------------- /ingest/ledgerbackend/testdata/sample-appendix.cfg: -------------------------------------------------------------------------------- 1 | [[HOME_DOMAINS]] 2 | HOME_DOMAIN="testnet.stellar.org" 3 | QUALITY="MEDIUM" 4 | 5 | [[VALIDATORS]] 6 | NAME="sdf_testnet_1" 7 | HOME_DOMAIN="testnet.stellar.org" 8 | PUBLIC_KEY="GDKXE2OZMJIPOSLNA6N6F2BVCI3O777I2OOC4BV7VOYUEHYX7RTRYA7Y" 9 | ADDRESS="localhost:123" 10 | -------------------------------------------------------------------------------- /ingest/ledgerbackend/testdata/validator-has-invalid-public-key.cfg: -------------------------------------------------------------------------------- 1 | [[VALIDATORS]] 2 | NAME="sdf_testnet_2" 3 | HOME_DOMAIN="testnet2.stellar.org" 4 | PUBLIC_KEY="invalid-key" 5 | ADDRESS="localhost:9834" 6 | QUALITY="HIGH" -------------------------------------------------------------------------------- /ingest/ledgerbackend/testdata/validator-has-invalid-quality.cfg: -------------------------------------------------------------------------------- 1 | [[VALIDATORS]] 2 | NAME="sdf_testnet_2" 3 | HOME_DOMAIN="testnet2.stellar.org" 4 | PUBLIC_KEY="GDV46EIEF57TDL4W27UFDAUVPDDCKJNVBYB3WIV2WYUYUG753FCFU6EJ" 5 | ADDRESS="localhost:9834" 6 | QUALITY="DECENT" -------------------------------------------------------------------------------- /ingest/ledgerbackend/testdata/validator-missing-home-domain.cfg: -------------------------------------------------------------------------------- 1 | [[HOME_DOMAINS]] 2 | HOME_DOMAIN="testnet.stellar.org" 3 | QUALITY="MEDIUM" 4 | 5 | [[VALIDATORS]] 6 | NAME="sdf_testnet_1" 7 | PUBLIC_KEY="GDKXE2OZMJIPOSLNA6N6F2BVCI3O777I2OOC4BV7VOYUEHYX7RTRYA7Y" 8 | ADDRESS="localhost:123" 9 | QUALITY="MEDIUM" -------------------------------------------------------------------------------- /ingest/ledgerbackend/testdata/validator-missing-name.cfg: -------------------------------------------------------------------------------- 1 | [[VALIDATORS]] 2 | HOME_DOMAIN="testnet.stellar.org" 3 | PUBLIC_KEY="GDKXE2OZMJIPOSLNA6N6F2BVCI3O777I2OOC4BV7VOYUEHYX7RTRYA7Y" 4 | ADDRESS="localhost:123" 5 | QUALITY="MEDIUM" -------------------------------------------------------------------------------- /ingest/ledgerbackend/testdata/validator-missing-public-key.cfg: -------------------------------------------------------------------------------- 1 | [[HOME_DOMAINS]] 2 | HOME_DOMAIN="testnet.stellar.org" 3 | QUALITY="MEDIUM" 4 | 5 | [[VALIDATORS]] 6 | NAME="sdf_testnet_1" 7 | HOME_DOMAIN="testnet.stellar.org" 8 | ADDRESS="localhost:123" -------------------------------------------------------------------------------- /ingest/ledgerbackend/testdata/validator-missing-quality.cfg: -------------------------------------------------------------------------------- 1 | [[HOME_DOMAINS]] 2 | HOME_DOMAIN="testnet.stellar.org" 3 | QUALITY="MEDIUM" 4 | 5 | [[VALIDATORS]] 6 | NAME="sdf_testnet_1" 7 | HOME_DOMAIN="testnet.stellar.org" 8 | PUBLIC_KEY="GDKXE2OZMJIPOSLNA6N6F2BVCI3O777I2OOC4BV7VOYUEHYX7RTRYA7Y" 9 | ADDRESS="localhost:123" 10 | 11 | [[VALIDATORS]] 12 | NAME="sdf_testnet_2" 13 | HOME_DOMAIN="testnet2.stellar.org" 14 | PUBLIC_KEY="GDV46EIEF57TDL4W27UFDAUVPDDCKJNVBYB3WIV2WYUYUG753FCFU6EJ" 15 | ADDRESS="localhost:9834" 16 | -------------------------------------------------------------------------------- /ingest/mock_change_reader.go: -------------------------------------------------------------------------------- 1 | package ingest 2 | 3 | import ( 4 | "github.com/stretchr/testify/mock" 5 | 6 | "github.com/stellar/go/xdr" 7 | ) 8 | 9 | var _ ChangeReader = (*MockChangeReader)(nil) 10 | 11 | type MockChangeReader struct { 12 | mock.Mock 13 | } 14 | 15 | func (m *MockChangeReader) Read() (Change, error) { 16 | args := m.Called() 17 | return args.Get(0).(Change), args.Error(1) 18 | } 19 | 20 | func (m *MockChangeReader) Close() error { 21 | args := m.Called() 22 | return args.Error(0) 23 | } 24 | 25 | func (m *MockChangeReader) VerifyBucketList(expectedHash xdr.Hash) error { 26 | args := m.Called(expectedHash) 27 | return args.Error(0) 28 | } 29 | -------------------------------------------------------------------------------- /ingest/tutorial/example_main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | func main() { 4 | helloworld() 5 | statistics() 6 | claimables() 7 | } 8 | -------------------------------------------------------------------------------- /install-core.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # CORE_VERSION="15.3.0-498.7a7f18c.xenial~SetTrustlineFlagsPR~buildtests" 4 | 5 | CORE_PACKAGE=stellar-core 6 | if [[ "$CORE_VERSION" != "" ]]; then 7 | CORE_PACKAGE="$CORE_PACKAGE=$CORE_VERSION" 8 | fi 9 | sudo wget -qO - https://apt.stellar.org/SDF.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=true sudo apt-key add - 10 | sudo bash -c 'echo "deb https://apt.stellar.org xenial unstable" > /etc/apt/sources.list.d/SDF-unstable.list' 11 | sudo apt-get update && sudo apt-get install -y "$CORE_PACKAGE" 12 | echo "using stellar core version $(stellar-core version)" 13 | echo "export CAPTIVE_CORE_BIN=/usr/bin/stellar-core" >> ~/.bashrc 14 | 15 | -------------------------------------------------------------------------------- /protocols/horizon/effects/signer_effects.go: -------------------------------------------------------------------------------- 1 | package effects 2 | 3 | // Rehydrate implements base.Rehydratable interface 4 | func (sc *SignerCreated) Rehydrate() error { 5 | sc.Key = sc.PublicKey 6 | return nil 7 | } 8 | 9 | // Rehydrate implements base.Rehydratable interface 10 | func (sr *SignerRemoved) Rehydrate() error { 11 | sr.Key = sr.PublicKey 12 | return nil 13 | } 14 | 15 | // Rehydrate implements base.Rehydratable interface 16 | func (su *SignerUpdated) Rehydrate() error { 17 | su.Key = su.PublicKey 18 | return nil 19 | } 20 | -------------------------------------------------------------------------------- /protocols/stellarcore/getledgerentryraw_response.go: -------------------------------------------------------------------------------- 1 | package stellarcore 2 | 3 | // GetLedgerEntryRawResponse is the structure of Stellar Core's /getledgerentryraw 4 | type GetLedgerEntryRawResponse struct { 5 | Ledger uint32 `json:"ledger"` 6 | Entries []RawLedgerEntryResponse `json:"entries"` 7 | } 8 | 9 | type RawLedgerEntryResponse struct { 10 | Entry string `json:"le"` // base64-encoded xdr.LedgerEntry 11 | } 12 | -------------------------------------------------------------------------------- /protos/ingest/address/address.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package address; 4 | 5 | enum AddressType { 6 | ADDRESS_TYPE_ACCOUNT = 0; 7 | ADDRESS_TYPE_CONTRACT = 1; 8 | ADDRESS_TYPE_LIQUIDITY_POOL = 2; 9 | ADDRESS_TYPE_CLAIMABLE_BALANCE = 3; 10 | ADDRESS_TYPE_MUXED_ACCOUNT = 4; 11 | } 12 | 13 | message Address { 14 | AddressType address_type = 1; 15 | string str_key = 2; 16 | } 17 | -------------------------------------------------------------------------------- /protos/ingest/asset/asset.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package asset; 4 | 5 | message IssuedAsset { 6 | string asset_code = 1; // Asset code (e.g., USD, BTC) 7 | string issuer = 2; // Issuer account address 8 | } 9 | 10 | // Asset message that can represent either a native asset or an issued asset 11 | message Asset { 12 | oneof asset_type { 13 | bool native = 1; // Native asset (XLM) 14 | IssuedAsset issued_asset = 2; // Issued asset - via classic operations. 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /services/README.md: -------------------------------------------------------------------------------- 1 | # Services package 2 | 3 | Packages contained by this package represent the long-running applications developed for the Stellar network. 4 | 5 | See [godoc](https://godoc.org/github.com/stellar/go/services) for details about each application. -------------------------------------------------------------------------------- /services/doc.go: -------------------------------------------------------------------------------- 1 | // Package services contains sub-packages that provide long-running applications 2 | // such as API servers. 3 | package services 4 | -------------------------------------------------------------------------------- /services/federation/build_sample.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | set -e 4 | 5 | createdb federation_sample 6 | 7 | psql federation_sample -e <<-EOS 8 | CREATE TABLE people (id character varying, name character varying, domain character varying); 9 | INSERT INTO people (id, name, domain) VALUES 10 | ('GD2GJPL3UOK5LX7TWXOACK2ZPWPFSLBNKL3GTGH6BLBNISK4BGWMFBBG', 'bob', 'stellar.org'), 11 | ('GCYMGWPZ6NC2U7SO6SMXOP5ZLXOEC5SYPKITDMVEONLCHFSCCQR2J4S3', 'alice', 'stellar.org'); 12 | EOS -------------------------------------------------------------------------------- /services/federation/federation-sqlite-sample: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/services/federation/federation-sqlite-sample -------------------------------------------------------------------------------- /services/federation/federation.cfg: -------------------------------------------------------------------------------- 1 | port = 8000 2 | 3 | [database] 4 | type = "postgres" 5 | dsn = "postgres://localhost/federation_sample?sslmode=disable" 6 | 7 | [queries] 8 | federation = "SELECT id FROM people WHERE name = ? AND domain = ?" 9 | reverse-federation = "SELECT name, domain FROM people WHERE id = ?" -------------------------------------------------------------------------------- /services/friendbot/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this 4 | file. This project adheres to [Semantic Versioning](http://semver.org/). 5 | 6 | As this project is pre 1.0, breaking changes may happen for minor version 7 | bumps. A breaking change will get clearly notified in this log. 8 | 9 | ## Unreleased 10 | 11 | * Log User-Agent header in request logs. 12 | 13 | ## [v0.0.2] - 2019-11-20 14 | 15 | ### Changed 16 | 17 | - Add `ReadTimeout` to HTTP server configuration to fix potential DoS vector. 18 | 19 | ## [v0.0.1] - 2018-10-16 20 | 21 | ### Added 22 | 23 | - Extracted friendbot out of horizon 24 | -------------------------------------------------------------------------------- /services/friendbot/Makefile: -------------------------------------------------------------------------------- 1 | # Check if we need to prepend docker commands with sudo 2 | SUDO := $(shell docker version >/dev/null 2>&1 || echo "sudo") 3 | 4 | # If TAG is not provided set default value 5 | TAG ?= stellar/friendbot:$(shell git rev-parse --short HEAD)$(and $(shell git status -s),-dirty-$(shell id -u -n)) 6 | # https://github.com/opencontainers/image-spec/blob/master/annotations.md 7 | BUILD_DATE := $(shell date -u +%FT%TZ) 8 | 9 | docker-build: 10 | cd ../../ && \ 11 | $(SUDO) docker build --pull --label org.opencontainers.image.created="$(BUILD_DATE)" \ 12 | -f services/friendbot/docker/Dockerfile -t $(TAG) . 13 | 14 | docker-push: 15 | cd ../../ && \ 16 | $(SUDO) docker push $(TAG) 17 | -------------------------------------------------------------------------------- /services/friendbot/README.md: -------------------------------------------------------------------------------- 1 | # Friendbot Service for the Stellar Test Network 2 | 3 | Friendbot helps users of the Stellar testnet by exposing a REST endpoint that creates & funds new accounts. 4 | 5 | Horizon needs to be started with the following command line param: --friendbot-url="http://localhost:8004/" 6 | This will forward any query params received against /friendbot to the friendbot instance. 7 | The ideal setup for horizon is to proxy all requests to the /friendbot url to the friendbot service 8 | -------------------------------------------------------------------------------- /services/friendbot/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.23-bullseye as build 2 | 3 | ADD . /src/friendbot 4 | WORKDIR /src/friendbot 5 | RUN go build -o /bin/friendbot ./services/friendbot 6 | 7 | FROM ubuntu:22.04 8 | 9 | RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates 10 | COPY --from=build /bin/friendbot /app/ 11 | EXPOSE 8004 12 | ENTRYPOINT ["/app/friendbot"] 13 | -------------------------------------------------------------------------------- /services/friendbot/friendbot.cfg: -------------------------------------------------------------------------------- 1 | port = 8000 2 | friendbot_secret = "SDANVB2UMNILW5UIMWO5BOZ4QYYEKQ34JNFCTDKTTLCBRG2ELDTNRGAM" 3 | network_passphrase = "Test SDF Network ; September 2015" 4 | horizon_url = "https://horizon-testnet.stellar.org" 5 | starting_balance = "10000.00" 6 | num_minions = 1000 7 | base_fee = 100000 8 | minion_batch_size = 50 9 | submit_tx_retries_allowed = 5 10 | 11 | -------------------------------------------------------------------------------- /services/galexie/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this 4 | file. This project adheres to [Semantic Versioning](http://semver.org/). 5 | 6 | ## [v1.0.0] 7 | 8 | - 🎉 First release! 9 | -------------------------------------------------------------------------------- /services/galexie/architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/services/galexie/architecture.png -------------------------------------------------------------------------------- /services/galexie/docker/config.test.toml: -------------------------------------------------------------------------------- 1 | [datastore_config] 2 | type = "GCS" 3 | 4 | [datastore_config.params] 5 | destination_bucket_path = "exporter-test/ledgers/testnet" 6 | 7 | [datastore_config.schema] 8 | ledgers_per_file = 1 9 | files_per_partition = 64000 10 | 11 | [stellar_core_config] 12 | network = "testnet" 13 | 14 | -------------------------------------------------------------------------------- /services/galexie/internal/test/10perfile.toml: -------------------------------------------------------------------------------- 1 | [stellar_core_config] 2 | stellar_core_binary_path = "test/stellar-core" 3 | network = "pubnet" 4 | 5 | [datastore_config.schema] 6 | ledgers_per_file = 10 -------------------------------------------------------------------------------- /services/galexie/internal/test/15perfile.toml: -------------------------------------------------------------------------------- 1 | [stellar_core_config] 2 | stellar_core_binary_path = "test/stellar-core" 3 | network = "pubnet" 4 | 5 | [datastore_config.schema] 6 | ledgers_per_file = 15 -------------------------------------------------------------------------------- /services/galexie/internal/test/1perfile.toml: -------------------------------------------------------------------------------- 1 | [stellar_core_config] 2 | stellar_core_binary_path = "test/stellar-core" 3 | network = "pubnet" 4 | 5 | [datastore_config.schema] 6 | ledgers_per_file = 1 -------------------------------------------------------------------------------- /services/galexie/internal/test/64perfile.toml: -------------------------------------------------------------------------------- 1 | [stellar_core_config] 2 | stellar_core_binary_path = "test/stellar-core" 3 | network = "pubnet" 4 | 5 | [datastore_config.schema] 6 | ledgers_per_file = 64 -------------------------------------------------------------------------------- /services/galexie/internal/test/captive-core-test.cfg: -------------------------------------------------------------------------------- 1 | PEER_PORT=11725 2 | 3 | UNSAFE_QUORUM=true 4 | FAILURE_SAFETY=0 5 | 6 | [[VALIDATORS]] 7 | NAME="local_core" 8 | HOME_DOMAIN="core.local" 9 | PUBLIC_KEY="GD5KD2KEZJIGTC63IGW6UMUSMVUVG5IHG64HUTFWCHVZH2N2IBOQN7PS" 10 | ADDRESS="localhost" 11 | HISTORY="curl -sf https://localhost/{0} -o {1}" 12 | QUALITY="MEDIUM" -------------------------------------------------------------------------------- /services/galexie/internal/test/integration_config_template.toml: -------------------------------------------------------------------------------- 1 | [datastore_config] 2 | type = "GCS" 3 | 4 | [datastore_config.params] 5 | destination_bucket_path = "integration-test/standalone" 6 | 7 | [datastore_config.schema] 8 | ledgers_per_file = 1 9 | files_per_partition = 10 10 | 11 | [stellar_core_config] 12 | captive_core_toml_path = "test/integration_captive_core.cfg" 13 | history_archive_urls = ["http://localhost:1570"] 14 | network_passphrase = "Standalone Network ; February 2017" 15 | checkpoint_frequency = 8 -------------------------------------------------------------------------------- /services/galexie/internal/test/invalid_captive_core_toml_path.toml: -------------------------------------------------------------------------------- 1 | [stellar_core_config] 2 | captive_core_toml_path = "test/notfound.cfg" 3 | stellar_core_binary_path = "test/stellar-core" 4 | history_archive_urls = ["http://testarchive"] 5 | network_passphrase = "test" 6 | -------------------------------------------------------------------------------- /services/galexie/internal/test/invalid_empty.toml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /services/galexie/internal/test/invalid_preconfigured_network.toml: -------------------------------------------------------------------------------- 1 | [stellar_core_config] 2 | stellar_core_binary_path = "test/stellar-core" 3 | network = "invalid" 4 | 5 | -------------------------------------------------------------------------------- /services/galexie/internal/test/no_core_bin.toml: -------------------------------------------------------------------------------- 1 | [stellar_core_config] 2 | network = "testnet" 3 | -------------------------------------------------------------------------------- /services/galexie/internal/test/no_network.toml: -------------------------------------------------------------------------------- 1 | 2 | [datastore_config] 3 | type = "ABC" 4 | 5 | [datastore_config.params] 6 | destination_bucket_path = "your-bucket-name/subpath" 7 | 8 | [exporter_config] 9 | ledgers_per_file = 3 10 | files_per_partition = 1 11 | file_suffix = ".xdr.gz" -------------------------------------------------------------------------------- /services/galexie/internal/test/test.toml: -------------------------------------------------------------------------------- 1 | [stellar_core_config] 2 | stellar_core_binary_path = "test/stellar-core" 3 | network = "pubnet" 4 | 5 | [datastore_config] 6 | type = "ABC" 7 | 8 | [datastore_config.params] 9 | destination_bucket_path = "your-bucket-name/subpath/testnet" 10 | 11 | [datastore_config.schema] 12 | ledgers_per_file = 3 13 | files_per_partition = 1 -------------------------------------------------------------------------------- /services/galexie/internal/test/useragent.toml: -------------------------------------------------------------------------------- 1 | user_agent = "useragent_x" 2 | 3 | [stellar_core_config] 4 | stellar_core_binary_path = "test/stellar-core" 5 | network = "pubnet" 6 | 7 | 8 | -------------------------------------------------------------------------------- /services/galexie/internal/test/valid_captive_core_manual.toml: -------------------------------------------------------------------------------- 1 | [stellar_core_config] 2 | captive_core_toml_path = "test/captive-core-test.cfg" 3 | stellar_core_binary_path = "test/stellar-core" 4 | history_archive_urls = ["http://testarchive"] 5 | network_passphrase = "test" -------------------------------------------------------------------------------- /services/galexie/internal/test/valid_captive_core_override.toml: -------------------------------------------------------------------------------- 1 | [stellar_core_config] 2 | network="pubnet" 3 | captive_core_toml_path = "test/captive-core-test.cfg" 4 | stellar_core_binary_path = "test/stellar-core" 5 | -------------------------------------------------------------------------------- /services/galexie/internal/test/valid_captive_core_override_archives.toml: -------------------------------------------------------------------------------- 1 | [stellar_core_config] 2 | network="pubnet" 3 | history_archive_urls = ["http://testarchive"] 4 | stellar_core_binary_path = "test/stellar-core" 5 | -------------------------------------------------------------------------------- /services/galexie/internal/test/valid_captive_core_preconfigured.toml: -------------------------------------------------------------------------------- 1 | [stellar_core_config] 2 | stellar_core_binary_path = "test/stellar-core" 3 | network = "pubnet" 4 | 5 | -------------------------------------------------------------------------------- /services/galexie/internal/test/validate_start_end.toml: -------------------------------------------------------------------------------- 1 | [datastore_config.schema] 2 | ledgers_per_file = 1 3 | 4 | [stellar_core_config] 5 | stellar_core_binary_path = "test/stellar-core" 6 | network = "pubnet" -------------------------------------------------------------------------------- /services/galexie/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | 7 | galexie "github.com/stellar/go/services/galexie/internal" 8 | ) 9 | 10 | func main() { 11 | err := galexie.Execute() 12 | if err != nil { 13 | fmt.Fprintln(os.Stderr, err) 14 | os.Exit(1) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /services/horizon/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | internal/docs/public 3 | /.env 4 | /.go 5 | /tmp/ 6 | /pkg 7 | /bin 8 | /dist 9 | /vendor/pkg 10 | /vendor/bin 11 | /vendor/src 12 | /.vscode/last.sql 13 | /.vscode/temp.sql 14 | /.vscode/* 15 | *.bts 16 | *.swp 17 | *.swo 18 | 19 | /test.go 20 | /tls/*.crt 21 | /tls/*.key 22 | /tls/*.csr 23 | -------------------------------------------------------------------------------- /services/horizon/.projections.json: -------------------------------------------------------------------------------- 1 | { 2 | "*.go": {"alternate": "{}_test.go"}, 3 | "*_test.go": {"alternate": "{}.go"} 4 | } 5 | -------------------------------------------------------------------------------- /services/horizon/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to contribute 2 | 3 | Please read the [Contribution Guide](https://github.com/stellar/.github/blob/master/CONTRIBUTING.md). 4 | -------------------------------------------------------------------------------- /services/horizon/cmd/serve.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import ( 4 | "github.com/spf13/cobra" 5 | horizon "github.com/stellar/go/services/horizon/internal" 6 | ) 7 | 8 | var serveCmd = &cobra.Command{ 9 | Use: "serve", 10 | Short: "run horizon server", 11 | Long: "serve initializes then starts the horizon HTTP server", 12 | RunE: func(cmd *cobra.Command, args []string) error { 13 | app, err := horizon.NewAppFromFlags(globalConfig, globalFlags) 14 | if err != nil { 15 | return err 16 | } 17 | return app.Serve() 18 | }, 19 | } 20 | 21 | func init() { 22 | RootCmd.AddCommand(serveCmd) 23 | } 24 | -------------------------------------------------------------------------------- /services/horizon/cmd/version.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import ( 4 | "fmt" 5 | "runtime" 6 | 7 | "github.com/spf13/cobra" 8 | apkg "github.com/stellar/go/support/app" 9 | ) 10 | 11 | var versionCmd = &cobra.Command{ 12 | Use: "version", 13 | Short: "print horizon and Golang runtime version", 14 | Long: "", 15 | RunE: func(cmd *cobra.Command, args []string) error { 16 | fmt.Println(apkg.Version()) 17 | fmt.Println(runtime.Version()) 18 | return nil 19 | }, 20 | } 21 | 22 | func init() { 23 | RootCmd.AddCommand(versionCmd) 24 | } 25 | -------------------------------------------------------------------------------- /services/horizon/docker/.gitignore: -------------------------------------------------------------------------------- 1 | .env -------------------------------------------------------------------------------- /services/horizon/docker/captive-core-standalone.cfg: -------------------------------------------------------------------------------- 1 | PEER_PORT=11725 2 | 3 | UNSAFE_QUORUM=true 4 | FAILURE_SAFETY=0 5 | 6 | [[VALIDATORS]] 7 | NAME="local_core" 8 | HOME_DOMAIN="core.local" 9 | # From "SACJC372QBSSKJYTV5A7LWT4NXWHTQO6GHG4QDAVC2XDPX6CNNXFZ4JK" 10 | PUBLIC_KEY="GD5KD2KEZJIGTC63IGW6UMUSMVUVG5IHG64HUTFWCHVZH2N2IBOQN7PS" 11 | ADDRESS="host.docker.internal" 12 | QUALITY="MEDIUM" -------------------------------------------------------------------------------- /services/horizon/docker/core-start.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | set -x 5 | 6 | source /etc/profile 7 | # work within the current docker working dir 8 | if [ ! -f "./stellar-core.cfg" ]; then 9 | cp /stellar-core.cfg ./ 10 | fi 11 | 12 | echo "using config:" 13 | cat stellar-core.cfg 14 | 15 | # initialize new db 16 | stellar-core new-db 17 | 18 | if [ "$1" = "standalone" ]; then 19 | # initialize for new history archive path, remove any pre-existing on same path from base image 20 | rm -rf ./history 21 | stellar-core new-hist vs 22 | 23 | # serve history archives to horizon on port 1570 24 | pushd ./history/vs/ 25 | python3 -m http.server 1570 & 26 | popd 27 | fi 28 | 29 | exec stellar-core run --console 30 | -------------------------------------------------------------------------------- /services/horizon/docker/docker-compose.pubnet.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | services: 3 | horizon: 4 | platform: linux/amd64 5 | environment: 6 | - NETWORK=pubnet -------------------------------------------------------------------------------- /services/horizon/docker/verify-range/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:22.04 2 | 3 | ARG GO_VERSION 4 | ARG STELLAR_CORE_VERSION 5 | ENV STELLAR_CORE_VERSION=${STELLAR_CORE_VERSION:-*} 6 | # to remove tzdata interactive flow 7 | ENV DEBIAN_FRONTEND=noninteractive 8 | 9 | ADD dependencies / 10 | RUN ["chmod", "+x", "/dependencies"] 11 | RUN /dependencies 12 | 13 | ADD stellar-core.cfg / 14 | ADD captive-core-pubnet.cfg / 15 | RUN mkdir -p /cc 16 | RUN mkdir -p /data 17 | 18 | ADD start / 19 | RUN ["chmod", "+x", "start"] 20 | 21 | ENTRYPOINT ["/start"] 22 | -------------------------------------------------------------------------------- /services/horizon/internal/actions/doc.go: -------------------------------------------------------------------------------- 1 | // Package actions provides the infrastructure for defining and executing 2 | // actions (code that is triggered in response to an client request) on horizon. 3 | // At present it allows for defining actions that can respond using JSON or SSE. 4 | package actions 5 | -------------------------------------------------------------------------------- /services/horizon/internal/actions/main.go: -------------------------------------------------------------------------------- 1 | package actions 2 | 3 | import "github.com/stellar/go/services/horizon/internal/corestate" 4 | 5 | type CoreStateGetter interface { 6 | GetCoreState() corestate.State 7 | } 8 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/history/account_signers_batch_insert_builder.go: -------------------------------------------------------------------------------- 1 | package history 2 | 3 | import ( 4 | "context" 5 | ) 6 | 7 | func (i *accountSignersBatchInsertBuilder) Add(signer AccountSigner) error { 8 | return i.builder.Row(map[string]interface{}{ 9 | "account_id": signer.Account, 10 | "signer": signer.Signer, 11 | "weight": signer.Weight, 12 | "sponsor": signer.Sponsor, 13 | }) 14 | } 15 | 16 | func (i *accountSignersBatchInsertBuilder) Exec(ctx context.Context) error { 17 | return i.builder.Exec(ctx, i.session, i.table) 18 | } 19 | 20 | func (i *accountSignersBatchInsertBuilder) Len() int { 21 | return i.builder.Len() 22 | } 23 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/history/ledger_cache_test.go: -------------------------------------------------------------------------------- 1 | package history 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stellar/go/services/horizon/internal/test" 7 | ) 8 | 9 | func TestLedgerCache(t *testing.T) { 10 | tt := test.Start(t) 11 | tt.Scenario("base") 12 | defer tt.Finish() 13 | q := &Q{tt.HorizonSession()} 14 | 15 | var lc LedgerCache 16 | lc.Queue(2) 17 | lc.Queue(3) 18 | 19 | err := lc.Load(tt.Ctx, q) 20 | 21 | if tt.Assert.NoError(err) { 22 | tt.Assert.Contains(lc.Records, int32(2)) 23 | tt.Assert.Contains(lc.Records, int32(3)) 24 | tt.Assert.NotContains(lc.Records, int32(1)) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/history/mock_account_data_batch_insert_builder.go: -------------------------------------------------------------------------------- 1 | package history 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/stretchr/testify/mock" 7 | ) 8 | 9 | type MockAccountDataBatchInsertBuilder struct { 10 | mock.Mock 11 | } 12 | 13 | func (m *MockAccountDataBatchInsertBuilder) Add(data Data) error { 14 | a := m.Called(data) 15 | return a.Error(0) 16 | } 17 | 18 | func (m *MockAccountDataBatchInsertBuilder) Exec(ctx context.Context) error { 19 | a := m.Called(ctx) 20 | return a.Error(0) 21 | } 22 | 23 | func (m *MockAccountDataBatchInsertBuilder) Len() int { 24 | a := m.Called() 25 | return a.Int(0) 26 | } 27 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/history/mock_account_signers_batch_insert_builder.go: -------------------------------------------------------------------------------- 1 | package history 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/stretchr/testify/mock" 7 | ) 8 | 9 | type MockAccountSignersBatchInsertBuilder struct { 10 | mock.Mock 11 | } 12 | 13 | func (m *MockAccountSignersBatchInsertBuilder) Add(signer AccountSigner) error { 14 | a := m.Called(signer) 15 | return a.Error(0) 16 | } 17 | 18 | func (m *MockAccountSignersBatchInsertBuilder) Exec(ctx context.Context) error { 19 | a := m.Called(ctx) 20 | return a.Error(0) 21 | } 22 | 23 | func (m *MockAccountSignersBatchInsertBuilder) Len() int { 24 | a := m.Called() 25 | return a.Get(0).(int) 26 | } 27 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/history/mock_accounts_batch_insert_builder.go: -------------------------------------------------------------------------------- 1 | package history 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/stretchr/testify/mock" 7 | ) 8 | 9 | type MockAccountsBatchInsertBuilder struct { 10 | mock.Mock 11 | } 12 | 13 | func (m *MockAccountsBatchInsertBuilder) Add(account AccountEntry) error { 14 | a := m.Called(account) 15 | return a.Error(0) 16 | } 17 | 18 | func (m *MockAccountsBatchInsertBuilder) Exec(ctx context.Context) error { 19 | a := m.Called(ctx) 20 | return a.Error(0) 21 | } 22 | 23 | func (m *MockAccountsBatchInsertBuilder) Len() int { 24 | a := m.Called() 25 | return a.Int(0) 26 | } 27 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/history/mock_offers_batch_insert_builder.go: -------------------------------------------------------------------------------- 1 | package history 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/stretchr/testify/mock" 7 | ) 8 | 9 | type MockOffersBatchInsertBuilder struct { 10 | mock.Mock 11 | } 12 | 13 | func (m *MockOffersBatchInsertBuilder) Add(offer Offer) error { 14 | a := m.Called(offer) 15 | return a.Error(0) 16 | } 17 | 18 | func (m *MockOffersBatchInsertBuilder) Exec(ctx context.Context) error { 19 | a := m.Called(ctx) 20 | return a.Error(0) 21 | } 22 | 23 | func (m *MockOffersBatchInsertBuilder) Len() int { 24 | a := m.Called() 25 | return a.Int(0) 26 | } 27 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/history/mock_q_effects.go: -------------------------------------------------------------------------------- 1 | package history 2 | 3 | import ( 4 | "context" 5 | "github.com/stretchr/testify/mock" 6 | ) 7 | 8 | // MockQEffects is a mock implementation of the QEffects interface 9 | type MockQEffects struct { 10 | mock.Mock 11 | } 12 | 13 | func (m *MockQEffects) NewEffectBatchInsertBuilder() EffectBatchInsertBuilder { 14 | a := m.Called() 15 | return a.Get(0).(EffectBatchInsertBuilder) 16 | } 17 | 18 | func (m *MockQEffects) CreateAccounts(ctx context.Context, addresses []string, maxBatchSize int) (map[string]int64, error) { 19 | a := m.Called(ctx, addresses, maxBatchSize) 20 | return a.Get(0).(map[string]int64), a.Error(1) 21 | } 22 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/history/mock_q_operations.go: -------------------------------------------------------------------------------- 1 | package history 2 | 3 | import "github.com/stretchr/testify/mock" 4 | 5 | // MockQOperations is a mock implementation of the QOperations interface 6 | type MockQOperations struct { 7 | mock.Mock 8 | } 9 | 10 | // NewOperationBatchInsertBuilder mock 11 | func (m *MockQOperations) NewOperationBatchInsertBuilder() OperationBatchInsertBuilder { 12 | a := m.Called() 13 | return a.Get(0).(OperationBatchInsertBuilder) 14 | } 15 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/history/mock_q_transactions.go: -------------------------------------------------------------------------------- 1 | package history 2 | 3 | import "github.com/stretchr/testify/mock" 4 | 5 | // MockQTransactions is a mock implementation of the QTransactions interface 6 | type MockQTransactions struct { 7 | mock.Mock 8 | } 9 | 10 | func (m *MockQTransactions) NewTransactionBatchInsertBuilder() TransactionBatchInsertBuilder { 11 | a := m.Called() 12 | return a.Get(0).(TransactionBatchInsertBuilder) 13 | } 14 | 15 | func (m *MockQTransactions) NewTransactionFilteredTmpBatchInsertBuilder() TransactionBatchInsertBuilder { 16 | a := m.Called() 17 | return a.Get(0).(TransactionBatchInsertBuilder) 18 | } 19 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/history/mock_transactions_batch_insert_builder.go: -------------------------------------------------------------------------------- 1 | package history 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/stretchr/testify/mock" 7 | 8 | "github.com/stellar/go/ingest" 9 | "github.com/stellar/go/support/db" 10 | ) 11 | 12 | type MockTransactionsBatchInsertBuilder struct { 13 | mock.Mock 14 | } 15 | 16 | func (m *MockTransactionsBatchInsertBuilder) Add(transaction ingest.LedgerTransaction, sequence uint32) error { 17 | a := m.Called(transaction, sequence) 18 | return a.Error(0) 19 | } 20 | 21 | func (m *MockTransactionsBatchInsertBuilder) Exec(ctx context.Context, session db.SessionInterface) error { 22 | a := m.Called(ctx, session) 23 | return a.Error(0) 24 | } 25 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/history/mock_trust_lines_batch_insert_builder.go: -------------------------------------------------------------------------------- 1 | package history 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/stretchr/testify/mock" 7 | ) 8 | 9 | type MockTrustLinesBatchInsertBuilder struct { 10 | mock.Mock 11 | } 12 | 13 | func (m *MockTrustLinesBatchInsertBuilder) Add(line TrustLine) error { 14 | a := m.Called(line) 15 | return a.Error(0) 16 | } 17 | 18 | func (m *MockTrustLinesBatchInsertBuilder) Exec(ctx context.Context) error { 19 | a := m.Called(ctx) 20 | return a.Error(0) 21 | } 22 | 23 | func (m *MockTrustLinesBatchInsertBuilder) Len() int { 24 | a := m.Called() 25 | return a.Int(0) 26 | } 27 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/history/total_order_id.go: -------------------------------------------------------------------------------- 1 | package history 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | // PagingToken returns a cursor for this record 8 | func (r *TotalOrderID) PagingToken() string { 9 | return fmt.Sprintf("%d", r.ID) 10 | } 11 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/main.go: -------------------------------------------------------------------------------- 1 | // Package db2 is the replacement for db. It provides low level db connection 2 | // and query capabilities. 3 | package db2 4 | 5 | // PageQuery represents a portion of a Query struct concerned with paging 6 | // through a large dataset. 7 | type PageQuery struct { 8 | Cursor string 9 | Order string 10 | Limit uint64 11 | } 12 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/11_add_trades_account_index.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | CREATE INDEX htrd_by_base_account ON history_trades USING BTREE(base_account_id); 4 | CREATE INDEX htrd_by_counter_account ON history_trades USING BTREE(counter_account_id); 5 | 6 | -- +migrate Down 7 | 8 | DROP INDEX htrd_by_base_account; 9 | DROP INDEX htrd_by_counter_account; -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/12_asset_stats_amount_string.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | ALTER TABLE asset_stats 3 | ALTER COLUMN amount SET DATA TYPE character varying; 4 | 5 | -- +migrate Down 6 | ALTER TABLE asset_stats 7 | ALTER COLUMN amount SET DATA TYPE bigint USING amount::bigint; 8 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/13_trade_offer_ids.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | ALTER TABLE history_trades ADD base_offer_id BIGINT; 4 | ALTER TABLE history_trades ADD counter_offer_id BIGINT; 5 | 6 | CREATE INDEX htrd_by_base_offer ON history_trades USING btree(base_offer_id); 7 | CREATE INDEX htrd_by_counter_offer ON history_trades USING btree(counter_offer_id); 8 | 9 | -- +migrate Down 10 | 11 | DROP INDEX htrd_by_base_offer; 12 | DROP INDEX htrd_by_counter_offer; 13 | 14 | ALTER TABLE history_trades DROP COLUMN base_offer_id; 15 | ALTER TABLE history_trades DROP COLUMN counter_offer_id; 16 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/14_fix_asset_toml_field.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | ALTER TABLE asset_stats ALTER COLUMN toml TYPE varchar(255); 4 | 5 | -- +migrate Down 6 | 7 | ALTER TABLE asset_stats ALTER COLUMN toml TYPE varchar(64); 8 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/15_ledger_failed_txs.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | ALTER TABLE history_ledgers ADD successful_transaction_count integer DEFAULT NULL; 4 | ALTER TABLE history_ledgers ADD failed_transaction_count integer DEFAULT NULL; 5 | 6 | -- +migrate Down 7 | 8 | ALTER TABLE history_ledgers DROP COLUMN successful_transaction_count; 9 | ALTER TABLE history_ledgers DROP COLUMN failed_transaction_count; 10 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/16_ingest_failed_transactions.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | -- Check db2/history.Transaction.Successful field comment for more information. 4 | ALTER TABLE history_transactions ADD successful boolean; 5 | 6 | -- +migrate Down 7 | 8 | -- Remove failed transactions and operations from failed transactions! 9 | DELETE FROM history_operations USING history_transactions 10 | WHERE history_transactions.id = history_operations.transaction_id AND successful = false; 11 | DELETE FROM history_transactions WHERE successful = false; 12 | ALTER TABLE history_transactions DROP COLUMN successful; 13 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/17_transaction_fee_paid.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | ALTER TABLE history_transactions ADD fee_charged integer; 4 | ALTER TABLE history_transactions RENAME COLUMN fee_paid TO max_fee; 5 | 6 | -- +migrate Down 7 | 8 | ALTER TABLE history_transactions DROP COLUMN fee_charged; 9 | ALTER TABLE history_transactions RENAME COLUMN max_fee TO fee_paid; 10 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/18_account_for_signers.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | CREATE TABLE accounts_signers ( 4 | account character varying(64), 5 | signer character varying(64), 6 | weight integer NOT NULL, 7 | -- we will query by signer so that is why signer is the first item in the composite key 8 | PRIMARY KEY (signer, account) 9 | ); 10 | 11 | CREATE TABLE key_value_store ( 12 | key varchar(255) NOT NULL, 13 | value varchar(255) NOT NULL, 14 | PRIMARY KEY (key) 15 | ); 16 | 17 | -- +migrate Down 18 | DROP TABLE accounts_signers cascade; 19 | DROP TABLE key_value_store cascade; 20 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/20_account_for_signer_index.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | CREATE INDEX signers_by_account ON accounts_signers USING BTREE(account); 4 | 5 | -- +migrate Down 6 | 7 | DROP INDEX signers_by_account; 8 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/26_exp_history_ledgers.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | CREATE TABLE exp_history_ledgers ( 4 | LIKE history_ledgers 5 | including defaults 6 | including constraints 7 | including indexes 8 | ); 9 | 10 | -- +migrate Down 11 | 12 | DROP TABLE exp_history_ledgers cascade; 13 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/28_exp_history_operations.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | CREATE TABLE exp_history_operations ( 4 | LIKE history_operations 5 | including defaults 6 | including constraints 7 | including indexes 8 | ); 9 | 10 | CREATE TABLE exp_history_operation_participants ( 11 | LIKE history_operation_participants 12 | including defaults 13 | including constraints 14 | including indexes 15 | ); 16 | 17 | -- +migrate Down 18 | 19 | DROP TABLE exp_history_operations cascade; 20 | 21 | DROP TABLE exp_history_operation_participants cascade; 22 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/29_exp_history_assets.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | CREATE TABLE exp_history_assets ( 4 | LIKE history_assets 5 | including defaults 6 | including constraints 7 | including indexes 8 | ); 9 | 10 | -- +migrate Down 11 | 12 | DROP TABLE exp_history_assets cascade; 13 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/2_index_participants_by_toid.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | CREATE INDEX hop_by_hoid ON history_operation_participants USING btree (history_operation_id); 4 | CREATE INDEX htp_by_htid ON history_transaction_participants USING btree (history_transaction_id); 5 | 6 | -- +migrate Down 7 | 8 | DROP INDEX hop_by_hoid; 9 | DROP INDEX htp_by_htid; 10 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/31_exp_history_effects.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | CREATE TABLE exp_history_effects ( 4 | LIKE history_effects 5 | including defaults 6 | including constraints 7 | including indexes 8 | ); 9 | 10 | -- +migrate Down 11 | 12 | DROP TABLE exp_history_effects cascade; 13 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/35_drop_participant_id.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | ALTER TABLE history_operation_participants 4 | DROP COLUMN id; 5 | 6 | ALTER TABLE history_transaction_participants 7 | DROP COLUMN id; 8 | 9 | -- +migrate Down 10 | 11 | ALTER TABLE history_operation_participants 12 | ADD COLUMN id integer; 13 | 14 | ALTER TABLE history_transaction_participants 15 | ADD COLUMN id integer; -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/37_add_tx_set_operation_count_to_ledgers.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | ALTER TABLE history_ledgers ADD tx_set_operation_count integer DEFAULT NULL; 4 | 5 | -- +migrate Down 6 | 7 | ALTER TABLE history_ledgers DROP COLUMN tx_set_operation_count; 8 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/39_history_trades_indices.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | CREATE INDEX htrd_pair_pid ON history_trades USING BTREE(base_asset_id, counter_asset_id, history_operation_id, "order"); 4 | 5 | -- +migrate Down 6 | 7 | DROP INDEX htrd_pair_pid; 8 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/3_use_sequence_in_history_accounts.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | CREATE SEQUENCE history_accounts_id_seq 3 | START WITH 1 4 | INCREMENT BY 1 5 | NO MINVALUE 6 | NO MAXVALUE 7 | CACHE 1; 8 | SELECT setval('history_accounts_id_seq', (SELECT MAX(id) FROM history_accounts)); 9 | ALTER TABLE ONLY history_accounts ALTER COLUMN id SET DEFAULT nextval('history_accounts_id_seq'::regclass); 10 | 11 | -- +migrate Down 12 | ALTER TABLE ONLY history_accounts ALTER COLUMN id DROP DEFAULT; 13 | DROP SEQUENCE history_accounts_id_seq; 14 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/40_fix_inner_tx_max_fee_constraint.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | ALTER TABLE history_transactions DROP CONSTRAINT valid_max_fee; 4 | -- Inner tx in fee bump can have max_fee=0 5 | ALTER TABLE history_transactions ADD CONSTRAINT valid_max_fee CHECK (max_fee >= 0) NOT VALID; 6 | 7 | -- +migrate Down 8 | 9 | ALTER TABLE history_transactions DROP CONSTRAINT valid_max_fee; 10 | ALTER TABLE history_transactions ADD CONSTRAINT valid_max_fee CHECK (max_fee > 0) NOT VALID; -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/42_add_num_sponsored_and_num_sponsoring_to_accounts.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | ALTER TABLE accounts 4 | ADD COLUMN num_sponsored integer DEFAULT 0 CHECK (num_sponsored >= 0), 5 | ADD COLUMN num_sponsoring integer DEFAULT 0 CHECK (num_sponsoring >= 0); 6 | 7 | -- +migrate Down 8 | 9 | ALTER TABLE accounts 10 | DROP COLUMN num_sponsored, 11 | DROP COLUMN num_sponsoring; 12 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/43_add_claimable_balances_flags.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | 4 | ALTER TABLE claimable_balances ADD flags int NOT NULL DEFAULT 0; 5 | 6 | -- +migrate Down 7 | 8 | ALTER TABLE claimable_balances DROP flags; 9 | 10 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/44_asset_stat_accounts_and_balances.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | ALTER TABLE exp_asset_stats 4 | ADD COLUMN accounts JSONB, 5 | ADD COLUMN balances JSONB; 6 | UPDATE exp_asset_stats 7 | SET 8 | accounts = jsonb_build_object('authorized', num_accounts), 9 | balances = jsonb_build_object('authorized', amount); 10 | 11 | ALTER TABLE exp_asset_stats 12 | ALTER COLUMN accounts SET NOT NULL, 13 | ALTER COLUMN balances SET NOT NULL; 14 | 15 | -- +migrate Down 16 | 17 | ALTER TABLE exp_asset_stats 18 | DROP COLUMN accounts, 19 | DROP COLUMN balances; 20 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/46_add_muxed_accounts.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | ALTER TABLE history_transactions ADD account_muxed varchar(69) NULL, ADD fee_account_muxed varchar(69) NULL; 4 | ALTER TABLE history_operations ADD source_account_muxed varchar(69) NULL; 5 | ALTER TABLE history_effects ADD address_muxed varchar(69) NULL; 6 | 7 | -- +migrate Down 8 | 9 | ALTER TABLE history_transactions DROP account_muxed, DROP fee_account_muxed; 10 | ALTER TABLE history_operations DROP source_account_muxed; 11 | ALTER TABLE history_effects DROP address_muxed; 12 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/49_add_brin_index_trade_aggregations.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up notransaction 2 | 3 | CREATE INDEX CONCURRENTLY IF NOT EXISTS htrd_agg_timestamp_brin ON history_trades_60000 USING brin(timestamp); 4 | 5 | -- +migrate Down 6 | 7 | DROP INDEX IF EXISTS htrd_agg_timestamp_brin; 8 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/4_add_protocol_version.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | ALTER TABLE ONLY history_ledgers 3 | ADD COLUMN protocol_version integer DEFAULT 0 NOT NULL; 4 | 5 | -- +migrate Down 6 | ALTER TABLE ONLY history_ledgers DROP COLUMN protocol_version; 7 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/51_remove_ht_unused_indexes.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | -- unused indices 4 | DROP INDEX IF EXISTS by_account; 5 | DROP INDEX IF EXISTS by_fee_account; 6 | 7 | 8 | -- +migrate Down 9 | CREATE INDEX by_account ON history_transactions USING btree (account, account_sequence); 10 | CREATE INDEX by_fee_account ON history_transactions USING btree (fee_account) WHERE fee_account IS NOT NULL; 11 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/52_add_trade_type_index.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | ALTER TABLE history_trades ADD trade_type smallint DEFAULT 1 CHECK(trade_type > 0); 4 | UPDATE history_trades SET trade_type = 2 WHERE base_liquidity_pool_id IS NOT NULL OR counter_liquidity_pool_id IS NOT NULL; 5 | CREATE INDEX htrd_by_trade_type ON history_trades USING BTREE(trade_type, history_operation_id, "order"); 6 | 7 | -- +migrate Down 8 | 9 | DROP INDEX htrd_by_trade_type; 10 | ALTER TABLE history_trades DROP trade_type; 11 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/53_add_trades_rounding_slippage.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | -- Add is_dust to trades table 4 | ALTER TABLE history_trades ADD rounding_slippage bigint; 5 | ALTER TABLE history_trades ADD base_is_exact boolean; 6 | 7 | -- +migrate Down 8 | ALTER TABLE history_trades DROP rounding_slippage; 9 | ALTER TABLE history_trades DROP base_is_exact; 10 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/57_trade_aggregation_autovac.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | alter table history_trades_60000 set ( 4 | autovacuum_vacuum_scale_factor = 0.05, 5 | autovacuum_analyze_scale_factor = 0.025 6 | ); 7 | 8 | -- +migrate Down 9 | 10 | alter table history_trades_60000 set ( 11 | autovacuum_vacuum_scale_factor = 0.1, 12 | autovacuum_analyze_scale_factor = 0.5 13 | ); 14 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/60_add_asset_id_indexes.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | CREATE INDEX "htrd_by_counter_asset" ON history_trades USING btree (counter_asset_id); 4 | CREATE INDEX "htrd_agg_counter_asset" ON history_trades_60000 USING btree (counter_asset_id); 5 | 6 | -- +migrate Down 7 | 8 | DROP INDEX "htrd_by_counter_asset"; 9 | DROP INDEX "htrd_agg_counter_asset"; 10 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/61_trust_lines_by_account_type_code_issuer.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | CREATE INDEX "trust_lines_by_type_code_issuer_account" ON trust_lines USING btree (asset_type, asset_code, asset_issuer, account_id); 4 | DROP INDEX "trust_lines_by_type_code_issuer"; 5 | 6 | -- +migrate Down 7 | 8 | DROP INDEX "trust_lines_by_type_code_issuer_account"; 9 | CREATE INDEX "trust_lines_by_type_code_issuer" ON trust_lines USING btree (asset_type, asset_code, asset_issuer); 10 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/63_add_contract_id_to_asset_stats.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | ALTER TABLE exp_asset_stats ADD COLUMN contract_id BYTEA UNIQUE; 4 | 5 | -- +migrate Down 6 | 7 | ALTER TABLE exp_asset_stats DROP COLUMN contract_id; 8 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/64_add_payment_flag_history_ops.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | ALTER TABLE history_operations ADD is_payment boolean; 4 | 5 | -- +migrate Down 6 | 7 | ALTER TABLE history_operations DROP COLUMN is_payment; 8 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/65_drop_payment_index.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | -- index_history_operations_on_is_payment was added in migration 64 but it turns out 4 | -- the index was not necessary, see https://github.com/stellar/go/issues/5059 5 | DROP INDEX IF EXISTS "index_history_operations_on_is_payment"; 6 | 7 | -- +migrate Down 8 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/66_contract_asset_stats.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | CREATE TABLE contract_asset_stats ( 3 | contract_id BYTEA PRIMARY KEY, 4 | stat JSONB NOT NULL 5 | ); 6 | 7 | CREATE TABLE contract_asset_balances ( 8 | key_hash BYTEA PRIMARY KEY, 9 | asset_contract_id BYTEA NOT NULL, 10 | amount numeric(39,0) NOT NULL, -- 39 digits is sufficient for a 128 bit integer 11 | expiration_ledger integer NOT NULL 12 | ); 13 | 14 | CREATE INDEX "contract_asset_balances_by_expiration" ON contract_asset_balances USING btree (expiration_ledger); 15 | 16 | -- +migrate Down 17 | DROP TABLE contract_asset_stats cascade; 18 | DROP TABLE contract_asset_balances cascade; -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/68_remove_deprecated_fields_from_exp_asset_stats.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | ALTER TABLE exp_asset_stats DROP CONSTRAINT valid_num_accounts; 4 | 5 | ALTER TABLE exp_asset_stats 6 | DROP COLUMN num_accounts; 7 | 8 | ALTER TABLE exp_asset_stats 9 | DROP COLUMN amount; 10 | 11 | -- +migrate Down 12 | ALTER TABLE exp_asset_stats 13 | ADD COLUMN num_accounts INTEGER NOT NULL DEFAULT 0; 14 | 15 | ALTER TABLE exp_asset_stats 16 | ADD COLUMN amount TEXT NOT NULL DEFAULT ''; 17 | 18 | ALTER TABLE exp_asset_stats ADD CONSTRAINT valid_num_accounts CHECK (num_accounts >= 0) NOT VALID; 19 | -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/6_create_assets_table.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | CREATE TABLE history_assets ( 3 | id SERIAL PRIMARY KEY , 4 | asset_type VARCHAR(64) NOT NULL, 5 | asset_code VARCHAR(12) NOT NULL, 6 | asset_issuer VARCHAR(56) NOT NULL, 7 | UNIQUE(asset_code, asset_type, asset_issuer) 8 | ); 9 | 10 | CREATE INDEX asset_by_issuer ON history_assets USING btree (asset_issuer); 11 | 12 | -- +migrate Down 13 | DROP TABLE history_assets cascade; -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/8_create_asset_stats_table.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | CREATE TABLE asset_stats ( 3 | id BIGINT PRIMARY KEY REFERENCES history_assets ON DELETE CASCADE ON UPDATE RESTRICT, 4 | amount BIGINT NOT NULL, 5 | num_accounts INTEGER NOT NULL, 6 | flags SMALLINT NOT NULL, 7 | toml VARCHAR(64) NOT NULL 8 | ); 9 | 10 | CREATE INDEX asset_by_code ON history_assets USING btree (asset_code); 11 | 12 | -- +migrate Down 13 | DROP TABLE asset_stats cascade; -------------------------------------------------------------------------------- /services/horizon/internal/db2/schema/migrations/9_add_header_xdr.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | ALTER TABLE ONLY history_ledgers ADD COLUMN ledger_header text NULL; 3 | 4 | -- +migrate Down 5 | ALTER TABLE ONLY history_ledgers DROP COLUMN ledger_header; -------------------------------------------------------------------------------- /services/horizon/internal/httpx/main.go: -------------------------------------------------------------------------------- 1 | package httpx 2 | 3 | import "embed" 4 | 5 | var ( 6 | //go:embed static 7 | staticFiles embed.FS 8 | ) 9 | -------------------------------------------------------------------------------- /services/horizon/internal/ingest/filters/main_test.go: -------------------------------------------------------------------------------- 1 | package filters 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stellar/go/services/horizon/internal/db2/history" 7 | "github.com/stellar/go/services/horizon/internal/test" 8 | ) 9 | 10 | func TestItGetsFilters(t *testing.T) { 11 | tt := test.Start(t) 12 | defer tt.Finish() 13 | test.ResetHorizonDB(t, tt.HorizonDB) 14 | q := &history.Q{tt.HorizonSession()} 15 | 16 | filtersService := NewFilters() 17 | 18 | ingestFilters := filtersService.GetFilters(q, tt.Ctx) 19 | 20 | // should be total of filters implemented in the system 21 | tt.Assert.Len(ingestFilters, 2) 22 | } 23 | -------------------------------------------------------------------------------- /services/horizon/internal/ingest/mock_filter.go: -------------------------------------------------------------------------------- 1 | package ingest 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/stellar/go/services/horizon/internal/db2/history" 7 | "github.com/stellar/go/services/horizon/internal/ingest/processors" 8 | "github.com/stretchr/testify/mock" 9 | ) 10 | 11 | type MockFilters struct { 12 | mock.Mock 13 | } 14 | 15 | func (m *MockFilters) GetFilters(filterQ history.QFilter, ctx context.Context) []processors.LedgerTransactionFilterer { 16 | return []processors.LedgerTransactionFilterer{} 17 | } 18 | -------------------------------------------------------------------------------- /services/horizon/internal/ingest/processors/mock_change_processor.go: -------------------------------------------------------------------------------- 1 | package processors 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/stretchr/testify/mock" 7 | 8 | "github.com/stellar/go/ingest" 9 | ) 10 | 11 | var _ ChangeProcessor = (*MockChangeProcessor)(nil) 12 | 13 | type MockChangeProcessor struct { 14 | mock.Mock 15 | } 16 | 17 | func (m *MockChangeProcessor) ProcessChange(ctx context.Context, change ingest.Change) error { 18 | args := m.Called(ctx, change) 19 | return args.Error(0) 20 | } 21 | -------------------------------------------------------------------------------- /services/horizon/internal/ingest/states.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/services/horizon/internal/ingest/states.jpg -------------------------------------------------------------------------------- /services/horizon/internal/ingest/testdata/sample-changes.xdr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/services/horizon/internal/ingest/testdata/sample-changes.xdr -------------------------------------------------------------------------------- /services/horizon/internal/ingest/testdata/test_asset_filter_params.json: -------------------------------------------------------------------------------- 1 | { 2 | "CanonicalAssetList": [ 3 | "BITC:ABC123456", 4 | "DOGT:DEF123456" 5 | ], 6 | "AssetIssuerList": [], 7 | "AssetCodeList ": [], 8 | "ResolveLiquidityPoolAsAsset": true, 9 | "TraverseEffects": false, 10 | "Activated": true 11 | } 12 | -------------------------------------------------------------------------------- /services/horizon/internal/integration/contracts/.gitignore: -------------------------------------------------------------------------------- 1 | target -------------------------------------------------------------------------------- /services/horizon/internal/integration/contracts/Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | resolver = "2" 3 | 4 | members = [ 5 | "sac_test", 6 | "increment", 7 | "add_u64", 8 | "store", 9 | "constructor", 10 | "bulk", 11 | ] 12 | 13 | [profile.release-with-logs] 14 | inherits = "release" 15 | debug-assertions = true 16 | 17 | [profile.release] 18 | opt-level = "z" 19 | overflow-checks = true 20 | debug = 0 21 | strip = "symbols" 22 | debug-assertions = false 23 | panic = "abort" 24 | codegen-units = 1 25 | lto = true 26 | 27 | [workspace.dependencies.soroban-sdk] 28 | version = "22.0.0-rc.2" 29 | git = "https://github.com/stellar/rs-soroban-sdk" 30 | rev = "f0e653e364b19a7bf23bcb6b1cb2427ba12cee44" 31 | -------------------------------------------------------------------------------- /services/horizon/internal/integration/contracts/add_u64/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | version = "0.0.0" 3 | name = "soroban_add_u64" 4 | authors = ["Stellar Development Foundation "] 5 | license = "Apache-2.0" 6 | edition = "2021" 7 | publish = false 8 | 9 | [lib] 10 | crate-type = ["cdylib"] 11 | doctest = false 12 | 13 | [dependencies] 14 | soroban-sdk = { workspace = true } 15 | 16 | [dev_dependencies] 17 | soroban-sdk = { workspace = true, features = ["testutils"] } -------------------------------------------------------------------------------- /services/horizon/internal/integration/contracts/bulk/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | version = "0.0.0" 3 | name = "soroban-bulk" 4 | authors = ["Stellar Development Foundation "] 5 | license = "Apache-2.0" 6 | edition = "2021" 7 | publish = false 8 | 9 | [lib] 10 | crate-type = ["cdylib"] 11 | doctest = false 12 | 13 | [dependencies] 14 | soroban-sdk = { workspace = true } 15 | 16 | [dev_dependencies] 17 | soroban-sdk = { workspace = true, features = ["testutils"] } -------------------------------------------------------------------------------- /services/horizon/internal/integration/contracts/bulk/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | use soroban_sdk::{contract, contractimpl, token, Address, Env, Vec}; 3 | 4 | #[contract] 5 | pub struct Contract; 6 | 7 | #[contractimpl] 8 | impl Contract { 9 | pub fn bulk_transfer(env: Env, sender: Address, contract: Address, recipients: Vec
, amounts: Vec) { 10 | if recipients.len() != amounts.len() { 11 | panic!("number of recipients does not match amounts"); 12 | } 13 | sender.require_auth(); 14 | let client = token::Client::new(&env, &contract); 15 | for (dest, amt) in recipients.iter().zip(amounts.iter()) { 16 | client.transfer(&sender, &dest, &amt); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /services/horizon/internal/integration/contracts/constructor/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | version = "0.0.0" 3 | name = "soroban-constructor-contract" 4 | authors = ["Stellar Development Foundation "] 5 | license = "Apache-2.0" 6 | edition = "2021" 7 | publish = false 8 | 9 | [lib] 10 | crate-type = ["cdylib"] 11 | doctest = false 12 | 13 | [dependencies] 14 | soroban-sdk = { workspace = true } 15 | 16 | [dev_dependencies] 17 | soroban-sdk = { workspace = true, features = ["testutils"] } 18 | -------------------------------------------------------------------------------- /services/horizon/internal/integration/contracts/constructor/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | use soroban_sdk::{contract, contractimpl, symbol_short, Address, Env, token, Symbol}; 3 | 4 | #[contract] 5 | pub struct Contract; 6 | 7 | const KEY: Symbol = symbol_short!("key"); 8 | 9 | #[contractimpl] 10 | impl Contract { 11 | pub fn __constructor(env: Env, sender: Address, token_contract: Address, amount: i128) { 12 | let client = token::Client::new(&env, &token_contract); 13 | client.transfer(&sender, &env.current_contract_address(), &amount); 14 | env.storage().persistent().set(&KEY, &1_u32); 15 | env.storage().instance().set(&KEY, &2_u32); 16 | env.storage().temporary().set(&KEY, &3_u32); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /services/horizon/internal/integration/contracts/increment/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | version = "0.0.0" 3 | name = "soroban-increment-contract" 4 | authors = ["Stellar Development Foundation "] 5 | license = "Apache-2.0" 6 | edition = "2021" 7 | publish = false 8 | 9 | [lib] 10 | crate-type = ["cdylib"] 11 | doctest = false 12 | 13 | [dependencies] 14 | soroban-sdk = { workspace = true } 15 | 16 | [dev_dependencies] 17 | soroban-sdk = { workspace = true, features = ["testutils"] } 18 | -------------------------------------------------------------------------------- /services/horizon/internal/integration/contracts/increment/src/test.rs: -------------------------------------------------------------------------------- 1 | #![cfg(test)] 2 | 3 | use super::{IncrementContract, IncrementContractClient}; 4 | use soroban_sdk::{testutils::Logs, Env}; 5 | 6 | extern crate std; 7 | 8 | #[test] 9 | fn test() { 10 | let env = Env::default(); 11 | let contract_id = env.register_contract(None, IncrementContract); 12 | let client = IncrementContractClient::new(&env, &contract_id); 13 | 14 | assert_eq!(client.increment(), 1); 15 | assert_eq!(client.increment(), 2); 16 | assert_eq!(client.increment(), 3); 17 | 18 | std::println!("{}", env.logs().all().join("\n")); 19 | } 20 | -------------------------------------------------------------------------------- /services/horizon/internal/integration/contracts/sac_test/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | version = "0.0.0" 3 | name = "soroban-sac-test" 4 | authors = ["Stellar Development Foundation "] 5 | license = "Apache-2.0" 6 | edition = "2021" 7 | publish = false 8 | 9 | [lib] 10 | crate-type = ["cdylib"] 11 | doctest = false 12 | 13 | [dependencies] 14 | soroban-sdk = { workspace = true } 15 | 16 | [dev_dependencies] 17 | soroban-sdk = { workspace = true, features = ["testutils"] } -------------------------------------------------------------------------------- /services/horizon/internal/integration/contracts/store/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | version = "0.0.0" 3 | name = "soroban-store" 4 | authors = ["Stellar Development Foundation "] 5 | license = "Apache-2.0" 6 | edition = "2021" 7 | publish = false 8 | 9 | [lib] 10 | crate-type = ["cdylib"] 11 | doctest = false 12 | 13 | [dependencies] 14 | soroban-sdk = { workspace = true } 15 | 16 | [dev_dependencies] 17 | soroban-sdk = { workspace = true, features = ["testutils"] } -------------------------------------------------------------------------------- /services/horizon/internal/integration/contracts/store/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | use soroban_sdk::{contract, contractimpl, Env, Val}; 3 | 4 | #[contract] 5 | pub struct Contract; 6 | 7 | #[contractimpl] 8 | impl Contract { 9 | pub fn set(e: Env, key: Val, val: Val) { 10 | e.storage().persistent().set(&key, &val) 11 | } 12 | 13 | pub fn remove(e: Env, key: Val) { 14 | e.storage().persistent().remove(&key) 15 | } 16 | } -------------------------------------------------------------------------------- /services/horizon/internal/integration/testdata/load-test-accounts.xdr.zstd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/services/horizon/internal/integration/testdata/load-test-accounts.xdr.zstd -------------------------------------------------------------------------------- /services/horizon/internal/integration/testdata/load-test-ledgers.xdr.zstd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/services/horizon/internal/integration/testdata/load-test-ledgers.xdr.zstd -------------------------------------------------------------------------------- /services/horizon/internal/integration/testdata/soroban_add_u64.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/services/horizon/internal/integration/testdata/soroban_add_u64.wasm -------------------------------------------------------------------------------- /services/horizon/internal/integration/testdata/soroban_bulk.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/services/horizon/internal/integration/testdata/soroban_bulk.wasm -------------------------------------------------------------------------------- /services/horizon/internal/integration/testdata/soroban_constructor_contract.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/services/horizon/internal/integration/testdata/soroban_constructor_contract.wasm -------------------------------------------------------------------------------- /services/horizon/internal/integration/testdata/soroban_increment_contract.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/services/horizon/internal/integration/testdata/soroban_increment_contract.wasm -------------------------------------------------------------------------------- /services/horizon/internal/integration/testdata/soroban_sac_test.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/services/horizon/internal/integration/testdata/soroban_sac_test.wasm -------------------------------------------------------------------------------- /services/horizon/internal/integration/testdata/soroban_store.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/services/horizon/internal/integration/testdata/soroban_store.wasm -------------------------------------------------------------------------------- /services/horizon/internal/integration/testdata/testbucket/FFFFFC18--999.xdr.zstd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/services/horizon/internal/integration/testdata/testbucket/FFFFFC18--999.xdr.zstd -------------------------------------------------------------------------------- /services/horizon/internal/integration/testdata/testbucket/FFFFFC19--998.xdr.zstd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/services/horizon/internal/integration/testdata/testbucket/FFFFFC19--998.xdr.zstd -------------------------------------------------------------------------------- /services/horizon/internal/integration/testdata/testbucket/FFFFFC1A--997.xdr.zstd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/services/horizon/internal/integration/testdata/testbucket/FFFFFC1A--997.xdr.zstd -------------------------------------------------------------------------------- /services/horizon/internal/paths/doc.go: -------------------------------------------------------------------------------- 1 | // Package paths provides utilities and facilities for payment paths as needed by horizon. Most 2 | // importantly, it provides the Finder interface, allowing for pluggable path finding back ends. 3 | package paths 4 | -------------------------------------------------------------------------------- /services/horizon/internal/render/mime.go: -------------------------------------------------------------------------------- 1 | package render 2 | 3 | const ( 4 | 5 | //MimeEventStream is the mime type for "text/event-stream" 6 | MimeEventStream = "text/event-stream" 7 | //MimeHal is the mime type for "application/hal+json" 8 | MimeHal = "application/hal+json" 9 | //MimeJSON is the mime type for "application/json" 10 | MimeJSON = "application/json" 11 | //MimeRaw is the mime type for "application/octet-stream" 12 | MimeRaw = "application/octet-stream" 13 | ) 14 | -------------------------------------------------------------------------------- /services/horizon/internal/render/sse/doc.go: -------------------------------------------------------------------------------- 1 | // This package contains the Server Sent Events implementation used by 2 | // horizon. 3 | package sse 4 | -------------------------------------------------------------------------------- /services/horizon/internal/resourceadapter/asset.go: -------------------------------------------------------------------------------- 1 | package resourceadapter 2 | 3 | import ( 4 | "context" 5 | 6 | protocol "github.com/stellar/go/protocols/horizon" 7 | "github.com/stellar/go/xdr" 8 | ) 9 | 10 | func PopulateAsset(ctx context.Context, dest *protocol.Asset, asset xdr.Asset) error { 11 | return asset.Extract(&dest.Type, &dest.Code, &dest.Issuer) 12 | } 13 | -------------------------------------------------------------------------------- /services/horizon/internal/scripts/check_release_hash/README.md: -------------------------------------------------------------------------------- 1 | # check_release_hash 2 | 3 | Docker image for comparing releases hash to a local builds hash. 4 | 5 | ## Usage 6 | 7 | 1. Build the image. Optionally pass `--build-arg` with `golang` image you want to use for compilation. See `Dockerfile` for a default value. 8 | 2. `docker run -e "TAG=horizon-vX.Y.Z" -e "PACKAGE_VERSION=X.Y.Z-BUILD_ID" check_release_hash` 9 | 3. Compare the hashes in the output. `released` directory contains packages from GitHub, `dist` are the locally built packages. -------------------------------------------------------------------------------- /services/horizon/internal/scripts/current_os.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "runtime" 6 | ) 7 | 8 | func main() { 9 | fmt.Println(runtime.GOOS) 10 | } 11 | -------------------------------------------------------------------------------- /services/horizon/internal/scripts/dev.bash: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | set -e 4 | 5 | mcdev-each-change go test {{.Pkg}} 6 | -------------------------------------------------------------------------------- /services/horizon/internal/scripts/rebuild_schema.bash: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | set -e 3 | 4 | # This scripts rebuilds the latest.sql file included in the schema package. 5 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 6 | GOTOP="$( cd "$DIR/../../../../../../../.." && pwd )" 7 | 8 | go generate github.com/stellar/go/services/horizon/internal/db2/schema 9 | go generate github.com/stellar/go/services/horizon/internal/test 10 | go install github.com/stellar/go/services/horizon 11 | -------------------------------------------------------------------------------- /services/horizon/internal/test/log.go: -------------------------------------------------------------------------------- 1 | package test 2 | 3 | import ( 4 | "github.com/sirupsen/logrus" 5 | "github.com/stellar/go/support/log" 6 | ) 7 | 8 | var testLogger *log.Entry 9 | 10 | func init() { 11 | testLogger = log.New() 12 | testLogger.DisableColors() 13 | testLogger.SetLevel(logrus.DebugLevel) 14 | } 15 | -------------------------------------------------------------------------------- /services/horizon/internal/test/static_mock_server.go: -------------------------------------------------------------------------------- 1 | package test 2 | 3 | import ( 4 | "fmt" 5 | "net/http" 6 | "net/http/httptest" 7 | ) 8 | 9 | // NewStaticMockServer creates a new mock server that always responds with 10 | // `response` 11 | func NewStaticMockServer(response string) *StaticMockServer { 12 | result := &StaticMockServer{} 13 | result.Server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 14 | result.LastRequest = r 15 | fmt.Fprintln(w, response) 16 | })) 17 | 18 | return result 19 | } 20 | -------------------------------------------------------------------------------- /services/horizon/internal/tls/localhost.conf: -------------------------------------------------------------------------------- 1 | [ req ] 2 | distinguished_name = req_distinguished_name 3 | 4 | [ req_distinguished_name ] 5 | C = US 6 | C_default = US 7 | ST = California 8 | ST_default = California 9 | L = San Francisco 10 | L_default = San Francisco 11 | O = Stellar Development Foundation 12 | O_default = Stellar Development Foundation 13 | OU = Engineering 14 | OU_default = Engineering 15 | CN = localhost:8000 16 | CN_default = localhost:8000 17 | emailAddress_default = 18 | -------------------------------------------------------------------------------- /services/horizon/internal/tls/regen.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 6 | pushd $DIR 7 | 8 | openssl genrsa -des3 -passout pass:x -out new.pass.key 2048 9 | openssl rsa -passin pass:x -in new.pass.key -out new.key 10 | rm new.pass.key 11 | openssl req -new -key new.key -out new.csr -config localhost.conf 12 | openssl x509 -req -days 365 -in new.csr -signkey new.key -out new.crt 13 | 14 | mv new.csr server.csr 15 | mv new.crt server.crt 16 | mv new.key server.key 17 | -------------------------------------------------------------------------------- /services/horizon/internal/txsub/doc.go: -------------------------------------------------------------------------------- 1 | // Package txsub provides the machinery that horizon uses to submit transactions to 2 | // the stellar network and track their progress. It also helps to hide some of the 3 | // complex asynchronous nature of transaction submission, waiting to respond to 4 | // submitters when no definitive state is known. 5 | package txsub 6 | 7 | // Package layout: 8 | // - main.go: interface and result types 9 | // - errors.go: error definitions exposed by txsub 10 | // - system.go: txsub.System, the struct that ties all the interfaces together 11 | // - open_submission_list.go: A default implementation of the OpenSubmissionList interface 12 | // - submitter.go: A default implementation of the Submitter interface 13 | -------------------------------------------------------------------------------- /services/horizon/internal/utf8/main_test.go: -------------------------------------------------------------------------------- 1 | package utf8 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stellar/go/services/horizon/internal/test" 7 | ) 8 | 9 | func TestScrub(t *testing.T) { 10 | tt := test.Start(t) 11 | defer tt.Finish() 12 | 13 | tt.Assert.Equal("scott", Scrub("scott")) 14 | tt.Assert.Equal("scött", Scrub("scött")) 15 | tt.Assert.Equal("�(", Scrub(string([]byte{0xC3, 0x28}))) 16 | } 17 | -------------------------------------------------------------------------------- /services/horizon/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | 7 | "github.com/stellar/go/services/horizon/cmd" 8 | ) 9 | 10 | func main() { 11 | err := cmd.Execute() 12 | if e, ok := err.(cmd.ErrExitCode); ok { 13 | os.Exit(int(e)) 14 | } else if err != nil { 15 | fmt.Fprintln(os.Stderr, err) 16 | os.Exit(1) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /services/keystore/Makefile: -------------------------------------------------------------------------------- 1 | # Check if we need to prepend docker commands with sudo 2 | SUDO := $(shell docker version >/dev/null 2>&1 || echo "sudo") 3 | 4 | # If TAG is not provided set default value 5 | TAG ?= stellar/keystore:$(shell git rev-parse --short HEAD)$(and $(shell git status -s),-dirty-$(shell id -u -n)) 6 | # https://github.com/opencontainers/image-spec/blob/master/annotations.md 7 | BUILD_DATE := $(shell date -u +%FT%TZ) 8 | 9 | docker-build: 10 | cd ../../ && \ 11 | $(SUDO) docker build --pull --label org.opencontainers.image.created="$(BUILD_DATE)" \ 12 | -f services/keystore/docker/Dockerfile -t $(TAG) . 13 | 14 | docker-push: 15 | cd ../../ && \ 16 | $(SUDO) docker push $(TAG) 17 | -------------------------------------------------------------------------------- /services/keystore/README.md: -------------------------------------------------------------------------------- 1 | # Keystore 2 | -------------------------------------------------------------------------------- /services/keystore/attachments/2019-07-10-keystore-auth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/services/keystore/attachments/2019-07-10-keystore-auth.png -------------------------------------------------------------------------------- /services/keystore/cmd/keystored/dev.go: -------------------------------------------------------------------------------- 1 | //go:build !aws 2 | // +build !aws 3 | 4 | package main 5 | 6 | import ( 7 | "github.com/stellar/go/services/keystore" 8 | "github.com/stellar/go/support/env" 9 | ) 10 | 11 | func getConfig() *keystore.Config { 12 | return &keystore.Config{ 13 | DBURL: env.String("KEYSTORE_DATABASE_URL", "postgres:///keystore?sslmode=disable"), 14 | MaxIdleDBConns: env.Int("DB_MAX_IDLE_CONNS", 5), 15 | MaxOpenDBConns: env.Int("DB_MAX_OPEN_CONNS", 5), 16 | AUTHURL: env.String("KEYSTORE_AUTHFORWARDING_URL", ""), 17 | ListenerPort: env.Int("KEYSTORE_LISTENER_PORT", 8000), 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /services/keystore/context.go: -------------------------------------------------------------------------------- 1 | package keystore 2 | 3 | import "context" 4 | 5 | type contextKey int 6 | 7 | const userKey contextKey = iota 8 | 9 | func userID(ctx context.Context) string { 10 | uid, _ := ctx.Value(userKey).(string) 11 | return uid 12 | } 13 | 14 | func withUserID(ctx context.Context, userID string) context.Context { 15 | return context.WithValue(ctx, userKey, userID) 16 | } 17 | -------------------------------------------------------------------------------- /services/keystore/db_test.go: -------------------------------------------------------------------------------- 1 | package keystore 2 | 3 | import ( 4 | "testing" 5 | 6 | migrate "github.com/rubenv/sql-migrate" 7 | "github.com/stellar/go/support/db/dbtest" 8 | ) 9 | 10 | // TODO: creating a DB for every single test is inefficient. Maybe we can 11 | // improve our dbtest package so that we can just get a transaction. 12 | func openKeystoreDB(t *testing.T) *dbtest.DB { 13 | db := dbtest.Postgres(t) 14 | migrations := &migrate.FileMigrationSource{ 15 | Dir: "migrations", 16 | } 17 | 18 | conn := db.Open() 19 | defer conn.Close() 20 | 21 | _, err := migrate.Exec(conn.DB, "postgres", migrations, migrate.Up) 22 | if err != nil { 23 | t.Fatal(err) 24 | } 25 | return db 26 | } 27 | -------------------------------------------------------------------------------- /services/keystore/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.19.1 as build 2 | 3 | ADD . /src/keystore 4 | WORKDIR /src/keystore 5 | RUN go build -o /bin/keystored ./services/keystore/cmd/keystored 6 | 7 | 8 | FROM ubuntu:18.04 9 | 10 | RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates 11 | ADD ./services/keystore/migrations/ /app/migrations/ 12 | COPY --from=build /bin/keystored /app/ 13 | EXPOSE 8000 14 | ENTRYPOINT ["/app/keystored"] 15 | CMD ["serve"] 16 | -------------------------------------------------------------------------------- /services/keystore/migrations/2019-05-23.0.initial-migrations.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | CREATE TABLE public.encrypted_keys ( 4 | user_id text NOT NULL PRIMARY KEY, 5 | encrypted_keys_data bytea NOT NULL, 6 | salt text NOT NULL, 7 | encrypter_name text NOT NULL, 8 | created_at timestamp with time zone NOT NULL DEFAULT NOW(), 9 | modified_at timestamp with time zone 10 | ); 11 | 12 | -- +migrate Down 13 | 14 | DROP TABLE public.encrypted_keys; 15 | -------------------------------------------------------------------------------- /services/keystore/migrations/2019-08-20.0.update-encrypted-keys.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | ALTER TABLE public.encrypted_keys 4 | DROP COLUMN salt, 5 | DROP COLUMN encrypter_name, 6 | DROP COLUMN encrypted_keys_data; 7 | 8 | TRUNCATE public.encrypted_keys; 9 | 10 | ALTER TABLE public.encrypted_keys 11 | ADD COLUMN encrypted_keys_data jsonb NOT NULL; 12 | 13 | -- +migrate Down 14 | 15 | ALTER TABLE public.encrypted_keys 16 | DROP COLUMN encrypted_keys_data; 17 | 18 | ALTER TABLE public.encrypted_keys 19 | ADD COLUMN salt text NOT NULL, 20 | ADD COLUMN encrypter_name text NOT NULL, 21 | ADD COLUMN encrypted_keys_data bytea NOT NULL; 22 | -------------------------------------------------------------------------------- /services/keystore/service.go: -------------------------------------------------------------------------------- 1 | package keystore 2 | 3 | import ( 4 | "context" 5 | "database/sql" 6 | ) 7 | 8 | const ( 9 | REST = "REST" 10 | GraphQL = "GRAPHQL" 11 | ) 12 | 13 | type Config struct { 14 | DBURL string 15 | MaxIdleDBConns int 16 | MaxOpenDBConns int 17 | 18 | AUTHURL string 19 | 20 | ListenerPort int 21 | } 22 | 23 | type Authenticator struct { 24 | URL string 25 | APIType string 26 | //GraphQL related fields will be added later 27 | } 28 | 29 | type Service struct { 30 | db *sql.DB 31 | authenticator *Authenticator 32 | } 33 | 34 | func NewService(ctx context.Context, db *sql.DB, authenticator *Authenticator) *Service { 35 | return &Service{db: db, authenticator: authenticator} 36 | } 37 | -------------------------------------------------------------------------------- /services/keystore/tls/localhost.conf: -------------------------------------------------------------------------------- 1 | [ req ] 2 | distinguished_name = req_distinguished_name 3 | 4 | [ req_distinguished_name ] 5 | C = US 6 | C_default = US 7 | ST = New York 8 | ST_default = New York 9 | L = New York 10 | L_default = New York 11 | O = Stellar Development Foundation 12 | O_default = Stellar Development Foundation 13 | OU = Engineering 14 | OU_default = Engineering 15 | CN = localhost:8443 16 | CN_default = localhost:8443 17 | emailAddress_default = 18 | -------------------------------------------------------------------------------- /services/keystore/tls/regen.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 6 | pushd $DIR 7 | 8 | openssl genrsa -des3 -passout pass:x -out new.pass.key 2048 9 | openssl rsa -passin pass:x -in new.pass.key -out new.key 10 | rm new.pass.key 11 | openssl req -new -key new.key -out new.csr -config localhost.conf 12 | openssl x509 -req -days 365 -in new.csr -signkey new.key -out new.crt 13 | 14 | mv new.csr server.csr 15 | mv new.crt server.crt 16 | mv new.key server.key 17 | -------------------------------------------------------------------------------- /services/regulated-assets-approval-server/.gitignore: -------------------------------------------------------------------------------- 1 | /.env -------------------------------------------------------------------------------- /services/regulated-assets-approval-server/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. This 4 | project adheres to [Semantic Versioning](http://semver.org/). 5 | 6 | As this project is pre 1.0, breaking changes may happen for minor version bumps. 7 | A breaking change will get clearly notified in this log. 8 | 9 | ## Unreleased 10 | 11 | Initial release. 12 | -------------------------------------------------------------------------------- /services/regulated-assets-approval-server/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.23-bullseye as build 2 | 3 | ADD . /src/regulated-assets-approval-server 4 | WORKDIR /src/regulated-assets-approval-server 5 | RUN go build -o /bin/regulated-assets-approval-server ./services/regulated-assets-approval-server 6 | 7 | 8 | FROM ubuntu:22.04 9 | 10 | RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates 11 | COPY --from=build /bin/regulated-assets-approval-server /app/ 12 | EXPOSE 8000 13 | ENTRYPOINT ["/app/regulated-assets-approval-server"] 14 | CMD ["serve"] 15 | -------------------------------------------------------------------------------- /services/regulated-assets-approval-server/internal/db/db.go: -------------------------------------------------------------------------------- 1 | package db 2 | 3 | import ( 4 | "github.com/jmoiron/sqlx" 5 | _ "github.com/lib/pq" 6 | ) 7 | 8 | func Open(dataSourceName string) (*sqlx.DB, error) { 9 | return sqlx.Open("postgres", dataSourceName) 10 | } 11 | -------------------------------------------------------------------------------- /services/regulated-assets-approval-server/internal/db/dbmigrate/migrations/2021-05-05.0.initial.sql: -------------------------------------------------------------------------------- 1 | -- This migration file is intentionally empty and is a first starting point for 2 | -- our migrations before we yet have a schema. 3 | 4 | -- +migrate Up 5 | 6 | -- +migrate Down 7 | 8 | -------------------------------------------------------------------------------- /services/regulated-assets-approval-server/internal/db/dbmigrate/migrations/2021-05-18.0.accounts-kyc-status.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | CREATE TABLE public.accounts_kyc_status ( 4 | stellar_address text NOT NULL PRIMARY KEY, 5 | callback_id text NOT NULL, 6 | email_address text, 7 | created_at timestamp with time zone NOT NULL DEFAULT NOW(), 8 | kyc_submitted_at timestamp with time zone, 9 | approved_at timestamp with time zone, 10 | rejected_at timestamp with time zone 11 | ); 12 | 13 | -- +migrate Down 14 | 15 | DROP TABLE public.accounts_kyc_status; -------------------------------------------------------------------------------- /services/regulated-assets-approval-server/internal/db/dbmigrate/migrations/2021-06-08.0.pending-kyc-status.sql: -------------------------------------------------------------------------------- 1 | -- +migrate Up 2 | 3 | ALTER TABLE public.accounts_kyc_status 4 | ADD COLUMN pending_at timestamp with time zone; 5 | 6 | -- +migrate Down 7 | 8 | ALTER TABLE public.accounts_kyc_status 9 | DROP COLUMN pending_at; 10 | -------------------------------------------------------------------------------- /services/regulated-assets-approval-server/internal/db/dbtest/dbtest_test.go: -------------------------------------------------------------------------------- 1 | package dbtest 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/assert" 7 | "github.com/stretchr/testify/require" 8 | ) 9 | 10 | func TestOpen(t *testing.T) { 11 | db := Open(t) 12 | session := db.Open() 13 | 14 | count := 0 15 | err := session.Get(&count, `SELECT COUNT(*) FROM gorp_migrations`) 16 | require.NoError(t, err) 17 | assert.Greater(t, count, 0) 18 | } 19 | -------------------------------------------------------------------------------- /services/regulated-assets-approval-server/internal/serve/middleware.go: -------------------------------------------------------------------------------- 1 | package serve 2 | 3 | import ( 4 | "net/http" 5 | 6 | "github.com/rs/cors" 7 | ) 8 | 9 | func corsHandler(next http.Handler) http.Handler { 10 | cors := cors.New(cors.Options{ 11 | AllowedOrigins: []string{"*"}, 12 | AllowedHeaders: []string{"*"}, 13 | AllowedMethods: []string{"GET", "PUT", "POST", "PATCH", "DELETE", "HEAD", "OPTIONS"}, 14 | }) 15 | return cors.Handler(next) 16 | } 17 | -------------------------------------------------------------------------------- /services/ticker/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | internal/docs/public 3 | /.env 4 | /.go 5 | /tmp/ 6 | /pkg 7 | /bin 8 | /dist 9 | /vendor/pkg 10 | /vendor/bin 11 | /vendor/src 12 | /.vscode/last.sql 13 | /.vscode/temp.sql 14 | /.vscode/* 15 | *.bts 16 | *.swp 17 | *.swo 18 | 19 | /test.go 20 | /tls/*.crt 21 | /tls/*.key 22 | /tls/*.csr 23 | 24 | docker/db 25 | -------------------------------------------------------------------------------- /services/ticker/.gqlconfig: -------------------------------------------------------------------------------- 1 | { 2 | schema: { 3 | files: 'internal/gql/**/*.gql' 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /services/ticker/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## Unreleased 2 | 3 | * Dropped support for Go 1.12. 4 | * Dropped support for Go 1.13. 5 | 6 | 7 | ## [v1.2.0] - 2019-11-20 8 | - Add `ReadTimeout` to Ticker HTTP server configuration to fix potential DoS vector. 9 | - Added nested `"issuer_detail"` field to `/assets.json`. 10 | - Dropped support for Go 1.10, 1.11. 11 | 12 | 13 | ## [v1.1.0] - 2019-07-22 14 | 15 | - Added support for running the ticker on Stellar's Test Network, by using the `--testnet` CLI flag. 16 | - The ticker now retries requests to Horizon if it gets rate-limited. 17 | - Minor bug fixes and performance improvements. 18 | 19 | 20 | ## [v1.0.0] - 2019-05-20 21 | 22 | Initial release of the ticker. 23 | -------------------------------------------------------------------------------- /services/ticker/dbconfig.yml: -------------------------------------------------------------------------------- 1 | development: 2 | dialect: postgres 3 | datasource: dbname=stellarticker01 sslmode=disable 4 | dir: internal/tickerdb/migrations 5 | table: migrations 6 | -------------------------------------------------------------------------------- /services/ticker/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.19.1 as build 2 | 3 | ADD . /src/ticker 4 | WORKDIR /src/ticker 5 | RUN go build -o /bin/ticker ./services/ticker 6 | 7 | 8 | FROM ubuntu:22.04 9 | 10 | RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates 11 | COPY --from=build /bin/ticker /app/ 12 | EXPOSE 8000 13 | ENTRYPOINT ["/app/ticker"] 14 | -------------------------------------------------------------------------------- /services/ticker/docker/Dockerfile-dev: -------------------------------------------------------------------------------- 1 | FROM golang:1.19.1 as build 2 | 3 | LABEL maintainer="Alex Cordeiro " 4 | 5 | EXPOSE 5432 6 | EXPOSE 8000 7 | 8 | ADD . /src/ticker 9 | WORKDIR /src/ticker 10 | RUN go build -o /opt/stellar/bin/ticker ./services/ticker/ 11 | 12 | WORKDIR /src/ticker/services/ticker/docker/ 13 | RUN ["chmod", "+x", "./dependencies"] 14 | RUN ["./dependencies"] 15 | RUN ["chmod", "+x", "setup"] 16 | RUN ["./setup"] 17 | RUN ["cp", "-r", "conf", "/opt/stellar/conf"] 18 | RUN ["crontab", "-u", "stellar", "/opt/stellar/conf/crontab.txt"] 19 | RUN ["chmod", "+x", "start"] 20 | 21 | ENTRYPOINT ["/src/ticker/services/ticker/docker/start"] 22 | -------------------------------------------------------------------------------- /services/ticker/docker/conf/.pgpass: -------------------------------------------------------------------------------- 1 | *:*:*:stellar:__PGPASS__ 2 | -------------------------------------------------------------------------------- /services/ticker/docker/dependencies: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | # Required for using a newer PostgreSQL version: 5 | wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O- | apt-key add - 6 | echo "deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main" | tee /etc/apt/sources.list.d/postgresql.list 7 | 8 | 9 | # Install dependencies: 10 | apt-get update 11 | apt-get install -y \ 12 | curl \ 13 | git \ 14 | libpq-dev \ 15 | postgresql-client-9.5 \ 16 | postgresql-9.5 \ 17 | postgresql-contrib-9.5 \ 18 | sudo \ 19 | vim \ 20 | supervisor \ 21 | nginx \ 22 | cron 23 | apt-get clean 24 | -------------------------------------------------------------------------------- /services/ticker/docker/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | useradd --uid 10011001 --home-dir /home/stellar --no-log-init stellar \ 5 | && mkdir -p /home/stellar \ 6 | && chown -R stellar:stellar /home/stellar 7 | 8 | mkdir -p /opt/stellar/bin 9 | mkdir -p /opt/stellar/www 10 | chown -R stellar:stellar /opt/stellar/www 11 | mkdir -p /opt/stellar/postgresql/data 12 | -------------------------------------------------------------------------------- /services/ticker/docs/images/StellarTicker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/services/ticker/docs/images/StellarTicker.png -------------------------------------------------------------------------------- /services/ticker/internal/actions_graphql.go: -------------------------------------------------------------------------------- 1 | package ticker 2 | 3 | import ( 4 | "github.com/stellar/go/services/ticker/internal/gql" 5 | "github.com/stellar/go/services/ticker/internal/tickerdb" 6 | hlog "github.com/stellar/go/support/log" 7 | ) 8 | 9 | func StartGraphQLServer(s *tickerdb.TickerSession, l *hlog.Entry, port string) { 10 | graphql := gql.New(s, l) 11 | 12 | graphql.Serve(port) 13 | } 14 | -------------------------------------------------------------------------------- /services/ticker/internal/gql/main_test.go: -------------------------------------------------------------------------------- 1 | package gql 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/graph-gophers/graphql-go" 7 | "github.com/stellar/go/services/ticker/internal/gql/static" 8 | ) 9 | 10 | func TestValidateSchema(t *testing.T) { 11 | r := resolver{} 12 | opts := []graphql.SchemaOpt{graphql.UseFieldResolvers()} 13 | graphql.MustParseSchema(static.Schema(), &r, opts...) 14 | } 15 | -------------------------------------------------------------------------------- /services/ticker/internal/gql/resolvers_issuer.go: -------------------------------------------------------------------------------- 1 | package gql 2 | 3 | import ( 4 | "context" 5 | "errors" 6 | 7 | "github.com/stellar/go/services/ticker/internal/tickerdb" 8 | ) 9 | 10 | // Issuers resolves the issuers() GraphQL query. 11 | func (r *resolver) Issuers(ctx context.Context) (issuers []*tickerdb.Issuer, err error) { 12 | dbIssuers, err := r.db.GetAllIssuers(ctx) 13 | if err != nil { 14 | // obfuscating sql errors to avoid exposing underlying 15 | // implementation 16 | err = errors.New("could not retrieve the requested data") 17 | } 18 | 19 | for i := range dbIssuers { 20 | issuers = append(issuers, &dbIssuers[i]) 21 | } 22 | 23 | return issuers, err 24 | } 25 | -------------------------------------------------------------------------------- /services/ticker/internal/scraper/helpers.go: -------------------------------------------------------------------------------- 1 | package scraper 2 | 3 | import "net/url" 4 | 5 | // nextCursor finds the cursor parameter on the "next" link of a hProtocol page. 6 | func nextCursor(nextPageURL string) (cursor string, err error) { 7 | u, err := url.Parse(nextPageURL) 8 | if err != nil { 9 | return 10 | } 11 | 12 | m, err := url.ParseQuery(u.RawQuery) 13 | if err != nil { 14 | return 15 | } 16 | cursor = m["cursor"][0] 17 | 18 | return 19 | } 20 | -------------------------------------------------------------------------------- /services/ticker/internal/tickerdb/migrations/20190405112544-increase_asset_code_size.sql: -------------------------------------------------------------------------------- 1 | 2 | -- +migrate Up 3 | ALTER TABLE public.assets 4 | ALTER COLUMN code type character varying(64); 5 | 6 | ALTER TABLE public.assets 7 | ALTER COLUMN anchor_asset_code type character varying(64); 8 | 9 | -- +migrate Down 10 | ALTER TABLE public.assets 11 | ALTER COLUMN code type character varying(12); 12 | 13 | ALTER TABLE public.assets 14 | ALTER COLUMN anchor_asset_code type character varying(12); 15 | -------------------------------------------------------------------------------- /services/ticker/internal/tickerdb/migrations/20190409172610-rename_assets_desc_description.sql: -------------------------------------------------------------------------------- 1 | 2 | -- +migrate Up 3 | ALTER TABLE public.assets 4 | RENAME COLUMN "desc" TO description; 5 | 6 | -- +migrate Down 7 | ALTER TABLE public.assets 8 | RENAME COLUMN description TO "desc"; 9 | -------------------------------------------------------------------------------- /services/ticker/internal/tickerdb/migrations/20190410094830-add_assets_issuer_account_field.sql: -------------------------------------------------------------------------------- 1 | 2 | -- +migrate Up 3 | ALTER TABLE public.assets 4 | ADD COLUMN issuer_account text NOT NULL; 5 | 6 | ALTER TABLE public.assets 7 | DROP CONSTRAINT assets_code_issuer_key; 8 | 9 | ALTER TABLE ONLY public.assets 10 | ADD CONSTRAINT assets_code_issuer_account UNIQUE (code, issuer_account); 11 | 12 | 13 | -- +migrate Down 14 | ALTER TABLE public.assets 15 | DROP COLUMN issuer_account; 16 | -------------------------------------------------------------------------------- /services/ticker/internal/tickerdb/migrations/20220909100700-trades_pk_to_bigint.sql: -------------------------------------------------------------------------------- 1 | 2 | -- +migrate Up 3 | ALTER TABLE trades ALTER COLUMN id TYPE BIGINT; 4 | ALTER SEQUENCE trades_id_seq AS BIGINT CYCLE; 5 | 6 | 7 | -- +migrate Down 8 | ALTER TABLE trades ALTER COLUMN id TYPE INT; 9 | ALTER SEQUENCE trades_id_seq AS INT NO CYCLE; 10 | -------------------------------------------------------------------------------- /services/ticker/internal/tickerdb/queries_orderbook.go: -------------------------------------------------------------------------------- 1 | package tickerdb 2 | 3 | import ( 4 | "context" 5 | ) 6 | 7 | // InsertOrUpdateOrderbookStats inserts an OrdebookStats entry on the database (if new), 8 | // or updates an existing one 9 | func (s *TickerSession) InsertOrUpdateOrderbookStats(ctx context.Context, o *OrderbookStats, preserveFields []string) (err error) { 10 | return s.performUpsertQuery(ctx, *o, "orderbook_stats", "orderbook_stats_base_counter_asset_key", preserveFields) 11 | } 12 | -------------------------------------------------------------------------------- /services/ticker/internal/utils/main_test.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/assert" 7 | ) 8 | 9 | func TestSliceDiff(t *testing.T) { 10 | slice1 := []string{"a", "b", "c"} 11 | slice2 := []string{"a", "b"} 12 | 13 | diff := SliceDiff(slice1, slice2) 14 | assert.Contains(t, diff, "c") 15 | assert.NotContains(t, diff, "a") 16 | assert.NotContains(t, diff, "b") 17 | assert.Equal(t, 1, len(diff)) 18 | } 19 | -------------------------------------------------------------------------------- /services/ticker/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "github.com/stellar/go/services/ticker/cmd" 4 | 5 | func main() { 6 | cmd.Execute() 7 | } 8 | -------------------------------------------------------------------------------- /staticcheck.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | set -e 3 | 4 | version='2024.1.1' 5 | 6 | staticcheck='go run honnef.co/go/tools/cmd/staticcheck@'"$version" 7 | 8 | printf "Running staticcheck $version...\n" 9 | 10 | ls -d */ \ 11 | | egrep -v '^vendor|^docs' \ 12 | | xargs -I {} $staticcheck -tests=false -checks="all,-ST1003,-SA1019,-ST1005,-ST1000,-ST1016,-S1039,-ST1021,-ST1020,-ST1019,-SA4022" ./{}... 13 | -------------------------------------------------------------------------------- /strkey/benchmark_test.go: -------------------------------------------------------------------------------- 1 | package strkey_test 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stellar/go/strkey" 7 | "github.com/stretchr/testify/require" 8 | ) 9 | 10 | func BenchmarkDecode_accountID(b *testing.B) { 11 | accountID, err := strkey.Encode(strkey.VersionByteAccountID, make([]byte, 32)) 12 | require.NoError(b, err) 13 | for i := 0; i < b.N; i++ { 14 | _, _ = strkey.Decode(strkey.VersionByteAccountID, accountID) 15 | } 16 | } 17 | 18 | func BenchmarkEncode_accountID(b *testing.B) { 19 | accountID := make([]byte, 32) 20 | for i := 0; i < b.N; i++ { 21 | _, _ = strkey.Encode(strkey.VersionByteAccountID, accountID) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /strkey/doc.go: -------------------------------------------------------------------------------- 1 | // Package strkey is an implementation of StrKey, the address scheme for the 2 | // StellarNetwork. 3 | package strkey 4 | -------------------------------------------------------------------------------- /strkey/internal/crc16/main_test.go: -------------------------------------------------------------------------------- 1 | package crc16 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/assert" 7 | ) 8 | 9 | func TestChecksum(t *testing.T) { 10 | result := Checksum([]byte{0x12, 0x34, 0x56, 0x78, 0x90}) 11 | assert.Equal(t, uint16(0x48e6), result) 12 | } 13 | 14 | func TestValidate(t *testing.T) { 15 | err := Validate([]byte{0x12, 0x34, 0x56, 0x78, 0x90}, 0x48e6) 16 | assert.NoError(t, err) 17 | 18 | err = Validate([]byte{0x12, 0x34, 0x56, 0x78, 0x90}, 0x48e7) 19 | assert.ErrorIs(t, err, ErrInvalidChecksum) 20 | } 21 | -------------------------------------------------------------------------------- /support/clock/clocktest/fixed.go: -------------------------------------------------------------------------------- 1 | package clocktest 2 | 3 | import ( 4 | "time" 5 | ) 6 | 7 | // FixedSource is a clock source that has its current time stopped and fixed at 8 | // a specific time. 9 | type FixedSource time.Time 10 | 11 | // Now returns the fixed source's constant time. 12 | func (s FixedSource) Now() time.Time { 13 | return time.Time(s) 14 | } 15 | -------------------------------------------------------------------------------- /support/collections/maps/map.go: -------------------------------------------------------------------------------- 1 | package maps 2 | 3 | func Keys[T comparable, U any](m map[T]U) []T { 4 | keys := make([]T, 0, len(m)) 5 | for key := range m { 6 | keys = append(keys, key) 7 | } 8 | return keys 9 | } 10 | 11 | func Values[T comparable, U any](m map[T]U) []U { 12 | values := make([]U, 0, len(m)) 13 | for _, value := range m { 14 | values = append(values, value) 15 | } 16 | return values 17 | } 18 | -------------------------------------------------------------------------------- /support/collections/maps/map_test.go: -------------------------------------------------------------------------------- 1 | package maps 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stellar/go/support/collections/set" 7 | "github.com/stretchr/testify/require" 8 | ) 9 | 10 | func TestSanity(t *testing.T) { 11 | m := map[int]float32{1: 10, 2: 20, 3: 30} 12 | for k, v := range m { 13 | require.Contains(t, Keys(m), k) 14 | require.Contains(t, Values(m), v) 15 | } 16 | 17 | // compatibility with collections/set.Set 18 | s := set.Set[float32]{} 19 | s.Add(1) 20 | s.Add(2) 21 | s.Add(3) 22 | 23 | for item := range s { 24 | require.Contains(t, Keys(s), item) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /support/collections/set/iset.go: -------------------------------------------------------------------------------- 1 | package set 2 | 3 | type ISet[T comparable] interface { 4 | Add(item T) 5 | AddSlice(items []T) 6 | Remove(item T) 7 | Contains(item T) bool 8 | Slice() []T 9 | } 10 | 11 | var _ ISet[int] = (*Set[int])(nil) // ensure conformity to the interface 12 | var _ ISet[int] = (*safeSet[int])(nil) 13 | -------------------------------------------------------------------------------- /support/collections/set/set_test.go: -------------------------------------------------------------------------------- 1 | package set 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/require" 7 | ) 8 | 9 | func TestSet(t *testing.T) { 10 | s := NewSet[string](10) 11 | s.Add("sanity") 12 | require.True(t, s.Contains("sanity")) 13 | require.False(t, s.Contains("check")) 14 | 15 | s.AddSlice([]string{"a", "b", "c"}) 16 | require.True(t, s.Contains("b")) 17 | require.ElementsMatch(t, []string{"sanity", "a", "b", "c"}, s.Slice()) 18 | } 19 | 20 | func TestSafeSet(t *testing.T) { 21 | s := NewSafeSet[string](0) 22 | s.Add("sanity") 23 | require.True(t, s.Contains("sanity")) 24 | require.False(t, s.Contains("check")) 25 | } 26 | -------------------------------------------------------------------------------- /support/compressxdr/mocks.go: -------------------------------------------------------------------------------- 1 | package compressxdr 2 | 3 | import ( 4 | "io" 5 | 6 | "github.com/stretchr/testify/mock" 7 | ) 8 | 9 | type MockXDRDecoder struct { 10 | mock.Mock 11 | } 12 | 13 | func (m *MockXDRDecoder) ReadFrom(r io.Reader) (int64, error) { 14 | args := m.Called(r) 15 | return args.Get(0).(int64), args.Error(1) 16 | } 17 | 18 | func (m *MockXDRDecoder) Unzip(r io.Reader) ([]byte, error) { 19 | args := m.Called(r) 20 | return args.Get(0).([]byte), args.Error(1) 21 | } 22 | -------------------------------------------------------------------------------- /support/compressxdr/testdata/FCD285FF--53312000.xdr.zstd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/support/compressxdr/testdata/FCD285FF--53312000.xdr.zstd -------------------------------------------------------------------------------- /support/config/invalid_config_error.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | ) 7 | 8 | func (err *InvalidConfigError) Error() string { 9 | fields := make([]string, 0, len(err.InvalidFields)) 10 | for key := range err.InvalidFields { 11 | fields = append(fields, key) 12 | } 13 | 14 | return fmt.Sprintf(`invalid fields: %s`, strings.Join(fields, ",")) 15 | } 16 | -------------------------------------------------------------------------------- /support/contractevents/fixtures/transfer_event_xdr.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/support/contractevents/fixtures/transfer_event_xdr.bin -------------------------------------------------------------------------------- /support/datastore/datastore_test.go: -------------------------------------------------------------------------------- 1 | package datastore 2 | 3 | import ( 4 | "context" 5 | "testing" 6 | 7 | "github.com/stretchr/testify/require" 8 | ) 9 | 10 | func TestInvalidStore(t *testing.T) { 11 | _, err := NewDataStore(context.Background(), DataStoreConfig{Type: "unknown"}) 12 | require.Error(t, err) 13 | } 14 | -------------------------------------------------------------------------------- /support/db/errors.go: -------------------------------------------------------------------------------- 1 | package db 2 | 3 | // NoRowsError is returned when an insert is attempted without providing any 4 | // values to insert. 5 | type NoRowsError struct { 6 | } 7 | 8 | func (err *NoRowsError) Error() string { 9 | return "no rows provided to insert" 10 | } 11 | 12 | var _ error = &NoRowsError{} 13 | -------------------------------------------------------------------------------- /support/db/get_builder_test.go: -------------------------------------------------------------------------------- 1 | package db 2 | 3 | import ( 4 | "context" 5 | "testing" 6 | 7 | "github.com/stellar/go/support/db/dbtest" 8 | "github.com/stretchr/testify/assert" 9 | ) 10 | 11 | func TestGetBuilder_Exec(t *testing.T) { 12 | db := dbtest.Postgres(t).Load(testSchema) 13 | defer db.Close() 14 | sess := &Session{DB: db.Open()} 15 | defer sess.DB.Close() 16 | 17 | var found person 18 | 19 | tbl := sess.GetTable("people") 20 | err := tbl.Get(&found, "name = ?", "scott").Exec(context.Background()) 21 | 22 | if assert.NoError(t, err, "query error") { 23 | assert.Equal(t, "scott", found.Name) 24 | assert.Equal(t, "1000000", found.HungerLevel) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /support/db/pg/pg.go: -------------------------------------------------------------------------------- 1 | package pg 2 | 3 | import ( 4 | "github.com/lib/pq" 5 | "github.com/stellar/go/support/errors" 6 | ) 7 | 8 | func IsUniqueViolation(err error) bool { 9 | switch pgerr := errors.Cause(err).(type) { 10 | case *pq.Error: 11 | return string(pgerr.Code) == "23505" 12 | default: 13 | return false 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /support/http/httptest/client.go: -------------------------------------------------------------------------------- 1 | package httptest 2 | 3 | // On is the entrypoint method into this packages "client" mocking system. 4 | func (c *Client) On(method string, url string) *ClientExpectation { 5 | return &ClientExpectation{ 6 | Method: method, 7 | URL: url, 8 | Client: c, 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /support/http/mutil/main.go: -------------------------------------------------------------------------------- 1 | // Package mutil contains various functions that are helpful when writing http 2 | // middleware. 3 | package mutil 4 | -------------------------------------------------------------------------------- /support/keypairgen/keypairgentest/slice.go: -------------------------------------------------------------------------------- 1 | package keypairgentest 2 | 3 | import ( 4 | "github.com/stellar/go/keypair" 5 | ) 6 | 7 | // SliceSource is a keypairgen.Generator source that has the values returned 8 | // from a slice of keys that are provided at generation one at a time. 9 | type SliceSource []*keypair.Full 10 | 11 | // Generate returns the first key in the slice, and then shortens the slice 12 | // removing the returned key, so that each call returns the next key in the 13 | // original source. If called when no keys are available the function will 14 | // panic. 15 | func (s *SliceSource) Generate() (*keypair.Full, error) { 16 | kp := (*s)[0] 17 | *s = (*s)[1:] 18 | return kp, nil 19 | } 20 | -------------------------------------------------------------------------------- /support/log/doc.go: -------------------------------------------------------------------------------- 1 | // Package log provides the common logging facilities used by the Stellar 2 | // Development foundation. 3 | // 4 | // You may notice that this package does not expose the "Fatal" family of 5 | // logging functions: this is intentional. This package is specifically geared 6 | // to logging within the context of an http server, and our chosen path for 7 | // responding to "Oh my god something is horribly wrong" within the context 8 | // of an HTTP request is to panic on that request. 9 | package log 10 | -------------------------------------------------------------------------------- /support/log/entry_test.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | import ( 4 | "bytes" 5 | "testing" 6 | 7 | "github.com/stretchr/testify/assert" 8 | ) 9 | 10 | func TestEntry_StartTest(t *testing.T) { 11 | var out bytes.Buffer 12 | e := New() 13 | e.SetOutput(&out) 14 | 15 | // when in test mode, out gets no output 16 | done := e.StartTest(WarnLevel) 17 | e.Warn("hello") 18 | logged := done() 19 | 20 | assert.Empty(t, out.String()) 21 | if assert.Len(t, logged, 1) { 22 | assert.Equal(t, "hello", logged[0].Message) 23 | } 24 | 25 | e.Warn("goodbye") 26 | assert.Contains(t, out.String(), "goodbye", "output was not logged after test") 27 | } 28 | -------------------------------------------------------------------------------- /support/ordered/math_test.go: -------------------------------------------------------------------------------- 1 | package ordered 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/require" 7 | ) 8 | 9 | func TestMinMax(t *testing.T) { 10 | t.Run("int", func(tt *testing.T) { 11 | a, b := -5, 10 12 | require.Equal(tt, Min(a, b), a) 13 | require.Equal(tt, Max(a, b), b) 14 | }) 15 | 16 | t.Run("float", func(tt *testing.T) { 17 | a, b := -5.0, 10.0 18 | require.Equal(tt, Min(a, b), a) 19 | require.Equal(tt, Max(a, b), b) 20 | }) 21 | 22 | t.Run("unsigned", func(tt *testing.T) { 23 | a, b := uint(5), uint(10) 24 | require.Equal(tt, Min(a, b), a) 25 | require.Equal(tt, Max(a, b), b) 26 | }) 27 | } 28 | -------------------------------------------------------------------------------- /support/render/hal/handler.go: -------------------------------------------------------------------------------- 1 | package hal 2 | 3 | import ( 4 | "context" 5 | "net/http" 6 | 7 | "github.com/stellar/go/support/render/httpjson" 8 | ) 9 | 10 | func Handler(fn, param interface{}) (http.Handler, error) { 11 | return httpjson.Handler(fn, param, httpjson.HALJSON) 12 | } 13 | 14 | func ExecuteFunc(ctx context.Context, fn, param interface{}) (interface{}, bool, error) { 15 | return httpjson.ExecuteFunc(ctx, fn, param, httpjson.HALJSON) 16 | } 17 | -------------------------------------------------------------------------------- /support/render/hal/io.go: -------------------------------------------------------------------------------- 1 | package hal 2 | 3 | import ( 4 | "net/http" 5 | 6 | "github.com/stellar/go/support/render/httpjson" 7 | ) 8 | 9 | // Render write data to w, after marshaling to json 10 | func Render(w http.ResponseWriter, data interface{}) { 11 | httpjson.Render(w, data, httpjson.HALJSON) 12 | } 13 | -------------------------------------------------------------------------------- /support/render/hal/link.go: -------------------------------------------------------------------------------- 1 | package hal 2 | 3 | import ( 4 | "strings" 5 | ) 6 | 7 | type Link struct { 8 | Href string `json:"href"` 9 | Templated bool `json:"templated,omitempty"` 10 | } 11 | 12 | func (l *Link) PopulateTemplated() { 13 | l.Templated = strings.Contains(l.Href, "{") 14 | } 15 | 16 | func NewLink(href string) Link { 17 | l := Link{Href: href} 18 | l.PopulateTemplated() 19 | return l 20 | } 21 | -------------------------------------------------------------------------------- /support/render/hal/paging_token.go: -------------------------------------------------------------------------------- 1 | package hal 2 | 3 | // Pageable implementors can be added to hal.Page collections 4 | type Pageable interface { 5 | PagingToken() string 6 | } 7 | -------------------------------------------------------------------------------- /support/render/health/doc.go: -------------------------------------------------------------------------------- 1 | // Package health contains simple utilities for implementing a /health endpoint 2 | // that adheres to the requirements defined in the draft IETF network working 3 | // group standard, Health Check Response Format for HTTP APIs. 4 | // 5 | // https://tools.ietf.org/id/draft-inadarei-api-health-check-01.html 6 | package health 7 | -------------------------------------------------------------------------------- /support/render/health/handler.go: -------------------------------------------------------------------------------- 1 | package health 2 | 3 | import ( 4 | "net/http" 5 | 6 | "github.com/stellar/go/support/render/httpjson" 7 | ) 8 | 9 | // PassHandler implements a simple handler that returns the most basic health 10 | // response with a status of 'pass'. 11 | type PassHandler struct{} 12 | 13 | func (h PassHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { 14 | response := Response{ 15 | Status: StatusPass, 16 | } 17 | httpjson.Render(w, response, httpjson.HEALTHJSON) 18 | } 19 | -------------------------------------------------------------------------------- /support/render/health/response.go: -------------------------------------------------------------------------------- 1 | package health 2 | 3 | // Response implements the most basic required fields for the health response 4 | // based on the format defined in the draft IETF network working group 5 | // standard, Health Check Response Format for HTTP APIs. 6 | // 7 | // https://tools.ietf.org/id/draft-inadarei-api-health-check-01.html 8 | type Response struct { 9 | Status Status `json:"status"` 10 | } 11 | -------------------------------------------------------------------------------- /support/render/health/status.go: -------------------------------------------------------------------------------- 1 | package health 2 | 3 | // Status indicates whether the service is health or not. 4 | type Status string 5 | 6 | const ( 7 | // StatusPass indicates that the service is healthy. 8 | StatusPass Status = "pass" 9 | // StatusFail indicates that the service is unhealthy. 10 | StatusFail Status = "fail" 11 | ) 12 | -------------------------------------------------------------------------------- /support/scripts/README.md: -------------------------------------------------------------------------------- 1 | This directory contains simple go programs and/or bash scripts that aid in the development of this repo. Build scripts, linting scripts, etc. 2 | 3 | 4 | ## `build_release_artifacts` 5 | 6 | This simple go application that travis uses to build our release packages. -------------------------------------------------------------------------------- /support/strutils/main.go: -------------------------------------------------------------------------------- 1 | package strutils 2 | 3 | import "strings" 4 | 5 | // KebabToConstantCase converts a string from lower-case-dashes to UPPER_CASE_UNDERSCORES. 6 | func KebabToConstantCase(kebab string) (constantCase string) { 7 | constantCase = strings.ToUpper(kebab) 8 | constantCase = strings.Replace(constantCase, "-", "_", -1) 9 | 10 | return constantCase 11 | } 12 | -------------------------------------------------------------------------------- /support/strutils/main_test.go: -------------------------------------------------------------------------------- 1 | package strutils 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/assert" 7 | ) 8 | 9 | func TestKebabToConstantCase(t *testing.T) { 10 | assert.Equal(t, "ENABLE_ASSET_STATS", KebabToConstantCase("enable-asset-stats"), "ordinary use") 11 | assert.Equal(t, "ABC_DEF", KebabToConstantCase("ABC_DEF"), "ignores uppercase and underscores") 12 | } 13 | -------------------------------------------------------------------------------- /tools/alb-replay/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 2021-08-04 2 | 3 | Initial version 4 | -------------------------------------------------------------------------------- /tools/archive-reader/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## Changelog 2 | -------------------------------------------------------------------------------- /tools/archive-reader/README.md: -------------------------------------------------------------------------------- 1 | # Archive Reader 2 | -------------------------------------------------------------------------------- /tools/goreplay-middleware/CHANGELOG.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/tools/goreplay-middleware/CHANGELOG.md -------------------------------------------------------------------------------- /tools/goreplay-middleware/README.md: -------------------------------------------------------------------------------- 1 | # goreplay-middleware -------------------------------------------------------------------------------- /tools/horizon-cmp/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 2019-04-25 2 | 3 | Initial version 4 | -------------------------------------------------------------------------------- /tools/horizon-cmp/internal/route_counter_test.go: -------------------------------------------------------------------------------- 1 | package cmp 2 | 3 | import ( 4 | "fmt" 5 | "testing" 6 | 7 | "github.com/stretchr/testify/assert" 8 | ) 9 | 10 | func TestMakeRoute(t *testing.T) { 11 | var testCases = []struct { 12 | Input string 13 | Output string 14 | }{ 15 | {"/accounts/*/payments", "^/accounts/[^?/]+/payments[?/]?[^/]*$"}, 16 | {"/accounts/*", "^/accounts/[^?/]+[?/]?[^/]*$"}, 17 | {"/accounts", "^/accounts[?/]?[^/]*$"}, 18 | } 19 | 20 | for _, tc := range testCases { 21 | t.Run(fmt.Sprintf("%s -> %s", tc.Input, tc.Output), func(t *testing.T) { 22 | assert.Equal(t, tc.Output, MakeRoute(tc.Input).regexp.String()) 23 | }) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /tools/horizon-cmp/internal/scanner.go: -------------------------------------------------------------------------------- 1 | package cmp 2 | 3 | import "bufio" 4 | 5 | type Scanner struct { 6 | *bufio.Scanner 7 | linesRead int 8 | } 9 | 10 | func (s *Scanner) Scan() bool { 11 | ret := s.Scanner.Scan() 12 | if ret { 13 | s.linesRead++ 14 | } 15 | return ret 16 | } 17 | 18 | func (s *Scanner) LinesRead() int { 19 | return s.linesRead 20 | } 21 | -------------------------------------------------------------------------------- /tools/horizon-verify/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 2019-04-25 2 | 3 | Initial version 4 | -------------------------------------------------------------------------------- /tools/horizon-verify/README.md: -------------------------------------------------------------------------------- 1 | # Horizon verify 2 | 3 | Tool that checks some invariants about Horizon responses: 4 | 5 | - successful response codes when getting transactions from ledgers 6 | - successful transaction counts are correct 7 | - failed transaction counts are correct 8 | 9 | TODO: add more info 10 | -------------------------------------------------------------------------------- /tools/stellar-hd-wallet/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this 4 | file. This project adheres to [Semantic Versioning](http://semver.org/). 5 | 6 | As this project is pre 1.0, breaking changes may happen for minor version 7 | bumps. A breaking change will get clearly notified in this log. 8 | 9 | ## Unreleased 10 | 11 | - Dropped support for Go 1.10, 1.11, 1.12. 12 | 13 | ## [v0.0.1] - 2017-12-28 14 | 15 | Initial release. 16 | -------------------------------------------------------------------------------- /tools/stellar-hd-wallet/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "log" 5 | 6 | "github.com/spf13/cobra" 7 | "github.com/stellar/go/tools/stellar-hd-wallet/commands" 8 | ) 9 | 10 | var mainCmd = &cobra.Command{ 11 | Use: "stellar-hd-wallet", 12 | Short: "Simple HD wallet for Stellar Lumens. THIS PROGRAM IS STILL EXPERIMENTAL. USE AT YOUR OWN RISK.", 13 | } 14 | 15 | func init() { 16 | mainCmd.AddCommand(commands.NewCmd) 17 | mainCmd.AddCommand(commands.AccountsCmd) 18 | } 19 | 20 | func main() { 21 | if err := mainCmd.Execute(); err != nil { 22 | log.Fatal(err) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tools/stellar-key-gen/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | Not yet released. 4 | -------------------------------------------------------------------------------- /tools/stellar-vanity-gen/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this 4 | file. This project adheres to [Semantic Versioning](http://semver.org/). 5 | 6 | As this project is pre 1.0, breaking changes may happen for minor version 7 | bumps. A breaking change will get clearly notified in this log. 8 | 9 | ## Unreleased 10 | 11 | - Dropped support for Go 1.10, 1.11, 1.12. 12 | 13 | ## [v0.1.0] - 2016-08-17 14 | 15 | Initial release after import from https://github.com/stellar/go-stellar-base/cmd/stellar-vanity-gen 16 | 17 | [Unreleased]: https://github.com/stellar/go/compare/stellar-vanity-gen-v0.1.0...master 18 | -------------------------------------------------------------------------------- /tools/stellar-vanity-gen/README.md: -------------------------------------------------------------------------------- 1 | # Stellar Vanity Address Generator 2 | 3 | This folder contains `stellar-vanity-gen` a simple utility to generate vanity addresses that have some prefix. This utility demonstrates the use of the 4 | `GenerateRandomKey()` helper. 5 | 6 | ## Installing 7 | 8 | ```bash 9 | $ go get -u github.com/stellar/go/tools/stellar-vanity-gen 10 | ``` 11 | 12 | ## Running 13 | 14 | ```bash 15 | $ stellar-vanity-gen PREFIX 16 | ``` 17 | -------------------------------------------------------------------------------- /tools/xdr2go/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this 4 | file. This project adheres to [Semantic Versioning](http://semver.org/). 5 | 6 | ## v0.0.1 7 | 8 | Initial version. -------------------------------------------------------------------------------- /txnbuild/asset_amount.go: -------------------------------------------------------------------------------- 1 | package txnbuild 2 | 3 | // AssetAmount is a "tuple", pairing an asset with an amount. Used for 4 | // LiquidityPoolDeposit and LiquidityPoolWithdraw operations. 5 | type AssetAmount struct { 6 | Asset Asset 7 | Amount string 8 | } 9 | -------------------------------------------------------------------------------- /txnbuild/assets.go: -------------------------------------------------------------------------------- 1 | package txnbuild 2 | 3 | // Assets represents a list of Stellar assets. Importantly, it is sortable. 4 | type Assets []Asset 5 | 6 | func (s Assets) Len() int { return len(s) } 7 | func (s Assets) Swap(i, j int) { s[i], s[j] = s[j], s[i] } 8 | func (s Assets) Less(i, j int) bool { return s[i].LessThan(s[j]) } 9 | -------------------------------------------------------------------------------- /txnbuild/begin_sponsoring_future_reserves_test.go: -------------------------------------------------------------------------------- 1 | package txnbuild 2 | 3 | import ( 4 | "testing" 5 | ) 6 | 7 | func TestBeginSponsoringFutureReservesRoundTrip(t *testing.T) { 8 | beginSponsoring := &BeginSponsoringFutureReserves{ 9 | SponsoredID: newKeypair1().Address(), 10 | } 11 | 12 | testOperationsMarshalingRoundtrip(t, []Operation{beginSponsoring}, false) 13 | } 14 | -------------------------------------------------------------------------------- /txnbuild/cmd/demo/main.go: -------------------------------------------------------------------------------- 1 | // Demo is an interactive demonstration of the Go SDK using the Stellar TestNet. 2 | package main 3 | 4 | import ( 5 | "github.com/stellar/go/txnbuild/cmd/demo/cmd" 6 | ) 7 | 8 | func main() { 9 | cmd.Execute() 10 | } 11 | -------------------------------------------------------------------------------- /txnbuild/end_sponsoring_future_reserves_test.go: -------------------------------------------------------------------------------- 1 | package txnbuild 2 | 3 | import "testing" 4 | 5 | func TestEndSponsoringFutureReservesRoundTrip(t *testing.T) { 6 | withoutMuxedAccounts := &EndSponsoringFutureReserves{SourceAccount: "GB7BDSZU2Y27LYNLALKKALB52WS2IZWYBDGY6EQBLEED3TJOCVMZRH7H"} 7 | testOperationsMarshalingRoundtrip(t, []Operation{withoutMuxedAccounts}, false) 8 | withMuxedAccounts := &EndSponsoringFutureReserves{SourceAccount: "MA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJVAAAAAAAAAAAAAJLK"} 9 | testOperationsMarshalingRoundtrip(t, []Operation{withMuxedAccounts}, true) 10 | } 11 | -------------------------------------------------------------------------------- /txnbuild/inflation_test.go: -------------------------------------------------------------------------------- 1 | package txnbuild 2 | 3 | import "testing" 4 | 5 | func TestInflationRoundtrip(t *testing.T) { 6 | inflation := Inflation{ 7 | SourceAccount: "GB7BDSZU2Y27LYNLALKKALB52WS2IZWYBDGY6EQBLEED3TJOCVMZRH7H", 8 | } 9 | testOperationsMarshalingRoundtrip(t, []Operation{&inflation}, false) 10 | 11 | // with muxed accounts 12 | inflation = Inflation{ 13 | SourceAccount: "MA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJVAAAAAAAAAAAAAJLK", 14 | } 15 | testOperationsMarshalingRoundtrip(t, []Operation{&inflation}, true) 16 | } 17 | -------------------------------------------------------------------------------- /txnbuild/ledgerbounds.go: -------------------------------------------------------------------------------- 1 | package txnbuild 2 | 3 | import "github.com/stellar/go/support/errors" 4 | 5 | // LedgerBounds represent a transaction precondition that controls the ledger 6 | // range for which a transaction is valid. Setting MaxLedger = 0 indicates there 7 | // is no maximum ledger. 8 | type LedgerBounds struct { 9 | MinLedger uint32 10 | MaxLedger uint32 11 | } 12 | 13 | func (lb *LedgerBounds) Validate() error { 14 | if lb == nil { 15 | return nil 16 | } 17 | 18 | if lb.MaxLedger > 0 && lb.MaxLedger < lb.MinLedger { 19 | return errors.New("invalid ledgerbound: max ledger < min ledger") 20 | } 21 | 22 | return nil 23 | } 24 | -------------------------------------------------------------------------------- /txnbuild/signer_summary.go: -------------------------------------------------------------------------------- 1 | package txnbuild 2 | 3 | // SignerSummary is a map of signers to their weights. 4 | type SignerSummary map[string]int32 5 | -------------------------------------------------------------------------------- /xdr/README.md: -------------------------------------------------------------------------------- 1 | # xdr 2 | 3 | The xdr package contains encoding/decoding of Stellar XDR types. 4 | 5 | ## Code Generate 6 | 7 | Most of the code this package is generated. 8 | 9 | To download new XDR for code generation: 10 | 11 | ``` 12 | docker run --platform linux/amd64 -it --rm -v $PWD:/wd -w /wd ruby /bin/bash -c 'bundle install && bundle exec rake xdr:download' 13 | ``` 14 | 15 | To regenerate the code from the local XDR: 16 | 17 | ``` 18 | docker run --platform linux/amd64 -it --rm -v $PWD:/wd -w /wd ruby /bin/bash -c 'bundle install && bundle exec rake xdr:generate' && go fmt ./xdr 19 | ``` 20 | 21 | To download XDR for a different branch of stellar-core, modify `Rakefile` in the root. 22 | -------------------------------------------------------------------------------- /xdr/Stellar-contract-meta.x: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Stellar Development Foundation and contributors. Licensed 2 | // under the Apache License, Version 2.0. See the COPYING file at the root 3 | // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 4 | 5 | // The contract meta XDR is highly experimental, incomplete, and still being 6 | // iterated on. Breaking changes expected. 7 | 8 | % #include "xdr/Stellar-types.h" 9 | namespace stellar 10 | { 11 | 12 | struct SCMetaV0 13 | { 14 | string key<>; 15 | string val<>; 16 | }; 17 | 18 | enum SCMetaKind 19 | { 20 | SC_META_V0 = 0 21 | }; 22 | 23 | union SCMetaEntry switch (SCMetaKind kind) 24 | { 25 | case SC_META_V0: 26 | SCMetaV0 v0; 27 | }; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /xdr/Stellar-exporter.x: -------------------------------------------------------------------------------- 1 | // Copyright 2024 Stellar Development Foundation and contributors. Licensed 2 | // under the Apache License, Version 2.0. See the COPYING file at the root 3 | // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 4 | 5 | %#include "xdr/Stellar-ledger.h" 6 | 7 | namespace stellar 8 | { 9 | 10 | // Batch of ledgers along with their transaction metadata 11 | struct LedgerCloseMetaBatch 12 | { 13 | // starting ledger sequence number in the batch 14 | uint32 startSequence; 15 | 16 | // ending ledger sequence number in the batch 17 | uint32 endSequence; 18 | 19 | // Ledger close meta for each ledger within the batch 20 | LedgerCloseMeta ledgerCloseMetas<>; 21 | }; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /xdr/account_thresholds.go: -------------------------------------------------------------------------------- 1 | package xdr 2 | 3 | func (t Thresholds) MasterKeyWeight() byte { 4 | return t[0] 5 | } 6 | 7 | func (t Thresholds) ThresholdLow() byte { 8 | return t[1] 9 | } 10 | 11 | func (t Thresholds) ThresholdMedium() byte { 12 | return t[2] 13 | } 14 | 15 | func (t Thresholds) ThresholdHigh() byte { 16 | return t[3] 17 | } 18 | 19 | func NewThreshold(masterKey, low, medium, high byte) Thresholds { 20 | return Thresholds{masterKey, low, medium, high} 21 | } 22 | -------------------------------------------------------------------------------- /xdr/accounts_thesholds_test.go: -------------------------------------------------------------------------------- 1 | package xdr_test 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stellar/go/xdr" 7 | "github.com/stretchr/testify/assert" 8 | ) 9 | 10 | func TestNewThreshold(t *testing.T) { 11 | threshold := xdr.NewThreshold(1, 2, 3, 4) 12 | 13 | assert.Equal(t, byte(1), threshold.MasterKeyWeight()) 14 | assert.Equal(t, byte(2), threshold.ThresholdLow()) 15 | assert.Equal(t, byte(3), threshold.ThresholdMedium()) 16 | assert.Equal(t, byte(4), threshold.ThresholdHigh()) 17 | } 18 | -------------------------------------------------------------------------------- /xdr/claimable_balance_entry.go: -------------------------------------------------------------------------------- 1 | package xdr 2 | 3 | func (entry *ClaimableBalanceEntry) Flags() ClaimableBalanceFlags { 4 | switch entry.Ext.V { 5 | case 1: 6 | return ClaimableBalanceFlags(entry.Ext.V1.Flags) 7 | } 8 | return 0 9 | } 10 | -------------------------------------------------------------------------------- /xdr/claimable_balance_flags.go: -------------------------------------------------------------------------------- 1 | package xdr 2 | 3 | // IsClawbackEnabled returns true if the claimable balance has the "CLAWBACK_ENABLED" option 4 | // turned on. 5 | func (cbFlags ClaimableBalanceFlags) IsClawbackEnabled() bool { 6 | return (cbFlags & ClaimableBalanceFlagsClaimableBalanceClawbackEnabledFlag) != 0 7 | } 8 | -------------------------------------------------------------------------------- /xdr/claimable_balance_flags_test.go: -------------------------------------------------------------------------------- 1 | package xdr_test 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/assert" 7 | 8 | "github.com/stellar/go/xdr" 9 | ) 10 | 11 | func TestIsClawbackEnabled(t *testing.T) { 12 | tt := assert.New(t) 13 | 14 | flag := xdr.ClaimableBalanceFlags(1) 15 | tt.True(flag.IsClawbackEnabled()) 16 | 17 | flag = xdr.ClaimableBalanceFlags(0) 18 | tt.False(flag.IsClawbackEnabled()) 19 | 20 | flag = xdr.ClaimableBalanceFlags(2) 21 | tt.False(flag.IsClawbackEnabled()) 22 | 23 | flag = xdr.ClaimableBalanceFlags(4) 24 | tt.False(flag.IsClawbackEnabled()) 25 | 26 | } 27 | -------------------------------------------------------------------------------- /xdr/claimable_balance_id.go: -------------------------------------------------------------------------------- 1 | package xdr 2 | 3 | func (e *EncodingBuffer) claimableBalanceCompressEncodeTo(cb ClaimableBalanceId) error { 4 | if err := e.xdrEncoderBuf.WriteByte(byte(cb.Type)); err != nil { 5 | return err 6 | } 7 | switch cb.Type { 8 | case ClaimableBalanceIdTypeClaimableBalanceIdTypeV0: 9 | _, err := e.xdrEncoderBuf.Write(cb.V0[:]) 10 | return err 11 | default: 12 | panic("Unknown type") 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /xdr/claimant.go: -------------------------------------------------------------------------------- 1 | package xdr 2 | 3 | import ( 4 | "sort" 5 | ) 6 | 7 | // SortClaimantsByDestination returns a new []Claimant array sorted by destination. 8 | func SortClaimantsByDestination(claimants []Claimant) []Claimant { 9 | keys := make([]string, 0, len(claimants)) 10 | keysMap := make(map[string]Claimant) 11 | newClaimants := make([]Claimant, 0, len(claimants)) 12 | 13 | for _, claimant := range claimants { 14 | v0 := claimant.MustV0() 15 | key := v0.Destination.Address() 16 | keys = append(keys, key) 17 | keysMap[key] = claimant 18 | } 19 | 20 | sort.Strings(keys) 21 | 22 | for _, key := range keys { 23 | newClaimants = append(newClaimants, keysMap[key]) 24 | } 25 | 26 | return newClaimants 27 | } 28 | -------------------------------------------------------------------------------- /xdr/equals.go: -------------------------------------------------------------------------------- 1 | package xdr 2 | 3 | import ( 4 | "bytes" 5 | "encoding" 6 | ) 7 | 8 | func Equals(a, b encoding.BinaryMarshaler) (bool, error) { 9 | serialized, err := a.MarshalBinary() 10 | if err != nil { 11 | return false, err 12 | } 13 | otherSerialized, err := b.MarshalBinary() 14 | if err != nil { 15 | return false, err 16 | } 17 | return bytes.Equal(serialized, otherSerialized), nil 18 | } 19 | -------------------------------------------------------------------------------- /xdr/event.go: -------------------------------------------------------------------------------- 1 | package xdr 2 | 3 | import ( 4 | "encoding/hex" 5 | "fmt" 6 | ) 7 | 8 | func (ce ContractEvent) String() string { 9 | result := ce.Type.String() + "(" 10 | if ce.ContractId != nil { 11 | result += hex.EncodeToString(ce.ContractId[:]) + "," 12 | } 13 | result += ce.Body.String() + ")" 14 | return result 15 | } 16 | 17 | func (eb ContractEventBody) String() string { 18 | return fmt.Sprintf("%+v", *eb.V0) 19 | } 20 | 21 | func (de DiagnosticEvent) String() string { 22 | return fmt.Sprintf("%s, successful call: %t", de.Event, de.InSuccessfulContractCall) 23 | } 24 | -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/0: -------------------------------------------------------------------------------- 1 |  _FD[ -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/059ce73797da3779f67d67b27fbbe1586fb5af4c-11: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/xdr/fuzz/jsonclaimpredicate/corpus/059ce73797da3779f67d67b27fbbe1586fb5af4c-11 -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/06b5aa65dd57296c5d7d71c34e4458704c9d8504-24: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/070fdb451a68170438d23544e162edbe0c53831c-24: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/0738efae9b6af6dd2f5b47ee3670e79e120bf8ff-5: -------------------------------------------------------------------------------- 1 |   -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/0c11486742bca82a11751928390f3c143964bae5-4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/xdr/fuzz/jsonclaimpredicate/corpus/0c11486742bca82a11751928390f3c143964bae5-4 -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/0c52a7776c7b6699bbb73b57fcd48c92d5861814-1: -------------------------------------------------------------------------------- 1 |   -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/0e7786143ce4b5034c1df4f0bf398198b7880a06-1: -------------------------------------------------------------------------------- 1 | _FD[ -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/0e92db53270df55314b1629bb2362d00be9ae485-27: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/17b83232cd0cb2405c3e44f22c1a449dd321bab1-14: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/18d6cfc1fee128a9ed89b45c644fefb1a67c557f-4: -------------------------------------------------------------------------------- 1 |   -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/1dd0e81c3f135bbfcdf5e306727f1fdaa954c4b5-20: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/1ffd4bb29dbaf9a8b23a80410b7dcf6d160f20f5-5: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/22059050a2075418d91ab3d94cb5b5202dcb5449-10: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/22afe6d1107dc8421df2d27cf51c1e644c02c61c-18: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/23d671738a3514e6addb20280a0bd45d04991f35-9: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/xdr/fuzz/jsonclaimpredicate/corpus/23d671738a3514e6addb20280a0bd45d04991f35-9 -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/24196ca658a9c921b531ee7000b268a21a630b9e-9: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/xdr/fuzz/jsonclaimpredicate/corpus/24196ca658a9c921b531ee7000b268a21a630b9e-9 -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/2ad5aa06b6a21b80102b70f792a6f5182b1e795e-26: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/2c4456e3a9606ff70b52b741d60629fc0aff6670-24: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/33081e04522f2adea4af265daeb32b9be88972ba-16: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/xdr/fuzz/jsonclaimpredicate/corpus/33081e04522f2adea4af265daeb32b9be88972ba-16 -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/33ede038ddd6a6b2f2db89f2ead0338defbd68bb-26: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/34dabb7d96c82c2808d791c0267e28e79bfac2bf-19: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/3506b22eae67d429090fc709a72819b833c6d96f-25: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/35e0ed07d721971cb22d5957dee80f25ead2cb42-22: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/377545c22c2ee8e37810716409b46536e840f56b-20: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/3e9f514f89306765a02fba331f057ca66961dd71-17: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/xdr/fuzz/jsonclaimpredicate/corpus/3e9f514f89306765a02fba331f057ca66961dd71-17 -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/3f2b6cbcae547826b84ba42a9e6ea0b1a3339aa4-2: -------------------------------------------------------------------------------- 1 |   -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/3f6582b3dcb15d99dab3789e997aa26f721ecbfe-16: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/4079505f0bc61228e001bc6471699238dde274f4-4: -------------------------------------------------------------------------------- 1 |  Bool -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/48afcfe2230cea5d2d3ee438fa0b7a74e372d158-12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/xdr/fuzz/jsonclaimpredicate/corpus/48afcfe2230cea5d2d3ee438fa0b7a74e372d158-12 -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/4f3bde9486d6faa2790e56aedf58b4ac44aec8b5-20: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/4fe56699612c2cf2ff3f386e7c555f560deadf9a-15: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/60b8e1cbf32b5ca3b1ec60572dab334951058d0b-6: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/xdr/fuzz/jsonclaimpredicate/corpus/60b8e1cbf32b5ca3b1ec60572dab334951058d0b-6 -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/61cb9be335a9ed20ab522fc29a6e6dfbcb33a601-1: -------------------------------------------------------------------------------- 1 | _FD[ -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/63ab224880353a2b49f80077e9da722c18329ac1-10: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/xdr/fuzz/jsonclaimpredicate/corpus/63ab224880353a2b49f80077e9da722c18329ac1-10 -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/658c4a6cc7e274ed79d0ce7ed12a2c7b8c57e601-5: -------------------------------------------------------------------------------- 1 |   -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/6adde074d4fe03d42ba8caab1516c4ceb97da570-11: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/6b12dad633f25444a712e5fd0bb47ec718950a18-20: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/6cd24a62b01b2c0e4dcc1304817ca6700054b339-21: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/76ac82e6a9d81c206c98f8305978f3ceb003ef29-2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/xdr/fuzz/jsonclaimpredicate/corpus/76ac82e6a9d81c206c98f8305978f3ceb003ef29-2 -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/7704823d2993cac4543740727aadf0da46f0b187-19: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/78eb7d11840d3521ebdf34aa850c275d1f48bae8-12: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/7ff2c71aacf7b64291948dfb49369e5d1fee5e1c-2: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/802c4d37a41acc0a65a47dd9260578db8a91c7b0-2: -------------------------------------------------------------------------------- 1 |   -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/80bce1575cf091d64032193bf508ef39b9a2c929-13: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/xdr/fuzz/jsonclaimpredicate/corpus/80bce1575cf091d64032193bf508ef39b9a2c929-13 -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/8167706299d763d2680aafb67be0c1de500bd577-1: -------------------------------------------------------------------------------- 1 |  _FD[ -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/836ccf6afc61a555e6c77db43e9972e14e018db3-17: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/8415b311a622e944074e28ca77d538f483201a43-3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/xdr/fuzz/jsonclaimpredicate/corpus/8415b311a622e944074e28ca77d538f483201a43-3 -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/8700a406939d1a113038c778808c81c32dc3bc28-1: -------------------------------------------------------------------------------- 1 |  _FD[ -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/8997d68a77b10c3c9ec4196b33e64224b3241266-2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/xdr/fuzz/jsonclaimpredicate/corpus/8997d68a77b10c3c9ec4196b33e64224b3241266-2 -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/8b3e6618aa03e9c7959cfd5a68095cb4d6a203df-20: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/8b9538724414e6d819239a7c01199398fab43ffc-3: -------------------------------------------------------------------------------- 1 |   -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/9069ca78e7450a285173431b3e52c5c25299e473-1: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/958cc6437a39b63f7396b0a71d04007b88c6379b-7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/xdr/fuzz/jsonclaimpredicate/corpus/958cc6437a39b63f7396b0a71d04007b88c6379b-7 -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/959ed41ac6a90cd2ebc4795df6ddd40ea0d75b0f-2: -------------------------------------------------------------------------------- 1 |   -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/9a18ed489961b6bd472665166ae1b92fadb4a30d-25: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/a01a7ff06434fa1552a81f30078b392e6d2bfad1-4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/xdr/fuzz/jsonclaimpredicate/corpus/a01a7ff06434fa1552a81f30078b392e6d2bfad1-4 -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/a46d5ed7d68b26e1c5d9c1b88d657dafd2205150-23: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/a7473f2a9f6d6c330457bf2de9d5969a55d0aee3-16: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/a751ccd38c35877231ba5493bfc2616870c2988e-24: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/a9d519b73acfc6693baa94caf8d3775d1b5c2e4d-3: -------------------------------------------------------------------------------- 1 |  Bool -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/aaa626f320812eb78a7ef9b957db9e00792c2ae6-25: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/ab8767081fee98bd3c608822c63599d9bb4cd7f0-15: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/abdc9928a9e1d7dc324eba5e7bd9be3d3f648a58-14: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/ac8f325e3a178437989e9fb6d577d8b3ec57cfd8-9: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/ae48c762a25dc2b03889d5830768edd235ec5b9e-10: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/xdr/fuzz/jsonclaimpredicate/corpus/ae48c762a25dc2b03889d5830768edd235ec5b9e-10 -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/b1a3550eaa19cc0fee2e869c5e126f433910d1d3-12: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/b20ec8a5c170be3a45ebb6d7736ef7e2450bcfc8-19: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/b283d6eafb57f10081d075a1e513297d0f003dda-4: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/b2af21ff16013174e8b940aeea46a5d2b7ebe959-3: -------------------------------------------------------------------------------- 1 |   -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/b43d6499a479a144d48743aceab226ae04b084b3-27: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/b975870c79205eb51bb870470dc43a2247a840b4-2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/xdr/fuzz/jsonclaimpredicate/corpus/b975870c79205eb51bb870470dc43a2247a840b4-2 -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/ba38988d5c5dcc1ac3a71cd384361208fe07b52b-3: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/ba66c7f545d45a2f9e3a0ccdf3c890d599be0c04-23: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/bdc41f8d992fb63574a3502310f8da8fa2f46ecb-6: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/xdr/fuzz/jsonclaimpredicate/corpus/bdc41f8d992fb63574a3502310f8da8fa2f46ecb-6 -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/c0113ad49c1ab5cb58850b98f057361b51a07de9-19: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/c04c37d97e7d5f40e778a9f4f2798e79d67b2894-13: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/c3e528e0864bdeabc3a493347d081458107d6d02-8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/xdr/fuzz/jsonclaimpredicate/corpus/c3e528e0864bdeabc3a493347d081458107d6d02-8 -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/c8e6898a08dcd50eb9d4277f52b5a1316363b1ce-8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/xdr/fuzz/jsonclaimpredicate/corpus/c8e6898a08dcd50eb9d4277f52b5a1316363b1ce-8 -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/cd9e58d3d455ad5a8dbe295c15bcc497ad0a5b3f-6: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/xdr/fuzz/jsonclaimpredicate/corpus/cd9e58d3d455ad5a8dbe295c15bcc497ad0a5b3f-6 -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/d1c5c02b37cee617709474c716cff28931a83f0a-1: -------------------------------------------------------------------------------- 1 |   -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/d1c92868d562107bef8080a1e36abb5118cd6c1f-1: -------------------------------------------------------------------------------- 1 |  _FD[ -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/d47aadd63b71c1edf2560bd7790b6ece114ac150-4: -------------------------------------------------------------------------------- 1 |   -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/d4e6caed58ca3f001ee3f9b719e72f48af941e69-8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/xdr/fuzz/jsonclaimpredicate/corpus/d4e6caed58ca3f001ee3f9b719e72f48af941e69-8 -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/dd2292f040e7417fd33bffef779136045e3e42e9-8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/xdr/fuzz/jsonclaimpredicate/corpus/dd2292f040e7417fd33bffef779136045e3e42e9-8 -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/e1e0b62f78224847064adfb1db88db5c2ad7314f-22: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/e496e6bcb958104db803f6987f7463e64dd03c36-3: -------------------------------------------------------------------------------- 1 |   -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/e6d28f2def888dd7b4e3e7bb0602a9a54032fc25-14: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/xdr/fuzz/jsonclaimpredicate/corpus/e6d28f2def888dd7b4e3e7bb0602a9a54032fc25-14 -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/e9ae6ca39d51bd4198dc8b4f2ed429dd7464a1b7-15: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/ea5ef46f0ad1b2f1477437d6a8fea4a05bf589f9-21: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/ec7ef371ebfc7964bd80d7783b5e4eb0f614b9f2-18: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/ed23eb5f747659b11a5505b08e56624399351eb3-16: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/efad3ce838161e85a374929a9c0fd4d51812cc5f-2: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/f4e16e4477ecc1f88f51319373564404a1e9b03d-7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/xdr/fuzz/jsonclaimpredicate/corpus/f4e16e4477ecc1f88f51319373564404a1e9b03d-7 -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/f54b8d6090a285885734d804129213715c3c5b55-10: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/f54d55cac405aed2c99ca12e5f630db204f46b67-2: -------------------------------------------------------------------------------- 1 |  _FD[ -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/f76bac376810acce74267a853b664a0a29d47d2b-5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/xdr/fuzz/jsonclaimpredicate/corpus/f76bac376810acce74267a853b664a0a29d47d2b-5 -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/f816b4e064d14656872cadca92ecb1f5179a6319-5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/xdr/fuzz/jsonclaimpredicate/corpus/f816b4e064d14656872cadca92ecb1f5179a6319-5 -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/fb1c8df7fa2faac955b0e03fbc7423030d6ab8ae-1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/xdr/fuzz/jsonclaimpredicate/corpus/fb1c8df7fa2faac955b0e03fbc7423030d6ab8ae-1 -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/fb4933de8b968e1cda99b1d7d8dfb600d60123ce-7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/xdr/fuzz/jsonclaimpredicate/corpus/fb4933de8b968e1cda99b1d7d8dfb600d60123ce-7 -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/fbfab2089beccd80677b39f984d4a2e1151000e4-18: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KOSASIH/go/054d8e771bd333e1a47a02339e5f2ab78c7f92ce/xdr/fuzz/jsonclaimpredicate/corpus/fbfab2089beccd80677b39f984d4a2e1151000e4-18 -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/fd447488be54b05d69fa33e39e3754eb7b34a5ba-5: -------------------------------------------------------------------------------- 1 |  Bool -------------------------------------------------------------------------------- /xdr/fuzz/jsonclaimpredicate/corpus/fef930fcbbe7b532642eb9bed98dd04d6bbff761-11: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xdr/hash.go: -------------------------------------------------------------------------------- 1 | package xdr 2 | 3 | import "encoding/hex" 4 | 5 | func (h Hash) HexString() string { 6 | return hex.EncodeToString(h[:]) 7 | } 8 | 9 | func (s Hash) Equals(o Hash) bool { 10 | if len(s) != len(o) { 11 | return false 12 | } 13 | for i := 0; i < len(s); i++ { 14 | if s[i] != o[i] { 15 | return false 16 | } 17 | } 18 | return true 19 | } 20 | -------------------------------------------------------------------------------- /xdr/ledger_close_meta_test.go: -------------------------------------------------------------------------------- 1 | package xdr 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/assert" 7 | ) 8 | 9 | func TestLedgerSequence(t *testing.T) { 10 | l := LedgerCloseMeta{ 11 | V0: &LedgerCloseMetaV0{ 12 | LedgerHeader: LedgerHeaderHistoryEntry{ 13 | Header: LedgerHeader{LedgerSeq: 23}, 14 | }, 15 | }, 16 | } 17 | assert.Equal(t, uint32(23), l.LedgerSequence()) 18 | } 19 | -------------------------------------------------------------------------------- /xdr/liquidity_pool.go: -------------------------------------------------------------------------------- 1 | package xdr 2 | 3 | // LiquidityPoolTypeToString maps an xdr.LiquidityPoolType to its string representation 4 | var LiquidityPoolTypeToString = map[LiquidityPoolType]string{ 5 | LiquidityPoolTypeLiquidityPoolConstantProduct: "constant_product", 6 | } 7 | -------------------------------------------------------------------------------- /xdr/memo.go: -------------------------------------------------------------------------------- 1 | package xdr 2 | 3 | func MemoText(text string) Memo { 4 | return Memo{Type: MemoTypeMemoText, Text: &text} 5 | } 6 | 7 | func MemoID(id uint64) Memo { 8 | idObj := Uint64(id) 9 | return Memo{Type: MemoTypeMemoId, Id: &idObj} 10 | } 11 | 12 | func MemoHash(hash Hash) Memo { 13 | return Memo{Type: MemoTypeMemoHash, Hash: &hash} 14 | } 15 | 16 | func MemoRetHash(hash Hash) Memo { 17 | return Memo{Type: MemoTypeMemoReturn, RetHash: &hash} 18 | } 19 | -------------------------------------------------------------------------------- /xdr/node_id.go: -------------------------------------------------------------------------------- 1 | package xdr 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/stellar/go/strkey" 7 | ) 8 | 9 | func (n NodeId) GetAddress() (string, error) { 10 | switch n.Type { 11 | case PublicKeyTypePublicKeyTypeEd25519: 12 | ed, ok := n.GetEd25519() 13 | if !ok { 14 | return "", fmt.Errorf("could not get NodeID.Ed25519") 15 | } 16 | raw := make([]byte, 32) 17 | copy(raw, ed[:]) 18 | encodedAddress, err := strkey.Encode(strkey.VersionByteAccountID, raw) 19 | if err != nil { 20 | return "", err 21 | } 22 | return encodedAddress, nil 23 | default: 24 | return "", fmt.Errorf("unknown NodeId.PublicKeyType") 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /xdr/preconditions.go: -------------------------------------------------------------------------------- 1 | package xdr 2 | 3 | // NewPreconditionsWithTimebounds constructs the simplest possible 4 | // `Preconditions` instance given the (possibly empty) timebounds. 5 | func NewPreconditionsWithTimeBounds(timebounds *TimeBounds) Preconditions { 6 | cond := Preconditions{Type: PreconditionTypePrecondNone} 7 | if timebounds != nil { 8 | cond.Type = PreconditionTypePrecondTime 9 | cond.TimeBounds = timebounds 10 | } 11 | return cond 12 | } 13 | -------------------------------------------------------------------------------- /xdr/signers.go: -------------------------------------------------------------------------------- 1 | package xdr 2 | 3 | import ( 4 | "sort" 5 | ) 6 | 7 | // SortSignersByKey returns a new []Signer array sorted by signer key. 8 | func SortSignersByKey(signers []Signer) []Signer { 9 | keys := make([]string, 0, len(signers)) 10 | keysMap := make(map[string]Signer) 11 | newSigners := make([]Signer, 0, len(signers)) 12 | 13 | for _, signer := range signers { 14 | key := signer.Key.Address() 15 | keys = append(keys, key) 16 | keysMap[key] = signer 17 | } 18 | 19 | sort.Strings(keys) 20 | 21 | for _, key := range keys { 22 | newSigners = append(newSigners, keysMap[key]) 23 | } 24 | 25 | return newSigners 26 | } 27 | -------------------------------------------------------------------------------- /xdr/string.go: -------------------------------------------------------------------------------- 1 | package xdr 2 | 3 | func String32Ptr(val string) *String32 { 4 | pval := String32(val) 5 | return &pval 6 | } 7 | -------------------------------------------------------------------------------- /xdr/trust_line_entry.go: -------------------------------------------------------------------------------- 1 | package xdr 2 | 3 | // Liabilities returns TrustLineEntry's liabilities 4 | func (trustLine *TrustLineEntry) Liabilities() Liabilities { 5 | var liabilities Liabilities 6 | if trustLine.Ext.V1 != nil { 7 | liabilities = trustLine.Ext.V1.Liabilities 8 | } 9 | return liabilities 10 | } 11 | -------------------------------------------------------------------------------- /xdr/uint256.go: -------------------------------------------------------------------------------- 1 | package xdr 2 | 3 | import ( 4 | "math/big" 5 | ) 6 | 7 | // String returns a display friendly form of the uint256 8 | func (u Uint256) String() string { 9 | return new(big.Int).SetBytes(u[:]).String() 10 | } 11 | 12 | func (s Uint256) Equals(o Uint256) bool { 13 | if len(s) != len(o) { 14 | return false 15 | } 16 | for i := 0; i < len(s); i++ { 17 | if s[i] != o[i] { 18 | return false 19 | } 20 | } 21 | return true 22 | } 23 | -------------------------------------------------------------------------------- /xdr/uint256_test.go: -------------------------------------------------------------------------------- 1 | package xdr_test 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stellar/go/xdr" 7 | "github.com/stretchr/testify/assert" 8 | ) 9 | 10 | func TestUint256String(t *testing.T) { 11 | assert.Equal(t, "0", xdr.Uint256{}.String()) 12 | assert.Equal(t, "1", xdr.Uint256{ 13 | 0, 0, 0, 0, 0, 0, 0, 0, 14 | 0, 0, 0, 0, 0, 0, 0, 0, 15 | 0, 0, 0, 0, 0, 0, 0, 0, 16 | 0, 0, 0, 0, 0, 0, 0, 1, 17 | }.String()) 18 | assert.Equal(t, "16909060", xdr.Uint256{ 19 | 0, 0, 0, 0, 0, 0, 0, 0, 20 | 0, 0, 0, 0, 0, 0, 0, 0, 21 | 0, 0, 0, 0, 0, 0, 0, 0, 22 | 0, 0, 0, 0, 1, 2, 3, 4, 23 | }.String()) 24 | } 25 | -------------------------------------------------------------------------------- /xdr/xdr_commit_generated.txt: -------------------------------------------------------------------------------- 1 | 529d5176f24c73eeccfa5eba481d4e89c19b1181 -------------------------------------------------------------------------------- /xdr/xdr_suite_test.go: -------------------------------------------------------------------------------- 1 | package xdr_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "testing" 8 | ) 9 | 10 | func TestXdr(t *testing.T) { 11 | RegisterFailHandler(Fail) 12 | RunSpecs(t, "XDR Suite") 13 | } 14 | --------------------------------------------------------------------------------