1

The code below will produce the following error message:

TypeError: Cannot read property 'threshold' of undefined authority.threshold updateauth.auth action.data transaction.actions index.js:121

Tested with eos 1.0.1 and eosjs 14.1.0:

Eos = require('eosjs')
let {ecc} = Eos.modules

eosioPrivate = '5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3'
eosioPublic = ecc.privateToPublic(eosioPrivate)

const azarus1 = 'azarus1';
azarusPrivate1 = ecc.seedPrivate(azarus1)
azarusPublic1 = ecc.privateToPublic(azarusPrivate1)
console.log("Azarus Public_key = ", azarusPublic1);

const azarus2 = 'azarus2';
azarusPrivate2 = ecc.seedPrivate(azarus2)
azarusPublic2 = ecc.privateToPublic(azarusPrivate2)
console.log("Azarus Public_key = ", azarusPublic2);

keyProvider = [eosioPrivate, azarusPrivate1, azarusPrivate2];

console.log("Starting Connexion to EOS V", Eos.version);
eos = Eos({keyProvider})

async function TestPermission() {
    try {
        const azarusAccount1 = await eos.newaccount({
            creator: 'eosio',
            name: azarus1,
            owner: azarusPublic1,
            active: azarusPublic1,
            recovery: 'eosio',
            deposit: '0 EOS'});    
    } catch (e) {
        console.log("Error creating account");
    }

    try {
        const azarusAccount2 = await eos.newaccount({
            creator: 'eosio',
            name: azarus2,
            owner: azarusPublic2,
            active: azarusPublic2,
            recovery: 'eosio',
            deposit: '0 EOS'});    
    } catch (e) {
        console.log("Error creating account");
    }

    try {
        const permRes = await eos.updateauth({
            account: azarus2,
            permission: 'active',
            parent: 'owner',
            data: {
                    threshold: 1, 
                    keys: [{key: azarusPublic2, weight: 1}], 
                    accounts: [{permission:{ actor:azarus1, permission:'active'}, weight:1}]
                },
            delay: 0});
    } catch (e) {
        console.log("Error in permission: " + e);
    }    
}

TestPermission();
  • It is unclear what your question is. Can you clarify the question you would like answered? – John Haager Jun 11 '18 at 18:20
  • Well, I try to change the permissions of azarus2 and add azarus1 in the list of accounts. To do that, I call eos.updateauth() (see code attached). This code worked perfectly with Dawn4.0 and eosjs 13.1 When I try to run it with latest version of EOS (1.0.3) and lates version of EOSJS (14.1.1), I have an exception raised when calling updateoauth() – Pierre Pontevia Jun 12 '18 at 19:04
  • I forgot to mention that I am running on OSX 10.13.5 – Pierre Pontevia Jun 13 '18 at 0:41

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.