Closed yankunsam closed 6 years ago
I have the exact same problem, still trying to figure out
Same. Was about to post this.
My code looks like this
var EOS = require('eosjs');
var i = Math.round(+new Date());
let initaPrivate = "5J7dLLEWRuK7ws5Jb7GcVJRFMJR4vFzL2bWp6mHvhx6GyAiiuz2";
let initaPublic = "EOS6RZNJvzvLUKhMF8dee4zgCKgU4Y5nYvVdHJApE51vFjYLKapdi";
let keyProvider = initaPrivate;
let eos = EOS.Localnet({ keyProvider });
let res = eos.transaction(
{
actions: [
{
account: 'eosio.token',
name: 'transfer' ,
authorization: [{ actor: 'eosio.token', permission: 'active' }],
data: { from:'alice', to:'olivier', quantity:'50.0000 EOS', memo:' ['+i+']' }
}
]
},
{ broadcast: true });
Has anyone figured it out?
add chainId into Localnet options
@yepp4you Thanks. Can you give me more detail information?
options = {broadcast: true,sign: true,initial_chain_id: "0000000000000000000000000000000000000000000000000000000000000000"}
But it does not work
It seems to be good to check on the issue below. https://github.com/EOSIO/eosjs/issues/118
options = {broadcast: true,sign: true,chainld: "b686f7d31bd96218d73a080b4bfac00abd34fe13725139cd4bd55fd2435c40db"}
chainld? But it does not work for me. eosjs@13.0.0 eos: dawn-v4.2.0
After added the chainId fixed the problem
let config = {
chainId: "706a7ddd808de9fc2b8879904f3b392256c83104c1d544b38302cc07d9fca477",
keyProvider: [privateKeys],
broadcast: true,
sign: true,
}
let eos = Eos.Localnet(config)
@lihao6485 It works. Thanks
I'm getting this error when I do that:
api error => { message: 'transaction has expired, expiration is 2018-05-28T11:21:02 and pending block time is 2018-05-28T12:46:34.000',
file: 'controller.cpp',
line_number: 1380,
method: 'validate_expiration' }
Has anyone got this before?
@Olivierlu1 you eos version and eosjs version? Also the action detail
Increase expireInSeconds https://github.com/EOSIO/eosjs#configuration
@yankunsam I am using dawnv4.2.0 with 13.0.0 for eosjs.
@jcalfee I changed my config to:
let config = {
chainId: '706a7ddd808de9fc2b8879904f3b392256c83104c1d544b38302cc07d9fca477',
keyProvider: initaPrivate,
broadcast: true,
sign: true,
expireInSeconds: 60
};
But it still doesn't work.
Actually, I was able to resolve the error by configuring my nodeos. However, I still get my initial error of: api error => { message: 'transaction declares authority \'{"actor":"eosio.token","permission":"active"}\', but does not have signatures for it under a provided delay of 0 ms',
My whole program is simple and looks like this:
var EOS = require('eosjs');
var i = Math.round(+new Date());
let initaPrivate = "5J7dLLEWRuK7ws5Jb7GcVJRFMJR4vFzL2bWp6mHvhx6GyAiiuz2";
let initaPublic = "EOS6RZNJvzvLUKhMF8dee4zgCKgU4Y5nYvVdHJApE51vFjYLKapdi";
let keyProvider = initaPrivate;
let config = {
chainId: '706a7ddd808de9fc2b8879904f3b392256c83104c1d544b38302cc07d9fca477',
keyProvider: initaPrivate,
broadcast: true,
sign: true,
expireInSeconds: 60,
};
let eos = EOS.Localnet(config);
let res = eos.transaction(
{
actions: [
{
account: 'eosio.token',
name: 'transfer' ,
authorization: [{ actor: 'eosio.token', permission: 'active' }],
data: { from:'alice', to:'olivier', quantity:'50.0000 EOS', memo:' ['+i+']' },
}
]
},
{ broadcast: true });
not great! It doesn't work
@Olivierlu1 a transfer "from" alice needs an authorization from "alice" not "eosio.token" .. So change to: authorization: [{ actor: 'alice, permission: 'active' }],
.
api error => { message: 'transaction declares authority \'{"actor":"eosio.token","permission":"active"}\', but does not have signatures for it under a provided delay of 0 ms', file: 'authorization_manager.cpp', line_number: 405,