Skip to content

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

Description

@zebei

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"
   },`

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions