Skip to content
This repository has been archived by the owner on Dec 14, 2021. It is now read-only.

Create nodejs.yml #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

ericramos1980
Copy link

@ericramos1980 ericramos1980 commented Jan 28, 2020

const Eth = require('ethjs');
const eth = new Eth(new Eth.HttpProvider('https://ropsten.infura.io'));

eth.getBlockByNumber(45300, true, (err, block) => {
// result null { ...block data... }
});

const etherValue = Eth.toWei(72, 'ether');

// result <BN: 3e733628714200000>

const tokenABI = [{
"constant": true,
"inputs": [],
"name": "totalSupply",
"outputs":[{"name": "","type": "uint256"}],
"payable": false,
"type": "function",
}];

const token = eth.contract(tokenABI).at('0x6e0E0e02377Bc1d90E8a7c21f12BA385C2C35f78');

token.totalSupply().then((totalSupply) => {
// result <BN ...> 4500000
});

// token.transfer( ... ).then(txHash => eth.getTransactionSuccess(txHash)).then(receipt => console.log(receipt));

ethjs

Thank you for contributing! Please take a moment to review our contributing guidelines
to make the process easy and effective for everyone involved.

Please open an issue before embarking on any significant pull request, especially those that
add a new library or change existing tests, otherwise you risk spending a lot of time working
on something that might not end up being merged into the project.

Before opening a pull request, please ensure:

  • You have followed our contributing guidelines
  • Pull request has tests (we are going for 100% coverage!)
  • Code is well-commented, linted and follows project conventions
  • Documentation is updated (if necessary)
  • Internal code generators and templates are updated (if necessary)
  • Description explains the issue/use-case resolved and auto-closes related issues

Be kind to code reviewers, please try to keep pull requests as small and focused as possible :)

IMPORTANT: By submitting a patch, you agree to allow the project
owners to license your work under the terms of the MIT License.

const Eth = require('ethjs');
const eth = new Eth(new Eth.HttpProvider('https://ropsten.infura.io'));

eth.getBlockByNumber(45300, true, (err, block) => {
  // result null { ...block data... }
});

const etherValue = Eth.toWei(72, 'ether');

// result <BN: 3e733628714200000>

const tokenABI = [{
  "constant": true,
  "inputs": [],
  "name": "totalSupply",
  "outputs":[{"name": "","type": "uint256"}],
  "payable": false,
  "type": "function",
}];

const token = eth.contract(tokenABI).at('0x6e0E0e02377Bc1d90E8a7c21f12BA385C2C35f78');

token.totalSupply().then((totalSupply) => {
  // result <BN ...>  4500000
});

// token.transfer( ... ).then(txHash => eth.getTransactionSuccess(txHash)).then(receipt => console.log(receipt));
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 1d37ccf on ericramos1980:master into 68229b9 on ethjs:master.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants