#how to use token in a soroban smart contract

12 messages · Page 1 of 1 (latest)

indigo plinth
#

Via the soroban SDK . You initialize a token with its address. How can you get the address of an asset in stellar. Where all you are given is an asset code and the issuer

blazing flame
#

Hey @indigo plinth, you need to wrap the Stellar classic asset to get the Address of the Stellar Asset Contract (SAC)

Allows the user to use their Stellar account and trustline balance on Soroban using the Token Interface, which is similar to the ERC-20 token standard.

Use the Token Interface to construct a smart contract token that has a uniform and predictable interface for payments, balance transfers, balance inquiries, and more.

indigo plinth
#

The wrapping is only done with soroban cli. Is there not a way of wrapping with the soroban js client

#

I am building a dApp that involves the use of stellar Asset.

My users would not understand wrapping asset because they are not going to be tech savvy

All they have would be a code and issuer address

Is there not a way of wrapping it via the soroban js client

normal elbow
# indigo plinth I am building a dApp that involves the use of stellar Asset. My users would not...

So you want to use the token with js? Or within a smart contract?
This can be helpful
https://github.com/esteblock/token-playground
https://token-playground.gitbook.io/guide/

GitHub

Token playground to learn how create and interact with Soroban and Stellar Classic Assets using Soroban - GitHub - esteblock/token-playground: Token playground to learn how create and interact wit...

indigo plinth
#

Thanks

Does anyone know how to interact with a getter function via js. I mean smart contract function that don't retrieve info only and does one pay gas fee for this

normal elbow
#

Js without frontend?

kind lava
#

You can get a ledger entry or index emitted events to get data without a getter or gas. There are some examples in the rpciege game

#

But youre gonna wanna use js-soroban-client for now

indigo plinth
#

I used server.simulateTransaction

kind lava
#

To get data? Can i see hoe?

kind lava