You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
If warned that balance should be a string, I can easily use .toHexString() to fix the problem.
Current Behavior
No typescript error for the above example, but instead a runtime error:
(node:210) UnhandledPromiseRejectionWarning: Error: bigNumber.toString does not accept parameters (code=UNEXPECTED_ARGUMENT, version=bignumber/5.0.6)
at Logger.makeError (/home/circleci/project/node_modules/@ethersproject/logger/src.ts/index.ts:205:28)
at Logger.throwError (/home/circleci/project/node_modules/@ethersproject/logger/src.ts/index.ts:217:20)
at BigNumber.toString (/home/circleci/project/node_modules/@ethersproject/bignumber/src.ts/bignumber.ts:192:20)
at Object.hex (/home/circleci/project/node_modules/ganache-cli/build/ganache-core.node.cli.js:4:66868)
at S.createAccount (/home/circleci/project/node_modules/ganache-cli/build/ganache-core.node.cli.js:48:177548)
at Array.map (<anonymous>)
at S.initialize (/home/circleci/project/node_modules/ganache-cli/build/ganache-core.node.cli.js:48:175451)
at new p (/home/circleci/project/node_modules/ganache-cli/build/ganache-core.node.cli.js:48:163787)
at new l (/home/circleci/project/node_modules/ganache-cli/build/ganache-core.node.cli.js:19:90308)
at Object.create (/home/circleci/project/node_modules/ganache-cli/build/ganache-core.node.cli.js:96:91251)
at Object.server (/home/circleci/project/node_modules/ganache-cli/build/ganache-core.node.cli.js:48:7388)
at new GanacheServer (/home/circleci/project/packages/devtools/src/ganache/server.ts:31:27)
at /home/circleci/project/packages/devtools/src/ganache/index.ts:47:18
at Generator.next (<anonymous>)
at /home/circleci/project/packages/devtools/lib/src/ganache/index.js:8:71
at new Promise (<anonymous>)
IProviderOptions['accounts']
should have a narrower type.Expected Behavior
Passing in the wrong type of object to
ganache.server()
should raise a Typescript error, for example using an ethers BigNumber:If warned that
balance
should be astring
, I can easily use.toHexString()
to fix the problem.Current Behavior
No typescript error for the above example, but instead a runtime error:
Possible Solution
https://github.com/trufflesuite/ganache-core/blob/53f653ea4356fa558ecb0c2d6338278d8d7285cc/typings/index.d.ts#L20
Should be instead
accounts?: { balance: string; secretKey: string }[];
Steps to Reproduce (for bugs)
Install
ganache-core@2.12.1 and ethers@5.0.12
. Callganache.server(opts)
with opts specified as above. Observe no TS error but a runtime error.Context
Using
ganache-core
in our project alongsideethers.BigNumber
(which we had previously had working withganache-cli
.statechannels/statechannels#2648
Your Environment
The text was updated successfully, but these errors were encountered: