Here’s an article that you
The choice of Metamask feature is not found an error
When developing decentralized applications (DAPPS), it is customary to interact with Ethereum -based contracts using Web3 libraries such as Eters.js. However, a common problem that can occur is the mistake “Selecting a function is not found” in the Hardhat knot.
In this article,
What is Metamask?
Metamask is an Ethereum portfolio that allows users to interact with Ethereum blockchain. Ethereum network.
The choice of feature is not found in Hardhat knot
When “found”.
Here is an example of what can go wrong:
`Javascript
Import {Compile} by ‘Hardhat-Typescript’;
Const Compilett = ASYNC (Name of Contractname, ABI) => {
try {
Const Contruiment = Wait a compilation (Contractname name);
Const binascii = buffher.from (abi.map ((key) => Key.type) .join (‘,’));
Const Selector = ‘0x’ + binascii;
Console.log (selector); // This must be the correct function selector
// now, you call the contract with this selector
Wait a contract.AT.
} Catch (error) {
Console.error (error);
}
};
`
Bytecode Ethereum for the feature of the ‘Gettokendepositamount.
At ()The contract method "also returns a new contract with the designated selector. However, using an intelligent contract from the Metamask collection, such as the contract" Sushiswap ", it will have a different byte.
What is confused when using Metamask?
There are several reasons why you may encounter an error "Selecting a feature not found":
- incorrect abi
:
- Metamask Collection :
- Hardhat configuration :
Solving the problem
To resolve this error, make sure that:
1
2.
3
Here's an updated example that uses Sushiswap Treaty:
Javascript
Import {compileTrate} by ‘hardhat-tepescript’;
Import ‘@Nomiclabs/Hardhat-Waffle’;
CONST compile = async (name of Contractname, ABI) => {
try {
Const Contruiment = Wait a compilation (Contractname name);
Const binascii = buffher.from (abi.map ((key) => Key.type) .join (‘,’));
Const Selector = ‘0x’ + binascii;
// now, you call the contract with this selector
Return Keut Controg.at.
} Catch (error) {
Console.