All Questions
Tagged with javascript ether
34 questions
7
votes
1
answer
10k
views
How do I send ETH from an account to another in Hardhat?
I am trying those methods (both) and neither worked for me:
signer.sendTransaction({ to, value });
(and)
provider.send("eth_sendTransaction", [{ from, to, value }]);
Would be great if your ...
4
votes
1
answer
3k
views
How to send ether to an account instead of creating a smart contract using ethers.js
I would like to send some ether to an account in ropsten testnet. I'm using the following code and the library https://docs.ethers.io/ethers.js/html/. However, instead of sending the ether to the to ...
3
votes
2
answers
788
views
Testing VrfCoordinatorV2Mock fulfillRandomWords gets stuck
I am testing a smart contract that uses Chainlink's VRF Oracle. Locally, I am using a mock to test with. In the unit test it never executes the fulfillRandomWords function that on my smart contract, ...
3
votes
0
answers
2k
views
Why ethers.js sign function not working?
I am using the ethers.js library, and am trying to code a transaction. Here is a snippet where I connect a wallet to a provider, connect to a contract I want to call a function in, and try to call the ...
2
votes
1
answer
494
views
Ether.Camp web3 js interact with contract - what am I doing wrong?
I have a working contract that I made in ether.camp with solidity, it functions as desired through the IDE contract interface and now I am trying to tie it into an html GUI with web3.
To this end I ...
2
votes
0
answers
2k
views
invalid signer or provider (argument="signerOrProvider") from @web3-react/core
hello everyone I'm able to connect walletConnect with @web3-react/core but I don't know how to get the provider here's my code.
import { InjectedConnector } from "@web3-react/injected-connector&...
1
vote
1
answer
2k
views
WEI to ETHER conversion issue with Web3 and Javascript
So i have a form where the user enters a price for an item in ETHER. I understand the blockchain does not handle floatin point numbers currently, so i am attempting to convert to WEI and store it on ...
1
vote
1
answer
2k
views
Manually setting the maxFeePerGas and maxPriorityFee works. Same values but dynamically set fail. How come?
Trying to do a simple transfer of Eth in Ethers js. When manually setting the maxFeePerGas and the maxPriorityFeePerGas, the transaction goes through. Yet when I use feeData from wallet.getFeeData(), ...
1
vote
2
answers
4k
views
How to check Balance of a specific account (MetaCoin)
I'm fairly new to programing and solidity, still on the learning curve of things here.... So right now I'm trying to check for the balance in Wei of the account I submit into the text field (Account). ...
1
vote
1
answer
208
views
how do I implement payable in erc1155?
I'm so new to solidity and I'm trying to implement payable Nft using ethers.js. I think I'm checking the balance of the address and comparing it with mintRate * amount wrong. I tried something like ...
1
vote
1
answer
5k
views
How to connect Trust Wallet in Javascript?
I want to use TrustWallet for payments in my project for mobile users. I saw the documents related to TrustWallet web3 API but not getting how to use it in javascript. Can anybody help me with the ...
1
vote
3
answers
3k
views
How to dynamically load contracts data with their ABI from etherscan API?
Im wanting to pull data from a smart contract I've loaded via user address and etherscan API for the ABI.
But how would I go about programmatically adding all the functions from the ABI into my ...
1
vote
2
answers
2k
views
Should an API call be in the Solidity backend or the Javascript frontend?
I am fairly new to blockchain development. I want to call a function in my contract when a condition in the API is true. Should I make this API call in my contract, or in my frontend?
1
vote
1
answer
694
views
"execution reverted: ds-math-sub-underflow" when processing swap
I get this error or another error err: insufficient funds for gas * price + value, which has been exhaustively discussed, but no real solution has worked for me here.
I saw the suggestion made here, ...
1
vote
1
answer
97
views
Enumerate non-enumerated NFTs in web3.js
I want to call the ownerOf() function on all of the NFT's in a contract. If the address matches the website user address I want to add the tokenID to an array so I can eventually display all nft's ...
1
vote
1
answer
3k
views
Create new account in ganache
I'm creating a Dapp which provide the user with individual account. while developing, when i create a account by
const accounts = await web3.eth.personal.newAccount('test');
the account is created ...
1
vote
0
answers
489
views
Ether transaction does not reflect in ganache
Hi am developing a etherium DAPP.
In that for every user registration some ether will get transfer from user to contract...
Everything work perfect but the transacted ether is not reflecting in ...
0
votes
1
answer
504
views
How to send signed data to backed and verify it?
On a web page I have some 3 fields, name, age and height, which a user authenticated via MetaMask sends to backend along with his wallet address. In JSON.
In order to ensure that data that's sent ...
0
votes
1
answer
1k
views
swapExactTokensForTokens not working!
We are trying to "swapExactTokensforTokens" for swapping any token, and it runs well, but we get this error at the blockchain:
TRANSFER_FROM_FAILED
https://polygonscan.com/tx/...
0
votes
1
answer
678
views
How to redirect to Etherscan website when transaction completes?
In my project, I am doing a transaction by using
ethereum.send({ })
method from web3 in javascript using metamask. After the transaction completes I want to display the link to the user in label ...
0
votes
0
answers
23
views
How to connect trust wallet conection modal in mobile ethersjs?
I have an authorization web3 window but its only opens on desktop but not on mobile apps. How can I solve this problem ?
export const getSigner = async () => {
let provider;
if(window....
0
votes
0
answers
23
views
setOpenCreatePost Function Not Triggered Despite Click Event Logging "Textarea clicked"
I'm currently facing an issue in my Next.js application where the setOpenCreatePost function does not seem to be triggered when clicking on a . Although the console correctly logs "Textarea ...
0
votes
2
answers
38
views
How to Call Solidity Function with Struct Parameter from JavaScript?
I'm trying to execute a Solidity function using JavaScript. The Solidity function accepts a struct as an argument, and I'm not sure how to structure the data in my JavaScript code to make this call ...
0
votes
1
answer
157
views
Reading Ethereum contract event TypeError: Cannot read properties of undefined (reading 'toHexString')
I have the following js script that i want to use to read events from a smart contract below, but when i run the script I get the following error message
TypeError: Cannot read properties of undefined ...
0
votes
1
answer
109
views
ethers sendTransaction times out
I am using Remix IDE with the Remix VM (Shanghai) environment.
In a Javascript unit test, I would like to send Ether from the main account to another account. Here is a minimal reproducible example:
/*...
0
votes
1
answer
140
views
Why do i keep getting some transaction failed CALL_EXCEPTION error when sending a transaction through client
i have created a function that should allow me to join a channel for a price.
this is like some on and off type of thing. It worked yesterday and now it doesnt want to work. I am pulling my hair out ...
0
votes
1
answer
20
views
Help with “web3 not defined”
I am cloning a tutorial https://github.com/techaddict0x/liquidityminer
And when I run the debug console I get the error “web3 is not defined”
The code is the exact same, looked all over the internet ...
0
votes
1
answer
656
views
Batch check balance of addresses with my node?
I have a txt file with around 1300 ethereum addreses (1 each line) that I have saved during the years. Now I am running a node since some time and would like to utilize it to automatically check the ...
0
votes
0
answers
32
views
Can I allow a user to sign a contract, and then based on that contract to make a transaction without approval?
For example, let's say we have a sender and a receiver. A is the sender and B is the receiver.
For exampple I have a website. Using js, user A signs a contract, and by hitting the donate button on ...
0
votes
1
answer
164
views
Testing a SmatContract on Ropsten - The transaction is "Success" but I didn't get token in my wallet
I'm trying to take my first steps in the blockchain, and sometimes I stuck with some very weird issue (for me), this is one of them.
I've deployed a very simple SmallContract that inherit from @...
0
votes
1
answer
217
views
Problem in withdraw() function in Auction contract, !payable is used still its able to refund the amount of the lower bidders when we click withdraw
In Withdraw Function, !payable condition is given, but payable condition not given, still when we click withdraw, then we will get our money back if we dont have the highest bid
pragma solidity ^0.8.4;...
0
votes
1
answer
1k
views
Uncaught ReferenceError: require is not defined
I am fairly new to Ethereum development, I just tried to follow this tutorial but instead of connection to a public blockchain I am trying to connect to my local blockchain instance through MetaMask ...
0
votes
0
answers
160
views
About IPFS client add() function
I am digging into ipfs field in order to start a NFT project so that I am working with frontend with ipfs-http-client npm package (npm i ipfs-http-client).
My simple test code is like below:
const { ...
0
votes
1
answer
496
views
Web3.eth.abi.encodeFunctionCall Is not working
I'm creating a dapp that charges users a specific amount of eth depending on their input.
Whenever I attempt to create the transaction, I specify the amount of Eth in Wei. It throws an Error with no ...