Skip to content
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

Closed
wants to merge 29 commits into from
Closed

Feature/contracts #45

wants to merge 29 commits into from

Conversation

gamalielhere
Copy link
Contributor

@gamalielhere gamalielhere commented Aug 9, 2018

Feature

  • Updated CHANGELOG.md
  • Add PR label

@codecov
Copy link

codecov bot commented Aug 9, 2018

Codecov Report

Merging #45 into develop will decrease coverage by 0.25%.
The diff coverage is 0%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
src/configs/networks/nodes/etsc.js 0% <0%> (ø)
src/configs/networks/nodes/tomo.js 0% <0%> (ø)
src/configs/networks/nodes/etho.js 0% <0%> (ø)
src/layouts/InterfaceLayout/InterfaceLayout.vue 0% <0%> (ø) ⬆️
src/configs/networks/nodes/music.js 0% <0%> (ø)
src/configs/networks/types/GO.js 0% <0%> (ø)
src/configs/networks/types/ETHO.js 0% <0%> (ø)
src/configs/networks/types/KOV.js 0% <0%> (ø)
src/configs/networks/nodes/go.js 0% <0%> (ø)
...ts/InterfaceNetworkModal/InterfaceNetworkModal.vue 0% <0%> (ø) ⬆️
... and 87 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ec060ea...d3c302c. Read the comment docs.

@SteveMieskoski SteveMieskoski added this to In progress in Development via automation Aug 9, 2018
@gamalielhere gamalielhere added Feature Feature tasks Ready Tag for when a PR is ready to merge labels Aug 14, 2018
@gamalielhere gamalielhere moved this from In progress to Needs review / Reviewer approved in Development Aug 14, 2018
}

const tx = new EthTx(this.raw)
tx.sign(this.$store.state.wallet.getPrivateKey())
Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

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?

Copy link
Contributor

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 :)

Copy link
Contributor Author

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.

@kvhnuke
Copy link
Contributor

kvhnuke commented Aug 15, 2018

also if method.constant === true && method.inputs.length === 0 then you should read automatically without user needing to click read button

@kvhnuke
Copy link
Contributor

kvhnuke commented Aug 15, 2018

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()
Copy link
Contributor

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

Copy link
Contributor Author

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() })
Copy link
Contributor

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:

Copy link
Contributor Author

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.

@gamalielhere gamalielhere mentioned this pull request Aug 17, 2018
1 task
Development automation moved this from Needs review / Reviewer approved to Done Aug 17, 2018
@gamalielhere gamalielhere deleted the feature/contracts branch August 17, 2018 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Feature tasks Ready Tag for when a PR is ready to merge
Projects
No open projects
Development
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants