Monday, July 6, 2026
  • Login
SB Crypto Guru News- latest crypto news, NFTs, DEFI, Web3, Metaverse
No Result
View All Result
  • HOME
  • BITCOIN
  • CRYPTO UPDATES
    • GENERAL
    • ALTCOINS
    • ETHEREUM
    • CRYPTO EXCHANGES
    • CRYPTO MINING
  • BLOCKCHAIN
  • NFT
  • DEFI
  • WEB3
  • METAVERSE
  • REGULATIONS
  • SCAM ALERT
  • ANALYSIS
CRYPTO MARKETCAP
  • HOME
  • BITCOIN
  • CRYPTO UPDATES
    • GENERAL
    • ALTCOINS
    • ETHEREUM
    • CRYPTO EXCHANGES
    • CRYPTO MINING
  • BLOCKCHAIN
  • NFT
  • DEFI
  • WEB3
  • METAVERSE
  • REGULATIONS
  • SCAM ALERT
  • ANALYSIS
No Result
View All Result
SB Crypto Guru News- latest crypto news, NFTs, DEFI, Web3, Metaverse
No Result
View All Result

Solidity/React situation when utilizing Ethers.js : ethereum

by SB Crypto Guru News
November 5, 2022
in Ethereum
Reading Time: 2 mins read
0 0
A A
0


Solidity/React Query: Utilizing Ethers.js, I am making an attempt to entry a operate taking in two variables as parameters utilizing the hook useContractReader. I replicated it from different useContractReader code I’ve in my undertaking, but it surely would not appear to be working for no matter motive. I assume it has to do with some parsing of the variables I’ve, however how I do it in different issues, it really works wonderful.

The React:

const check = useContractReader(writeContracts, "YourContract", "getTest", "1", "0"); // Indexing recreation 1, gamers 0

  operate getTestName() {
    if (check == null) {
      return "check is undefined.";
    } else if (check[0] == null) { // check[0] is the identify variable within the struct
      return "noName";
    } else {
      return check[0].toString();
    }
  }

The Solidity code:

struct Recreation {
        deal with host; // Establishes host operate entry 0
        uint gameId; // Permits totally different video games to be performed concurrently 1
        uint buyinRequirement; // To ascertain minimal buyin quantity for a recreation 2
        uint etherWithdrawalReqs; // Tracks # of ether in complete from requests. If >/< than contract stability, throws error 3   
        uint gamePot; // Tracks how a lot ether is within the recreation's pot 4 
        uint8 tableWithdrawalReqs; // Tracks what number of gamers have requested a withdrawal 5
        uint8 playerCount; // Tracks # of of gamers in a recreation 6
        uint8 verifiedWithdrawalReqs; // Tracks # of verifs that withdrawal requests are legitimate 7
        bool endedBuyin; // Host operate to finish buyin stage 8
        bool isActive; // Checks if recreation struct is already completed 9 
        deal with[] playerList; // 10
    }
    
    struct Participant {
        string identify; // Permits gamers to extra simply determine eachother
        uint gameId; // gameId generated from gameNumber
        uint buyinAmount; // How a lot a participant has purchased in with
        uint withdrawalAmount; // How a lot a participant has requested a withdrawal for
        bool withdrawalReq; // Tracks if a participant has submitted a request
        bool verifyReqs; // TO confirm that every one withdrawal requests look good at desk
        bool hasWithdrawn; // To indicate {that a} participant has paidout to forestall triggering of any features after they receieve again their funds
        bool isInGame; // Is in recreation bool
        bool isHost; // Is host
    }

mapping(deal with => Participant) public playerInfo; // To name Participant struct primarily based on the msg.sender

    // Mapping for finding every recreation's particulars
    mapping(uint => Recreation) public idToGame; // To name Recreation struct to see recreation particulars

operate getTest(uint gameId, uint playerIndex) public view returns (Participant reminiscence) {
        return playerInfo[idToGame[gameId].playerList[playerIndex]];
    }

Please discuss with my stack overflow query for extra info on the problem:

https://stackoverflow.com/questions/74323524/problem-accessing-solidity-getter-using-ethers-js



Source link

Tags: Bitcoin NewsCrypto NewsCrypto Updatesethereumethers.jsissueLatest News on CryptoSB Crypto Guru NewsSolidityReact
Previous Post

What Occurs To Dogecoin If Twitter Fails To Implement Crypto Plans?

Next Post

Solana (SOL) Continues To Lag In Worth; SOL Should Do This One Factor To Rally

Related Posts

Why are address poisoning attacker able to send fake token out of my account?

Why are address poisoning attacker able to send fake token out of my account?

by SB Crypto Guru News
July 5, 2026
0

I am used to address poisoning. Whenever I send/receive token, I will then receive some random tokens from addresses that...

Bitcoin Suisse Moves Its Ethereum Staking to Obol Distributed Validators

Bitcoin Suisse Moves Its Ethereum Staking to Obol Distributed Validators

by SB Crypto Guru News
July 2, 2026
0

Bitcoin Suisse has been active in the institutional crypto industry since its early stage and one of the oldest and...

Ethereum as Protocol Polity: The Case for Founding-Period Funding

Ethereum as Protocol Polity: The Case for Founding-Period Funding

by SB Crypto Guru News
July 1, 2026
0

https://preview.redd.it/pspmpam0wmah1.png?width=5235&format=png&auto=webp&s=78293ee07018eb6a236614fb83cd716bf578b572 My latest article on Ethereum institutions and their political economy. Comparing Ethereum to Linux or ICANN is a category...

Ethereum for Governments and Institutions: Why neutral infrastructure matters now

Ethereum for Governments and Institutions: Why neutral infrastructure matters now

by SB Crypto Guru News
July 1, 2026
0

Current global shifts clearly signal a critical need for shared, neutral digital public infrastructure outside the control of any single...

The EF’s new structure | Ethereum Foundation Blog

The EF’s new structure | Ethereum Foundation Blog

by SB Crypto Guru News
June 23, 2026
0

Today, the EF is changing shape, concluding a months-long process of reorganization as part of the implementation of the Mandate...

Load More
Next Post
Solana (SOL) Continues To Lag In Worth; SOL Should Do This One Factor To Rally

Solana (SOL) Continues To Lag In Worth; SOL Should Do This One Factor To Rally

Mastercard demo on the Polygon MATIC community! That is nice for Ethereum! : ethereum

Mastercard demo on the Polygon MATIC community! That is nice for Ethereum! : ethereum

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Facebook Twitter LinkedIn Tumblr RSS

CATEGORIES

  • Altcoin
  • Analysis
  • Bitcoin
  • Blockchain
  • Crypto Exchanges
  • Crypto Updates
  • DeFi
  • Ethereum
  • Metaverse
  • Mining
  • NFT
  • Regulations
  • Scam Alert
  • Uncategorized
  • Web3

SITE MAP

  • Disclaimer
  • Privacy Policy
  • DMCA
  • Cookie Privacy Policy
  • Terms and Conditions
  • Contact us

Copyright © 2022 - SB Crypto Guru News.
SB Crypto Guru News is not responsible for the content of external sites.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
No Result
View All Result
  • HOME
  • BITCOIN
  • CRYPTO UPDATES
    • GENERAL
    • ALTCOINS
    • ETHEREUM
    • CRYPTO EXCHANGES
    • CRYPTO MINING
  • BLOCKCHAIN
  • NFT
  • DEFI
  • WEB3
  • METAVERSE
  • REGULATIONS
  • SCAM ALERT
  • ANALYSIS

Copyright © 2022 - SB Crypto Guru News.
SB Crypto Guru News is not responsible for the content of external sites.