Address feedback

This commit is contained in:
Leonid Logvinov
2017-12-07 01:15:15 +03:00
parent f1b267cc9f
commit 825402b0f9
5 changed files with 4 additions and 12 deletions

View File

@@ -1,4 +1,3 @@
import {TxData} from '@0xproject/types';
import {BigNumber} from 'bignumber.js'; import {BigNumber} from 'bignumber.js';
import * as _ from 'lodash'; import * as _ from 'lodash';
import * as path from 'path'; import * as path from 'path';

View File

@@ -1,5 +1,4 @@
import {promisify} from '@0xproject/utils'; import {promisify} from '@0xproject/utils';
import {Web3Wrapper} from '@0xproject/web3-wrapper';
import * as _ from 'lodash'; import * as _ from 'lodash';
import * as Web3 from 'web3'; import * as Web3 from 'web3';

View File

@@ -1,10 +1,10 @@
Web3 wrapper 0x types
------ ------
Wrapped version of web3 with nicer interface to be used across 0x projects and packages TS types shared across 0x projects and packages
## Install ## Install
```bash ```bash
yarn add @0xproject/web3-wrapper yarn add -D @0xproject/types
``` ```

View File

@@ -20,6 +20,7 @@
"homepage": "https://github.com/0xProject/0x.js/packages/web3-wrapper/README.md", "homepage": "https://github.com/0xProject/0x.js/packages/web3-wrapper/README.md",
"devDependencies": { "devDependencies": {
"@0xproject/tslint-config": "^0.2.0", "@0xproject/tslint-config": "^0.2.0",
"@0xproject/types": "^0.0.1",
"@types/lodash": "^4.14.86", "@types/lodash": "^4.14.86",
"npm-run-all": "^4.1.2", "npm-run-all": "^4.1.2",
"shx": "^0.2.2", "shx": "^0.2.2",
@@ -29,7 +30,6 @@
}, },
"dependencies": { "dependencies": {
"@0xproject/utils": "^0.0.1", "@0xproject/utils": "^0.0.1",
"@0xproject/types": "^0.0.1",
"bignumber.js": "~4.1.0", "bignumber.js": "~4.1.0",
"lodash": "^4.17.4", "lodash": "^4.17.4",
"web3": "^0.20.0" "web3": "^0.20.0"

View File

@@ -74,12 +74,6 @@ export class Web3Wrapper {
balanceInWei = new BigNumber(balanceInWei); balanceInWei = new BigNumber(balanceInWei);
return balanceInWei; return balanceInWei;
} }
public async getBalanceInEthAsync(owner: string): Promise<BigNumber> {
const balanceInWei = await this.getBalanceInWeiAsync(owner);
const balanceEthOldBigNumber = this.web3.fromWei(balanceInWei, 'ether');
const balanceEth = new BigNumber(balanceEthOldBigNumber);
return balanceEth;
}
public async doesContractExistAtAddressAsync(address: string): Promise<boolean> { public async doesContractExistAtAddressAsync(address: string): Promise<boolean> {
const code = await promisify<string>(this.web3.eth.getCode)(address); const code = await promisify<string>(this.web3.eth.getCode)(address);
// Regex matches 0x0, 0x00, 0x in order to accommodate poorly implemented clients // Regex matches 0x0, 0x00, 0x in order to accommodate poorly implemented clients