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
registrarNameOrId
Name or id of account that creates the contract
passwordOrWif
Password or WIF from account for transaction signature
assetId
Asset of contract
byteCode
Bytecode of the contract
supportedAssetId
If you dont want to link the contract with the specified asset
ethAccuracy
If true all balances passing to contract with ethereum accuracy
parameters
Parameters of constructor
completion
Callback 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
registrarNameOrId
Name or id of account that creates the contract
passwordOrWif
Password or WIF from account for transaction signature
assetId
Asset of contract
byteCode
Full bytecode for contract creation
supportedAssetId
If you dont want to link the contract with the specified asset
ethAccuracy
If true all balances passing to contract with ethereum accuracy
completion
Callback 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
registrarNameOrId
Name or id of account that call the contract
passwordOrWif
Password or WIF from account for transaction signature
assetId
Asset of contract
amount
Amount
contratId
Id of called contract
methodName
Name of called method
methodParams
Parameters of called method
completion
Callback 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
registrarNameOrId
Name or id of account that call the contract
passwordOrWif
Password or WIF from account for transaction signature
assetId
Asset of contract
amount
Amount
contratId
Id of called contract
byteCode
Code which will be execute
completion
Callback 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
registrarNameOrId
Name or id of account that call the contract
assetId
Asset of contract
contratId
Id of called contract
methodName
Name of called method
methodParams
Parameters of called method
completion
Callback 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
registrarNameOrId
Name or id of account that call the contract
assetId
Asset of contract
contratId
Id of called contract
byteCode
Code which will be execute
completion
Callback 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
contractResultId
Contract result identifier
completion
Callback 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
contractId
Contract id for fetching logs
fromBlockId
Number of the earliest block to retrieve
toBlockId
Number of the most recent block to retrieve
completion
Callback 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
contractIds
Contracts identifiers for call
completion
Callback which returns an [ContractInfo] or error
-
Return full information about contract
Declaration
Swift
func getContract(contractId: String, completion: @escaping Completion<ContractStructEnum>)
Parameters
contractId
Identifier for contract
completion
Callback which returns an ContractStructEnum or error