File tree Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " thirdweb " : minor
3
+ ---
4
+
5
+ Add isERC20 extension
Original file line number Diff line number Diff line change 1
1
// read
2
+ export { isERC20 } from "../../extensions/erc20/read/isERC20.js" ;
2
3
export {
3
4
getBalance ,
4
5
type GetBalanceParams ,
Original file line number Diff line number Diff line change
1
+ import type { BaseTransactionOptions } from "../../../transaction/types.js" ;
2
+ import { supportsInterface } from "../../erc165/__generated__/IERC165/read/supportsInterface.js" ;
3
+
4
+ /**
5
+ * Check if a contract supports the ERC20 interface.
6
+ * @param options - The transaction options.
7
+ * @returns A boolean indicating whether the contract supports the ERC20 interface.
8
+ * @extension ERC20
9
+ * @example
10
+ * ```ts
11
+ * import { isERC20 } from "thirdweb/extensions/erc20";
12
+ * const result = await isERC20({ contract });
13
+ * ```
14
+ */
15
+ export function isERC20 ( options : BaseTransactionOptions ) {
16
+ return supportsInterface ( {
17
+ contract : options . contract ,
18
+ interfaceId : "0x36372b07" ,
19
+ } ) ;
20
+ }
You can’t perform that action at this time.
0 commit comments