Comments (6)
I have changed to the scatterjs-plugin-eosjs,and works fine. Great job, thank you
from scatter-js.
Are you using the scatterjs-plugin-eosjs2
?
Can you show me full code in a gist maybe?
from scatter-js.
Yes, I'm sure.
code is here:
const scatter = await getScatterEOS();
if (scatter != null) {
if (scatter.identity) {
// Always use the accounts you got back from Scatter. Never hardcode them even
// if you are prompting the user for their account name beforehand. They could
// still give you a different account.
const account = scatter
.identity
.accounts
.find(x => x.blockchain === 'eos');
// Get a proxy reference to eosjs which you can use to sign transactions with a
// user's Scatter. eosjs2
const network = {
blockchain: 'eos',
protocol: process.env.EOS.PROTOCOL,
host: process.env.EOS.host,
port: process.env.EOS.PORT,
chainId: process.env.EOS.CHAINID
};
const api = new Api({
rpc,
signatureProvider: scatter.eosHook(network),
textDecoder: new TextDecoder(),
textEncoder: new TextEncoder()
});
const api = scatter.eos(network, Api, {rpc});
try {
const result = await api.transact({
actions: [
{
account: 'xxxx',
name: 'xxx',
authorization: [
{
actor: `${account.name}`,
permission: `${account.authority}`
}
],
data: {
xxxxxx:xxxxx
}
}
]
}, {
blocksBehind: 3,
expireSeconds: 10
});
console.dir(result);
return result;
} catch (e) {
console.log('\nCaught exception: ' + e);
if (e instanceof RpcError)
console.log(JSON.stringify(e.json, null, 2));
}
}
}
If I use hook provider。Console says eosHook is not a function.
If I use proxy provider. Console says TypeError: Cannot read property 'length' of undefined
but if I use eosjs
const defaultPrivateKey = 'dddddddd'; // privkey
const signatureProvider = new JsSignatureProvider([defaultPrivateKey]);
const rpc = new JsonRpc(process.env.EOS.JSONRPC, {fetch});
const api = new Api({rpc, signatureProvider, textDecoder: new TextDecoder(), textEncoder: new TextEncoder()});
everything is fine!
env
mac chrome.
scatter desktop and chrome has the same result.
from scatter-js.
Need more of this code as it's not showing imports for scatterjs, or what getScatterEOS()
does.
from scatter-js.
getScatterEOS() follow the document:https://get-scatter.com/docs/examples-interaction-flow
I think you should must already know what getScatterEOS() does, no need to post more code of it.
And if I didn't imports scatterjs, does the code can go through to the ````const api = xxxxx```, not a chance.
And I think hook provider show eosHook() not a function, I checked the code of packages/plugin-eosjs2, not a function named eosHook, maybe use hookProvider instead, params of it can fit the document. I will try tonight.
from scatter-js.
Using hookProvider
will not work as they are renamed.
Please post the code inside the getScatterEOS()
so I can see the full thing. I can't help with only pieces of the code.
Also please post an image of the error that you are getting with desktop open and the extension disabled ( extension does not support eosjs2 )
from scatter-js.
Related Issues (20)
- Can't call eos contract by use WalletAPI CreateTransaction HOT 1
- TypeError: c is not a constructor
- eosjs2 naming confusion HOT 1
- signing arbitrary data HOT 1
- Repeat websocket connections causes WalletAPI to utilize closed old websocket HOT 5
- README broken links HOT 3
- Add custom network globe icon is broken in v. 12.0.0 HOT 3
- TypeError: ScatterJS.scatter.eosHook is not a function at ta.html:61
- Defining "ScatterJS.scatter.eos" Cannot call related methods
- Scatter not found in Firefox HOT 1
- Cannot read property 'getRawAbi' of undefined
- Can't connect to scatter from browser
- Blocking when sendTransaction in Tron HOT 1
- ES6 Proxy is not defined in IE11 and Old Chrome
- Detecting auth
- JSON parsing error when RelaySocket connect fails HOT 2
- When calling transact(eosio.msig), Firefox and Chrome caught exception that said firewalled. HOT 2
- 404 at https://relay.get-scatter.com/app/connect/nodejs_env
- ScatterCDN failed
- Whitelisting
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scatter-js.