AssetApi
public protocol AssetApi : BaseApi
Undocumented
-
get(byId:)Default implementationGet asset by id.
Throws
DCoreException.Network.notFoundif asset does not exist.Default Implementation
Declaration
Swift
func get(byId id: AssetObjectIdConvertible) -> Single<Asset>Parameters
idAsset id, eg. 1.3.*, as
AssetObjectIdorStringformat.Return Value
-
getAll(byIds:)Default implementationGet all assets by ids.
Default Implementation
Declaration
Swift
func getAll(byIds ids: [AssetObjectIdConvertible]) -> Single<[Asset]>Parameters
idsAsset ids, eg. [1.3.*], as
AssetObjectIdorStringformat.Return Value
Array
[Asset]of assets. -
get(bySymbol:)Default implementationGet assets by symbol.
Throws
DCoreException.Network.notFoundif asset does not exist.Default Implementation
Parameters
symbolAsset symbol, eg.
Asset.Symbol.dct.Return Value
-
getAll(bySymbols:)Default implementationGet all assets by symbols.
Throws
DCoreException.Network.notFoundif asset does not exist.Default Implementation
Parameters
symbolsAsset symbols, eg.
[Asset.Symbol.dct].Return Value
Array
[Asset]of assets. -
findAllRelative(byLower:limit:)Default implementationGet assets alphabetically by symbol name.
Default Implementation
Declaration
Swift
func findAllRelative(byLower bound: String, limit: Int) -> Single<[Asset]>Parameters
boundLower bound of symbol names to retrieve.
limitMaximum number of assets to fetch, default/max
100.Return Value
Array
[Asset]of assets. -
getRealSupply()Default implementationCurrent core asset supply.
Default Implementation
Declaration
Swift
func getRealSupply() -> Single<RealSupply>Return Value
RealSupplycurrent supply. -
getData(byAssetDataId:)Default implementationGet asset dynamic data by id.
Throws
DCoreException.Network.notFoundif asset data does not exist.Default Implementation
Declaration
Swift
func getData(byAssetDataId id: ObjectIdConvertible) -> Single<AssetData>Parameters
idAsset dynamic data id, eg. DCT id is 2.3.0, as
AssetDataObjectIdorStringformat.Return Value
AssetDataof asset data. -
getAllData(byAssetDataIds:)Default implementationGet all asset dynamic data by ids.
Default Implementation
Declaration
Swift
func getAllData(byAssetDataIds ids: [ObjectIdConvertible]) -> Single<[AssetData]>Parameters
idsAsset dynamic data ids, eg. DCT id is 2.3.0, as
AssetDataObjectIdorStringformat.Return Value
Array
[AssetData]of asset data. -
convert(fromDct:to:rounding:)Default implementationConverts DCT amount to asset by id, conversion is done via
Decimalwith rounding mode.Throws
DCoreException.Network.notFoundif asset does not exist orDCoreException.Chain.failConvertif failed to convert.Default Implementation
Declaration
Swift
func convert(fromDct amount: BigInt, to assetId: AssetObjectIdConvertible, rounding: Decimal.RoundingMode) -> Single<AssetAmount>Parameters
amountAmount in DCT (1.3.0).
assetIdAsset id, different then DCT (1.3.0).
roundingRounding mode for division operation.
Return Value
AssetAmountin DCT. -
convert(toDct:from:rounding:)Default implementationConverts from asset by id to DCT, conversion is done via
Decimalwith rounding mode.Throws
DCoreException.Network.notFoundif asset does not exist orDCoreException.Chain.failConvertif failed to convert.Default Implementation
Declaration
Swift
func convert(toDct amount: BigInt, from assetId: AssetObjectIdConvertible, rounding: Decimal.RoundingMode) -> Single<AssetAmount>Parameters
amountAmount with different asset id, then DCT (1.3.0).
assetIdAsset id of amount, then DCT (1.3.0).
roundingRounding mode for division operation.
Return Value
AssetAmountin DCT. -
exist(bySymbol:)Default implementationCheck if the asset exists.
Default Implementation
Declaration
Swift
func exist(bySymbol symbol: Asset.Symbol) -> Single<Bool>Parameters
symbolAsset symbol.
Return Value
trueif asset exist. -
create(credentials:symbol:precision:description:options:fee:)Default implementationCreate asset.
Throws
DCoreException.Network.alreadyFoundif asset with given symbol already exists.Default Implementation
Declaration
Swift
func create(credentials: Credentials, symbol: String, precision: UInt8, description: String, options: Asset.Options, fee: AssetAmount) -> Single<TransactionConfirmation>Parameters
credentialsaccount credentials issuing the asset.
symbolthe string symbol, 3-16 uppercase chars.
precisionbase unit precision, decimal places used in string representation.
descriptionoptional description
optionsasset options
feeAssetAmountfee for the operation, if leftAssetAmount.unsetthe fee will be computed in DCT asset, defaultAssetAmount.unset.Return Value
TransactionConfirmationthat asset was created.
View on GitHub
Install in Dash
AssetApi Protocol Reference