AssetApi
public protocol AssetApi : BaseApi
Undocumented
-
get(byId:)
Default implementationGet asset by id.
Throws
DCoreException.Network.notFound
if asset does not exist.Default Implementation
Declaration
Swift
func get(byId id: AssetObjectIdConvertible) -> Single<Asset>
Parameters
id
Asset id, eg. 1.3.*, as
AssetObjectId
orString
format.Return Value
-
getAll(byIds:)
Default implementationGet all assets by ids.
Default Implementation
Declaration
Swift
func getAll(byIds ids: [AssetObjectIdConvertible]) -> Single<[Asset]>
Parameters
ids
Asset ids, eg. [1.3.*], as
AssetObjectId
orString
format.Return Value
Array
[Asset]
of assets. -
get(bySymbol:)
Default implementationGet assets by symbol.
Throws
DCoreException.Network.notFound
if asset does not exist.Default Implementation
Parameters
symbol
Asset symbol, eg.
Asset.Symbol.dct
.Return Value
-
getAll(bySymbols:)
Default implementationGet all assets by symbols.
Throws
DCoreException.Network.notFound
if asset does not exist.Default Implementation
Parameters
symbols
Asset 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
bound
Lower bound of symbol names to retrieve.
limit
Maximum 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
RealSupply
current supply. -
getData(byAssetDataId:)
Default implementationGet asset dynamic data by id.
Throws
DCoreException.Network.notFound
if asset data does not exist.Default Implementation
Declaration
Swift
func getData(byAssetDataId id: ObjectIdConvertible) -> Single<AssetData>
Parameters
id
Asset dynamic data id, eg. DCT id is 2.3.0, as
AssetDataObjectId
orString
format.Return Value
AssetData
of asset data. -
getAllData(byAssetDataIds:)
Default implementationGet all asset dynamic data by ids.
Default Implementation
Declaration
Swift
func getAllData(byAssetDataIds ids: [ObjectIdConvertible]) -> Single<[AssetData]>
Parameters
ids
Asset dynamic data ids, eg. DCT id is 2.3.0, as
AssetDataObjectId
orString
format.Return Value
Array
[AssetData]
of asset data. -
convert(fromDct:to:rounding:)
Default implementationConverts DCT amount to asset by id, conversion is done via
Decimal
with rounding mode.Throws
DCoreException.Network.notFound
if asset does not exist orDCoreException.Chain.failConvert
if failed to convert.Default Implementation
Declaration
Swift
func convert(fromDct amount: BigInt, to assetId: AssetObjectIdConvertible, rounding: Decimal.RoundingMode) -> Single<AssetAmount>
Parameters
amount
Amount in DCT (1.3.0).
assetId
Asset id, different then DCT (1.3.0).
rounding
Rounding mode for division operation.
Return Value
AssetAmount
in DCT. -
convert(toDct:from:rounding:)
Default implementationConverts from asset by id to DCT, conversion is done via
Decimal
with rounding mode.Throws
DCoreException.Network.notFound
if asset does not exist orDCoreException.Chain.failConvert
if failed to convert.Default Implementation
Declaration
Swift
func convert(toDct amount: BigInt, from assetId: AssetObjectIdConvertible, rounding: Decimal.RoundingMode) -> Single<AssetAmount>
Parameters
amount
Amount with different asset id, then DCT (1.3.0).
assetId
Asset id of amount, then DCT (1.3.0).
rounding
Rounding mode for division operation.
Return Value
AssetAmount
in DCT. -
exist(bySymbol:)
Default implementationCheck if the asset exists.
Default Implementation
Declaration
Swift
func exist(bySymbol symbol: Asset.Symbol) -> Single<Bool>
Parameters
symbol
Asset symbol.
Return Value
true
if asset exist. -
create(credentials:symbol:precision:description:options:fee:)
Default implementationCreate asset.
Throws
DCoreException.Network.alreadyFound
if 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
credentials
account credentials issuing the asset.
symbol
the string symbol, 3-16 uppercase chars.
precision
base unit precision, decimal places used in string representation.
description
optional description
options
asset options
fee
AssetAmount
fee for the operation, if leftAssetAmount.unset
the fee will be computed in DCT asset, defaultAssetAmount.unset
.Return Value
TransactionConfirmation
that asset was created.