TransWikia.com

How to use scatter without node.js?

EOS.IO Asked on December 11, 2021

I am using scatterjs cdn.

<script src="https://cdn.scattercdn.com/file/scatter-cdn/js/latest/scatterjs-core.min.js"></script>

I thought I can use scatterjs by only importing simple javascript without node.js but it isn’t working. Does anyone know an example using scatter.js without node.js?

Or is it not possible?

2 Answers

You can use the following files to set up scatter without node,

<script src="https://cdn.scattercdn.com/file/scatter-cdn/js/latest/scatterjs-core.min.js"></script>

<script src="https://cdn.scattercdn.com/file/scatter-cdn/js/latest/scatterjs-plugin-eosjs2.min.js"></script>

and below script for simple javascript, to connect to scatter.

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

    ScatterJS.plugins(new ScatterEOS());

    try {
        ScatterJS.scatter.connect(contract).then(connected => {
            // User does not have Scatter Desktop, Mobile or Classic installed.
            if (!connected) return console.log("Issue Connecting");

            scatter = ScatterJS.scatter;

            const requiredFields = {
                accounts: [network]
            };

            scatter.getIdentity(requiredFields).then(() => {
                _account = scatter.identity.accounts.find(
                    x => x.blockchain === "eos"
                )
            })
            .catch(error => {
                console.log(error);
            })

            window.ScatterJS = null;
        });
    }
    catch (error) {}

You can also find code example on github

Answered by Abdul Moiz on December 11, 2021

Scatter design to work with frontend. Check out demo application of scatter with eosjs SDK but it's depreciated and for newest example, contract telegram scatter developer channel.

https://github.com/EOSEssentials/Scatter-Demos

https://t.me/ScatterDevelopers

Answered by Farhan-TroonTechnologies on December 11, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP