-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d2524ec
commit 8a97938
Showing
8 changed files
with
158 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
title: API Explorer | ||
sidebar_position: 20 | ||
--- | ||
|
||
import DocCardList from "@theme/DocCardList"; | ||
|
||
# Developer Tools | ||
|
||
This section provides description for Stellar suite of developer tools. Explore a suite of developer tools for Stellar, including anchor directory, demo wallet, asset sandbox, block explorers, CLI, indexers, IDEs, network status, smart contract resources, and wallets. | ||
|
||
<DocCardList /> |
136 changes: 136 additions & 0 deletions
136
docs/tools/developer-tools/lab/api-explorer/horizon-endpoint.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
# Horizon Endpoint | ||
|
||
Horizon provides an HTTP API to data stored in the Stellar network. This API serves the bridge between apps and Stellar Core. Stellar Lab's [API Explorer](https://lab.stellar.org/endpoints) provides Horizon Endpoint UI for developers to interact with Horizon on Futurenet, Testnet, Mainnet, and Custom network. Developers can use Stellar Lab to build and submit transactions, query an account balance, and stream events like transactions to an account. | ||
|
||
:::info | ||
|
||
On August 1, 2024, the SDF truncated historical data on its Horizon instances to one year. This update allows us to optimize performance and ensure a streamlined experience for all users. We encourage you to explore [third-party ecosystem providers of Horizon](../../../../data/horizon/horizon-providers), which may provide a longer history retention window as well as other features. | ||
|
||
::: | ||
|
||
Data on the Stellar ledger is organized according to [resources](https://developers.stellar.org/docs/data/horizon/api-reference/resources): **Accounts, Assets, Claimable Balances, Effects, Ledgers, Liquidity Pools, Offers, Operations, Trades**, and **Transactions**. Each resource has several different endpoints. The endpoints that aggregate data about the ledger (also known as [aggregations](https://developers.stellar.org/docs/data/horizon/api-reference/aggregations)) use the following resource: **Order Books, Paths, Trade Aggregations**, and **Fee Stats**. | ||
|
||
Stellar Lab's horizon endpoint has each resource type listed in the side menu for developers to interact with its endpoint. | ||
|
||
![Lab: Horizon Page](/assets/lab/horizon-endpoints.png) | ||
|
||
Let's go through a few examples of Horizon Endpoints — Accounts, Asset, Payment — using Testnet, Mainnet, and Custom Network. | ||
|
||
:::info | ||
|
||
For more information on each endpoint, click the **View Docs** link in the header. It'll redirect you to its endpoint's API Reference documentation. | ||
|
||
::: | ||
|
||
![Lab: Horizon - View Docs](/assets/lab/lab-horizon-view-docs.png) | ||
|
||
## [[Accounts] Single Account](https://lab.stellar.org/endpoints/accounts/single) | ||
|
||
The single account endpoint provides information on a specific account. The balances section in the response will also list all the trustlines this account has established, including trustlines that haven’t been authorized yet. I'm using an account that I created on Testnet `GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F` that has an XLM balance, USDC trustline, thresholds value, and 3 signers as an example. | ||
|
||
![Lab: Horizon - Single Account](/assets/lab/lab-single-account.png) | ||
|
||
Once I click the **Submit** button, the account endpoint returns my account details in `JSON` format. Developers can use the **Copy Json** functionality to copy and paste the response. In addition to the account details, the account endpoint also provides links for other resources' pages on the Stellar Lab related to the account that I inquired. For example, its response shows `transactions`, `operations`, `payments`, and etc under `_links`. For example, clicking transaction's `href` would take developers to [Transactions for Account page](https://lab.stellar.org/endpoints/transactions/account?$=network$id=testnet&label=Testnet&horizonUrl=https:////horizon-testnet.stellar.org&rpcUrl=https:////soroban-testnet.stellar.org&passphrase=Test%20SDF%20Network%20/;%20September%202015;&endpoints$params$account_id=GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F;;) on the Stellar Lab. | ||
|
||
![Lab: Horizon - Single Account Response](/assets/lab/lab-single-account-response.png) | ||
|
||
The JSON response for the account `GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F` is the following. It has all the details I need to know about the account I inquired including `thresholds`, `flags`, `balances`, `signers`, | ||
|
||
```{ | ||
"_links": { | ||
"self": { | ||
"href": "https://horizon-testnet.stellar.org/accounts/GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F" | ||
}, | ||
"transactions": { | ||
"href": "https://horizon-testnet.stellar.org/accounts/GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F/transactions{?cursor,limit,order}", | ||
"templated": true | ||
}, | ||
"operations": { | ||
"href": "https://horizon-testnet.stellar.org/accounts/GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F/operations{?cursor,limit,order}", | ||
"templated": true | ||
}, | ||
"payments": { | ||
"href": "https://horizon-testnet.stellar.org/accounts/GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F/payments{?cursor,limit,order}", | ||
"templated": true | ||
}, | ||
"effects": { | ||
"href": "https://horizon-testnet.stellar.org/accounts/GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F/effects{?cursor,limit,order}", | ||
"templated": true | ||
}, | ||
"offers": { | ||
"href": "https://horizon-testnet.stellar.org/accounts/GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F/offers{?cursor,limit,order}", | ||
"templated": true | ||
}, | ||
"trades": { | ||
"href": "https://horizon-testnet.stellar.org/accounts/GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F/trades{?cursor,limit,order}", | ||
"templated": true | ||
}, | ||
"data": { | ||
"href": "https://horizon-testnet.stellar.org/accounts/GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F/data/{key}", | ||
"templated": true | ||
} | ||
}, | ||
"id": "GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F", | ||
"account_id": "GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F", | ||
"sequence": "4113457683103748", | ||
"sequence_ledger": 958608, | ||
"sequence_time": "1731620848", | ||
"subentry_count": 3, | ||
"last_modified_ledger": 958608, | ||
"last_modified_time": "2024-11-14T21:47:28Z", | ||
"thresholds": { | ||
"low_threshold": 5, | ||
"med_threshold": 5, | ||
"high_threshold": 5 | ||
}, | ||
"flags": { | ||
"auth_required": false, | ||
"auth_revocable": false, | ||
"auth_immutable": false, | ||
"auth_clawback_enabled": false | ||
}, | ||
"balances": [ | ||
{ | ||
"balance": "0.0000000", | ||
"limit": "922337203685.4775807", | ||
"buying_liabilities": "0.0000000", | ||
"selling_liabilities": "0.0000000", | ||
"last_modified_ledger": 958608, | ||
"is_authorized": true, | ||
"is_authorized_to_maintain_liabilities": true, | ||
"asset_type": "credit_alphanum4", | ||
"asset_code": "USDC", | ||
"asset_issuer": "GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5" | ||
}, | ||
{ | ||
"balance": "9990.9999400", | ||
"buying_liabilities": "0.0000000", | ||
"selling_liabilities": "0.0000000", | ||
"asset_type": "native" | ||
} | ||
], | ||
"signers": [ | ||
{ | ||
"weight": 2, | ||
"key": "GAGOOY3NKKNEXDOVKTKIP2AUCT6ZOQD4SMWAB54TSHTAXATLJSVVDJCZ", | ||
"type": "ed25519_public_key" | ||
}, | ||
{ | ||
"weight": 1, | ||
"key": "GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F", | ||
"type": "ed25519_public_key" | ||
}, | ||
{ | ||
"weight": 2, | ||
"key": "GDFHN4ILDFEBM5YHW6MYOQIRNY3EQ7VV72IW3YIAZNXDW363SUAK7BBL", | ||
"type": "ed25519_public_key" | ||
} | ||
], | ||
"data": {}, | ||
"num_sponsoring": 0, | ||
"num_sponsored": 0, | ||
"paging_token": "GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F" | ||
} | ||
``` | ||
|
||
// transactions to talk about getting funded and adding thresholds to 3 accounts |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.