Closed liamcurry closed 6 years ago
Here's the tic-tac-toe.wast
file: https://gist.github.com/liamcurry/8c107e14fe05a5a2fa9befee2f72a976
Okay I think I've partially figured out the issue. I have the contract account named tictactoe
, but there's a check in the contract for code tic.tac.toe
here: https://github.com/EOSIO/eos/blob/master/contracts/tic_tac_toe/tic_tac_toe.cpp#L195
I changed that to be tictactoe
and now I can create games with eosc
and with eos.transaction
like this:
eos.transaction({
scope: ['inita', 'initb'],
messages: [
{
code: 'tictactoe',
type: 'create',
authorization: [{ account: 'inita', permission: 'active' }],
data: {
host: 'inita', challenger: 'initb'
}
}
]
})
However I'm still getting errors when I try this code:
eos.contract('tictactoe').then(c => c.create({ host: 'inita', challenger: 'initb' }))
eosjs could not figure out the correct authorization
in this case.. As a work-around, try supplying your own "authorization" as an option (last parameter) to c.create({}, options)
This works:
const game = await eos.contract('tic.tac.toe')
await game.create(
{challenger: 'inita', host: 'initb'},
{
scope: ['inita', 'initb'],
authorization: ['initb@active']
}
)
const game = await eos.contract('tic.tac.toe') SyntaxError: await is only valid in async function
eos.contract('tic.tac.toe').then((contract) = { contract.create( {challenger: 'inita', host: 'initb'}, { scope: ['inita', 'initb'], authorization: ['initb@active'] }) })
I've deployed the tic tac toe example and am now trying to create a new game with
eosjs
, but I'm getting errors about irrelevant authorities?Here's the code I'm trying to run:
But when I run that I get these errors:
Here's the payload for that
push_transaction
request:I also tried creating the transaction manually like this:
But then I get different errors about missing required keys:
Any idea what's causing this? Am I doing something wrong? Thanks.