0

Using ContractData from drizzle/react-components to try and call a read function that returns multiple parameters from a struct

MyComponent.js

<div>
    <h2>Get Participant Details</h2>
        <ContractData
            drizzle={drizzle}
            drizzleState={drizzleState}
            contract="supplyChain"
            method="getParticipantDetails"
            methodArgs={[1, "modelNumber"]}
        />

Solidity Contract

 struct participant {
    string userName;
    string password;
    string participantType;
    address participantAddress;
}
function getParticipantDetails(uint32 _p_id) public view returns (string,address,string) {
    return (participants[_p_id].userName, participants[_p_id].participantAddress, participants[_p_id].participantType);
}

Not sure how to exactly read a tuple with Drizzle

TylerH
  • 20,799
  • 66
  • 75
  • 101
slugz
  • 1
  • 1

1 Answers1

0

can help you https://github.com/trufflesuite/drizzle/blob/develop/ui-tests/react-redux/src/MyComponent.js

From Row:188 for contract ComplexStorage

but I see Error Tags for methodArgs add:

Add   :methodArgs="[1, "modelNumber"]"

<ContractData drizzle={drizzle} drizzleState={drizzleState} contract="supplyChain" method="getParticipantDetails" :methodArgs="[1,"modelNumber"]" />
TylerH
  • 20,799
  • 66
  • 75
  • 101
Oncelot
  • 33
  • 1
  • 7
  • Please add some explanation to your answer such that others can learn from it – Nico Haase Dec 05 '21 at 12:19
  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/30480231) – MD. RAKIB HASAN Dec 06 '21 at 07:00
  • ok excuse me, i've read bad the question, I focused in the html tags, because in the methodArgs, add : – Oncelot Dec 06 '21 at 14:58