-
Notifications
You must be signed in to change notification settings - Fork 771
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/contracts #45
Conversation
ac43765
to
3468cf1
Compare
Codecov Report
@@ Coverage Diff @@
## develop #45 +/- ##
==========================================
- Coverage 4% 3.74% -0.26%
==========================================
Files 377 422 +45
Lines 1625 1734 +109
Branches 107 104 -3
==========================================
Hits 65 65
- Misses 1551 1660 +109
Partials 9 9
Continue to review full report at Codecov.
|
} | ||
|
||
const tx = new EthTx(this.raw) | ||
tx.sign(this.$store.state.wallet.getPrivateKey()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you have to use web3.eth.sendTransaction
which will sign and send, is this a temp workaround?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried using that and the send contract method but I'm getting Error: Returned error: {eth_sendTransaction} Method not found or unavailable
. I also found this: web3/web3.js#1637
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SteveMieskoski can you look into this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is happening because sendTransaction
is directly hitting the node, Steve gotta fix it :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I'll wait on @SteveMieskoski on this one then.
also if |
also now both result field and "result" field is shown, no need to display the "result" field |
return res | ||
}) | ||
.catch(err => console.log(err)) | ||
this.data = contract.methods[this.selectedMethod.name](...params).encodeABI() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use
contract.methods[this.selectedMethod.name](...params).send({ from: this.$store.state.wallet.getAddressString() gasPrice:'0x...', gas: '0x...', value:'0x00'})
no need to create the tx manually
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same error as mentioned above.
this.loading = true | ||
if (this.selectedMethod.constant === true) { | ||
contract.methods[this.selectedMethod.name](...params) | ||
.call({ from: this.$store.state.wallet.getAddressString() }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to answer your question
var MyContract = new web3.eth.contract(abi, address);
MyContract.methods.myFunction().call()
.then(console.log);
> Result {
myNumber: '23456',
myString: 'Hello!%',
0: '23456', // these are here as fallbacks if the name is not know or given
1: 'Hello!%'
}
if it is a single output, then call
will just return that, but if it is multiple outputs itll return both an object or an array
The return value(s) of the smart contract method. If it returns a single value, it’s returned as is. If it has multiple return values they are returned as an object with properties and indices:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just end up looping through the object keys and using that to render the results instead.
c9a705c
to
d3c302c
Compare
Feature