Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

ethers.js calling smart contract

import { ethers } from 'ethers';
(async () => {
  //calling smart contract which contains bigNumber
let bigNumber = await stakeContract.totalBalanceGrowRich();
 let number = ethers.utils.formatEther(bigNumber);
      setStakeInfo(prev => {
        return { ...prev, staked: Number(number).toLocaleString('en-US') };
  });
  //which return non big Number
 let currentTime = await stakeContract.getCurrentTime();
  setStakeInfo(prev => {
    return { ...prev, currentTime: Number(currentTime) };
   });
  
})()
 
PREVIOUS NEXT
Tagged: #calling #smart #contract
ADD COMMENT
Topic
Name
3+4 =