合约调用
唤起MYKEY进行合约调用, 支持多Action组合调用, 支持ContractAction和TransferAction两种形式的action类型。 参数请详见类定义:ContractRequest,ContractAction,TransferActionMYKEYResponse.
1
let transferData = TransferData()
2
transferData.from = "mykeyhulu525"
3
transferData.to = "madaraxliang"
4
transferData.quantity = "1.31 EOS"
5
transferData.memo = "transfer-memo"
6
7
let transferActionData = TransferAction()
8
transferActionData.account = "eosio.token"
9
transferActionData.name = WalletActionConstants.TRANSFER.rawValue
10
transferActionData.info = "contract-transfer-info"
11
transferActionData.data = transferData
12
13
let contractActionData = ContractAction()
14
contractActionData.account = "eosio"
15
contractActionData.name = "buyram"
16
contractActionData.info = "contract-contract-info"
17
contractActionData.data = ["payer":"mykeyhulu123","receiver":"mykeyhulu111","quant":"1.01 EOS"]
18
19
let contractRequest = ContractRequest()
20
contractRequest.info = "Perform the mortgage REX operation"
21
contractRequest.orderId = "BH19004"
22
// param:{"protocol": "", "version": "", "tx_id": "", "ref": "", "account": ""}
23
// return: same as SimpleWallet {"code": [0-2], "message": ""}
24
contractRequest.callbackUrl = "https://dappserver.xxx.url"
25
contractRequest.actions = [transferActionData,contractActionData]
26
27
MYKEYWallet.shared.contract(contractRequest: contractRequest, response: MYKEYResponse.init(success: { (response) in
28
self.presentDataView(data: response)
29
self.view.makeToast("success")
30
}, failure: { (errorValue) in
31
self.presentDataView(data: errorValue)
32
self.view.makeToast("failure")
33
}, cancelled: {
34
self.view.makeToast("cancelled")
35
}))
Copied!
Last modified 2yr ago
Copy link