New answers tagged typescript
0
votes
Trying to use window.ethereum.request in Typescript errors out with Property 'request' does not exist on type 'EthereumProvider'
Apparently, the desired type lives in @metamask/providers NPM library
. I've solved the type issue by installing this lib in devDependencies:
npm i -D @metamask/providers
and extended a global Window ...
0
votes
How to get deployed contract address with ethers?
The answer by @AlexanderHerranz is for ethers v5, for newer versions of hardhat that use ethers v6 you can get the deployed address using the async getAddress() method as shown below:
const ...
0
votes
Accepted
Cannot recover signer
abiCoder.encode is not packed, eg.:
abiCoder.encode(["address"], ['0x473173aDa23BE87a4740646b09F9c22d115CE5a0'])
'0x000000000000000000000000473173ada23be87a4740646b09f9c22d115ce5a0'
but in ...
0
votes
Instantiate a contract using interface generated by TypeChain
Define the type as both BaseContract and the typechain type:
import { Contract, BaseContract } from 'ethers'
import { IHintHelpers } from '../typechain-types';
const contract = new Contract(address, ...
0
votes
What is the right way to import a contract type that uses an interface in hardhat?
I guess the right way to do it is to deployContract('ONLY THE CONTRACT NAME WITHOUT THE PATH gives you the needed interface')
0
votes
Trying to use window.ethereum.request in Typescript errors out with Property 'request' does not exist on type 'EthereumProvider'
try with this.
interface CustomWindow extends Window {
ethereum?: any;
}
declare const window: CustomWindow;
1
vote
Accepted
Can we add network param to run function to verify contract on specific network?
Here is solution.. I created seperate tasks and then kind of used them in single task...
As per @Jaskaran Singh 's Answer.. it's correct to use --network param straight away as it is provided already ...
0
votes
Can we add network param to run function to verify contract on specific network?
Yes we can run --network to deploy and verify the smart contract . I would suggest you build two scripts one for deployment and one for verification . You can use this command for deployment npx ...
0
votes
Need help testing my smart contract
You can use this code to test the creation of all tokens:
import { ethers } from 'hardhat';
import { expect } from 'chai';
import { Contract, Signer } from 'ethers';
describe('SpiderVerse Contract', ...
Top 50 recent answers are included
Related Tags
typescript × 134hardhat × 38
solidity × 37
web3js × 26
ethers.js × 25
react × 19
javascript × 10
nodejs × 9
uniswap × 9
hardhat-deploy × 9
testing × 7
blockchain × 5
metamask × 5
test × 5
typechain × 5
wagmi × 5
truffle × 4
erc-721 × 4
frontend × 4
contract-development × 3
abi × 3
data-types × 3
polygon × 3
npm × 3
gnosis-safe × 3