Tuesday, September 1, 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

Glamsterdam Repricing Impact for Smart Contract Developers

by SB Crypto Guru News
August 24, 2026
0

TL;DR: The upcoming Glamsterdam upgrade includes a set of gas repricings. EIP-8037 and EIP-8038 (both scheduled for inclusion) adjust the...

Raising machine-checked security benchmarks to advance hash-based SNARKs through agentic collaboration

by SB Crypto Guru News
August 20, 2026
0

better.codes, an open autoresearch challenge built by the Ethereum Foundation Formal Verification team in collaboration with Yukon and zkSecurity, is...

Allocation Update – Q2 2026

by SB Crypto Guru News
August 18, 2026
0

DAOs/GovernanceResearchFaculty Research Fellowship: Ethereum Studies (AY 2025–2026)Enables Prof. Strnad to dedicate substantial research time to Ethereum-focused problems, including DAO governance,...

Announcing the Platåberget Testnet | Ethereum Foundation Blog

Announcing the Platåberget Testnet | Ethereum Foundation Blog

by SB Crypto Guru News
August 17, 2026
0

tl;dr: Meet Platåberget: Glamsterdam's (Gloas + Amsterdam) early testing ground open to public participation. This upgrade comes with breaking changes...

Trezor Data Breach exposes almost 14.000 customers home addresses tied to hardware-wallet purchases. Stay safe!

Trezor Data Breach exposes almost 14.000 customers home addresses tied to hardware-wallet purchases. Stay safe!

by SB Crypto Guru News
August 15, 2026
0

Key Takeaways In August 2026, a data exposure at Trezor's shipping provider, ShipMonk, affected approximately 14,000 customers, revealing names, email...

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 *

  • Trending
  • Comments
  • Latest
Why the Founders Winning With AI Agents Aren’t the Ones Automating the Most

Why the Founders Winning With AI Agents Aren’t the Ones Automating the Most

August 14, 2026

TON Validators Prepare Node Update Ahead Of Collator Vote

August 22, 2026
AVAX Price Prediction: Bears Own This Chart — .98 Is the Next Stop

AVAX Price Prediction: Bears Own This Chart — $5.98 Is the Next Stop

August 16, 2026
How AI Agents Are Deleting the Steep Web3 Tooling Curve

How AI Agents Are Deleting the Steep Web3 Tooling Curve

August 15, 2026

EU Carbon Taxes Push Bitcoin Mining to Russia, Study Claims

August 23, 2026

ZachXBT Exposes Canada as Worst Global Hotspot for Crypto Fraud

August 22, 2026

Strategy Restarts Bitcoin Buying with $370M Purchase after 10-Week Pause

0

Bitcoin Price Prediction: Macro Pressure Mounts as Yen Slides and Oil Climbs

0

The Small Decisions You Skip Are Costing Your Team 209 Hours a Year. Here’s How to Fix It.

0

What Is Bitcoin Halving & How Does It Affect BTC Price?

0

Bluefin Teams with Visa for In-Person Payment Acceptance

0

Crypto Platforms Suffer $3,630,000,000 in Crypto Losses as Audited Platforms Suffer Heavily: Report

0

The Small Decisions You Skip Are Costing Your Team 209 Hours a Year. Here’s How to Fix It.

August 31, 2026

Strive Becomes Fifth Biggest Bitcoin Treasury, Stock Surges On Latest BTC Buy

August 31, 2026

Strategy Restarts Bitcoin Buying with $370M Purchase after 10-Week Pause

August 31, 2026

Online platform connects hundreds of emerging Iranian artists with collectors abroad – The Art Newspaper

August 31, 2026

CFTC Fines Former White House Staffer Over Event Contract Insider Trading

August 31, 2026

Cronos Halts Chain After $75M Tectonic Exploit

August 31, 2026
Facebook Twitter LinkedIn Tumblr RSS
SB Crypto Guru News- latest crypto news, NFTs, DEFI, Web3, Metaverse

Find the latest Bitcoin, Ethereum, blockchain, crypto, Business, Fintech News, interviews, and price analysis at SB Crypto Guru News.

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.