Questions tagged [web3js]

Use this tag with questions about programming for the Ethereum JavaScript API.

Web3.js is open source and continuously updated since 2015. It has everything you need to start interacting with the Ethereum blockchain, giving easy access to accounts, events, smart contracts.

Useful links

2372 questions
0
votes
1 answer

How to Approve transfer in Bentobox on sushiswap?

I have this solidity function for interacting with Sushiswap: function swapSingleParamswhitPool( uint256 amountIn, uint256 amountOutMinimum, address pool, address tokenIn, bytes memory data) public payable { …
0
votes
1 answer

Call and access smart contract function through web3.js?

I need to know how can I call these methods through web3.js into my frontend which is in react and also the structure data. // SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; struct customer { uint256 amount; } contract Lottery { …
0
votes
1 answer

Solana Error: Warning! Token names and logos are not unique. This token may have spoofed its name and logo to look like another token

I minted token with my web3js script and received such warning in Solana explorer: Warning! Token names and logos are not unique. This token may have spoofed its name and logo to look like another token. Verify the token's mint address to ensure it…
0
votes
1 answer

Solana Web3.js getParsedTransaction sometimes return null

I am trying to get transaction values using signature id from any of the NFT's signature. For a test, I used the same signature and loop it 100 times to make sure that it is a valid signature with existing value I did console.log on the index of the…
Gene Lim
  • 1,068
  • 2
  • 14
  • 36
0
votes
0 answers

Send Token erc20 usign Web3.js( Private Key. Account unloked. SignTransaction )

If send to Avax but not my Erc20 Token. Thank you for your help First we get the url of the rcp. Then we create an instance of web3.js. Then with our private key you create an account. We create an instance of our contract by passing it the abi and…
0
votes
1 answer

Uncaught TypeError: _Web3Client__WEBPACK_IMPORTED_MODULE_1__.mintToken.then is not a function

I am trying to integrate my smart contract with frontend react js but I am getting this error while using methods of the contract. I got an error of react scripts version before so I installed a version less than 5 and now I am getting this error.…
Zoha Akram
  • 47
  • 9
0
votes
2 answers

I cannot create connector using "@walletconnect/client" and getting error

I used "@walletconnect/client" module to create wallet connector. Here is my code: const WalletConnect = require("@walletconnect/client"); const connector = new WalletConnect({ uri }); This makes an error in my project. Error: WalletConnect is not…
0
votes
1 answer

TypeError: web3.eth.Contract is not a constructor

Please how so I solve these error with web3.js Snapshot of Error Message const web3Token = new web3.eth.Contract(ERC20Token.abi);
Abbracx
  • 1
  • 3
0
votes
1 answer

Compiled with problems, 'crypto' module not found error in react js

Compiled with problems: ERROR in ../node_modules/eth-lib/lib/bytes.js 9:193-227 Module not found: Error: Can't resolve 'crypto' in '..2\node_modules\eth-lib\lib' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by…
R.S4697
  • 9
  • 4
0
votes
1 answer

Integrity assurance of smart contract call by Web3js library

I have a necessity where I want to verify the authenticity and integrity of the data that is returned by the Web3js library methods.mymethod().call() from the smart contract. Something we do in the client-server communication model, the authenticity…
0
votes
1 answer

Error when calling web3.sendRawTransaction(signature.serialize())

I want to sign a transaction of a user from phantom wallet and then send the transaction through web3.js but after successfully signing the transaction the web3js library function sendRawTransaction() is giving error message in console const…
0
votes
0 answers

trying to understand how setInterval/clearInterval work (in a solana web3 example)

I was going through the following tutorial to implement a simple web3 app: https://learn.figment.io/tutorials/chakra-ui-with-solana-dapps#realtime-account-updates-using-polling-and-custom-react-hooks This sets up an interval to monitor the status of…
LindleyLentati
  • 161
  • 3
  • 12
0
votes
1 answer

How to get transaction hash of a transaction with web3ja

am not able to get the transaction record of the transaction my code is below kindly help me here is the script tag I used
0
votes
1 answer

How a struct is taking an empty array and later how an address is going to be put there?

As far I know, new address[](number) creates an fixed sized array of that number initialized with zero. But how in this line Room memory room = Room(new address[](0), 0, 0); Room struct is taking an empty array and later how an address is going to…
Hasnat Pie
  • 17
  • 4
0
votes
3 answers

setState does not update inside eventListener in useEffect with empty array

this is not a duplicate because i tried to add an updater function and it didn't work this is the code i have const [counter, setCounter] = useState(0); useEffect(()=> { const fetchSessions =async ()=> { …
ezio
  • 359
  • 2
  • 13