Questions tagged [web3js-v1.x]

For questions specifically about version 1.x of the web3js Javascript API and library for Ethereum

For questions specifically about version 1.x of the web3js Javascript API and library for Ethereum.

See also and for version-agnostic questions .

74 questions
2
votes
1 answer

UnhandledPromiseRejectionWarning: Error: "gas" is missing

How can I catch exception thrown by method call? (async () => { try { const contract = await MyContract.deployed(); const gasPrice = await web3.eth.getGasPrice(); contract.methods .myMethod() .send({ from:…
Dimitry
  • 21
  • 1
  • 2
1
vote
1 answer

How to get balance of an address using web3js

Here is a very simple code that i am using :- let web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io/v3/XXXXX")); var balance; web3.eth.getBalance("0x407d73d8a49eeb85d32cf465507dd71d507100c1").then(bal => balance…
Hokkyokusei
  • 285
  • 1
  • 2
  • 8
1
vote
1 answer

Web3 .call not returning "valid value"

Low level function calls work in Truffle, Solidity is not the problem. Other method invocations are working with the JS and HTML. This is my first attempt at using .call instead of .send; I am not sure why I am getting this error. For the record, I…
0TTT0
  • 672
  • 2
  • 10
  • 20
1
vote
1 answer

How can I create a copy of an existent contract in Javascript ?

I'm trying to create a copy of an contract existent contract using web3.js 1.0. I'm trying to use the functions clone and deploy but without success. contract2 = contract1.clone(); contract2.deploy().send({from :…
1
vote
0 answers

Unable to install web3-eth-ens while installing web3-version 35

I had web3 ver 36. Due to an issue, I rolled back to ver 35 as follows - npm install -g web3@1.0.0-beta.35 --save Before this, I did npm cache clear --force. However, it looks like web3-eth-ens is never getting installed. I always see the following…
Omi
  • 191
  • 1
  • 9
0
votes
1 answer

Does web3.eth.wallet.create set the newly created wallet file as the 'global' source of addresses for the web3 instance?

I'm playing about with web3js@1.0.0-beta.55 and I'm setting an HttpProvider on Ganache for my web3 instance: this.web3Instance = new Web3(new Web3.providers.HttpProvider(environment.ethereum.provider)); I've noticed that if I call…
E. Rowlands
  • 127
  • 8
0
votes
2 answers

timed transactions using web3-1.0

I am creating a dapp using web3-1.0. I have a contract that stores personal data for a particular user(account). I want to implement a functionality so that a user can share his data (stored in the smart contract) with another user for a particular…
harshit
  • 13
  • 3
0
votes
0 answers

Error: Invalid bytes string given: 0x

Contract code: function getAddressDnaIds(address owner) external view returns(uint256[]) { return addressDnaIds[owner]; } Code causing the error: var dna = await this.airdrop.methods.getAddressDnaIds(this.address) .call({ from:…
Eddie
  • 131
  • 1
  • 4
0
votes
1 answer

How to sign a transaction using web3 1.0?

When trying the following code I will get an an wrong JSON RPC response. const fnc = myContract.methods.transferToken(...).encodeABI(); const tx = Object.assign({ nonce: nonce, to: address, data: fnc, …
MarcS82
  • 323
  • 1
  • 3
  • 13