TypeError: ZWeb3.accounts is not a function

In the Upgrading Contracts Programmatically section of Upgrading smart contracts tutorial, we have a code snippet:

const [from] = await ZWeb3.accounts();
const project = new ProxyAdminProject('MyProject', null, null, { from, gas: 1e6, gasPrice: 1e9 });

Here, we need to update this to:

const from = await ZWeb3.defaultAccount();
const project = new ProxyAdminProject('MyProject', null, null, { from, gas: 1e6, gasPrice: 1e9 });
1 Like

Hi @vasa-develop,

Thanks for raising this.

The documentation needs to be updated (I created Pull Request: https://github.com/OpenZeppelin/docs.openzeppelin.com/pull/152) to match the example:

This 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. (#1369)

1 Like