diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-03-02 05:04:55 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-03-02 05:04:55 +0800 |
commit | 0c16f0ea221d65e66942c27a69dda1c54f49e775 (patch) | |
tree | 5530d18fcd6e6c5e15272de3cb915fc2025c01bf /packages/web3-wrapper | |
parent | 003d43b03ae373ca24d6d728ffa6b0f2dfcda79a (diff) | |
parent | 451a0dacbe85d7a0d16ef007c1eb945a4c1977cb (diff) | |
download | dexon-sol-tools-0c16f0ea221d65e66942c27a69dda1c54f49e775.tar dexon-sol-tools-0c16f0ea221d65e66942c27a69dda1c54f49e775.tar.gz dexon-sol-tools-0c16f0ea221d65e66942c27a69dda1c54f49e775.tar.bz2 dexon-sol-tools-0c16f0ea221d65e66942c27a69dda1c54f49e775.tar.lz dexon-sol-tools-0c16f0ea221d65e66942c27a69dda1c54f49e775.tar.xz dexon-sol-tools-0c16f0ea221d65e66942c27a69dda1c54f49e775.tar.zst dexon-sol-tools-0c16f0ea221d65e66942c27a69dda1c54f49e775.zip |
Merge branch 'development' into feature/sra-reporter
* development: (71 commits)
Set max to 2 ETH/2 ZRX
Add missing types from website
Add dependencies
Update the README
Move BaseContract to its own package
Upgrate prettier
remove unused import
Move more configs into docsInfo and remove logic that does not belong there elsewhere
Fix a bug with displaying solidity functions returning multiple return values
Add ethers-contracts as a dependency
Include types for ethers-contracts
Fix the version
Include types for ethers-contracts
Rename idx to i
Remove tslint disable
Move BaseContract to web3Wrapper
Merge ifs
Fix an option description
Add link to the docs
Improve CHANGELOG entry
...
Diffstat (limited to 'packages/web3-wrapper')
-rw-r--r-- | packages/web3-wrapper/CHANGELOG.md | 7 | ||||
-rw-r--r-- | packages/web3-wrapper/package.json | 4 | ||||
-rw-r--r-- | packages/web3-wrapper/src/index.ts | 18 | ||||
-rw-r--r-- | packages/web3-wrapper/tsconfig.json | 6 |
4 files changed, 25 insertions, 10 deletions
diff --git a/packages/web3-wrapper/CHANGELOG.md b/packages/web3-wrapper/CHANGELOG.md index eb31f7e3c..eef665d24 100644 --- a/packages/web3-wrapper/CHANGELOG.md +++ b/packages/web3-wrapper/CHANGELOG.md @@ -1,5 +1,12 @@ # CHANGELOG +## v0.2.0 _TBD, 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_ * Fix publishing issue where .npmignore was not properly excluding undesired content (#389) diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json index 8e861b1d5..55f1ffff0 100644 --- a/packages/web3-wrapper/package.json +++ b/packages/web3-wrapper/package.json @@ -21,7 +21,6 @@ "homepage": "https://github.com/0xProject/0x.js/packages/web3-wrapper/README.md", "devDependencies": { "@0xproject/tslint-config": "^0.4.9", - "@0xproject/types": "^0.2.3", "@types/lodash": "^4.14.86", "npm-run-all": "^4.1.2", "shx": "^0.2.2", @@ -30,7 +29,10 @@ "web3-typescript-typings": "^0.9.11" }, "dependencies": { + "@0xproject/types": "^0.2.3", "@0xproject/utils": "^0.3.4", + "ethers-contracts": "^2.2.1", + "ethers-typescript-typings": "^0.0.1", "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 a2878fc2a..a07805344 100644 --- a/packages/web3-wrapper/src/index.ts +++ b/packages/web3-wrapper/src/index.ts @@ -41,7 +41,8 @@ export class Web3Wrapper { } public async isSenderAddressAvailableAsync(senderAddress: string): Promise<boolean> { const addresses = await this.getAvailableAddressesAsync(); - return _.includes(addresses, senderAddress); + const normalizedAddress = senderAddress.toLowerCase(); + return _.includes(addresses, normalizedAddress); } public async getNodeVersionAsync(): Promise<string> { const nodeVersion = await promisify<string>(this._web3.version.getNode)(); @@ -96,7 +97,8 @@ export class Web3Wrapper { } public async getAvailableAddressesAsync(): Promise<string[]> { const addresses = await promisify<string[]>(this._web3.eth.getAccounts)(); - return addresses; + const normalizedAddresses = _.map(addresses, address => address.toLowerCase()); + return normalizedAddresses; } public async getLogsAsync(filter: Web3.FilterObject): Promise<Web3.LogEntry[]> { let fromBlock = filter.fromBlock; @@ -126,14 +128,14 @@ export class Web3Wrapper { const web3Contract = this._web3.eth.contract(abi); return web3Contract; } - public getContractInstance(abi: Web3.ContractAbi, address: string): Web3.ContractInstance { - const web3ContractInstance = this.getContractFromAbi(abi).at(address); - return web3ContractInstance; - } - public async estimateGasAsync(data: string): Promise<number> { - const gas = await promisify<number>(this._web3.eth.estimateGas)({ data }); + public async estimateGasAsync(txData: Partial<Web3.TxData>): Promise<number> { + const gas = await promisify<number>(this._web3.eth.estimateGas)(txData); return gas; } + public async callAsync(callData: Web3.CallData, defaultBlock?: Web3.BlockParam): Promise<string> { + const rawCalllResult = await promisify<string>(this._web3.eth.call)(callData, defaultBlock); + return rawCalllResult; + } public async sendTransactionAsync(txData: Web3.TxData): Promise<string> { const txHash = await promisify<string>(this._web3.eth.sendTransaction)(txData); return txHash; diff --git a/packages/web3-wrapper/tsconfig.json b/packages/web3-wrapper/tsconfig.json index 3d967d05f..7bae7f9f0 100644 --- a/packages/web3-wrapper/tsconfig.json +++ b/packages/web3-wrapper/tsconfig.json @@ -3,5 +3,9 @@ "compilerOptions": { "outDir": "lib" }, - "include": ["./src/**/*", "../../node_modules/web3-typescript-typings/index.d.ts"] + "include": [ + "./src/**/*", + "../../node_modules/ethers-typescript-typings/index.d.ts", + "../../node_modules/web3-typescript-typings/index.d.ts" + ] } |