AccountApi
public protocol AccountApi : BaseApi
Undocumented
-
exist(byName:)Default implementationCheck if the account exist.
Default Implementation
Declaration
Swift
func exist(byName name: String) -> Single<Bool>Parameters
nameAccount name.
Return Value
trueif account exist. -
exist(byId:)Default implementationCheck if the account exist.
Default Implementation
Declaration
Swift
func exist(byId id: AccountObjectIdConvertible) -> Single<Bool>Parameters
idAccount id as
AccountObjectIdorStringformat.Return Value
trueif account exist. -
exist(byReference:)Default implementationCheck if the account exist.
Default Implementation
Declaration
Swift
func exist(byReference ref: Account.Reference) -> Single<Bool>Parameters
refAccount id or name.
Return Value
trueif account exist. -
get(byName:)Default implementationGet account by name.
Throws
DCoreException.Network.notFoundif account does not exist.Default Implementation
Declaration
Swift
func get(byName name: String) -> Single<Account>Parameters
nameAccount name.
Return Value
An
Accountif exist. -
get(byId:)Default implementationGet account by id.
Throws
DCoreException.Network.notFoundif account does not exist.Default Implementation
Declaration
Swift
func get(byId id: AccountObjectIdConvertible) -> Single<Account>Parameters
idAccount id as
AccountObjectIdorStringformat.Return Value
An
Accountif exist. -
get(byReference:)Default implementationGet account by reference (id or name) in
Stringformat.Throws
DCoreException.Network.notFoundif account does not exist.Default Implementation
Parameters
refAccount id or name.
Return Value
An
Accountif exist. -
getAll(byIds:)Default implementationGet accounts by ids.
Default Implementation
Declaration
Swift
func getAll(byIds ids: [AccountObjectIdConvertible]) -> Single<[Account]>Parameters
idsAccount ids as
AccountObjectIdorStringformat.Return Value
An
[Account]array. -
getAll(byNames:)Default implementationGet accounts by names.
Default Implementation
Declaration
Swift
func getAll(byNames names: [String]) -> Single<[Account]>Parameters
namesAccount names.
Return Value
An
[Account]array. -
getFullAccounts(byReferences:subscribe:)Default implementationGet all objects relevant to the specified accounts and subscribe to updates.
Default Implementation
Declaration
Swift
func getFullAccounts(byReferences refs: [Account.Reference], subscribe: Bool) -> Single<[String : FullAccount]>Parameters
refsAccount references (id or name) in
Stringformat.subscribetrueto subscribe to updates, defaultfalse.Return Value
Map
[String: FullAccount]of names or ids to account, or empty map if not present. -
findAllReferences(byKeys:)Default implementationGet accounts ids by public key addresses.
Default Implementation
Declaration
Swift
func findAllReferences(byKeys keys: [Address]) -> Single<[[AccountObjectId]]>Parameters
keysFormatted public keys of the account, eg. DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4.
Return Value
All
[[AccountObjectId]]account references by given keys. -
findAllReferences(byId:)Default implementationGet all accounts that refer to the account id in their owner or active authorities.
Default Implementation
Declaration
Swift
func findAllReferences(byId id: AccountObjectIdConvertible) -> Single<[AccountObjectId]>Parameters
idAccount id as
AccountObjectIdorStringformat.Return Value
All
[[AccountObjectId]]account references by given keys. -
findAllRelative(byLower:limit:)Default implementationGet names and ids for registered accounts.
Default Implementation
Declaration
Swift
func findAllRelative(byLower bound: String, limit: Int) -> Single<[String : AccountObjectId]>Parameters
boundLower bound of the first name to return.
limitNumber of items to get, max/default
1000Return Value
Map
[String: AccountObjectId]of account names to corresponding ids. -
findAll(by:order:id:limit:)Default implementationGet accounts that match lookup expression.
Default Implementation
Declaration
Swift
func findAll(by expression: String, order: SearchOrder.Accounts, id: AccountObjectId, limit: Int) -> Single<[Account]>Parameters
expressionWill try to partially match account name or id.
orderSort data by field, default
SearchOrder.Accounts.nameDesc.idObject id to start searching from, default
0.0.0.limitNumber of items to get, max/default
1000.Return Value
Array
[Account]of accounts. -
countAll()Default implementationGet the total number of registered accounts.
Default Implementation
Declaration
Swift
func countAll() -> Single<UInt64>Return Value
Number of registered accounts.
-
createCredentials(byName:wif:)Default implementationCreate account credentails by account name.
Throws
DCoreException.Network.notFoundif account does not exist.Default Implementation
Declaration
Swift
func createCredentials(byName name: String, wif: String) -> Single<Credentials>Parameters
nameAccount name.
wifPrivate key in wif base58 format, eg. 5Jd7zdvxXYNdUfnEXt5XokrE3zwJSs734yQ36a1YaqioRTGGLtn.
Return Value
Account
Credentials. -
createCredentials(byName:encryptedWif:passphrase:)Default implementationCreate account credentails by account name.
Throws
DCoreException.Network.notFoundif account does not exist.Default Implementation
Declaration
Swift
func createCredentials(byName name: String, encryptedWif wif: String, passphrase: String) -> Single<Credentials>Parameters
nameAccount name.
wifPrivate key in AES encrypted format.
passphraseKeypass to unlock encrypted private key.
Return Value
Account
Credentials. -
create(_:registrar:fee:)Default implementationCreate account.
Throws
DCoreException.Network.alreadyFoundif account with given name already exist.Default Implementation
Declaration
Swift
func create(_ account: SubmitAccount, registrar: Credentials, fee: AssetAmount) -> Single<TransactionConfirmation>Parameters
accountSubmitAccount object with name and public key (Address).
registrarCredentials of account which will pay operation fee.
feeAssetAmountfee for the operation, if leftAssetAmount.unsetthe fee will be computed in DCT asset, defaultAssetAmount.unset.Return Value
TransactionConfirmationthat account was created. -
update(credentials:options:active:owner:fee:)Default implementationUpdate account.
Default Implementation
Declaration
Swift
func update(credentials: Credentials, options: Options?, active: Authority?, owner: Authority?, fee: AssetAmount) -> Single<TransactionConfirmation>Parameters
credentialsCredentials of account to update.
optionsnew account options.
activenew active authority.
ownernew owner authority.
feeAssetAmountfee for the operation, if leftAssetAmount.unsetthe fee will be computed in DCT asset, defaultAssetAmount.unset.Return Value
TransactionConfirmationthat account was updated. -
createTransfer(from:to:amount:message:encrypted:fee:)Default implementationCreate transfer operation between two accounts using credentails.
Default Implementation
Declaration
Swift
func createTransfer(from credentials: Credentials, to: Account.Reference, amount: AssetAmount, message: String?, encrypted: Bool, fee: AssetAmount) -> Single<TransferOperation>Parameters
credentailsSender account credentials.
toReceiver account reference.
amountAssetAmountto send with asset type.messageMessage (Optional).
encryptedIf message present, encrypted is visible only for sender and receiver, unencrypted is visible publicly, default
true.feeAssetAmountfee for the operation, if leftAssetAmount.unsetthe fee will be computed in DCT asset, defaultAssetAmount.unset.Return Value
-
createTransfer(from:to:amount:fee:)Default implementationCreate transfer operation between two accounts using credentails.
Default Implementation
Declaration
Swift
func createTransfer(from credentials: Credentials, to: Account.Reference, amount: AssetAmount, fee: AssetAmount) -> Single<TransferOperation>Parameters
credentailsSender account credentials.
toReceiver account reference.
amountAssetAmountto send with asset type.feeAssetAmountfee for the operation, if leftAssetAmount.unsetthe fee will be computed in DCT asset, defaultAssetAmount.unset.Return Value
-
transfer(from:to:amount:message:encrypted:fee:)Default implementationMake a transfer between two accounts
Default Implementation
Declaration
Swift
func transfer(from credentials: Credentials, to: Account.Reference, amount: AssetAmount, message: String?, encrypted: Bool, fee: AssetAmount) -> Single<TransactionConfirmation>Parameters
credentailsSender account credentials.
toReceiver account reference.
amountAssetAmountto send with asset type.messageMessage (Optional).
encryptedIf message present, encrypted is visible only for sender and receiver, unencrypted is visible publicly, default
true.feeAssetAmountfee for the operation, if leftAssetAmount.unsetthe fee will be computed in DCT asset, defaultAssetAmount.unset.Return Value
A transaction confirmation.
-
transfer(from:to:amount:fee:)Default implementationMake a transfer between two accounts
Default Implementation
Declaration
Swift
func transfer(from credentials: Credentials, to: Account.Reference, amount: AssetAmount, fee: AssetAmount) -> Single<TransactionConfirmation>Parameters
credentailsSender account credentials.
toReceiver account reference.
amountAssetAmountto send with asset type.feeAssetAmountfee for the operation, if leftAssetAmount.unsetthe fee will be computed in DCT asset, defaultAssetAmount.unset.Return Value
A transaction confirmation.
View on GitHub
Install in Dash
AccountApi Protocol Reference