New answers tagged

0 votes
Accepted

Web3.js => _data.trim() is not a function?

forge was compiling diffrently in bytecode there some other elements other than just bytecode. bytecode itself was under object element.
seojunchian's user avatar
0 votes
Accepted

Callable contract's function not exists in ABI

You can get a hint regarding the 4 parameters being passed by decoding a previous transaction, like this: Here's the revised code with the ABI of the mintPublic function, and passing the parameters ...
SYED ASAD KAZMI's user avatar
0 votes

How do I access data from blockchain

To get data of any transaction you can use this API https://ide.bitquery.io/Transaction-details_1 It gets you complete transaction detail and if you want you can get more details like event, call , ...
Gaurav Agrawal's user avatar
1 vote

Subscribe to eth3 transactions to a particular address

You can use Bitquery's streaming APIs For example, to subscribe to a specific smart contract, use this API https://ide.bitquery.io/Websocket-for-Transaction-events-calls-and-Transfers-for-USDT In this,...
Gaurav Agrawal's user avatar
1 vote

How to listen for events at a specific contract

Dev Advocate at Chainstack here. In case anyone needs an updated answer to Web3.js V4. To listen for events at a specific contract using web3.js, you can use the web3.eth.subscribe('logs', {...}) ...
Dave Dev Advocate Chainstack's user avatar
0 votes

How to determine reserves from getReserves method on Uniswap pair

On python how to know what reserves[0] and reserves[1]: reserves = pair_contract.functions.getReserves().call() token0 = pair_contract.functions.token0().call() if token0 == address: ...
sirjay's user avatar
  • 111
0 votes

How to listen for events at a specific contract

You can use the following query to listen to all events for smart contracts. https://ide.bitquery.io/USDT-smart-contract-events-on-ethereum In this, we get all the events of the USDT smart contract. ...
Gaurav Agrawal's user avatar
0 votes

What is the best way to monitor all token balances of wallet address?

If I understand your query properly, you want to show balance of multiple Tokens in individual wallet address. If this is your question then as a solution you can use Ether-scan or other blockchain ...
Aayush Kasera's user avatar
0 votes

How can i connect okx wallet (web3-react v6)?

You can check the boolean value of window.ethereum.isMetaMask property, as MetaMask injects an isMetaMask property into the window.ethereum object. So, you can use this property to check if the ...
SYED ASAD KAZMI's user avatar
0 votes

My web3 js transaction has a gas estimate of $0.02 displayed with rainbow wallet, but with metamask it displays as $2.00

const gasPrice = await web3.eth.getGasPrice(); // needed this line const sendOptions = { from: account, value: amountInMax.toString(), gas: estimatedGas.toString(), maxPriorityFeePerGas: ...
NimChimpsky's user avatar
0 votes

Retrieving the private/ public key with web3js for a specific wallet provided by truffle/hdwallet-provider

There is no provider.wallets anymore. I dig deeper into sourcecode and see that developers just drop it from exports, still under the hood there are private keys for all accounts generated, but you ...
Yuri Steps's user avatar
0 votes

parse transaction logs to get NFT Transfer information

