GithubHelp home page GithubHelp logo

Irrelevant authorities error? about eosjs HOT 6 CLOSED

eosio avatar eosio commented on June 8, 2024
Irrelevant authorities error?

from eosjs.

Comments (6)

liamcurry avatar liamcurry commented on June 8, 2024

Here's the tic-tac-toe.wast file: https://gist.github.com/liamcurry/8c107e14fe05a5a2fa9befee2f72a976

from eosjs.

liamcurry avatar liamcurry commented on June 8, 2024

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' }))

screenshot

from eosjs.

jcalfee avatar jcalfee commented on June 8, 2024

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)

https://github.com/EOSIO/eosjs#options

from eosjs.

jcalfee avatar jcalfee commented on June 8, 2024

Related: EOSIO/eos#401

from eosjs.

jcalfee avatar jcalfee commented on June 8, 2024

This works:

    const game = await eos.contract('tic.tac.toe')
    await game.create(
      {challenger: 'inita', host: 'initb'},
      {
        scope: ['inita', 'initb'],
        authorization: ['initb@active']
      }
    )

from eosjs.

davidfrothin avatar davidfrothin commented on June 8, 2024

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']
})
})

from eosjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.