Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/bright-erc165-abi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"viem": patch
---

Added `erc165Abi` for ERC-165 `supportsInterface` checks.
19 changes: 19 additions & 0 deletions src/constants/abis.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,25 @@ test('exports abis', () => {
"type": "function",
},
],
"erc165Abi": [
{
"inputs": [
{
"name": "interfaceId",
"type": "bytes4",
},
],
"name": "supportsInterface",
"outputs": [
{
"name": "",
"type": "bool",
},
],
"stateMutability": "view",
"type": "function",
},
],
"erc20Abi": [
{
"inputs": [
Expand Down
21 changes: 21 additions & 0 deletions src/constants/abis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,27 @@ export const erc6492SignatureValidatorAbi = [
},
] as const

/** [ERC-165 Standard Interface Detection](https://eips.ethereum.org/EIPS/eip-165) */
export const erc165Abi = [
{
type: 'function',
name: 'supportsInterface',
stateMutability: 'view',
inputs: [
{
name: 'interfaceId',
type: 'bytes4',
},
],
outputs: [
{
name: '',
type: 'bool',
},
],
},
] as const

/** [ERC-20 Token Standard](https://ethereum.org/en/developers/docs/standards/tokens/erc-20) */
export const erc20Abi = [
{
Expand Down
1 change: 1 addition & 0 deletions src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ test('exports', () => {
"webSocket",
"erc20Abi",
"erc20Abi_bytes32",
"erc165Abi",
"erc721Abi",
"erc1155Abi",
"erc4626Abi",
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,7 @@ export {
export {
erc20Abi,
erc20Abi_bytes32,
erc165Abi,
erc721Abi,
erc1155Abi,
erc4626Abi,
Expand Down
Loading