Dev Advocate at Chainstack. You can use a simple script to fetch and decode logs using ethers.js. Here is an example to fetch the Transfer event from the BAYC collection: const ethers = require('...
Dave Dev Advocate Chainstack's user avatar
1 vote

How can I get the correct pair price from Uniswap v3 pool?

You can remove the negative sign by using Math.abs(). Since the USDC value is in 6-decimal format and WETH value is in 18-decimal format as per their respective token contracts, so the USDC value ...
SYED ASAD KAZMI's user avatar
0 votes

deflationary tokens vs inflationary tokens

Deflationary tokens exist primarily to create scarcity and incentivize holders. By reducing the token supply over time, these tokens aim to increase their value over the long term. In other words, ...
Gabriel Stoica's user avatar
0 votes

Database column type (postgres) for storing erc20 token balances the correct way

How about storing it as NUMERIC(78,0)? postgres Max unsigned 256-bit integer is 115792089237316195423570985008687907853269984665640564039457584007913129639935, which is exactly 78 digits long. There ...
winwin's user avatar
  • 103
0 votes

Returned error: unknown account Web3.js

you can add this line before sending transaction web3.eth.accounts.wallet.add(privateKey);
ROSHAN G's user avatar
1 vote
Accepted

Capture emitted event with web3 v4.7.0

In your event listener, you've to specify fromBlock and toBlock values. As, you've only specified the fromBlock as latest without any info regarding the toBlock, therefore it's not capturing anything. ...
SYED ASAD KAZMI's user avatar
0 votes

web3.js methods call producing error Web3 validator found 1 error[s]: value "0" at "/1" must pass "address" validation

I suspect this might be an issue in the web3.js library, potentially related to overloaded functions. I just commented out the following piece of code in the _createContractMethod function, and the ...
bender's user avatar
  • 1
0 votes

Error: you must provide the json interface of the contract when instantiating a contract object

Here you have another example to load contracts with no require function. Working on Web3.js v4 2024 const loadContracts = async () => { const networkID = await web3.eth.net.getId(); ...
Seelen Meister's user avatar
0 votes

As a developer how to let user of your DAPP choose the preferred wallet

EIP-6963 ("Multi Injected Provider Discovery") was created in May 2023 to solve this problem. Both MetaMask and Coinbase Wallet (and most other major wallets) support EIP-6963. Basically, on ...
ardislu's user avatar
  • 412
0 votes

How do I subscribe to contract events in Web3.js 4.0?

This is from the doc web3js, there is no callback function anymore in the {EventName} or allEvents function. const subscription = await myContract.events.MyEvent({ filter: {myIndexedParam: [20,23],...
kyles's user avatar
  • 1
1 vote
Accepted

How can I decode the output of the first call and use it to send a transaction?

Here's how you can do it, by decoding the response of the first transaction, and then fetching the necessary details from the same using regex. Then, using that info, send the second transaction. ...
SYED ASAD KAZMI's user avatar
0 votes

Get unknown account when sending transaction to ethereum testnet network

It seems like the error unknown account is indicating that the account you're trying to send the transaction from is not recognised or accessible by the node you're connected to. To set the account ...
SYED ASAD KAZMI's user avatar
0 votes

Is there a way to find an account's current transaction nonce?

You can find out your transaction nonce through the help of Bitquery APIs. Please find the js console implementation for the same below https://gist.github.com/GkM8te-BitQuery/...
George Mathew's user avatar
0 votes

I was trying to convert private key of an account to its public key but getting an error

privatekey=0xafdfd9c3d2095ef696594f6cedcae59e72dcd697e2a7521b1578140422a4f890 you have to add '0x' before your privatekey
MD.Tameem Gazi's user avatar
0 votes

Can you convert my address (bytes20) type to a bytes32 string?

If you're using Ethers.js '0x'.concat(contract.address.slice(2).padStart(64, '0'))
Unicone's user avatar
  • 101
1 vote
Accepted

Web3.js does not include extra data with the function?

If you're using web3.js version 4.6.0 (i.e., the latest available version at this point in time), then when you prepend '0x' to stringToHex("any string message"), you might encounter this ...
SYED ASAD KAZMI's user avatar
0 votes
Accepted

uniswapRouter.getAmountsOut returns less value of token B than present in reverses when provide full amounts of token A

That's just how math works. Let's call the reserves values x and y. In your example x = 36851089197799104779745113323n y = 281312509765248795074n Before and after the swap, the value of their product ...
0xSanson's user avatar
  • 3,129
0 votes

uniswapRouter.getAmountsOut returns less value of token B than present in reverses when provide full amounts of token A

It seems like there might be a misunderstanding of how the getAmountsOut() function works in Uniswap. Let's break down the code and clarify the behavior: getReserves() -> retrieves the current ...
SYED ASAD KAZMI's user avatar
0 votes
Accepted

ethers read WETH allowance throwing call revert exception

I was using the wrong blast network, turns out there are two and I got the wrong one.
sha237's user avatar
  • 1
0 votes

How to integrate a web3 browser in my crypto wallet expo app

I am trying to do the similar thing, I am starting with the following https://github.com/abcoathup/expo-web3. I have not made it work yet, but hope the information helps
chygo's user avatar
  • 111
0 votes

Feeding a Smart contract with large Data

Sending such a large amount of data in a single transaction can indeed be problematic due to gas limits and other constraints imposed by the blockchain network. Breaking it down into smaller ...
SYED ASAD KAZMI's user avatar
0 votes

How to call approve ERC20 and other contract function?

I understand your dApp tries to make a transfer of an ERC20 token on behalf of the user. For this scenario, the most usual way is to make your user see the metamask's popup and click on it twice. ...
DarkWinter's user avatar

Top 50 recent answers are included