5: Get info about a token in Classic.
Last updated
Last updated
Check this guide in
Edit this guide in it's repo:
Contribute to this guide in the of the repo
In this chapter we will show you how to get info about the asset that we have created and minted in the .
The Horizon sever provides an HTTP API to request data in the stellar network, providing several endpoints. One of them allow us to request assets info. Our code uses the Stellar SDK sends request to these endpoints.
Remember to follow the code in the . Also, you can clone the code by doing
Asset information are stored in stellar ledgers. In order to facitilate the access to the data, stellar provides the Horizon API with several endpoints. Here we show you the endpoint URL with the query string to request an asset info.
The query string includes two parameters, one is the asset_code
and one is the asset_issuer
. This request will return the info of a single asset as reponse.
An answer looks like this:
In the response you'll find relevant info about the asset as:
-asset code
MYASSETCODE
-asset issuer
GAM5XOXRUWPMKENBGOEAKMLRQ4ENHLHDSU2L2J7TVJ34ZI7S6PHMYIGI
-amount issued
5.0000000
You can run it by:
Also you can run it with a different asset code than the one in settings.json by passing it as argument:
Here, you'll find a fragmet of the code that exemplifies how stellar sdk access to horizon asset endpoint.
If you want to use our code, we prepared the script that can be called by the soroban-preview-10
docker container:
This script uses the stellar sdk to request to horizon api about asset info. is a javascript library from stellar that offers a layer API for Horizon endpoints and facilities building, signing and submiting transactions.
In the we will wrap this asset from the classic Stellar blockchain into a Soroban smart contract. Are you ready?!
This Playground has been developed by in collaboration with from