-
-
Notifications
You must be signed in to change notification settings - Fork 268
feat: make SafeEventEmitterProvider compatible with eth req libraries #4422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
cryptodev-2s
merged 32 commits into
main
from
feature/make-SafeEventEmitterProvider-type-compatible-with-ethereum-request-libraries
Jul 8, 2024
Merged
Changes from 7 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
fe4e75b
feat: make SafeEventEmitterProvider compatible with eth req libraries
cryptodev-2s fd56e13
feat: add tsd for type testing
cryptodev-2s d754397
fix: unit tests
cryptodev-2s 72a25cd
Merge branch 'main' into feature/make-SafeEventEmitterProvider-type-c…
cryptodev-2s e734a5d
fix: build
cryptodev-2s bd6070f
fix: test coverage
cryptodev-2s 3bbf4db
Merge branch 'main' into feature/make-SafeEventEmitterProvider-type-c…
cryptodev-2s 2bd3b24
Merge branch 'main' into feature/make-SafeEventEmitterProvider-type-c…
cryptodev-2s 5338acc
fix: override request in fake provider
cryptodev-2s dc2f57b
fix: helper function unit tests
cryptodev-2s c99a02c
fix: remove tsd
cryptodev-2s 2285231
fix: remove useless jest config update
cryptodev-2s 7783d95
Merge branch 'main' into feature/make-SafeEventEmitterProvider-type-c…
cryptodev-2s 403a862
Merge branch 'main' into feature/make-SafeEventEmitterProvider-type-c…
cryptodev-2s 9f40d0e
Merge remote-tracking branch 'origin/main' into feature/make-SafeEven…
cryptodev-2s 58443b4
fix: add smoke tests
cryptodev-2s c96d681
fix: move @metamask/utils to devDependencies
cryptodev-2s e87a334
fix: move back metamsk utils as dependencies
cryptodev-2s 662b20e
fix: dependencies order
cryptodev-2s cf969dc
fix: request returned type and result
cryptodev-2s efda64b
Merge branch 'main' into feature/make-SafeEventEmitterProvider-type-c…
cryptodev-2s 5a7887f
fix: remove useless export of Eip1193Request
cryptodev-2s 640e821
fix: fake-provider
cryptodev-2s 5ac0498
fix: test handle thrown error
cryptodev-2s 17118e6
fix: remove optional chaining operator
cryptodev-2s 8a9dd51
fix: thrown error
cryptodev-2s b3c426a
fix: add more tests for request method
cryptodev-2s 88162ec
fix: add more tests for sendAsync and send
cryptodev-2s 43608ec
fix: add more request failure tests
cryptodev-2s 38dbabd
fix: request error unit tests
cryptodev-2s e19d25a
fix: drop error line
cryptodev-2s e9c69bb
fix: add :
cryptodev-2s File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,8 +40,10 @@ | |
| "lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write && yarn lint:dependencies", | ||
| "lint:misc": "prettier '**/*.json' '**/*.md' '!CHANGELOG.md' '**/*.yml' '!.yarnrc.yml' --ignore-path .gitignore --no-error-on-unmatched-pattern", | ||
| "publish:preview": "yarn npm publish --tag preview", | ||
| "test": "jest --reporters=jest-silent-reporter", | ||
| "test": "yarn test:source && yarn test:types", | ||
| "test:clean": "jest --clearCache", | ||
| "test:source": "jest --reporters=jest-silent-reporter", | ||
| "test:types": "tsd", | ||
| "test:verbose": "jest --verbose", | ||
| "test:watch": "jest --watch" | ||
| }, | ||
|
|
@@ -51,14 +53,20 @@ | |
| "@metamask/utils": "^8.3.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@ethersproject/providers": "^5.7.0", | ||
| "@metamask/auto-changelog": "^3.4.4", | ||
| "@metamask/eth-query": "^4.0.0", | ||
| "@metamask/ethjs-query": "^0.5.3", | ||
| "@types/jest": "^27.4.1", | ||
| "deepmerge": "^4.2.2", | ||
| "ethers": "^6.12.0", | ||
| "jest": "^27.5.1", | ||
| "jest-it-up": "^2.0.2", | ||
| "ts-jest": "^27.1.4", | ||
| "tsd": "^0.29.0", | ||
| "typedoc": "^0.24.8", | ||
| "typescript": "~4.9.5" | ||
| "typescript": "~4.9.5", | ||
| "uuid": "^8.3.2" | ||
cryptodev-2s marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| }, | ||
| "packageManager": "[email protected]", | ||
| "engines": { | ||
|
|
@@ -72,5 +80,8 @@ | |
| "allowScripts": { | ||
| "@lavamoat/preinstall-always-fail": false | ||
| } | ||
| }, | ||
| "tsd": { | ||
| "directory": "src" | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,6 @@ | ||
| export * from './provider-from-engine'; | ||
| export * from './provider-from-middleware'; | ||
| export { SafeEventEmitterProvider } from './safe-event-emitter-provider'; | ||
| export { | ||
| SafeEventEmitterProvider, | ||
| type Eip1193Request, | ||
cryptodev-2s marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } from './safe-event-emitter-provider'; | ||
22 changes: 22 additions & 0 deletions
22
packages/eth-json-rpc-provider/src/safe-event-emitter-provider.test-d.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import { Web3Provider } from '@ethersproject/providers'; | ||
| import EthQuery from '@metamask/eth-query'; | ||
| import EthJsQuery from '@metamask/ethjs-query'; | ||
| import { JsonRpcEngine } from '@metamask/json-rpc-engine'; | ||
| import { BrowserProvider } from 'ethers'; | ||
|
|
||
| import { SafeEventEmitterProvider } from './safe-event-emitter-provider'; | ||
|
|
||
| const engine = new JsonRpcEngine(); | ||
| const provider = new SafeEventEmitterProvider({ engine }); | ||
|
|
||
| // /* @metamask/eth-query */ | ||
| new EthQuery(provider); | ||
|
|
||
| // /* @metamask/ethjs-query */ | ||
| new EthJsQuery(provider); | ||
cryptodev-2s marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| // /* Ethers v5's Web3Provider */ | ||
| new Web3Provider(provider); | ||
|
|
||
| // /* Ethers v6's BrowserProvider */ | ||
| new BrowserProvider(provider); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.