🧪
The Soroban's Token Playground
  • README
  • Index
    • 1: Introduction & Motivation.
    • 2 : Basic Concepts
    • 3 : Environment preparation
    • 4 : Issue and Mint Asset in Stellar.
    • 5: Get info about a token in Classic.
    • 6 : Wrap a token from Stellar Classic to Soroban.
    • 7 : Mint from a wrapped token in Soroban.
    • 8 : Use the native Stellar Lumens (XLM) the classic way.
    • 9 : Read the native token (XLM) using soroban-cli.
    • 10 : Write the native token (XLM) using soroban-cli.
    • 11 : Use the native token (XLM) inside a smart contract.
    • 12 : Identify a Stellar Classic Asset using stellar-sdk.
    • 13 : Wrap an asset using stellar-sdk.
Powered by GitBook
On this page
  • From a SYMBOL:ISSUER address
  • See if the asset exist?
  • From a wrapped asset contract address
Edit on GitHub
  1. Index

12 : Identify a Stellar Classic Asset using stellar-sdk.

How can we know if a specific asset is a Stellar Classic Asset?

Create an asset:

bash quickstart.sh standalone
bash run.sh
node src/friendbot.js
node src/issueAsset.js AAA

This will return:

ASSET ISSUED:  Asset {
  code: 'ABCD',
  issuer: 'GAM5XOXRUWPMKENBGOEAKMLRQ4ENHLHDSU2L2J7TVJ34ZI7S6PHMYIGI'
}

From a SYMBOL:ISSUER address

1.- See if the combination have a correct format:

var asset = new StellarSdk.Asset(asset_code, asset_issuer );

This will create an asset object. If either the asset_code or the asset_issuer are not in a good format, this will fail.

Test with:

node src/chapter12/checkFormat.js ABC GAM5XOXRUWPMKENBGOEAKMLRQ4ENHLHDSU2L2J7TVJ34ZI7S6PHMYIGI

See if the asset exist?

Can we know if for an asset we have totalSupply or something?

Can we use this in stellar-sdk?

https://horizon-testnet.stellar.org/assets?asset_code=ASSET_CODE&asset_issuer=ISSUER_ADDRESS

From a wrapped asset contract address

Previous11 : Use the native token (XLM) inside a smart contract.Next13 : Wrap an asset using stellar-sdk.

Last updated 1 year ago