I'm trying to get scatter working in node.js. I was working with scatterjs-core and scatterjs-plugin-eosjs2 packages before and now moved to @scatterjs/core and @scatterjs/eosjs2
I've modified the example under eosjs@20.0.0 to work in node.js and simplified it a bit. There are a few things I have to add to have it working: introduce globally accessible window object, introduce window.fetch.
However, the request to https://relay.get-scatter.com/app/connect/nodejs_env fails with 404 now and I'm wondering if there is a way I could get scatterjs working in node.js at all. The latest code version swallows the error and reports with false on connect.
const fetch = require('node-fetch')
window = global
global.fetch = fetch
let ScatterJS = require('@scatterjs/core')
if (ScatterJS.default) {
ScatterJS = ScatterJS.default
}
let ScatterEOS = require('@scatterjs/eosjs2')
if (ScatterEOS.default) {
ScatterEOS = ScatterEOS.default
}
ScatterJS.plugins(new ScatterEOS())
async function main () {
console.log('connecting')
const connected = await ScatterJS.connect('AppName')
if (!connected) throw new Error('not connected')
}
main().catch(console.error).finally(() => process.exit())
I'm trying to get scatter working in node.js. I was working with scatterjs-core and scatterjs-plugin-eosjs2 packages before and now moved to @scatterjs/core and @scatterjs/eosjs2
I've modified the example under
eosjs@20.0.0
to work in node.js and simplified it a bit. There are a few things I have to add to have it working: introduce globally accessiblewindow
object, introducewindow.fetch
.However, the request to
https://relay.get-scatter.com/app/connect/nodejs_env
fails with 404 now and I'm wondering if there is a way I could get scatterjs working in node.js at all. The latest code version swallows the error and reports withfalse
on connect.