aboutsummaryrefslogtreecommitdiffstats
path: root/packages/web3-wrapper
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-01-09 10:02:41 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-01-09 10:02:41 +0800
commit8019b1b8231cac24dfc6aa3bb2d5115eff11ee89 (patch)
treed270d71404bd3aab44c79dcadf16e348614e9214 /packages/web3-wrapper
parent8fe81c9d090ce50496f3150602f19433e7aedd1e (diff)
parent7a56e83fa3ca02d796deba3359da480834a9f6ea (diff)
downloaddexon-sol-tools-8019b1b8231cac24dfc6aa3bb2d5115eff11ee89.tar
dexon-sol-tools-8019b1b8231cac24dfc6aa3bb2d5115eff11ee89.tar.gz
dexon-sol-tools-8019b1b8231cac24dfc6aa3bb2d5115eff11ee89.tar.bz2
dexon-sol-tools-8019b1b8231cac24dfc6aa3bb2d5115eff11ee89.tar.lz
dexon-sol-tools-8019b1b8231cac24dfc6aa3bb2d5115eff11ee89.tar.xz
dexon-sol-tools-8019b1b8231cac24dfc6aa3bb2d5115eff11ee89.tar.zst
dexon-sol-tools-8019b1b8231cac24dfc6aa3bb2d5115eff11ee89.zip
Merge branch 'development' into refactor/httpClientJsonParsing
* development: (21 commits) Update connect CHANGELOG Changes to abi-gen after code review Added constructor ABIs to abi-gen Describe #295 in a CHANGELOG Add #302 description to changelog Fix formatting Apply prettier config Install prettier Remove formatting esilnt rules sendTransactionAsync should return txHash string Added Event generation to abi-gen Publish Add dates to CHANGELOG entries Update subproviders CHANGELOG Support both personal_sign and eth_sign Fix Ledger tests given change from `personal_sign` to `eth_sign` Update subprovider to catch correct RPC method Rename guide Update contribution guide Fix broken links in the abi-gen README ...
Diffstat (limited to 'packages/web3-wrapper')
-rw-r--r--packages/web3-wrapper/package.json8
-rw-r--r--packages/web3-wrapper/src/index.ts29
2 files changed, 17 insertions, 20 deletions
diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json
index 2df0c08f4..6cc642c9d 100644
--- a/packages/web3-wrapper/package.json
+++ b/packages/web3-wrapper/package.json
@@ -1,6 +1,6 @@
{
"name": "@0xproject/web3-wrapper",
- "version": "0.1.1",
+ "version": "0.1.2",
"description": "Wraps around web3 and gives a nicer interface",
"main": "lib/index.js",
"types": "lib/index.d.ts",
@@ -19,8 +19,8 @@
},
"homepage": "https://github.com/0xProject/0x.js/packages/web3-wrapper/README.md",
"devDependencies": {
- "@0xproject/tslint-config": "^0.3.0",
- "@0xproject/types": "^0.1.1",
+ "@0xproject/tslint-config": "^0.4.0",
+ "@0xproject/types": "^0.1.2",
"@types/lodash": "^4.14.86",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
@@ -29,7 +29,7 @@
"web3-typescript-typings": "^0.7.2"
},
"dependencies": {
- "@0xproject/utils": "^0.1.1",
+ "@0xproject/utils": "^0.1.2",
"bignumber.js": "~4.1.0",
"lodash": "^4.17.4",
"web3": "^0.20.0"
diff --git a/packages/web3-wrapper/src/index.ts b/packages/web3-wrapper/src/index.ts
index b48532204..b7dd042f2 100644
--- a/packages/web3-wrapper/src/index.ts
+++ b/packages/web3-wrapper/src/index.ts
@@ -1,18 +1,15 @@
-import {TransactionReceipt, TxData} from '@0xproject/types';
-import {
- bigNumberConfigs,
- promisify,
-} from '@0xproject/utils';
+import { TransactionReceipt, TxData } from '@0xproject/types';
+import { bigNumberConfigs, promisify } from '@0xproject/utils';
import BigNumber from 'bignumber.js';
import * as _ from 'lodash';
import * as Web3 from 'web3';
interface RawLogEntry {
- logIndex: string|null;
- transactionIndex: string|null;
+ logIndex: string | null;
+ transactionIndex: string | null;
transactionHash: string;
- blockHash: string|null;
- blockNumber: string|null;
+ blockHash: string | null;
+ blockNumber: string | null;
address: string;
data: string;
topics: string[];
@@ -93,12 +90,12 @@ export class Web3Wrapper {
const blockNumber = await promisify<number>(this._web3.eth.getBlockNumber)();
return blockNumber;
}
- public async getBlockAsync(blockParam: string|Web3.BlockParam): Promise<Web3.BlockWithoutTransactionData> {
+ public async getBlockAsync(blockParam: string | Web3.BlockParam): Promise<Web3.BlockWithoutTransactionData> {
const block = await promisify<Web3.BlockWithoutTransactionData>(this._web3.eth.getBlock)(blockParam);
return block;
}
- public async getBlockTimestampAsync(blockParam: string|Web3.BlockParam): Promise<number> {
- const {timestamp} = await this.getBlockAsync(blockParam);
+ public async getBlockTimestampAsync(blockParam: string | Web3.BlockParam): Promise<number> {
+ const { timestamp } = await this.getBlockAsync(blockParam);
return timestamp;
}
public async getAvailableAddressesAsync(): Promise<string[]> {
@@ -138,7 +135,7 @@ export class Web3Wrapper {
return web3ContractInstance;
}
public async estimateGasAsync(data: string): Promise<number> {
- const gas = await promisify<number>(this._web3.eth.estimateGas)({data});
+ const gas = await promisify<number>(this._web3.eth.estimateGas)({ data });
return gas;
}
private async _sendRawPayloadAsync<A>(payload: Web3.JSONRPCRequestPayload): Promise<A> {
@@ -147,14 +144,14 @@ export class Web3Wrapper {
const result = response.result;
return result;
}
- private _normalizeTxReceiptStatus(status: undefined|null|string|0|1): null|0|1 {
+ private _normalizeTxReceiptStatus(status: undefined | null | string | 0 | 1): null | 0 | 1 {
// Transaction status might have four values
// undefined - Testrpc and other old clients
// null - New clients on old transactions
// number - Parity
// hex - Geth
if (_.isString(status)) {
- return this._web3.toDecimal(status) as 0|1;
+ return this._web3.toDecimal(status) as 0 | 1;
} else if (_.isUndefined(status)) {
return null;
} else {
@@ -170,7 +167,7 @@ export class Web3Wrapper {
};
return formattedLog;
}
- private _hexToDecimal(hex: string|null): number|null {
+ private _hexToDecimal(hex: string | null): number | null {
if (_.isNull(hex)) {
return null;
}