ContractsFacade
public protocol ContractsFacade
Encapsulates logic, associated with various blockchain smart contract processes
-
createContract(registrarNameOrId:passwordOrWif:assetId:amount:assetForFee:byteCode:supportedAssetId:ethAccuracy:parameters:completion:noticeHandler:)Creates contract on blockchain
Declaration
Swift
func createContract(registrarNameOrId: String, passwordOrWif: PassOrWif, assetId: String, amount: UInt?, assetForFee: String?, byteCode: String, supportedAssetId: String?, ethAccuracy: Bool, parameters: [AbiTypeValueInputModel]?, completion: @escaping Completion<Bool>, noticeHandler: NoticeHandler?)Parameters
registrarNameOrIdName or id of account that creates the contract
passwordOrWifPassword or WIF from account for transaction signature
assetIdAsset of contract
byteCodeBytecode of the contract
supportedAssetIdIf you dont want to link the contract with the specified asset
ethAccuracyIf true all balances passing to contract with ethereum accuracy
parametersParameters of constructor
completionCallback which returns an Bool result of creation or error
-
createContract(registrarNameOrId:passwordOrWif:assetId:amount:assetForFee:byteCode:supportedAssetId:ethAccuracy:completion:noticeHandler:)Creates contract on blockchain
Declaration
Swift
func createContract(registrarNameOrId: String, passwordOrWif: PassOrWif, assetId: String, amount: UInt?, assetForFee: String?, byteCode: String, supportedAssetId: String?, ethAccuracy: Bool, completion: @escaping Completion<Bool>, noticeHandler: NoticeHandler?)Parameters
registrarNameOrIdName or id of account that creates the contract
passwordOrWifPassword or WIF from account for transaction signature
assetIdAsset of contract
byteCodeFull bytecode for contract creation
supportedAssetIdIf you dont want to link the contract with the specified asset
ethAccuracyIf true all balances passing to contract with ethereum accuracy
completionCallback which returns an Bool result of creation or error
-
callContract(registrarNameOrId:passwordOrWif:assetId:amount:assetForFee:contratId:methodName:methodParams:completion:noticeHandler:)Calls to contract on blockchain
Declaration
Swift
func callContract(registrarNameOrId: String, passwordOrWif: PassOrWif, assetId: String, amount: UInt?, assetForFee: String?, contratId: String, methodName: String, methodParams: [AbiTypeValueInputModel], completion: @escaping Completion<Bool>, noticeHandler: NoticeHandler?)Parameters
registrarNameOrIdName or id of account that call the contract
passwordOrWifPassword or WIF from account for transaction signature
assetIdAsset of contract
amountAmount
contratIdId of called contract
methodNameName of called method
methodParamsParameters of called method
completionCallback which returns an Bool result of call or error
-
callContract(registrarNameOrId:passwordOrWif:assetId:amount:assetForFee:contratId:byteCode:completion:noticeHandler:)Calls to contract on blockchain
Declaration
Swift
func callContract(registrarNameOrId: String, passwordOrWif: PassOrWif, assetId: String, amount: UInt?, assetForFee: String?, contratId: String, byteCode: String, completion: @escaping Completion<Bool>, noticeHandler: NoticeHandler?)Parameters
registrarNameOrIdName or id of account that call the contract
passwordOrWifPassword or WIF from account for transaction signature
assetIdAsset of contract
amountAmount
contratIdId of called contract
byteCodeCode which will be execute
completionCallback which returns an Bool result of call or error
-
Calls contract method without changing state of blockchain
Declaration
Swift
func queryContract(registrarNameOrId: String, assetId: String, contratId: String, methodName: String, methodParams: [AbiTypeValueInputModel], completion: @escaping Completion<String>)Parameters
registrarNameOrIdName or id of account that call the contract
assetIdAsset of contract
contratIdId of called contract
methodNameName of called method
methodParamsParameters of called method
completionCallback which returns an Bool result of call or error
-
Calls contract method without changing state of blockchain
Declaration
Swift
func queryContract(registrarNameOrId: String, assetId: String, contratId: String, byteCode: String, completion: @escaping Completion<String>)Parameters
registrarNameOrIdName or id of account that call the contract
assetIdAsset of contract
contratIdId of called contract
byteCodeCode which will be execute
completionCallback which returns an Bool result of call or error
-
Return result of contract operation call
Declaration
Swift
func getContractResult(contractResultId: String, completion: @escaping Completion<ContractResultEnum>)Parameters
contractResultIdContract result identifier
completionCallback which returns an ContractResultEnum or error
-
Return list of contract logs
Declaration
Swift
func getContractLogs(contractId: String, fromBlock: Int, toBlock: Int, completion: @escaping Completion<[ContractLog]>)Parameters
contractIdContract id for fetching logs
fromBlockIdNumber of the earliest block to retrieve
toBlockIdNumber of the most recent block to retrieve
completionCallback which returns an array of ContractLog result of call or error
-
Returns contracts called by identifiers
Declaration
Swift
func getContracts(contractIds: [String], completion: @escaping Completion<[ContractInfo]>)Parameters
contractIdsContracts identifiers for call
completionCallback which returns an [ContractInfo] or error
-
Return full information about contract
Declaration
Swift
func getContract(contractId: String, completion: @escaping Completion<ContractStructEnum>)Parameters
contractIdIdentifier for contract
completionCallback which returns an ContractStructEnum or error
View on GitHub
ContractsFacade Protocol Reference