You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/thirdweb/src/transaction/read-contract.ts
+11-19Lines changed: 11 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -72,31 +72,16 @@ export type ReadContractOptions<
72
72
/**
73
73
* ### Reads state from a deployed smart contract.
74
74
*
75
-
* You can use raw read calls or read [extensions](https://portal.thirdweb.com/typescript/v5/extensions/use) to read from a contract.
75
+
* Use this for raw read calls from a contract, but you can also use read [extensions](https://portal.thirdweb.com/typescript/v5/extensions/use) for predefined methods for common standards.
76
76
*
77
77
* @param options - The transaction options.
78
78
* @returns A promise that resolves with the result of the read call.
79
79
* @transaction
80
80
* @example
81
81
*
82
-
* ### Using a contract read extension
82
+
* ### Raw contract call (recommended)
83
83
*
84
-
* ```ts
85
-
* import { getContract } from "thirdweb";
86
-
* import { sepolia } from "thirdweb/chains";
87
-
* import { useReadContract } from "thirdweb/react";
88
-
* import { getOwnedNFTs } form "thirdweb/extensions/erc721";
* You can read from any contract by using the solidity signature of the function you want to call.
100
85
*
101
86
* ```ts
102
87
* import { getContract } from "thirdweb";
@@ -116,7 +101,14 @@ export type ReadContractOptions<
116
101
* });
117
102
* ```
118
103
*
119
-
* ### Using `resolveMethod`
104
+
* Note that this is type safe, the params types will be enforced based on the signature.
105
+
*
106
+
* ### Raw contract call with `resolveMethod`
107
+
*
108
+
* If you don't have the solidity signature of the function you want to call, you can use the `resolveMethod` helper to resolve the method from any deployed contract.
109
+
*
110
+
* Note that this is not type safe, and will also have a 1 time overhead of resolving the contract ABI.
111
+
*
120
112
* ```ts
121
113
* import { getContract, resolveMethod } from "thirdweb";
0 commit comments