MiningApi
public protocol MiningApi : BaseApi
Undocumented
-
get(byAccountId:)
Default implementationGet miner by account id.
Throws
DCoreException.Network.notFound
if account does not exist.Default Implementation
Declaration
Swift
func get(byAccountId id: AccountObjectIdConvertible) -> Single<Miner>
Parameters
id
Account id as
AccountObjectId
orString
format.Return Value
An
Miner
if exist. -
getAll()
Default implementationGet first 1000 miners by their name to miner account.
Default Implementation
Declaration
Swift
func getAll() -> Single<[String : Miner]>
Return Value
Map
[String: Miner]
of miners. -
getAll(byIds:)
Default implementationGet list of miners by their ids.
Default Implementation
Declaration
Swift
func getAll(byIds ids: [ObjectIdConvertible]) -> Single<[Miner]>
Parameters
ids
Miner ids as
MinerObjectId
orString
format.Return Value
Array
[Miner]
of miners. -
findAllRelative(byLower:limit:)
Default implementationGet names and ids for registered miners.
Default Implementation
Declaration
Swift
func findAllRelative(byLower bound: String, limit: Int) -> Single<[MinerId]>
Parameters
bound
Lower bound of the first name.
limit
Max/default
1000
.Return Value
List of found miner ids.
-
countAllMiners()
Default implementationGet the total number of miners registered in DCore.
Default Implementation
Declaration
Swift
func countAllMiners() -> Single<UInt64>
Return Value
Number of miners.
-
getAllFeeds(byAccountId:limit:)
Default implementationGet a list of published price feeds by a miner.
Default Implementation
Declaration
Swift
func getAllFeeds(byAccountId id: AccountObjectIdConvertible, limit: UInt64) -> Single<AnyValue>
Parameters
id
Account id as
AccountObjectId
orString
format.limit
Maximum number of price feeds to fetch, max/default
100
.Return Value
Array of price feeds published by the miner.
-
getAllActualVotes()
Default implementationGet the number of votes each miner actually has.
Default Implementation
Declaration
Swift
func getAllActualVotes() -> Single<[MinerVotes]>
Return Value
Array of
[MinerVotes]
, mapping account names to the number of votes. -
findAllVotes(byVoteIds:)
Default implementationGiven a set of votes, return the objects they are voting for. The results will be in the same order as the votes. Null will be returned for any vote ids that are not found.
Default Implementation
Parameters
ids
Set of votes.
Return Value
Array of
[Miners]
, mapping account names to the number of votes. -
findAllVotingInfos(by:order:id:accountName:onlyMyVotes:limit:)
Default implementationGet miner voting info list by account that match search expression.
Default Implementation
Declaration
Swift
func findAllVotingInfos(by expression: String, order: SearchOrder.MinerVoting, id: ObjectIdConvertible?, accountName: String?, onlyMyVotes: Bool, limit: Int) -> Single<[MinerVotingInfo]>
Parameters
expression
Set of votes.
order
Order, default
SearchOrder.MinerVoting.nameDesc
.id
The object id of the miner to start searching from, 1.4.* or null when start from beginning, default
nil
, asMinerObjectId
orString
format.accountName
Account name or null when searching without account.
onlyMyVotes
When true it selects only votes given by account.
limit
Maximum number of miners info to fetch, max/default
1000
.Return Value
Array
[MinerVotingInfo]
of miner voting info. -
getNewAssetPerBlock()
Default implementationGet a reward for a miner from the most recent block.
Default Implementation
Declaration
Swift
func getNewAssetPerBlock() -> Single<BigInt>
Parameters
num
Block number.
Return Value
Amount of newlgenerated DCT.
-
getAssetPerBlock(byBlockNum:)
Default implementationGet a reward for a miner from a specified block.
Default Implementation
Declaration
Swift
func getAssetPerBlock(byBlockNum num: UInt64) -> Single<BigInt>
Parameters
num
Block number.
Return Value
Amount of generated DCT.
-
createVote(forMinerIds:credentials:)
Default implementationCreate vote for miner operation.
Default Implementation
Declaration
Swift
func createVote(forMinerIds ids: [ObjectIdConvertible], credentials: Credentials) -> Single<AccountUpdateOperation>
Parameters
ids
The object ids of the miners, eg. 1.4.*, as
MinerObjectId
orString
format.credentials
Account credentials.
Return Value
-
vote(forMinerIds:credentials:)
Default implementationMake vote for miner.
Default Implementation
Declaration
Swift
func vote(forMinerIds ids: [ObjectIdConvertible], credentials: Credentials) -> Single<TransactionConfirmation>
Parameters
ids
The object ids of the miners, eg. 1.4.*, as
MinerObjectId
orString
format.credentials
Account credentials.
Return Value