algod client
id of underlying asset
bank asset id
oracle application id of underlying asset
oracle price field of underlying asset
oracle price scale factor of underlying asset
Returns bank asset id
bank asset id
Returns bank asset info
bank asset info as a dictionary
Returns oracle app id
oracle app id
Returns oracle price field
oracle price field
Returns oracle price scale factor
oracle price scale factor
Returns the current oracle price
oracle price
Returns the current raw oracle price
oracle price
Returns underlying asset id
underlying asset id
Returns underlying asset info
underlying asset info as a dictionary
Returns decimals of asset
decimals
Returns the usd value of the underlying amount (base units)
integer amount of base underlying units
usd value
This is the function that should be called when creating a new asset. You pass everything you would to the constructor, but to this function instead and this returns the new and created asset.
//Correct way to instantiate new asset
const newAsset = await Asset.init(algodClient, underlyingAssetId, bankAssetId, oracleAppId, oraclePriceField, oraclePriceScaleFactor)
//Incorrect way to instantiate new asset
const newAsset = new Asset(algodClient, underlyingAssetId, bankAssetId, oracleAppId, oraclePriceField, oraclePriceScaleFactor)
algod client
id of underlying asset
bank asset id
oracle application id of underlying asset
oracle price field of underlying asset
oracle price scale factor of underlying asset
a finished instance of the asset class.
Generated using TypeDoc
This is the constructor for the Asset class.
Note, do not call this to create a new asset. Instead call the static method init as there are asynchronous set up steps in creating an asset and a constructor can only return an instance of the class and not a promise.
Example