remote-gildor / vue-drizzle-crowdsale Goto Github PK
View Code? Open in Web Editor NEWAn example of a crowdsale dApp made with Vue and Drizzle
License: MIT License
An example of a crowdsale dApp made with Vue and Drizzle
License: MIT License
If you like this project, stop by and say hello in this thread ๐ ๐
hey,
when i use the original-one (0.5.2) i get an error with open-zeppeling - when i changed i get the problem with npm run serve.
any ideas ?
solc: {
//version: "0.6.2", // Fetch exact version from solc-bin (default: truffle's version)
version: "0.5.2", // Fetch exact version from solc-bin (default: truffle's version)
Currently the dApp fetches the information about a current user's token balance with a call() method inside a custom store action:
/vapp/src/store/module/profile.js:
let drizzleInstance = rootState.drizzle.drizzleInstance;
const smallUnitBalance = await drizzleInstance.contracts.TestToken.methods.balanceOf(activeAccount).call();
Drizzle, however, also offers a method called cacheCall
, which would execute the above example like this:
let drizzleInstance = rootState.drizzle.drizzleInstance;
let drizzleState = drizzleInstance.store.getState();
const dataKey = await drizzleInstance.contracts.TestToken.methods.balanceOf.cacheCall(activeAccount);
const smallUnitBalance = await drizzleState.contracts.TestToken.balanceOf[dataKey]["value"];
The problem is that the cacheCall
does not work on the first page visit. I need to switch from /profile page to another page (for example /crowdsale) and then back to /profile for the call to successfully complete (note that in this case the <keep-alive>
tags in App.vue must be removed).
I'm not completely sure whether the issue is in cacheCall()
, or instead in this state call:
drizzleState.contracts.TestToken.balanceOf[dataKey]["value"];
This is where the "cannot read property value of undefined" error happens. But it could be because cacheCall
hasn't properly stored the data in the state.
As I said, this only happens on the first page visit. If a user then switches to another page and then back to the profile page, the state call completes successfully and the correct token balance is shown.
I have also tried to add a pause between the two function calls (the cacheCall and the state call), but it didn't help.
Any ideas how to solve this? Or should I use the call()
method instead of cacheCall()
?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.