diff options
Diffstat (limited to 'packages/web3-wrapper')
-rw-r--r-- | packages/web3-wrapper/CHANGELOG.json | 14 | ||||
-rw-r--r-- | packages/web3-wrapper/CHANGELOG.md | 13 | ||||
-rw-r--r-- | packages/web3-wrapper/README.md | 10 | ||||
-rw-r--r-- | packages/web3-wrapper/package.json | 21 | ||||
-rw-r--r-- | packages/web3-wrapper/src/index.ts | 2 | ||||
-rw-r--r-- | packages/web3-wrapper/src/marshaller.ts | 2 | ||||
-rw-r--r-- | packages/web3-wrapper/src/utils.ts | 2 | ||||
-rw-r--r-- | packages/web3-wrapper/src/web3_wrapper.ts | 22 | ||||
-rw-r--r-- | packages/web3-wrapper/tslint.json | 2 |
9 files changed, 56 insertions, 32 deletions
diff --git a/packages/web3-wrapper/CHANGELOG.json b/packages/web3-wrapper/CHANGELOG.json index be5c1fef6..7b21da73a 100644 --- a/packages/web3-wrapper/CHANGELOG.json +++ b/packages/web3-wrapper/CHANGELOG.json @@ -1,5 +1,16 @@ [ { + "version": "3.1.1", + "changes": [ + { + "note": + "Fix bug in `getTransactionByHashAsync` which was causing the return value to have the wrong type (raw fields instead of unmarshalled fields).", + "pr": 1177 + } + ], + "timestamp": 1541740904 + }, + { "version": "3.1.0", "changes": [ { @@ -11,7 +22,8 @@ "Web3Wrapper now throws when an RPC request contains an error field in the response. Previously errors could be swallowed and undefined returned.", "pr": 1102 } - ] + ], + "timestamp": 1539871071 }, { "version": "3.0.3", diff --git a/packages/web3-wrapper/CHANGELOG.md b/packages/web3-wrapper/CHANGELOG.md index 8f1dc0f3f..ebbef2c48 100644 --- a/packages/web3-wrapper/CHANGELOG.md +++ b/packages/web3-wrapper/CHANGELOG.md @@ -5,6 +5,15 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v3.1.1 - _November 9, 2018_ + + * Fix bug in `getTransactionByHashAsync` which was causing the return value to have the wrong type (raw fields instead of unmarshalled fields). (#1177) + +## v3.1.0 - _October 18, 2018_ + + * Add `signTypedData` to perform EIP712 `eth_signTypedData`. (#1102) + * Web3Wrapper now throws when an RPC request contains an error field in the response. Previously errors could be swallowed and undefined returned. (#1102) + ## v3.0.3 - _October 4, 2018_ * Dependencies updated @@ -40,7 +49,7 @@ CHANGELOG * Stop exporting types: `CallTxDataBaseRPC` and `AbstractBlockRPC` (#924) * Export `AbiDecoder` class (#924) -## v1.2.0 - _August 13, 2018_ +## v1.2.0 - _August 14, 2018_ * Export marshaller to convert between RPC and user-space data formats (#938) * Export RPC types (#938) @@ -80,7 +89,7 @@ CHANGELOG * Dependencies updated -## v0.7.0 - _June 3, 2018_ +## v0.7.0 - _June 4, 2018_ * Add `web3Wrapper.getContractCodeAsync` (#675) * Add `web3Wrapper.getTransactionTraceAsync` (#675) diff --git a/packages/web3-wrapper/README.md b/packages/web3-wrapper/README.md index 06c788101..4402de19c 100644 --- a/packages/web3-wrapper/README.md +++ b/packages/web3-wrapper/README.md @@ -1,4 +1,4 @@ -## @0xproject/web3-wrapper +## @0x/web3-wrapper Web3-wrapper is a JSON-RPC client for Ethereum nodes. It is a type-safe alternative to [Web3.js](https://github.com/ethereum/web3.js/) written in TypeScript. @@ -7,14 +7,14 @@ Web3-wrapper is a JSON-RPC client for Ethereum nodes. It is a type-safe alternat ## Installation ```bash -yarn add @0xproject/web3-wrapper +yarn add @0x/web3-wrapper ``` If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`: ```json "compilerOptions": { - "typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"], + "typeRoots": ["node_modules/@0x/typescript-typings/types", "node_modules/@types"], } ``` @@ -43,13 +43,13 @@ yarn install To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory: ```bash -PKG=@0xproject/web3-wrapper yarn build +PKG=@0x/web3-wrapper yarn build ``` Or continuously rebuild on change: ```bash -PKG=@0xproject/web3-wrapper yarn watch +PKG=@0x/web3-wrapper yarn watch ``` ### Clean diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json index a3f82c87e..2b87cc92a 100644 --- a/packages/web3-wrapper/package.json +++ b/packages/web3-wrapper/package.json @@ -1,6 +1,6 @@ { - "name": "@0xproject/web3-wrapper", - "version": "3.0.3", + "name": "@0x/web3-wrapper", + "version": "3.1.1", "engines": { "node": ">=6.12" }, @@ -11,7 +11,7 @@ "build": "tsc -b", "build:ci": "yarn build", "clean": "shx rm -rf lib generated_docs", - "lint": "tslint --project .", + "lint": "tslint --format stylish --project .", "test": "yarn run_mocha", "rebuild_and_test": "run-s clean build test", "test:circleci": "yarn test:coverage", @@ -35,13 +35,12 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/web3-wrapper/README.md", "devDependencies": { - "@0xproject/tslint-config": "^1.0.8", + "@0x/tslint-config": "^1.0.10", "@types/ganache-core": "^2.1.0", "@types/lodash": "4.14.104", "chai": "^4.0.1", "chai-as-promised": "^7.1.0", "chai-bignumber": "^2.0.1", - "copyfiles": "^2.0.0", "dirty-chai": "^2.0.1", "ganache-core": "0xProject/ganache-core#monorepo-dep", "make-promises-safe": "^1.1.0", @@ -50,15 +49,15 @@ "nyc": "^11.0.1", "shx": "^0.2.2", "tslint": "5.11.0", - "typedoc": "0.12.0", + "typedoc": "0.13.0", "typescript": "3.0.1" }, "dependencies": { - "@0xproject/assert": "^1.0.13", - "@0xproject/json-schemas": "^1.0.7", - "@0xproject/typescript-typings": "^3.0.2", - "@0xproject/utils": "^2.0.2", - "ethereum-types": "^1.0.11", + "@0x/assert": "^1.0.15", + "@0x/json-schemas": "^2.0.1", + "@0x/typescript-typings": "^3.0.4", + "@0x/utils": "^2.0.4", + "ethereum-types": "^1.1.2", "ethereumjs-util": "^5.1.1", "ethers": "~4.0.4", "lodash": "^4.17.5" diff --git a/packages/web3-wrapper/src/index.ts b/packages/web3-wrapper/src/index.ts index 9bef06fd4..679563a2b 100644 --- a/packages/web3-wrapper/src/index.ts +++ b/packages/web3-wrapper/src/index.ts @@ -1,7 +1,7 @@ export { Web3Wrapper } from './web3_wrapper'; export { marshaller } from './marshaller'; -export { AbiDecoder } from '@0xproject/utils'; +export { AbiDecoder } from '@0x/utils'; export { BlockParam, diff --git a/packages/web3-wrapper/src/marshaller.ts b/packages/web3-wrapper/src/marshaller.ts index 572a322d6..299c6a64c 100644 --- a/packages/web3-wrapper/src/marshaller.ts +++ b/packages/web3-wrapper/src/marshaller.ts @@ -1,4 +1,4 @@ -import { addressUtils } from '@0xproject/utils'; +import { addressUtils } from '@0x/utils'; import { BlockParam, BlockParamLiteral, diff --git a/packages/web3-wrapper/src/utils.ts b/packages/web3-wrapper/src/utils.ts index 0b568aac5..c68587632 100644 --- a/packages/web3-wrapper/src/utils.ts +++ b/packages/web3-wrapper/src/utils.ts @@ -1,4 +1,4 @@ -import { BigNumber } from '@0xproject/utils'; +import { BigNumber } from '@0x/utils'; import * as _ from 'lodash'; export const utils = { diff --git a/packages/web3-wrapper/src/web3_wrapper.ts b/packages/web3-wrapper/src/web3_wrapper.ts index 726246f1a..23204e616 100644 --- a/packages/web3-wrapper/src/web3_wrapper.ts +++ b/packages/web3-wrapper/src/web3_wrapper.ts @@ -1,6 +1,6 @@ -import { assert } from '@0xproject/assert'; -import { schemas } from '@0xproject/json-schemas'; -import { AbiDecoder, addressUtils, BigNumber, intervalUtils, promisify } from '@0xproject/utils'; +import { assert } from '@0x/assert'; +import { schemas } from '@0x/json-schemas'; +import { AbiDecoder, addressUtils, BigNumber, intervalUtils, promisify } from '@0x/utils'; import { BlockParam, BlockParamLiteral, @@ -23,7 +23,13 @@ import { import * as _ from 'lodash'; import { marshaller } from './marshaller'; -import { BlockWithoutTransactionDataRPC, BlockWithTransactionDataRPC, NodeType, Web3WrapperErrors } from './types'; +import { + BlockWithoutTransactionDataRPC, + BlockWithTransactionDataRPC, + NodeType, + TransactionRPC, + Web3WrapperErrors, +} from './types'; import { utils } from './utils'; const BASE_TEN = 10; @@ -145,7 +151,7 @@ export class Web3Wrapper { if (_.isUndefined((provider as any).sendAsync)) { // Web3@1.0 provider doesn't support synchronous http requests, // so it only has an async `send` method, instead of a `send` and `sendAsync` in web3@0.x.x` - // We re-assign the send method so that Web3@1.0 providers work with @0xproject/web3-wrapper + // We re-assign the send method so that Web3@1.0 providers work with @0x/web3-wrapper (provider as any).sendAsync = (provider as any).send; } this.abiDecoder = new AbiDecoder([]); @@ -228,10 +234,11 @@ export class Web3Wrapper { */ public async getTransactionByHashAsync(txHash: string): Promise<Transaction> { assert.isHexString('txHash', txHash); - const transaction = await this.sendRawPayloadAsync<Transaction>({ + const transactionRpc = await this.sendRawPayloadAsync<TransactionRPC>({ method: 'eth_getTransactionByHash', params: [txHash], }); + const transaction = marshaller.unmarshalTransaction(transactionRpc); return transaction; } /** @@ -526,9 +533,6 @@ export class Web3Wrapper { method: 'eth_call', params: [callDataHex, marshalledDefaultBlock], }); - if (rawCallResult === '0x') { - throw new Error('Contract call failed (returned null)'); - } return rawCallResult; } /** diff --git a/packages/web3-wrapper/tslint.json b/packages/web3-wrapper/tslint.json index ffaefe83a..dd9053357 100644 --- a/packages/web3-wrapper/tslint.json +++ b/packages/web3-wrapper/tslint.json @@ -1,3 +1,3 @@ { - "extends": ["@0xproject/tslint-config"] + "extends": ["@0x/tslint-config"] } |