0

I know EOSJS 16 is deprecated, but I want to know how to solve this following error in it.

  var Eos = require('eosjs');

// Default configuration
var config = {
  chainId: 'CID', // 32 byte (64 char) hex string
  keyProvider: 'KPD',
  httpEndpoint: 'http://localhost:8888',
  expireInSeconds: 60,
  broadcast: true,
  verbose: false, // API activity
  sign: true
};

var eos = Eos(config);

eos.transaction(tr => {
    tr.newaccount({
      creator: 'accountadmin',
      name: 'testaccount',
      owner: 'PB1',
      active: 'PB2'
    });
    tr.buyrambytes({
      payer: 't1',
      receiver: 'testaccount',
      bytes: 1024 * 3
    });
    tr.delegatebw({
      from: 't1',
      receiver: 'testaccount',
      stake_net_quantity: '1.0000 SGHX',
      stake_cpu_quantity: '1.0000 SGHX',
      transfer: 0
    });
  }).then(function (result) {
          console.log("here??");
    console.log(result);
  }).catch(function (error) {
    if (error) {
      console.log(error);
    }
  });

Above is the reproducable example of my code.

I have created two wallets, testaccount-owner and testaccount-active. And used their public keys here. I want to create another account 'testaccount' using an accountadmin I created, but whenever I run this script I get an error saying

Provided keys, permissions, and delays do not satisfy declared authorizations","details":[{"message":"transaction declares authority '{\"actor\":\"accountadmin\",\"permission\":\"active\"

To do this in the command line I would have simply included the flag -p accountadmin@active, but I can't figure out where to give the authority here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.