Git Product home page Git Product logo

vue-drizzle-crowdsale's People

Contributors

remote-gildor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

vue-drizzle-crowdsale's Issues

Can't make cacheCall to work properly

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()?

problem with compiling the contracts

hey,

  • this is more a question -
    i just want to try your repo but i fails because of problems concerning the pragma:

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.