Questions tagged [web3js]
Use this tag with questions about programming for the Ethereum JavaScript API.
2,378
questions
0
votes
0
answers
17
views
web3 auth integration to Login page
I'm making a login page for my dapp, and I think I will build on Solana chain.
And I wonder how I can add web3.auth in the page.
I'm using react-native, not sure what to do with this step
web3.auth ...
-1
votes
0
answers
30
views
How can I solve 'fetch' has been blocked by CORS policy?
I'm trying to fetch campaign data using wagmi's readContract hook and display it on the user's dashboard. I'm using Nextjs in the front-end and solidity & hardhat in the back-end.
The contract ...
0
votes
0
answers
21
views
Can I use SIWE in React Native?
My React and React Native projects use Walletconnect to connect wallet.
My question is if I don't have window.location.host and window.location.origin in React Native, how do I send the message to my ...
-1
votes
0
answers
27
views
InvalidResponseError: Returned error: The method eth_sendTransaction does not exist/is not available
I'm trying to interact with a smart contract on BSCtest using web3. I think the error occurs in this line
rs = await TokenContract.methods.transfer(receiverAddress, 100000).send({
from: myAddress,
...
-1
votes
1
answer
33
views
Transfering ERC20 token using javascript and Metamask
I'm developing a app that allows to transfer crypto assets using safeTransferFrom method that will call Metamask to confirm the transaction. It works well but I have a weird issue.
in order to test my ...
-2
votes
1
answer
30
views
How to sign a contract without web3js?
I want to sign and user "sendSignTransaction" method with web3js but gives me error meaning of error is by node provider doesnt support that function so how to handle this or are there any ...
-1
votes
1
answer
33
views
sendSignedTransaction in web3.js takes too long
This is the code I provided for sending a simple transaction to USDT contract on goerli network to mint some tokens. But when I run it takes too long until exceeds the limited timeout(which is not ...
-3
votes
1
answer
36
views
How to work with payable function in smart contract using Thirdweb? [closed]
As per Thirdweb's latest documentation for React, I have to use the useContractWrite function to call functions that basically make changes to the storage variables/data.
My question is, let say there ...
1
vote
1
answer
59
views
window.ethereum.request not working on mobile device
Expect behavior:
real mobile device
click the MetaMask button will trigger the MetaMask APP and login, just like PloyMarket website.
https://polymarket.com/
Actual behavior:
I try to use the function ...
-1
votes
0
answers
21
views
How to sign order using derived signer address?
The derived address i am creating is not getting recognized as a valid signature
so I created a limit order object and generated a derived address out of it
const limitOrder: LimitOrder = new ...
-1
votes
1
answer
22
views
In web3.js how do I get the original input parameters to a call into the callback return?
Using this example from the web3 docs, how would I get the original passed parameter "123" when the async .then is called?
myContract.methods.myMethod(123).call({from: '...
-1
votes
0
answers
17
views
getting error when am trying to execute dfx deploy after dfx start
Error: The post-build step failed for canister 'ryjl3-tyaaa-aaaaa-aaaba-cai' with an embedded error: The command '"npm" "run" "build"' failed with exit status 'exit ...
0
votes
2
answers
42
views
Cannot read properties of undefined (reading 'providers')
here i am getting importing web3 version 1.2.11 as
import Web3 from 'web3'
const readonlyProvider = new Web3.providers.HttpProvider(providerURL) in typescript.
after compiling getting in javascript
...
-1
votes
0
answers
49
views
how to add custom token to metamask using wagmi in react
I'm trying to add custom token to metamask using wagmi in react.
I could add custom token in metamask manually or using web3.js
but my project is using wagmi.
I can't find any docs or solution.
if ...
0
votes
0
answers
49
views
Ethereum Solidity ABI Decoder Error: "value exceeds width (20 bits)"
ethers.js v4 have deocding method for transaction encode it works though but for the upgraded versions v5 & v6 it didn't work & i couldn't find a clear solution about decoding this transaction ...
-1
votes
0
answers
45
views
AbiError keeps coming despite putting the correct ABI
So I've been working on a simple blockchain-based application using the Ethereum blockchain, and this app enables you to add or delete a tell. The home page retrieves the list of tells stored in the ...
0
votes
0
answers
14
views
increase tx building ethers when swap token
this is my code swap a token by bnb on pancake swap, i put some var date time and see part of code ( const tx2.... ) take almost 3 second to build, 2s to send to RPC , so total ~5s to buy complete ...
0
votes
1
answer
41
views
web3js gives null as output for a valid smart contract function
I am watching a yt tutorial on building dapps from dapp university and followed along his video until i got this problem. He was trying to build a social media site where users can post and tippers ...
1
vote
1
answer
69
views
How to pass tuples and structs using web3.py or blockchain explorers
How should I pass the following arguments to sendOFT function in
This smart smart contract using python web3.py and block explorer?
Here are the data types:
I get an error when I pass elements like ...
0
votes
1
answer
50
views
How do I allow my code to spend up to $35 in gas?
I have an escrow smart contract takes a token from a players' wallet. On my last deployment some months ago, It worked well and took a maximum. of $6 gas when gas price was around 10 gwei. When I ...
0
votes
1
answer
62
views
nodejs web3 bsc bep20 token transfer gas price need BNB or EHT
I have a question and would like to ask it.
I am currently using nodejs based on web3 and my wallet also goes to Ethereum based on web3.
The token currently used is BEP20.
let contract= new web3.eth....
0
votes
0
answers
24
views
Can I send BEP-20 to web3 ethereumjs-wallet.js?
I mainly use ethereumjs-wallet(https://www.npmjs.com/package/ethereumjs-wallet) based on web3 in nodejs to transmit ERC20.This time, I suddenly became curious. If I send BEP-20, will ethereumjs-wallet ...
1
vote
0
answers
51
views
How to do batch transaction request to Ethereum in flutter?
What i actually need is a way to create a batch request to ethereum for my transections in flutter web.
There are 2 specific library that i am following. One of them is web3dart which i see most ppl ...
0
votes
0
answers
37
views
Get original value from keccak_256 if the original value is small in size (less than 256 bits)
When converting an arbitrary long text to 256 bits, information will be lost. So, it is impossible to get it back.
However, if the original text is just few bits long, can we get it back from the ...
0
votes
1
answer
141
views
ethers js websocket RPC keeps disconnecting when no events
I use ethers to connect to ethereum contract and listen for its events.
This is how I set it up:
const provider = new ethers.WebSocketProvider(providerUrl);
const contract = new ethers.Contract(
...
1
vote
2
answers
56
views
Web3js Smart Contract interaction and Signing
I can interact with a smart contract when using a local node(ganache).
But when I try to interact with a public node with the following method, I get sender account not recognized
const web3 = new ...
1
vote
0
answers
30
views
MeshJs integration With Next 13 Error: Element type is invalid. Received a promise that resolves to: [object Promise]
I am trying to create a connect button to the Nami Wallet where the user can register so I can take the public address, network id, and so on as I need it for the backend.
To implement the Nami wallet ...
-1
votes
1
answer
23
views
Is It correct way to create selctor of function If function contained uint values and struct as parameters in solidity
function getMyFunctionSignature(
uint256 dbId,
launchpadLib.IDOInfo memory _idoInfo,
launchpadLib.IDOInfoTwo memory _IDOInfoTwo
) public pure returns (bytes memory) {
return (
abi.encodeWithSignature(
...
0
votes
0
answers
28
views
web3 library not sending data. Transaction failed
i am using a the latest npm version of web3 and when i try to send a data an error occurs. Transaction failed. if i downgrade my web3 version to 1.2.2 my transaction works successfully.
import ...
0
votes
0
answers
33
views
How to prompt connecting another wallet via Web3.js
I'm building a dapp that allows users to connect multiple wallets. When a user is not connected to my app at all and I issue the const accounts = await this.eth.request({ method: 'eth_requestAccounts' ...
1
vote
0
answers
44
views
I keep getting error when trying to send transaction signed by web3.eth.sign with web3.eth.sendsignedtransaction
I get the following error:
Error: TypedTransaction with ID 40 unknown
at t.TransactionFactory.fromSerializedData
My code:
const txData = {
nonce: "0x" + parseInt(nonce, 10).toString(...
0
votes
0
answers
33
views
Error in the browser and ganache crash when i check the transactions tab
I am trying to run a smart contract locally on ganache and interact with it using web3.js with vanilla javascript, but when i use the contract.methods.mymethod.send({from,gas}) function i get an error ...
1
vote
0
answers
96
views
Getting balance for wallet in React using Web3
React newbie here. Have an issue starting out, specifically with getting the balance of an address attached to a connected wallet.
import "./App.css";
import React, { useState } from "...
0
votes
0
answers
30
views
How to create a listener for Intercepting and handling requests to Metamask in a browser extension? [duplicate]
I want to create a PoC (Proof of Concept) for a simple extension that intercepts requests to Metamask and either accepts and forwards them to Metamask or blocks them.
I've seen applications like ...
0
votes
1
answer
236
views
Error: Could not fetch bytecode for contract at
I am using third web-dev/react to communicate with smart contract but the issue is it is giving me the could not fetch bytecode for contract.
Error: Could not fetch bytecode for contract at ...
0
votes
1
answer
88
views
Vue Use function for module configuration without createApp() function? Nuxt3
In the following code, is there a Vue function that I can use to get the same effect as app.use(UseWagmiPlugin, config); without importing './app.vue and using createApp()?
(Link to github docs here: ...
0
votes
0
answers
25
views
How-To Properly construct an object for the getPastLogs and filter transactions with the topics parameter
Ok this is a bit of a long one so please forgive me ahead of time. My goal is to recreate the Dex Trade Table from a token page through the usage of the RJSONRPCAPI method
Now I am using a Infura ...
0
votes
1
answer
24
views
Doesnt prompt anything , Signing a message with PRIVATE_KEY
I am running this js file which creates a random value Jeton and wants to sign it only if two of a smartContract functions return true (if a certain conditions is met). The problem is when I try node ...
0
votes
0
answers
7
views
result of async function getContractData() is not error
I have been developing website integrated metamask as react js
by the way,web3.js is not connected with backend
in my opinioin, backend means contract
transaction was not happend.
result is not ...
0
votes
1
answer
23
views
getting gassless transactions contract address
i'm getting transactions by block from covalent with nodejs, but some transactions doesn't have a gass fees sections which means i can't get contract address for those, how can i get contract for ...
-1
votes
1
answer
22
views
Error uploading file to IPFS: (readStream is not a readable stream or form data & source.on is not a function)
I am trying to upload files on ipfs using pinata but getting errors.
captureFile = (e) => {
console.log(e.target.files[0]);
if (e.target.files[0]) {
const file = e.target.files[0];
...
0
votes
2
answers
81
views
Connect to aws ec2 node by websocket
I have created a chain node on aws ec2 instance using geth.
Do I need to enable something or what ip should I use to connect to it?
I am using web3.js using new Web3.providers.WebsocketProvider('...
0
votes
0
answers
80
views
When sending a transaction using web3 I recive EIP1559FeeMarketTransaction.fillFromResult error
I am using a ganache local blockchain and truffle to test my smart contracts, this problem started to occur all of a sudden, since before I wasn't running into this problem.
So when I call the ...
0
votes
1
answer
47
views
CompilerError: Stack too deep. Try compiling
// SPDX-License-Identifier: [`
`MIT`
pragma solidity >=0.5.0 <0.9.0;
contract Record {
struct Patients {
string ic;
string name;
string phone;
string gender;
...
1
vote
1
answer
59
views
Solidity Transaction Reverted by EVM with USDC Interaction
I've created a smart contract in Solidity that interacts with USDC. However, when I try to execute transactions, I'm encountering an EVM revert error. I'd appreciate some assistance in understanding ...
1
vote
0
answers
33
views
TrustWallet not injecting Ethereum provider with deeplinking into mobile IOS TrustWallet app
const connectTrustWallet = () => {
// alert(`is window.trustwallet.ethereum ${window.trustwallet?.ethereum}`);
// alert(`is window.ethereum ${window.ethereum}`);
if (isOnMobile() &&...
1
vote
0
answers
56
views
Web3js back to basics | Call method ok, Send method not ok
So I am stuck in a really simple point with Web3js and I have no clue what the issue could be, I am starting to think that I have some sort of problem with metamask or maybe chrome, but I first want ...
-1
votes
1
answer
218
views
WEB3 error: Transaction has been reverted by the EVM
I have deployed this simple smart contract using Remix
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
contract Counter {
uint256 private count = 0;
function setCount(...
0
votes
1
answer
46
views
Problems with Payable function in Solidity. It is correctly executed in Remix, but it is not executed at all from Web3 Javascript core
I have one of my public functions in a solidity smart contract programmed as a payable function. This one is supposed to receive ETH when it is called from a user perspective, and then execute the ...
0
votes
1
answer
131
views
TypeError: mnemonic.computeSeed is not a function
This is my code
(https://i.stack.imgur.com/eCKGy.png)
and this is my error
(https://i.stack.imgur.com/MLWUg.png)
I tried to change from HDNodeWallet to HDNode but still no result
(https://i.stack....