I am trying to send tokens from one account to another using eosjs & reactjs with the standard eosio.token contract but I have issues with the authority. Can someone please explain the meaning of the error message and share some resources on how authorities are used in EOS? I have tried reading the official documentation but I am still struggling to solve the issue.
Reacjs function:
static async tranfsferTokens (accountFrom, accountTo, quantity) {
try {
(async () => {
console.log("Async func get_info");
const resp = await api.transact({
actions: [{
account: 'eosio.token',
name: 'transfer',
authorization: [{
actor: accountFrom,
permission: 'active',
}],
data: {
from: accountFrom,
to: accountTo,
quantity: quantity,
memo: '',
},
}]
}, {
signatures: [signatureProvider],
blocksBehind: 3,
expireSeconds: 30,
});
pre.textContent += '\n\nTransaction pushed!\n\n' + JSON.stringify(resp, null, 2);
})();
} catch (e) {
pre.textContent = '\nCaught exception: ' + e;
if (e instanceof eosjs_jsonrpc.RpcError)
pre.textContent += '\n\n' + JSON.stringify(e.json, null, 2);
}
}
Function call:
EosApiService.tranfsferTokens('alice', 'bob', '25 SYS');
Error message:
eosjs-rpcerror.js:26 Uncaught (in promise) Error: transaction declares authority '{"actor":"alice","permission":"active"}', but does not have signatures for it.
at new RpcError (eosjs-rpcerror.js:26)
at JsonRpc.eval (eosjs-jsonrpc.js:118)
at step (eosjs-jsonrpc.js:36)
at Object.eval [as next] (eosjs-jsonrpc.js:17)
at fulfilled (eosjs-jsonrpc.js:8)