0
    const ScatterJS = require('scatterjs-core').default
const ScatterEOS = require('scatterjs-plugin-eosjs2').default
const Eos = require('eosjs')
const fetch = require('fetch'); //node only
const { Api, JsonRpc, RpcError } = require('eosjs');

//const api = new Api({ rpc, signatureProvider, textDecoder: new TextDecoder(), textEncoder: new TextEncoder() }); //required to submit transactions
ScatterJS.plugins(new ScatterEOS())


const network = ScatterJS.Network.fromJson({
    blockchain: 'eos',
    chainId: 'e70aaab8997e1dfce58fbfac80cbbb8fecec7b99cf982a9444273cbc64c41473',
    host: 'jungle2.cryptolions.io',
    port: 443,
    protocol: 'https'
});

//const rpc = new JsonRpc('http://jungle2.cryptolions.io:443', { fetch });
const rpc = new JsonRpc(network.fullhost()); //required to read blockchain state

ScatterJS.connect('YourAppName', {network}).then(connected => {
    if(!connected) return console.error('no scatter');

    const eos = ScatterJS.eos(network, Api, {rpc});
   // let account = scatter.identity.accounts.find(x => x.blockchain === 'eos');
    ScatterJS.login().then(id => {
        if(!id) return console.error('no identity');
        const account = ScatterJS.account('eos');

        eos.transact({
            actions: [{
                account: 'eosio.token',
                name: 'transfer',
                authorization: [{
                    actor: account.name,
                    permission: account.authority,
                }],
                data: {
                    from: account.name,
                    to: 'bdtester1234',
                    quantity: '0.0001 EOS',
                    memo: account.name,
                },
            }]
        }, {
            blocksBehind: 3,
            expireSeconds: 30,
        }).then(res => {
            console.log('sent: ', res);
        }).catch(err => {
                console.log('\nCaught exception: ' + err);
                if (err instanceof RpcError)
                  console.log(JSON.stringify(err.json, null, 2));
            console.error('error: ', err);
        });
    });
});

But I'm getting the following error:

Caught exception: TypeError: f is not a function error: { TypeError: f is not a function at JsonRpc. (E:\EOSIO\node_modules\eosjs\dist\eosjs-jsonrpc.js:99:46) at step (E:\EOSIO\node_modules\eosjs\dist\eosjs-jsonrpc.js:36:23) at Object.next (E:\EOSIO\node_modules\eosjs\dist\eosjs-jsonrpc.js:17:53) at E:\EOSIO\node_modules\eosjs\dist\eosjs-jsonrpc.js:11:71 at new Promise () at __awaiter (E:\EOSIO\node_modules\eosjs\dist\eosjs-jsonrpc.js:7:12) at JsonRpc.fetch (E:\EOSIO\node_modules\eosjs\dist\eosjs-jsonrpc.js:92:16) at JsonRpc. (E:\EOSIO\node_modules\eosjs\dist\eosjs-jsonrpc.js:208:55) at step (E:\EOSIO\node_modules\eosjs\dist\eosjs-jsonrpc.js:36:23) Blockquote

Caught exception: TypeError: f is not a function error: { TypeError: f is not a function at JsonRpc. (E:\EOSIO\node_modules\eosjs\dist\eosjs-jsonrpc.js:99:46) at step (E:\EOSIO\node_modules\eosjs\dist\eosjs-jsonrpc.js:36:23) at Object.next (E:\EOSIO\node_modules\eosjs\dist\eosjs-jsonrpc.js:17:53) at E:\EOSIO\node_modules\eosjs\dist\eosjs-jsonrpc.js:11:71 at new Promise () at __awaiter (E:\EOSIO\node_modules\eosjs\dist\eosjs-jsonrpc.js:7:12) at JsonRpc.fetch (E:\EOSIO\node_modules\eosjs\dist\eosjs-jsonrpc.js:92:16) at JsonRpc. (E:\EOSIO\node_modules\eosjs\dist\eosjs-jsonrpc.js:208:55) at step (E:\EOSIO\node_modules\eosjs\dist\eosjs-jsonrpc.js:36:23) at Object.next (E:\EOSIO\node_modules\eosjs\dist\eosjs-jsonrpc.js:17:53) isFetchError: true }

Thank you in advance!

0

Hi @AditiBobde You might check the eosjs compitable versions for scatter over https://github.com/GetScatter/scatter-js and configure your code as per the compitablity version of modules given in github.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.