-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Test with injected external providers #5652
Conversation
Co-authored-by: Marin Petrunic <[email protected]>
Your Render PR Server URL is https://atweb3js-docs-pr-5652.onrender.com. Follow its progress at https://dashboard.render.com/static/srv-cdut7ig2i3mrajv8qbo0. |
1ca1e88
to
e593bf6
Compare
…number (Inspired by: #5373 (comment) and needed as a work around for blockchainsllc/in3#46)
Tested with ganache and in3. However, do you suggest testing with other providers, as well? Note: in3 currently does not completely follow the JsonRpc 2.0 specs. So, an additional functionality has been added at commit #b3cdf3f . And an issue has been opened at in3 repo (blockchainsllc/in3#46) |
and configure `in3` to be faster
The test for using And the code was modified to allow for its semi-standard provider as described here: https://github.com/web3/web3.js/pull/5652/files#diff-90d726c886e913b9fbd11b83e2b4160d084b075f1ca99ab809bf1baa8a743700R236 |
expect(typeof blockNumber0).toBe('bigint'); | ||
|
||
// send a transaction | ||
const tx = web3.eth.sendTransaction({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This tx is signed using node wallet accounts.
Can we add another (manual or automated ) test of injecting MM wallet and signing tx with it for:
- verifying signing is working with injected wallet controlled accounts
- verifying signing precedence is correct ( first local web3 wallets accounts are used/queried, after that wallet / node accounts ) for injected providers as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is a good point. And actually, there are varieties in the tests as follow:
-
For Ganache provider, the mnemonic is used:
https://github.com/web3/web3.js/pull/5652/files#diff-56116a720b3243384a647da52d1409a56641aeb8a0b6e2e31d833589de814f8eR27 -
With Truffle HDWallet, the private key is used:
https://github.com/web3/web3.js/pull/5652/files#diff-d87ba5b36cccb886840cd3cd83128e56cc39018c6628abe9c75c4eba943ebd9fR37 -
For HardHat provider, the node wallet account is used:
https://github.com/web3/web3.js/pull/5652/files#diff-daebb1664f443048cee34bb9970cc0adcec394cecb0164d04226f09e3519db08R26 -
With Infura as well as IN3 as provider, no authentication is made (because setting up in3 would complicate the test for the in3 setup and it will slow the test as well)
https://github.com/web3/web3.js/pull/5652/files#diff-e19b31481dc158c2bff69fd1fc2cac063a9eeb82bef6f98fb4d69626ffaa6db8R29
* Update CHANGELOG version headers * Contract call with tuple is missing param names (#5613) * call special output type * fix * fix: enable outputs to have param names (#5624) * hot fix * add type if only one param * overloaded inputs types * fix resolver tests * add type tests * simplify types * revert registry unit test * test firefox * revert firefox test * update changelogs Co-authored-by: Marin Petrunić <[email protected]> * Fix `isHex` and `isHexStrict` for some edge cases and enrich their tests (#5655) * Change `isHex` to return true for negative numbers (for example `-123`) * Change both `isHex` and `isHexStrict` to return `false` for `-0x` * Change `isHex` to return `false` for empty strings ''. * Remove erroneous set provider code for Contract constructor (#5669) * Remove erroneous set provider code for Contract constructor. Add Contract constructor provider set test * Update CHANGELOGs * Debugging failing integration tests * Apply suggestions from code review * Use getSystemTestProvider instead of hardcoded string * Refactor ternaries in Contract constructor to if statements * Correct CHANGELOG entries * Remove unneeded checks in if statements * Test with injected external providers (#5652) * fix: sending tx with injected provider (#5651) Co-authored-by: Marin Petrunic <[email protected]> * adding a test for using `ganache` provider * enable the jsonrpc `id` to optionally be incremented starting from a number (Inspired by: #5373 (comment) and needed as a work around for blockchainsllc/in3#46) * test with `in3` as a provider & skip `in3` test if it takes too long * increase integration test timeout at web3 package * add a test for using `hardhat` provider * improve how legacy providers, such as hardhat, is used * implement `isPromise` that works in the browsers * refactor external providers tests * update CHANGELOG.md * Use Error ABI to parse errors when sending a transaction (#5662) * use Error ABI when sending a transaction * update CHANGELOG.md for #5587 * Remove merge conflict marker Co-authored-by: Oleksii Kosynskyi <[email protected]> Co-authored-by: Marin Petrunić <[email protected]> Co-authored-by: Muhammad Altabba <[email protected]> Co-authored-by: jdevcs <[email protected]>
* Version bump and build for v4.0.1-alpha.2 * Release/4.0.1 alpha.2 changelog update 3 (#5689) * Update CHANGELOG version headers * Update CHANGELOGs * Revert package version bump for web3-packagetemplate * Release/4.0.1 alpha.2 merge conflicts (#5692) * Update CHANGELOG version headers * Contract call with tuple is missing param names (#5613) * call special output type * fix * fix: enable outputs to have param names (#5624) * hot fix * add type if only one param * overloaded inputs types * fix resolver tests * add type tests * simplify types * revert registry unit test * test firefox * revert firefox test * update changelogs Co-authored-by: Marin Petrunić <[email protected]> * Fix `isHex` and `isHexStrict` for some edge cases and enrich their tests (#5655) * Change `isHex` to return true for negative numbers (for example `-123`) * Change both `isHex` and `isHexStrict` to return `false` for `-0x` * Change `isHex` to return `false` for empty strings ''. * Remove erroneous set provider code for Contract constructor (#5669) * Remove erroneous set provider code for Contract constructor. Add Contract constructor provider set test * Update CHANGELOGs * Debugging failing integration tests * Apply suggestions from code review * Use getSystemTestProvider instead of hardcoded string * Refactor ternaries in Contract constructor to if statements * Correct CHANGELOG entries * Remove unneeded checks in if statements * Test with injected external providers (#5652) * fix: sending tx with injected provider (#5651) Co-authored-by: Marin Petrunic <[email protected]> * adding a test for using `ganache` provider * enable the jsonrpc `id` to optionally be incremented starting from a number (Inspired by: #5373 (comment) and needed as a work around for blockchainsllc/in3#46) * test with `in3` as a provider & skip `in3` test if it takes too long * increase integration test timeout at web3 package * add a test for using `hardhat` provider * improve how legacy providers, such as hardhat, is used * implement `isPromise` that works in the browsers * refactor external providers tests * update CHANGELOG.md * Use Error ABI to parse errors when sending a transaction (#5662) * use Error ABI when sending a transaction * update CHANGELOG.md for #5587 * Remove merge conflict marker Co-authored-by: Oleksii Kosynskyi <[email protected]> Co-authored-by: Marin Petrunić <[email protected]> Co-authored-by: Muhammad Altabba <[email protected]> Co-authored-by: jdevcs <[email protected]> * Release patch/4.0.1 alpha.2/solve merge conflicts (#5697) * Update CHANGELOG version headers * Remove merge conflict markers * Remove double CHANGELOG entry Co-authored-by: Oleksii Kosynskyi <[email protected]> Co-authored-by: Marin Petrunić <[email protected]> Co-authored-by: Muhammad Altabba <[email protected]> Co-authored-by: jdevcs <[email protected]>
Description
Closes #5309
Type of change
Checklist for 1.x:
npm run dtslint
with success and extended the tests and types if necessary.npm run test:cov
and my test cases cover all the lines and branches of the added code.npm run build
with success.dist/web3.min.js
in a browser.CHANGELOG.md
file in the root folder.Checklist for 4.x:
yarn
successfullyyarn lint
successfullyyarn build:web
successfullyyarn test:unit
successfullyyarn test:integration
successfullycompile:contracts
successfullyCHANGELOG.md
file in the packages I have edited.