Questions tagged [javascript]

JavaScript is a dynamic, weakly-typed language used for client-side as well as server-side scripting.

Filter by
Sorted by
Tagged with
1
vote
1answer
23 views

Logic help needed, how to transfer funds to the address who placed bets on winning team?

This is a betting application and right now -> if I place bets on HOME, the amount gets stored but I want to transfer the amount only to the address who placed bets on winning team. I have developed ...
0
votes
0answers
17 views

Unfulfilled Promise From A Metamask Transaction

I'm having a problem with my JS code pausing on the let result line. Metamask prompts me to approve the transaction initiated in the line (which I do), but then doesn't proceed any further. As the ...
0
votes
0answers
24 views

Not able to call the solidity function through App.js? Anyone know how to call a solidity function?

I'm trying to call a Solidity function from App.js, but I'm unsuccessful even after a number of tries. Its a very simple function betOnTeam(). Inside this function I just want to check condition and ...
0
votes
0answers
17 views

Error => invalid address, on passing arguments to function

so I created a function but then I needed to make it dynamic so that I will be able to call the same function body just bypassing the arguments on click of a button I am fetching the values from HTML ...
0
votes
1answer
18 views

How to call such a function? (pass argument)

For example, here is the code What will the best code practice, either to repeat the code inside two different functions or what can I do? OraclizeContract.deployed().then(function(instance) { ...
0
votes
0answers
21 views

Signing Ropsten transactions with

I am trying to sign transactions using the Web3 HDWalletProvider package and an infura API. I am using the following code: const Web3 = require('web3'); const Web3HDWalletProvider = require("web3-...
0
votes
1answer
34 views

Function stopped working? No check is being done now on transfer function

I created a function to deposit and transfer ether and it was working great until i tried to deploy again and now the transfer function is not working anymore No errors are being thrown, the transfer ...
0
votes
2answers
32 views

Cannot transfer ether from smart contract to another address

I am using truffle and when we type truffle develop it provides us with 10 address ** So, the problem I am facing is I have created 2 functions one to deposit ether and the other one to transfer the ...
0
votes
0answers
18 views

How can I make function calls in UI based on these functions of my smart Contract [closed]

I want to call these functions as soon as an address is logged in to my UI Whats the best way to achieve this with metamask, web3 js?
0
votes
0answers
18 views

How can we send ether to smart contract address and then transfer it to a account? [closed]

Any ideas, code or suggestions is welcome I am using truffle ,web3 ,metamask Can we send rawtransaction to contract address and then Retrieved the amount? I need to deduct amount from 2 people ...
0
votes
0answers
50 views

Cant call solidity function from app.js?

Solidity function Using web3 0.20 version and Cant call solidity BETONTEAM function pragma solidity ^0.4.22; import "installed_contracts/strings.sol"; import "installed_contracts/oraclize-api/...
0
votes
1answer
22 views

Can we take input of an address and pass it on the function to send ether using truffle and web3?

Actually i am trying to create a betting application so when i get the result that Home team has won Before this i will be taking both address as input (betting do two address whoever wins gets the ...
-1
votes
0answers
23 views

Can we take input of an address and pass it on the function to send ether using web3 and truffle? [closed]

Actually i am trying to create a betting application so when i get the result that Home team has won Before this i will be taking both address as input (betting do two address whoever wins gets the ...
1
vote
2answers
24 views

How to read data returned by a function? [duplicate]

Counter.sol: pragma solidity >=0.5.0 <0.7.0; contract Counter { uint public _counter = 0; function GenNextID() public returns (uint) { return _counter++; } } I use ...
0
votes
0answers
48 views

How to call solidity function from javascript file? Keep getting error deploying through truffle and webpack

Error -> TypeError: fetch.amount is not a function [WDS] Disconnected! Please explain or provide code on how to call solidity function Trying to call from ready() function console.log(contract.abi)...
0
votes
1answer
21 views

Getting error -> unexpected token. You may need an appropriate loader to handle this file type

root@kali:~/Documents/oraclize-test# npm run dev truffle-oraclize-api@0.0.2 dev /root/Documents/oraclize-test webpack-dev-server ERROR in ./app/javascripts/app.js Module parse failed: /root/...
2
votes
4answers
328 views

How essential is a knowledge of Javascript to learning solidity/ethereum?

I am new to the ethereum space, and though I can code in C and C++, I keep noticing in the docs that there are references to Javascript and node.js and how similar it is to solidity as well as ...
0
votes
1answer
28 views

web3 error - web3.eth.Contract is not a constructor

i try to get the contract balance and im using this var Web3 = require('web3') var web3 = new Web3('ropsten.infura.io/v3/123456789') var abi = abi is here ; var contractAddress = '0x31111.....'; var ...
1
vote
1answer
18 views

How can you work around Web3 1.0s bug to check for transaction confirmation?

The following includes a null Tx id: web3.eth.getTransaction('0x2fc36f9c6593bc1232b3466832c6ee38b5b2b3b4a54be3f6c68fb06e8d82e452', function(error, result){ if (!error) { console.log(result....
0
votes
1answer
33 views

Metamask (Chrome extension) web3.js console: ETH transaction issue (synchronous methods) + web3.version

I am playing around with Metamask and the web3.js API using the Google Chrome console. However, I have two issues: 1) I am trying to send a simple transaction using Ganache GUI (localhost 7545) and I ...
1
vote
2answers
37 views

Ganache Processing becomes very slow (with Automining Option) after consecutive thousands transactions

I am trying to deploy thousands of contracts on Ganache GUI. At first, it process all transactions very fast (deploy contracts and transactions for calling setters functions) . After some transactions,...
0
votes
0answers
21 views

Collection of erc20 tokens from multiple addresses

I have main address: const fromAddress There is also an array of addresses and their keys: foreth / keys I need to send all tokens from the addresses of the foreth array to the main address ...
1
vote
1answer
95 views

How Can You Find the Ethereum Provider on Web3 Browsers Other Than MetaMask?

MetaMask provides the following way currently to find a provider for their upcoming 2020 breaking change: // Running on the page, in the browser // This API will go live in Q1 2020 // It will be the ...
1
vote
2answers
37 views

The method eth_sendTransaction does not exist/is not available, when using Ropsten Network

My following code previously works perfectly at Ganache, but when i switched it to Ropsten Network, it give captioned error. Here is Code: async function finalSettersFunctions(){ var myFunc; ...
0
votes
1answer
47 views

UnhandledPromiseRejectionWarning: Error: Returned error: nonce too low

I am trying to deploy some contracts on Ropsten network. Here is my code async function finalDeploy(r){ for(i=0; i<constructorParams.length; i++) { const options = { data: '0x' + ...
0
votes
1answer
19 views

Could not deploy on Ropsten network using Truffle

I have following truffle-config.js file const fs = require('fs'); const HDWalletProvider = require("truffle-hdwallet-provider"); const secrets = JSON.parse( fs.readFileSync("abc.txt").toString()....
1
vote
2answers
54 views

How to insert multiple transactions into One Block in Ganache GUI

Is it possible to enable Ganache GUI to put multiple transactions into ONE block ?. The details about Why i need this thing, is given below; I am going to test Transaction Order Dependence (TOD) ...
1
vote
1answer
24 views

AZTEC validateProof and validateProofByHash sender / signer addresses

The AZTEC Crypto Engine lets you validate proofs and cache them for future re-use, since they are fairly expensive (around 800,000 gas for a 4-note join-split proof before Istanbul, and now about 200,...
2
votes
1answer
16 views

How to pass encoded parameters to call contract getter fuctions

I have an array (i.e. functionNames[]) of getter functions's names of my contract and another array (i.e. finalGettersParams) of encoded parameters (which has been populated from web3.eth.abi....
2
votes
1answer
16 views

How to access the element of decodedParameters

I have used web3.eth.abi.decodeParameters and returned values have been pushed into my array (finalGettersParams.push(...)) something like this. [ Result { __length__: 0 }, Result { '0': '...
1
vote
1answer
31 views

How to print the value of encoded getter functions of contract

UPDATED: Sorry for Inconvenience, I have updated all my question and accept my apology , being naive user. I have encoded getter functions of my contract i.e. ...
0
votes
1answer
15 views

base fee exceeds gas limit , error when deploying using encoded constructor

I have following small simple contract pragma solidity 0.4.24; contract MyContract { uint256 public totalSupply ; mapping( address => uint256) public balances ; address public ...
1
vote
0answers
17 views

EIP-712 typed signature for arrays

I'm trying to generate a typed signature for an array in JavaScript based on EIP-712 and using eth-sig-util. My problem is that I need to sign an array. It says in the specification to use Type[] or ...
1
vote
1answer
18 views

how to create Function Selector (Method IDs)

As stated in ABI specs that 0xcdcd77c0: the Method ID. This is derived as the first 4 bytes of the Keccak hash of the ASCII form of the signature baz(uint32,bool). So, I have to create method IDs (...
0
votes
0answers
29 views

TypeError: CreateListFromArrayLike called on non-object

I have this contract and deployed it to my local client (ganache gui) and its abi.json file (of solc compiler generated). The third file is param.txt which contains encoded functions with arguments ...
0
votes
0answers
13 views

Compiling Old Version Contracts , gives ParserError: Expected pragma, import directive or contract/interface/library definition

Ihave to compile some old contracts (having solidity pragma is <0.5. For this purpose, I have just copy and paste this contract from Etehrscan and save with its name in contracts folder. Install ...
0
votes
0answers
19 views

Solc Compiler related Error in Nodejs

I have almost 800 .solc files of version ^0.5.12 (i am using also 0.5.13 compiler version), when i all give them to my input, to compile with following code; var walk = function (dir) { var ...
0
votes
1answer
24 views

TypeError: _getWeb3__WEBPACK_IMPORTED_MODULE_0__.default.eth is undefined

I'm not familiar with webpack, but after reading this error all I know that I import one module that is undefined by webpack. However, I don't know why export default new web3.eth.Contract(abi, ...
0
votes
2answers
17 views

Recovering of typed signature fails because it's too long

I have a typed signature generated by EIP712 V3. It is 132 characters long. I'm trying to recover it using recoverTypedSignature from eth-sig-util. This fails saying: index.js:1 Error: Invalid ...
0
votes
0answers
8 views

How to recover a signature on the server side?

I need to verify the signer of a signature in my node server. const fortmaticApiKey = 'pk_live_...'; const checkPersonalSignature = async (data, signature, signer) => { try { const { get } =...
0
votes
1answer
26 views

Error: Uncaught [TypeError: Cannot read property 'ContractName' of undefined]

I am trying to get source of open source verified contracts and write into a file at my local folder. I could write only one file (of first address) but for the rest i am facing captioned error. ...
0
votes
1answer
37 views

Invalid Address format - Etherscan.io APIs problem

I have download list of verified open source contract addresses's list and loaded into addresses[]. Now I want to download sourcecode/ABIs etc... of that contracts. Although, i have called setTimeOut ...
1
vote
1answer
33 views

Could not find declaration module for file 'solc'

I was trying with a simple contract,when I do "node compile.js" in my windows cmd it throws an error.I was using vscode it showing error in const solc = require('solc'),I installed everything ...
1
vote
0answers
57 views

Error: Cross origin null forbidden : ---Problem in downloading Open source contracts from Etherscan.io

UPDATED: I am trying to download source code of open source verified contract from Etherscan.io. Here is my procedure as directed by Ann. 1. Download CSV file of captioned contracts. 2. Write ...
1
vote
0answers
25 views

How to check current status of state variables

I have deployed my contract locally into Ganache (GUI) and then send/call lot of transactions. After these transactions, now I want to check the current status of all state variables. Is there any way/...
0
votes
1answer
44 views

How to download contracts by address from Etherscan using web3.js

I want to download all contracts (open source code) from etherscan.io using Web3js. Etherscan gives only the list of such verified open source contract with txHash, name, and their addresses. Is there ...
0
votes
1answer
23 views

Storing code in contracts

I'm considering different designs to implement "configuration options" with Ethereum. The design should allow me to define arbitrary (= number and type) options, quick access to a list of options, ...
0
votes
1answer
24 views

Could not deploy contract with valid data

I have downloaded contracts with their abi and json. I have to deploy them. when i extract bytecode from downloaded files and then assign it to my data variable to deploy contract whic gives following ...
0
votes
1answer
21 views

How can fix in smart contract written in solidity?

TypeError: Invalid type for argument in function call. Invalid implicit conversion from address to address payable requested. selfdestruct(admin); pragma solidity >=0.4.21 <0.6.0; ...
0
votes
1answer
15 views

Could not deploy contract through sendTransaction

I am trying to deploy contract (available at Etherscan.io ). I proceed following steps: copy its contract creation code and save them in crCode variable. Then i tried to to run following code; async ...