Closed Jeremyyang closed 6 years ago
I need to see your code, not mine :)
Also throwNoAuth();
is not the noIdentity thrower. It's an authentication thrower, and doesn't even exist if using the extension.
Thank you for reply. Here's my code:
import ScatterJS from 'scatterjs-core';
import ScatterEOS from 'scatterjs-plugin-eosjs'
const Eos = require('eosjs');
ScatterJS.plugins(new ScatterEOS());
class EosApi {
constructor() {
this.eos = ScatterJS.scatter.eos(this.getNetwork(), Eos, {});
}
login() {
// I think actually ScatterJS.scatter.getIdentity refers to the extension's scatter.getIdentity
return ScatterJS.scatter.getIdentity({
accounts: [this.getNetwork()]
}).then( (identity) => {
return !!identity;
}).catch((error) => {
return false;
});
}
doTransfer(obj, opts) {
const opts = { authorization: [`${obj.from}@${obj.authority}`] };
return this.eos.transfer(obj.from, obj.to, obj.balance + " EOS", obj.memo, opts);
}
}
the packages version are:
"eosjs": "^16.0.9",
"scatterjs-core": "^2.3.2",
"scatterjs-plugin-eosjs": "^1.3.3"
The error threw from throwIfNoIdentity()
of scatterjs-plugin-eosjs
when I call eosApi.doTransfer()
after I logined successfuly.
Try setting this.eos
after you login.
Thank you so much, it works!
Since I use scatter-core with chrome scatter extension, an error occurs as the title shows when I tried to transfer.