diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-03-30 01:02:46 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-03-30 01:02:46 +0800 |
commit | 665011174bab7cfc6ec53e0044d60e1463222aee (patch) | |
tree | 44bc55bd390044d6cbfe8e0f7dddb621a8be7249 /packages/web3-wrapper | |
parent | d106079d9b69191d9cdc6d9323dbae3e4b45daf2 (diff) | |
parent | c4dd9658e791a9f821ea3b6eb4326bcba53b081a (diff) | |
download | dexon-sol-tools-665011174bab7cfc6ec53e0044d60e1463222aee.tar dexon-sol-tools-665011174bab7cfc6ec53e0044d60e1463222aee.tar.gz dexon-sol-tools-665011174bab7cfc6ec53e0044d60e1463222aee.tar.bz2 dexon-sol-tools-665011174bab7cfc6ec53e0044d60e1463222aee.tar.lz dexon-sol-tools-665011174bab7cfc6ec53e0044d60e1463222aee.tar.xz dexon-sol-tools-665011174bab7cfc6ec53e0044d60e1463222aee.tar.zst dexon-sol-tools-665011174bab7cfc6ec53e0044d60e1463222aee.zip |
Merge branch 'development' into feature/website/wallet-wrap
* development: (35 commits)
Fix CHANGELOG
Update Yarn.lock
Standardize changelog dates and format
Fix stubbing of a non-existent property
Remove redundant cast
Move common types out of web3 types
Add monorepo_scripts to npmignore
Add typeRoots
Add clean-state tests
Remove nested .gitignore files since `yarn publish` gets confused by them and ignores their contents on the top-level scope
Remove WETH hack now that updated WETH address is in TokenRegistry
Revert TokenRegistry address on Kovan
Improve rounding error message
Portal fill with mixed decimals
Add error popover if TokenRegistry on network user is browsing on don't include the requisite default tokens for 0x Portal to function
Set timeout for compiler tests
Remove redundant types
Add missing param comments
Fix a comment
Add a comment
...
Diffstat (limited to 'packages/web3-wrapper')
-rw-r--r-- | packages/web3-wrapper/.npmignore | 1 | ||||
-rw-r--r-- | packages/web3-wrapper/CHANGELOG.md | 8 | ||||
-rw-r--r-- | packages/web3-wrapper/README.md | 8 | ||||
-rw-r--r-- | packages/web3-wrapper/package.json | 5 | ||||
-rw-r--r-- | packages/web3-wrapper/src/index.ts | 36 | ||||
-rw-r--r-- | packages/web3-wrapper/tsconfig.json | 6 |
6 files changed, 36 insertions, 28 deletions
diff --git a/packages/web3-wrapper/.npmignore b/packages/web3-wrapper/.npmignore index ad5ffcd56..24e65ad5b 100644 --- a/packages/web3-wrapper/.npmignore +++ b/packages/web3-wrapper/.npmignore @@ -3,3 +3,4 @@ yarn-error.log /scripts/ /src/ tsconfig.json +/lib/monorepo_scripts/ diff --git a/packages/web3-wrapper/CHANGELOG.md b/packages/web3-wrapper/CHANGELOG.md index 9fbc9021c..d86a759a8 100644 --- a/packages/web3-wrapper/CHANGELOG.md +++ b/packages/web3-wrapper/CHANGELOG.md @@ -1,22 +1,22 @@ # CHANGELOG -## v0.4.0 _TBD_ +## v0.4.0 - _TBD_ * Rename `signTransactionAsync` to `signMessageAsync` for clarity (#465) -## v0.3.0 _March 18, 2018_ +## v0.3.0 - _March 18, 2018_ * Add `web3Wrapper.takeSnapshotAsync`, `web3Wrapper.revertSnapshotAsync`, `web3Wrapper.mineBlockAsync`, `web3Wrapper.increaseTimeAsync` (#426) * Add `web3Wrapper.isZeroExWeb3Wrapper` for runtime instanceOf checks (#426) * Add a `getProvider` method (#444) -## v0.2.0 _March 4, 2018_ +## v0.2.0 - _March 4, 2018_ * Ensure all returned user addresses are lowercase (#373) * Add `web3Wrapper.callAsync` (#413) * Make `web3Wrapper.estimateGas` accept whole `txData` instead of `data` (#413) * Remove `web3Wrapper.getContractInstance` (#413) -## v0.1.12 _February 9, 2018_ +## v0.1.12 - _February 9, 2018_ * Fix publishing issue where .npmignore was not properly excluding undesired content (#389) diff --git a/packages/web3-wrapper/README.md b/packages/web3-wrapper/README.md index 1fed11407..e7491acb0 100644 --- a/packages/web3-wrapper/README.md +++ b/packages/web3-wrapper/README.md @@ -12,10 +12,10 @@ yarn add @0xproject/web3-wrapper If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`: -``` -"include": [ - "./node_modules/web3-typescript-typings/index.d.ts", -] +```json +"compilerOptions": { + "typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"], +} ``` ## Contributing diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json index 176f796c8..fa79fa377 100644 --- a/packages/web3-wrapper/package.json +++ b/packages/web3-wrapper/package.json @@ -45,11 +45,10 @@ "dependencies": { "@0xproject/types": "^0.4.1", "@0xproject/utils": "^0.4.3", + "@0xproject/typescript-typings": "^0.0.1", "ethers-contracts": "^2.2.1", - "ethers-typescript-typings": "^0.0.4", "lodash": "^4.17.4", - "web3": "^0.20.0", - "web3-typescript-typings": "^0.10.2" + "web3": "^0.20.0" }, "publishConfig": { "access": "public" diff --git a/packages/web3-wrapper/src/index.ts b/packages/web3-wrapper/src/index.ts index 2ce2580ee..87c69b269 100644 --- a/packages/web3-wrapper/src/index.ts +++ b/packages/web3-wrapper/src/index.ts @@ -1,4 +1,16 @@ -import { RawLogEntry, TransactionReceipt, TxData } from '@0xproject/types'; +import { + BlockParam, + BlockWithoutTransactionData, + CallData, + ContractAbi, + FilterObject, + JSONRPCRequestPayload, + JSONRPCResponsePayload, + LogEntry, + RawLogEntry, + TransactionReceipt, + TxData, +} from '@0xproject/types'; import { BigNumber, promisify } from '@0xproject/utils'; import * as _ from 'lodash'; import * as Web3 from 'web3'; @@ -157,8 +169,8 @@ export class Web3Wrapper { * @param blockParam The block you wish to fetch (blockHash, blockNumber or blockLiteral) * @returns The requested block without transaction data */ - public async getBlockAsync(blockParam: string | Web3.BlockParam): Promise<Web3.BlockWithoutTransactionData> { - const block = await promisify<Web3.BlockWithoutTransactionData>(this._web3.eth.getBlock)(blockParam); + public async getBlockAsync(blockParam: string | BlockParam): Promise<BlockWithoutTransactionData> { + const block = await promisify<BlockWithoutTransactionData>(this._web3.eth.getBlock)(blockParam); return block; } /** @@ -166,7 +178,7 @@ export class Web3Wrapper { * @param blockParam The block you wish to fetch (blockHash, blockNumber or blockLiteral) * @returns The block's timestamp */ - public async getBlockTimestampAsync(blockParam: string | Web3.BlockParam): Promise<number> { + public async getBlockTimestampAsync(blockParam: string | BlockParam): Promise<number> { const { timestamp } = await this.getBlockAsync(blockParam); return timestamp; } @@ -214,7 +226,7 @@ export class Web3Wrapper { * @param filter Parameters by which to filter which logs to retrieve * @returns The corresponding log entries */ - public async getLogsAsync(filter: Web3.FilterObject): Promise<Web3.LogEntry[]> { + public async getLogsAsync(filter: FilterObject): Promise<LogEntry[]> { let fromBlock = filter.fromBlock; if (_.isNumber(fromBlock)) { fromBlock = this._web3.toHex(fromBlock); @@ -243,7 +255,7 @@ export class Web3Wrapper { * @param abi Smart contract ABI * @returns Web3 contract factory which can create Web3 Contract instances from the supplied ABI */ - public getContractFromAbi(abi: Web3.ContractAbi): Web3.Contract<any> { + public getContractFromAbi(abi: ContractAbi): Web3.Contract<any> { const web3Contract = this._web3.eth.contract(abi); return web3Contract; } @@ -252,7 +264,7 @@ export class Web3Wrapper { * @param txData Transaction data * @returns Estimated gas cost */ - public async estimateGasAsync(txData: Partial<Web3.TxData>): Promise<number> { + public async estimateGasAsync(txData: Partial<TxData>): Promise<number> { const gas = await promisify<number>(this._web3.eth.estimateGas)(txData); return gas; } @@ -262,7 +274,7 @@ export class Web3Wrapper { * @param defaultBlock Block height at which to make the call. Defaults to `latest` * @returns The raw call result */ - public async callAsync(callData: Web3.CallData, defaultBlock?: Web3.BlockParam): Promise<string> { + public async callAsync(callData: CallData, defaultBlock?: BlockParam): Promise<string> { const rawCallResult = await promisify<string>(this._web3.eth.call)(callData, defaultBlock); return rawCallResult; } @@ -271,13 +283,13 @@ export class Web3Wrapper { * @param txData Transaction data * @returns Transaction hash */ - public async sendTransactionAsync(txData: Web3.TxData): Promise<string> { + public async sendTransactionAsync(txData: TxData): Promise<string> { const txHash = await promisify<string>(this._web3.eth.sendTransaction)(txData); return txHash; } - private async _sendRawPayloadAsync<A>(payload: Partial<Web3.JSONRPCRequestPayload>): Promise<A> { + private async _sendRawPayloadAsync<A>(payload: Partial<JSONRPCRequestPayload>): Promise<A> { const sendAsync = this._web3.currentProvider.sendAsync.bind(this._web3.currentProvider); - const response = await promisify<Web3.JSONRPCResponsePayload>(sendAsync)(payload); + const response = await promisify<JSONRPCResponsePayload>(sendAsync)(payload); const result = response.result; return result; } @@ -295,7 +307,7 @@ export class Web3Wrapper { return status; } } - private _formatLog(rawLog: RawLogEntry): Web3.LogEntry { + private _formatLog(rawLog: RawLogEntry): LogEntry { const formattedLog = { ...rawLog, logIndex: this._hexToDecimal(rawLog.logIndex), diff --git a/packages/web3-wrapper/tsconfig.json b/packages/web3-wrapper/tsconfig.json index 7bae7f9f0..c56d255d5 100644 --- a/packages/web3-wrapper/tsconfig.json +++ b/packages/web3-wrapper/tsconfig.json @@ -3,9 +3,5 @@ "compilerOptions": { "outDir": "lib" }, - "include": [ - "./src/**/*", - "../../node_modules/ethers-typescript-typings/index.d.ts", - "../../node_modules/web3-typescript-typings/index.d.ts" - ] + "include": ["./src/**/*"] } |