Giter VIP home page Giter VIP logo

Comments (7)

heisenbergpromotions avatar heisenbergpromotions commented on June 25, 2024

Yes you can load totalSupply just by pulling from your contract.

If you find the line in your rendered code
{data.totalSupply}
I removed it and added this HTML in the same place
`<s.TextTitle
id="totalNumbers"
style={{
textAlign: 'center',
fontSize: 50,
fontWeight: 'bold',
color: 'var(--accent-text)',
}}

Minted VS Total Supply
</s.TextTitle>`

Then I wrote a function to update that HTMLID with the contract values instead of the config file

`async function passMaxNFT() {
var x = myContract.methods.MAX_NFT().call();
return x;
}
async function passTotalMinted() {
var y = myContract.methods.totalSupply().call();

return y;

}
async function showTotalMax() {

await passTotalMinted()
await passMaxNFT()
document.getElementById('totalNumbers').innerHTML =
  (await passTotalMinted()) + '/' + (await passMaxNFT()); 

}
showTotalMax();`

from hashlips_nft_minting_dapp.

NothingFancyNFT avatar NothingFancyNFT commented on June 25, 2024

where are you dropping these functions ? in blockchainactions.js or in app.js ?

from hashlips_nft_minting_dapp.

heisenbergpromotions avatar heisenbergpromotions commented on June 25, 2024

where are you dropping these functions ? in blockchainactions.js or in app.js ?

In app.js

from hashlips_nft_minting_dapp.

filipe-te avatar filipe-te commented on June 25, 2024

Hi heisenbergpromotions, thanks for your solution! Unfortunately its not working when i just paste ist under the Line "{data.totalSupply} / {CONFIG.MAX_SUPPLY}"

It would be very nice if you could sent more infos where exactly you did rewrite to app.js !
Thank you

from hashlips_nft_minting_dapp.

luncht3am avatar luncht3am commented on June 25, 2024

Could you please elaborate or provide the full code changes. Thanks in advance.

from hashlips_nft_minting_dapp.

mcferrou avatar mcferrou commented on June 25, 2024

i solved this problem creating an API that calls the supply number and pasting it on the script/head of the index.html file.
Follow this:

Paste the code below on the of your HTML (dont forget to replace the CONTRACTHERE and APIHERE by your NFT contract address and API (create an API by loging on etherscan):

<script>
      function getTokenSupply() {
        const apiUrl = `https://api.etherscan.io/api?module=stats&action=tokensupply&contractaddress=CONTRACTHERE&apikey=APIHERE`;
        
        fetch(apiUrl)
          .then(response => response.json())
          .then(data => {
            const result = parseInt(data.result);
            document.getElementById("result").innerHTML = result + '/10000';
          });
      }
      
      getTokenSupply();

Now go to your APP.JS file and replace this code:

        ```

<s.TextTitle
style={{
textAlign: "center",
fontSize: 60,
color: "var(--accent-text)",
fontFamily: "Beachday",
}}
>
{data.totalSupply} | {CONFIG.MAX_SUPPLY}
</s.TextTitle>



By this new code


           ```

<s.TextTitle
id="result"
style={{
textAlign: "center",
fontSize: 60,
color: "var(--accent-text)",
fontFamily: "Beachday",
}}
>
Conect...
</s.TextTitle>

Certify that you have to turn down adblocker to make sure that this code will gonna work correctly. I use brave browser and i had to deactivate the protection to my dapp minting site, but now its working perfectly.

Hope it helps.

from hashlips_nft_minting_dapp.

filipe-te avatar filipe-te commented on June 25, 2024

HI Thanks for your help! Now I have one Problem ... it just shows only "Conect" where the Minting Amount should be.
Do you have any tips? Thanks!

from hashlips_nft_minting_dapp.

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.