Open jurosh opened 6 years ago
Need more code here to see what's going on ( like what getScatterEosInstance
is doing ). Also, I see you're using extension, have to tried to check if this works from desktop? Lots of functionality is missing from the extension.
Wanted to build and try desktop version but ran into https://github.com/GetScatter/ScatterDesktop/issues/156 :x:
Here are some details about getScatterEosInstance
// Tried also with latest scatter-js and same result...
import ScatterJS from 'scatter-js/dist/scatter.esm';
import Eos from 'eosjs';
...
export const getScatterEosInstance = (
actors: Array<{ actor: string, permission: string }>,
moreOptions: any = {}
) => {
const options = {
broadcast: true,
chainId,
authorization: actors,
...moreOptions
};
const scatterEos = ScatterJS.scatter.eos(eosNetwork, Eos, options, 'http');
if (scatterEos === undefined || scatterEos === null) {
// 'failed to obtain the Scatter eosjs instance.'
// throw error....
}
return scatterEos;
};
Looks like you aren't pulling in the ScatterEOS
plugin: https://get-scatter.com/docs/examples-interaction-flow
Forgot to paste it here, but I am doing eos initialization ScatterJS.plugins(new ScatterEOS());
in another file..
Cannot make this code to be functional:
scatterInstance.getArbitrarySignature(
userPublicKey,
'testToSign',
'Order signing',
false
);
@nsjames can you confirm it's working for you ? Already tried Scatter Desktop too and looks like it's same issue - so maybe error in scatter eos plugin or am I calling it wrong way ?
Those imports, and the ScatterJS.plugins(new ScatterEOS());
instantiation should be done as early as possible in your app, and only in a single location and then fetched from a global store/state-handler.
By doing:
import ScatterJS from 'scatter-js/dist/scatter.esm';
import Eos from 'eosjs';
That instance of ScatterJS has no knowledge of any plugins in any other files as the scopes are different.
So I am getting into the core of issue. Looks like I have to use ScatterJS.scatter
for getting signatures but I was using ScatterJS.scatter.eos
instead.
As per docs here https://get-scatter.com/docs/api-request-arbitrary-signature
Scatter should be able to get signature like:
Instead promise is rejected with reason:
Using scatter extension
6.1.10
on Chrome (Linux)