Skip to content
This repository has been archived by the owner on Jan 24, 2022. It is now read-only.

Trim ZWeb3 #1369

Merged
merged 16 commits into from
Jan 6, 2020
Merged

Trim ZWeb3 #1369

merged 16 commits into from
Jan 6, 2020

Conversation

frangio
Copy link
Contributor

@frangio frangio commented Dec 30, 2019

This PR trims ZWeb3 by removing all the functions which are just wrappers around web3 functionality. I additionally made ZWeb3.eth a getter (it used to be a function) so that the syntax for using it is nicer (without parentheses).

For example ZWeb3.accounts() has been removed and it now becomes ZWeb3.eth.getAccounts().

I've also removed many tests that were only testing the wrapped functionality, because they were just testing the web3 dependency. We might want to keep them though, given that web3 is kind of unstable, but IMO they would not be enough to detect any significant issues.

Do we consider this a breaking change?

it('returns checksummed address', function() {
ZWeb3.toChecksumAddress(accounts[0]).should.be.eq(accounts[0]);
});
describe('checksum address', function() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unrelated to the PR purpose but I was editing this file and noticed that this describe block was incorrectly placed within the previous describe block.

@spalladino
Copy link
Contributor

I don't consider this a breaking change, but I'm reluctant to removing many of the methods from ZWeb3 that would allow us to switch to a different library in the future (if we need to). Let's discuss it live.

@@ -1,4 +1,6 @@
export const ERC20_PARTIAL_ABI = [
import { AbiItem } from 'web3-utils';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love how in every PR you keep adding more typings

@frangio frangio added the status:ready-to-merge Order mergify to merge label Jan 6, 2020
@mergify mergify bot merged commit 9018b5f into OpenZeppelin:master Jan 6, 2020
@frangio frangio deleted the trim-zweb3 branch January 6, 2020 18:42
frangio pushed a commit to OpenZeppelin/docs.openzeppelin.com that referenced this pull request Feb 27, 2020
Raised in the forum by a community member: 
https://forum.openzeppelin.com/t/typeerror-zweb3-accounts-is-not-a-function/2343

ZWeb3 was changed in OpenZeppelin CLI 2.7
>https://github.com/OpenZeppelin/openzeppelin-sdk/releases/tag/v2.7.0
>Trimmed the API of the ZWeb3 object to remove methods duplicated from web3.js. (OpenZeppelin/openzeppelin-sdk#1369)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status:ready-to-merge Order mergify to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants