Next.js Discord

Discord Forum

Help with hooks? -Venti Dilemma

Unanswered
ani posted this in #help-forum
Open in Discord
aniOP
So this is my directory -
And I want to do something like call
    const { data, isLoading } = useContractRead(contract, "getContestants", [id]);
 

which will get me all the contestants and then by their i want to get their address which is data[3] and then call this
  const { data, isLoading } = useContractRead(contract, "getContestant", [id, cid])

for each of the contestant address so i can see their number of votes

Is their any solution to my dilemma ;-;

2 Replies

aniOP
This is the array which
    const { data, isLoading } = useContractRead(contract, "getContestants", [id]);
 

returns :
[
    [
        {
            "type": "BigNumber",
            "hex": "0x03"
        },
        "https://i.pinimg.com/564x/9d/52/21/9d5221762042c2ecff288efab22730ec.jpg",
        "Anuu",
        "0x872Edfe2d75AAc27E5CaDA6dAa80D350879596DD",
        {
            "type": "BigNumber",
            "hex": "0x00"
        },
        []
    ],
    [
        {
            "type": "BigNumber",
            "hex": "0x04"
        },
        "https://i.pinimg.com/564x/9d/52/21/9d5221762042c2ecff288efab22730ec.jpg",
        "Abhi",
        "0xA88Ce2Ae4cA574d9E1E7cfad960A71274C14a503",
        {
            "type": "BigNumber",
            "hex": "0x00"
        },
        []
    ]
]
I want those address
0x872Edfe2d75AAc27E5CaDA6dAa80D350879596DD and 0xA88Ce2Ae4cA574d9E1E7cfad960A71274C14a503
and then call the getContestant function with each of em