I am trying to set the eosio.code
permission for my contract on account kbo2byvpkbiy
(private blockchain). The reason I want to do this is calling eosio.token/transfer from within this contract.
All I have figured out so far is the following code:
await contractApi.transact({
actions: [{
account: 'eosio',
name: 'updateauth',
authorization: [{
actor: "kbo2byvpkbiy",
permission: 'active',
}],
data: {
account: "kbo2byvpkbiy",
permission: "active",
parent: 'active',
auth: {
"threshold": 1,
"keys": [{
"key": "EOS6gmCFLGxcAkKRskJKBPwXdFwZSJ7TPz2RRpXU1Lyn5e3zXrEFm",
"weight": 1
}],
"accounts": [{
"permission": {
"actor": "kbo2byvpkbiy",
"permission": "eosio.code"
},
"weight": 1
}],
"waits": [
{
"wait_sec": 0,
"weight": 0
}
]
}
}
}]
}, {
blocksBehind: 3,
expireSeconds: 30,
});
When I use this I get the following error:
Error: Cannot set an authority as its own parent at new RpcError
What am I doing wrong? The correct cleos command (after importing the private key into my wallet is:
cleos set account permission kbo2byvpkbiy active '{"threshold": 1,"keys": [{"key": "EOS6gmCFLGxcAkKRskJKBPwXdFwZSJ7TPz2RRpXU1Lyn5e3zXrEFm","weight": 1}],"accounts": [{"permission":{"actor": "kbo2byvpkbiy","permission":"eosio.code"},"weight":1}]}'
But how do I do this correctly in eosjs?