Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defining "ScatterJS.scatter.eos" Cannot call related methods #161

Open
zebei opened this issue Feb 22, 2020 · 0 comments
Open

Defining "ScatterJS.scatter.eos" Cannot call related methods #161

zebei opened this issue Feb 22, 2020 · 0 comments

Comments

@zebei
Copy link

zebei commented Feb 22, 2020

Defining variables
const eos = scatter.eos(network, Api, { rpc, beta3: true });
when i try to use 'eos' related method:getCurrencyBalance or transfer
will throw exception: "TypeError:Cannot read property 'apply' of undefined"


import ScatterJS, { Network } from 'scatterjs-core';
import ScatterEOS from 'scatterjs-plugin-eosjs2'
import { Api, JsonRpc, RpcError, JsSignatureProvider } from 'eosjs';

ScatterJS.plugins(new ScatterEOS());
const network = Network.fromJson({
    blockchain: 'eos',
    protocol: 'https',
    host: 'jungle2.cryptolions.io',
    port: 443,
    chainId: 'e70aaab8997e1dfce58fbfac80cbbb8fecec7b99cf982a9444273cbc64c41473'
})
const rpc = new JsonRpc(network.fullhost());
const requiredFields = { accounts: [network] };

ScatterJS.connect('fff', { network }).then(connected => {
    if (!connected) return alert('no scatter');
    ScatterJS.scatter.getIdentity(requiredFields).then(() => {
        const scatter =ScatterJS.scatter;
        
        const account = scatter.identity.accounts.find(x => x.blockchain === 'eos');
        console.log( account.name);
        
        const eos = scatter.eos(network, Api, { rpc, beta3: true });
        
        let config = {
            account: account.name,  
            code: "eosio.token", 
            symbol: "EOS" 
        };
        eos.getCurrencyBalance(config).then(e => {
            console.log(e)
        });
    }).catch(error => {
        console.log(error);
    });
});

 "dependencies": {
    "browserify": "^16.5.0",
    "eosjs": "^20.0.3",
    "jquery": "^3.4.1",
    "scatterjs-core": "^2.7.18",
    "scatterjs-plugin-eosjs2": "^1.5.0"
   },`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant