Code Monkey home page Code Monkey logo

Comments (2)

jcalfee avatar jcalfee commented on July 22, 2024

This would help. I have this hack in place now, I'm not sure if it will work..

For example:

struct transfer
   from      AccountName  # may not be the message.sender if message.sender has delegated authority by from
   to        AccountName
   amount UInt64

transfer inita initb 1 yields scope: ['inita', 'initb'], authorization: ['inita', ...]

given the following hack:

    {// FIXME Hack, until an API call is available
      const fields = Object.keys(definition.fields)

      const f1 = fields[0]
      if(definition.fields[f1] === 'AccountName') {
        tx.scope.push(params[f1])
        tx.messages[0].authorization.push({
          account: params[f1],
          permission: 'active'
        })
      }

      if(fields.length > 1) {
        const f2 = fields[1]
        if(definition.fields[f2] === 'AccountName') {
          tx.scope.push(params[f2])
        }
      }
}

Does not work with new account.. newacct probably should not be in the scope because it does not exist in the block that the newacct will execute in.

struct newaccount
   creator   AccountName
   name      AccountName
   owner     Authority
   active    Authority
   recovery  Authority
   deposit Asset

yields scope: ['creator', 'newacct'], authorization: ['creator', ...]

So, I need the scope to be automated or done in an API call or I'll start adding these case by case to eosjs. Also, notice the authorizations is something we need too.

from eos.

gleehokie avatar gleehokie commented on July 22, 2024

OBE

from eos.

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.