Coder Social home page Coder Social logo

Comments (4)

nsjames avatar nsjames commented on June 15, 2024 1

Try setting this.eos after you login.

from scatter-js.

Jeremyyang avatar Jeremyyang commented on June 15, 2024 1

Thank you so much, it works!

from scatter-js.

nsjames avatar nsjames commented on June 15, 2024

I need to see your code, not mine :)

Also throwNoAuth(); is not the noIdentity thrower. It's an authentication thrower, and doesn't even exist if using the extension.

from scatter-js.

Jeremyyang avatar Jeremyyang commented on June 15, 2024

Thank you for reply. Here's my code:

import ScatterJS from 'scatterjs-core';
import ScatterEOS from 'scatterjs-plugin-eosjs'
const Eos = require('eosjs');
ScatterJS.plugins(new ScatterEOS());

class EosApi {
    constructor() {
        this.eos = ScatterJS.scatter.eos(this.getNetwork(), Eos, {});
    }
    
    login() {
        // I think actually ScatterJS.scatter.getIdentity refers to the extension's scatter.getIdentity
        return ScatterJS.scatter.getIdentity({
            accounts: [this.getNetwork()]
        }).then( (identity) => {
            return !!identity;
        }).catch((error) => {
            return false;
        });
    }
    
    doTransfer(obj, opts) {
        const opts = { authorization: [`${obj.from}@${obj.authority}`] };
        return this.eos.transfer(obj.from, obj.to, obj.balance + " EOS", obj.memo, opts);
    }
}

the packages version are:

  "eosjs": "^16.0.9",
  "scatterjs-core": "^2.3.2",
  "scatterjs-plugin-eosjs": "^1.3.3"

The error threw from throwIfNoIdentity() of scatterjs-plugin-eosjs when I call eosApi.doTransfer() after I logined successfuly.

from scatter-js.

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.