All Questions
Tagged with javascript contract-invocation
33 questions
0
votes
1
answer
161
views
Invalid opcode OR Cannot read properties of undefined (reading 'length') (depending on the situation)
I'm working on a bot that loads in a bunch of values from an array and uses an event handler to take action upon an event. This was originally built as a bot to monitor a swap on two exchanges for a ...
0
votes
0
answers
74
views
Calling ethers.Contract crashes NodeJS
On arbitrum network...
const prABI = require('./gmx-interface-master/src/abis/PositionRouter.json');
const PositionRouter = await new ethers.Contract("0xb87a436B93fFE9D75c5cFA7bAcFff96430b09868&...
1
vote
2
answers
946
views
Calling a state-changing function with ethers.js does not go through (no error message, not asking for approval)
I have a contract function that I cannot call from the front-end using ethers.js for some reason. I cannot even debug this call because it doesnt produce any errors. I tried to break the call by ...
0
votes
1
answer
198
views
Why I do not get returned value of function of my smart contract using testRPC and a Graphical User Interface?
I have a smart contract that is tested with remix and it works well. Its code is as follows :
contract Weechain:
pragma solidity ^0.4.15;
// --------------------------------------------------------...
13
votes
7
answers
30k
views
How to get value of a contract public property using web3.eth
using web3 javascript library how do you get the current value of a public property. e.g.
contract MyContract {
address public owner;
...
}
Here's a snippet of the abi:
[{
"constant": ...
1
vote
1
answer
171
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
1
answer
141
views
A common error at time of using web3 options
When i use some web3 options as follows, I receive a common error i.e.
TypeError: web3.[option] is not a function
For example :
TypeError: web3.toAscii is not a function
web3.toAscii(...
0
votes
1
answer
64
views
State Variable of solidity Contract could not be updated through JavaScript
I have following contract and just want to update its state variable values i.e. totalSupply. But when I try to attempt this task through JavaScript code (given below) by calling its function i.e. ...
0
votes
3
answers
66
views
Could not assign contract state variable value to javascript variable
I want to retrieve and assign the value of my contract state variable to my javascript variable.I am doing as per guidlines provided on this community, but failed to assigned. my javascript code is ...
5
votes
0
answers
4k
views
Contract call: data out of bounds
I'm working on a nextjs/react project in which i want to fetch the health factor of an address on AAVE. This can be done by calling getUserAcountData(address) on the lending pool contract. I can ...
1
vote
2
answers
397
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 ...
5
votes
2
answers
3k
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) ...
2
votes
2
answers
806
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;
...
2
votes
1
answer
92
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....
1
vote
0
answers
139
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
0
answers
42
views
Dataset of simple contracts with getter setters
Are there any repositories/datasets which provide smart contract with simple logic like having some getters and setter functions. So, that I could give some values to getter and setter functions, ...
0
votes
1
answer
977
views
Calling contract functions using only ABI without source code
I have MyContract.json file of some contract(assume i haven't its source code). In .json file, there is abi and bytecode. If i want to deploy such contract (through web3js), I am facing following ...
0
votes
1
answer
296
views
How to call external payable contract function from app.js (DApp)?
The contract has a function:
function purchaseTokens() external payable {
require(msg.value>0);
...etceteras...
}
What I need is an app.js part, something that would look like this (lets ...
0
votes
1
answer
430
views
How to know the execution time of transaction when miner execute it
When i send three consecutive transactions to my contract (deployed on ethereum testnet), how can i know the exact time (at milli/micro/nano level) which transaction executed (on miner side) first and ...
0
votes
0
answers
415
views
Trying to call a method in a contract, invalid address error/Type Error
Hi I have a deployed contract
pragma solidity ^0.4.0;
contract adderr {
int total;
function adder() public {
total = 0;
}
function getTotal() constant returns (int){
...
0
votes
1
answer
1k
views
Calling a "view" function using web3js
--- HEAVILY EDITED ---
Solidity contract:
pragma solidity ^0.4.24;
contract PatientRecords {
struct Patient {
string ID;
string weight;
string height;
string diseasehistory;
...
1
vote
1
answer
46
views
Doubt in javascript function execution
hi guys I have this contract function:
function teste(uint _oX) public returns (uint value) {
return 34;
}
And I try to call in JS this way :
MyContract.teste(1).then(value => console.log(...
0
votes
1
answer
469
views
Adding quotation marks to string before calling a function [closed]
Alright, so I'm not sure if I should be asking this here or HTML/JavaScript forums, so please do let me know if I am in the wrong place. I believe it belongs here as you all understand dApps and ...
1
vote
0
answers
91
views
encodeABI() throws Uncaught (in promise) Error
I am trying to use encodeABI() on one of my contract methods like this:
signTx = async () => {
...
const response = await contract.methods.recoverAddr(fixed_msg_sha,
v_decimal, r, s)....
1
vote
1
answer
69
views
How can I call a function in a smart contract that is inherited from another
Hi I am trying to call the function transfer , however in remix it says that I can only call the transferOwnership method, here is my solidity contract
pragma solidity ^0.4.18;
contract Ownable {
...
0
votes
0
answers
188
views
Problem of interacting with Smart Contract via HTML and JavaScript application
I followed and tested "Creating a Web UI for our Smart Contract" tutorial and it works well.
However, when I do exactly what I did in the above tutorial for THIS SMART CONTRACT, I do not see the ...
1
vote
0
answers
310
views
(browserify) Error : Cannot find module 'web3/lib/solidity/coder.js'
When I use command browserify viz.js -o main.js to build this project, I receive following error message :
C:\Users\KX5710\Downloads\GUI_solarchain\solarchain-dashboard-master>browserify
viz.js -o ...
4
votes
1
answer
3k
views
How to send ether to an account instead of creating a smart contract using ethers.js
I would like to send some ether to an account in ropsten testnet. I'm using the following code and the library https://docs.ethers.io/ethers.js/html/. However, instead of sending the ether to the to ...
2
votes
1
answer
1k
views
Truffle exec failure
I'm trying to run an external script in truffle. Basically I deploy the contracts with 'migrate' then want to run this script to set the variables. I just can't seem to get it to call correctly with:...
3
votes
1
answer
3k
views
Uncaught Type Error when calling a contract function using the web3 JavaScript API?
I wrote a contract to enable registration of a name. As an example, one of the functions takes in a name as a string, then outputs information on the registration of the name (name, registrant, last ...
2
votes
1
answer
750
views
How do I find a list of the Golem Network Token (GNT) TokenTrader contracts?
The Golem Network Token (GNT) TokenTrader contracts enables the trustless and decentralised sale of GNTs for ethers (ETH).
A seller deploys one of these TokenTrader contracts using the ...
4
votes
2
answers
2k
views
Solidity return string not hex?
Currently I'm using ether.camp to create a contract. At this stage it simply gets and stores some values. However when I try and get the values they are in bytes/hex even though the return type is ...
2
votes
0
answers
26
views
Recovering Contract Address varies every time [duplicate]
I have a contract datafactorycontract that calls another contract dataproducercontract. For that, in datafactorycontract I have a mapping that stores the address of the dataproducercontract being its ...