Skip to content

Commit 1a2390b

Browse files
committed
[SDK] Fix tsdocs for isERC20 (#5609)
## Problem solved Short description of the bug fixed or feature added <!-- start pr-codex --> --- ## PR-Codex overview This PR updates the `isERC20` function in the `isERC20.ts` file to retrieve the contract's ABI and extract function selectors before checking if the contract is an ERC20. ### Detailed summary - Removed direct usage of `isERC20` with a contract. - Added import of `resolveContractAbi` from `thirdweb/contract`. - Introduced a new step to resolve the contract's ABI. - Extracted function selectors from the ABI. - Updated `isERC20` call to use the extracted selectors. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent 2007b9c commit 1a2390b

File tree

1 file changed

+8
-1
lines changed
  • packages/thirdweb/src/extensions/erc20/read

1 file changed

+8
-1
lines changed

packages/thirdweb/src/extensions/erc20/read/isERC20.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,14 @@ import { isTransferFromSupported } from "../__generated__/IERC20/write/transferF
1616
* @example
1717
* ```ts
1818
* import { isERC20 } from "thirdweb/extensions/erc20";
19-
* const result = await isERC20({ contract });
19+
* import { resolveContractAbi } from "thirdweb/contract";
20+
*
21+
* const abi = await resolveContractAbi(contract);
22+
* const selectors = abi
23+
* .filter((f) => f.type === "function")
24+
* .map((f) => toFunctionSelector(f));
25+
*
26+
* const result = await isERC20(selectors);
2027
* ```
2128
*/
2229
export function isERC20(availableSelectors: string[]) {

0 commit comments

Comments
 (0)