This repository has been archived by the owner on Jan 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 146
A suggestion for updating the "useContractRead" documentation. #864
Comments
@Sandeepreddyr12 thank your report! It's true that its not well documented, would love a contribution in the docs repo for this! This is the API, and a little explanation on the implication of passing it vs not would be a great addition 🙏 useContractRead(contract, "functionName", [arg1, arg2], { from: "0x..." } ); |
Sandeepreddyr12
added a commit
to Sandeepreddyr12/docs
that referenced
this issue
Dec 4, 2023
thirdweb-dev#864 This pull request aims to enhance the documentation by providing clarity on retrieving the sender's address using msg.sender in view functions within a smart contract. The proposed addition emphasizes the significance of including the specifier {from: 0X.....} to access the relevant address information. Signed-off-by: sandeep reddy <[email protected]>
Sandeepreddyr12
added a commit
to Sandeepreddyr12/docs
that referenced
this issue
Dec 4, 2023
thirdweb-dev#864 This pull request aims to enhance the documentation by providing clarity on retrieving the sender's address using msg.sender in view functions within a smart contract. The proposed addition emphasizes the significance of including the specifier {from: 0X123} to access the relevant address information. Signed-off-by: sandeep reddy <[email protected]>
saminacodes
added a commit
that referenced
this issue
Dec 8, 2023
* Update usecontractread.mdx #864 This pull request aims to enhance the documentation by providing clarity on retrieving the sender's address using msg.sender in view functions within a smart contract. The proposed addition emphasizes the significance of including the specifier {from: 0X123} to access the relevant address information. Signed-off-by: sandeep reddy <[email protected]> * Update docs/react/hooks/core/usecontractread.mdx Co-authored-by: Joaquim Verges <[email protected]> Signed-off-by: samina <[email protected]> --------- Signed-off-by: sandeep reddy <[email protected]> Signed-off-by: samina <[email protected]> Co-authored-by: samina <[email protected]> Co-authored-by: Joaquim Verges <[email protected]>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Issue: When using the read functions (via useContractRead), the sender address is not automatically sent, causing msg.sender to be inaccessible to any view function within the smart contract. To work around this, I must explicitly fetch and pass the address using the "from" property in overrides. demonstrated in the image below calling the function with and without "from" property in overrides.
[Image: Image with and without Overrides]
Suggestion: It would be beneficial to enhance the user experience by adding a note or highlighting the importance of including the sender's address in view functions. Furthermore, consider implementing a boolean toggle that allows users to enable or disable the automatic forwarding of the sender's address, providing greater flexibility in contract interaction.
note:- above suggestion can be applicable to both Docs and Dashboard.
document update or any thing! please let me know, i'm happy to contribute.
Thank you.
The text was updated successfully, but these errors were encountered: