Questions tagged [ethers.js]

Ethers.js is a JavaScript framework to interact with EVM smart contracts.

More information on ethers.io.

801 questions
3
votes
1 answer

How to get a specific number of signers while testing smart contracts in Hardhat?

I am developing my smart contracts in Hardhat and testing on RSK Testnet. To create signer accounts, I am using a mnemonic seed phrase and the following Hardhat configuration: ​ require('@nomicfoundation/hardhat-toolbox'); const { mnemonic } =…
3
votes
1 answer

typechain --target ethers-v5 is not recognized as an internal command

I have in my package.json file : "scripts": { "compile-contract-types": "yarn compile-external-abi-types && yarn compile-v3-contract-types", "compile-external-abi-types": "typechain --target ethers-v5 --out-dir src/abis/types…
Software14
  • 155
  • 1
  • 9
3
votes
1 answer

Cannot switch signers with ethers.js for a contract interaction using Hardhat

Hardhat specifies that to use a different account for contract interactions you should use the connect() method, passing it a Signer, as such: const [owner, addr1] = await ethers.getSigners(); /* ... */ await…
Schmidt
  • 43
  • 1
  • 5
3
votes
1 answer

Getting ABI of both base contract and proxy contract

This is an example - https://etherscan.io/address/0x769250862220d509fb9bed5f88d824c9fb74a833. It is a proxy contract which I use for minting, the problem is it doesn't have mint function when I use etherscan API to get its ABI. Mint function is only…
Webby
  • 146
  • 10
3
votes
2 answers

Ethers js set noonce when using contract object

I use ethers to interact with solidity contract. I would like to execute multiple transactions at the same time. To do that I know I have to define noonce that would be +1 for each next transaction. I know how to do that when I do await…
Webby
  • 146
  • 10
3
votes
1 answer

Sign transaction without broadcasting it with metamask (not using private key)

I'm trying to sign a transaction without broadcast using metamask. I have tried web3js and etherjs (eth_signTransaction) but neither worked. How to do this? I think opensea is signing message and then using it for transaction. How did they do…
Blgdmbrl
  • 33
  • 1
  • 3
3
votes
2 answers

What is the difference between a Wallet and a JsonRpcSigner?

On the ethers documentation, it says that the two most commons signers are: Wallet, which is a class which knows its private key and can execute any operations with it. JsonRpcSigner, which is connected to a JsonRpcProvider (or sub-class) and is…
3
votes
1 answer

Get transaction history of a particular nft token

I want to retrieve all the transactions (for getting ownership history) of a given NFT(erc721) tokenId. How is it possible?
rahulserver
  • 10,411
  • 24
  • 90
  • 164
3
votes
3 answers

Passing a Struct Array to constructor of Solidity Contract

I am building an NFT smart contract with solidity, and I am trying to pass and Array of Structs into the constructor when I deploy the contract. However I am getting the following error. TypeError: Cannot read property 'length' of undefined The…
Joby Ingram-Dodd
  • 730
  • 5
  • 23
3
votes
2 answers

Check if an ERC-20 token is a scam / Honeypot

I'm looking for a way to get the buy and sell tax of a Token and check if it can be sold once bought. To do this, here's the method I thought about : 1-Simulate a Buy transaction on the DEX Router Contract 2-Simulate a Sell transaction on the DEX…
Omar6995
  • 63
  • 1
  • 2
  • 8
3
votes
0 answers

Why an old value of an smart-contract property is retrieved instead of the most current one?

I've deployed a simple ERC721-compatible contract to the Polygon network: contract MyContract is ERC721 { uint256 public counter; constructor(string memory name, string memory symbol) ERC721(name, symbol) { // ... counter =…
goodUser
  • 249
  • 1
  • 13
3
votes
0 answers

Why do my ethers.js transactions keep pending/dropping on polygon even with a lot of gas added?

I'm trying to automate sending transactions through ethers.js. It works all perfectly on Rinkeby, but then on Polygon the transactions stay pending for days even when adding much more gas than neccessary. Pending…
SINCOS
  • 89
  • 6
3
votes
1 answer

Hardhat test "UnrecognizedContract" when calling transfer function

I have deployed an erc20 contract (very old version running of open zeplins mintable token contract on solidity 0.4.18) calling the 'mint', 'total supply', 'finish minting' functions work fine but when i call the "transfer" function i get Mint…
Jay P
  • 596
  • 7
  • 23
3
votes
1 answer

Which provider should I choose ? Web3Provider ? InfuraProvider ? JsonRPCProvider?

I have a question : which provider should I choose for interacting with a contract on the mainnet and why ? It seems like Web3Provider is easier to use, are there any drawbacks ? Thank you for your answers.
Ben BK
  • 154
  • 2
  • 11
3
votes
1 answer

I can't get data from Ethers.js signer.getAddress() function

I can't get the value from the signer.getAddress() function on Ethers.js. When I try to use "alert" or "console.log" it is fine but I want to display it directly on the page. It says; "object Promise". Here is my code: import "./App.css"; import {…
Blockchain
  • 31
  • 2