Git Product home page Git Product logo

Comments (2)

ArnSch avatar ArnSch commented on May 25, 2024

Sorry @TomAFrench just getting to this. Just want to double check, do you mean the linkedToken property on the zkAsset?

If so, that is really an address, which you'll have to call to get information specific to the ERC20 (like the name of the token, if any). For the total amount of public value of a token stored within Aztec, you want the totalSupply property on the NoteRegistry associated with the zkAsset, which can be had by calling getRegistry() on ACE and giving it the address of the deployed zkAsset.

from aztec-v1.

TomAFrench avatar TomAFrench commented on May 25, 2024

Hey, no worries.

When I create a zkAsset, I get not only a linkedToken property but a token property as shown below.

Screenshot_2020-05-11_11-54-39

I'm coming at this from the perspective of (starting from only having the address of the zkAsset) printing the private and public balances for a particular user both in terms of the ERC20 value (i.e. accounting for the scaling factor) with the correct number of decimals. I can scale the private balance to be in terms of wei using the sdk but as you mention, getting the proper number of decimals to scale this by would require instantiating a contract object and making another call to get this information before the balances could be displayed.

As this would be a common task for building with zkAssets I thought it would be worth automatically caching this data within the token object. I'd preferably like to avoid having the instantiate another contract object and make an another call to get this information if possible as I would likely have to do it whenever I interacted with a zkAsset.

from aztec-v1.

Related Issues (20)

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.