I am trying to run the simple example in EOSIOSwift git repo (https://github.com/EOSIO/eosio-swift), but it does not work.
The example is like this:
let transaction = EosioTransaction()
transaction.rpcProvider = EosioRpcProvider(endpoint: URL(string: "http://localhost:8888")!)
transaction.serializationProvider = EosioAbieosSerializationProvider()
transaction.signatureProvider = try EosioSoftkeySignatureProvider(privateKeys: ["yourPrivateKey"])
/// Actions can now be added to the transaction, which can, in turn, be signed and broadcast:
let action = try EosioTransaction.Action(
account: EosioName("eosio.token"),
name: EosioName("transfer"),
authorization: [EosioTransaction.Action.Authorization(
actor: EosioName("useraaaaaaaa"),
permission: EosioName("active"))
],
data: Transfer(
from: EosioName("useraaaaaaaa"),
to: EosioName("useraaaaaaab"),
quantity: "42.0000 SYS",
memo: "")
)
transaction.add(action: action)
transaction.signAndBroadcast { (result) in
switch result {
case .failure (let error):
// Handle error.
print("ERROR SIGN/SEND Tx", error, "Reason", error.reason)
case .success:
// Handle success.
print("signed Tx.")
}
}
When I run the code above I get from
print("ERROR SIGN/SEND Tx", error, "Reason", error.reason)
the following message:
ERROR SIGN/SEND Tx There was an unexpected error. Reason self does not exist