EOSIO / eosjs

General purpose library for the EOSIO blockchain.
http://eosio.github.io/eosjs
MIT License
1.43k stars 463 forks source link

dawn-v4.2.0 eosjs@13.0 #140

Closed yankunsam closed 6 years ago

yankunsam commented 6 years ago

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,

vicraft18 commented 6 years ago

I have the exact same problem, still trying to figure out

Olivierlu1 commented 6 years ago

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?

yepp4you commented 6 years ago

add chainId into Localnet options

yankunsam commented 6 years ago

@yepp4you Thanks. Can you give me more detail information?
options = {broadcast: true,sign: true,initial_chain_id: "0000000000000000000000000000000000000000000000000000000000000000"}

But it does not work

yepp4you commented 6 years ago

It seems to be good to check on the issue below. https://github.com/EOSIO/eosjs/issues/118

yankunsam commented 6 years ago

options = {broadcast: true,sign: true,chainld: "b686f7d31bd96218d73a080b4bfac00abd34fe13725139cd4bd55fd2435c40db"}

chainld? But it does not work for me. eosjs@13.0.0 eos: dawn-v4.2.0

lihao6485 commented 6 years ago

After added the chainId fixed the problem

let config = {
            chainId: "706a7ddd808de9fc2b8879904f3b392256c83104c1d544b38302cc07d9fca477",
            keyProvider: [privateKeys],
            broadcast: true,
            sign: true,
        }

let eos = Eos.Localnet(config)
yankunsam commented 6 years ago

@lihao6485 It works. Thanks

Olivierlu1 commented 6 years ago

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?

yankunsam commented 6 years ago

@Olivierlu1 you eos version and eosjs version? Also the action detail

jcalfee commented 6 years ago

Increase expireInSeconds https://github.com/EOSIO/eosjs#configuration

Olivierlu1 commented 6 years ago

@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.

Olivierlu1 commented 6 years ago

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 });
Olivierlu1 commented 6 years ago

not great! It doesn't work

jcalfee commented 6 years ago

@Olivierlu1 a transfer "from" alice needs an authorization from "alice" not "eosio.token" .. So change to: authorization: [{ actor: 'alice, permission: 'active' }],.