-
-
Notifications
You must be signed in to change notification settings - Fork 275
deps: Bump @metamask/{eth-json-rpc-provider,rpc-errors}
#1653
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
Changes from all commits
d5313dd
1de002e
4ec496c
8861727
575937b
7eaa056
4c36b0f
573e59c
2f689c6
3a809ba
8b997a6
e47bcc6
bec2646
08d912c
d80a8d7
d1dd687
2ebfd68
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
legobeat marked this conversation as resolved.
Show resolved
Hide resolved
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,13 @@ | ||
| import type { InfuraNetworkType } from '@metamask/controller-utils'; | ||
| import type { SafeEventEmitterProvider } from '@metamask/eth-json-rpc-provider'; | ||
| import type { Hex } from '@metamask/utils'; | ||
| import type { PollingBlockTracker } from 'eth-block-tracker'; | ||
| import type { BlockTracker as BaseBlockTracker } from 'eth-block-tracker'; | ||
|
|
||
| export type Provider = SafeEventEmitterProvider; | ||
|
|
||
| export type BlockTracker = PollingBlockTracker; | ||
| export type BlockTracker = BaseBlockTracker & { | ||
| checkForLatestBlock(): Promise<string>; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, thanks for that. I'll keep an eye out so we can get this merged. |
||
| }; | ||
|
|
||
| /** | ||
| * The type of network client that can be created. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,8 +7,8 @@ import { | |
| NetworkType, | ||
| toHex, | ||
| } from '@metamask/controller-utils'; | ||
| import { rpcErrors } from '@metamask/rpc-errors'; | ||
| import assert from 'assert'; | ||
| import { ethErrors } from 'eth-rpc-errors'; | ||
| import type { Patch } from 'immer'; | ||
| import { when, resetAllWhenMocks } from 'jest-when'; | ||
| import { inspect, isDeepStrictEqual, promisify } from 'util'; | ||
|
|
@@ -27,7 +27,7 @@ import type { | |
| ProviderConfig, | ||
| } from '../src/NetworkController'; | ||
| import { NetworkController } from '../src/NetworkController'; | ||
| import type { Provider } from '../src/types'; | ||
| import type { BlockTracker, Provider } from '../src/types'; | ||
| import { NetworkClientType } from '../src/types'; | ||
| import type { FakeProviderStub } from './fake-provider'; | ||
| import { FakeProvider } from './fake-provider'; | ||
|
|
@@ -128,15 +128,15 @@ const SUCCESSFUL_ETH_GET_BLOCK_BY_NUMBER_RESPONSE = { | |
| /** | ||
| * A response object for a request that has been geoblocked by Infura. | ||
| */ | ||
| const BLOCKED_INFURA_JSON_RPC_ERROR = ethErrors.rpc.internal( | ||
| const BLOCKED_INFURA_JSON_RPC_ERROR = rpcErrors.internal( | ||
| JSON.stringify({ error: 'countryBlocked' }), | ||
| ); | ||
|
|
||
| /** | ||
| * A response object for a unsuccessful request to any RPC method. It is assumed | ||
| * that the error here is insignificant to the test. | ||
| */ | ||
| const GENERIC_JSON_RPC_ERROR = ethErrors.rpc.internal( | ||
| const GENERIC_JSON_RPC_ERROR = rpcErrors.internal( | ||
| JSON.stringify({ error: 'oops' }), | ||
| ); | ||
|
|
||
|
|
@@ -5106,7 +5106,7 @@ describe('NetworkController', () => { | |
| request: { | ||
| method: 'eth_getBlockByNumber', | ||
| }, | ||
| error: ethErrors.rpc.methodNotFound(), | ||
| error: rpcErrors.methodNotFound(), | ||
| }, | ||
| ]), | ||
| buildFakeProvider([ | ||
|
|
@@ -5622,7 +5622,7 @@ describe('NetworkController', () => { | |
| request: { | ||
| method: 'eth_getBlockByNumber', | ||
| }, | ||
| error: ethErrors.rpc.methodNotFound(), | ||
| error: rpcErrors.methodNotFound(), | ||
| }, | ||
| ]), | ||
| buildFakeProvider([ | ||
|
|
@@ -6250,7 +6250,7 @@ function lookupNetworkTests({ | |
| method: 'eth_getBlockByNumber', | ||
| params: ['latest', false], | ||
| }, | ||
| error: ethErrors.rpc.limitExceeded('some error'), | ||
| error: rpcErrors.limitExceeded('some error'), | ||
| }, | ||
| ], | ||
| stubLookupNetworkWhileSetting: true, | ||
|
|
@@ -6291,7 +6291,7 @@ function lookupNetworkTests({ | |
| method: 'eth_getBlockByNumber', | ||
| params: ['latest', false], | ||
| }, | ||
| error: ethErrors.rpc.limitExceeded('some error'), | ||
| error: rpcErrors.limitExceeded('some error'), | ||
| }, | ||
| ], | ||
| }); | ||
|
|
@@ -6326,7 +6326,7 @@ function lookupNetworkTests({ | |
| method: 'eth_getBlockByNumber', | ||
| params: ['latest', false], | ||
| }, | ||
| error: ethErrors.rpc.limitExceeded('some error'), | ||
| error: rpcErrors.limitExceeded('some error'), | ||
| }, | ||
| ], | ||
| stubLookupNetworkWhileSetting: true, | ||
|
|
@@ -6358,7 +6358,7 @@ function lookupNetworkTests({ | |
| method: 'eth_getBlockByNumber', | ||
| params: ['latest', false], | ||
| }, | ||
| error: ethErrors.rpc.limitExceeded('some error'), | ||
| error: rpcErrors.limitExceeded('some error'), | ||
| }, | ||
| ], | ||
| stubLookupNetworkWhileSetting: true, | ||
|
|
@@ -6392,7 +6392,7 @@ function lookupNetworkTests({ | |
| method: 'eth_getBlockByNumber', | ||
| params: ['latest', false], | ||
| }, | ||
| error: ethErrors.rpc.limitExceeded('some error'), | ||
| error: rpcErrors.limitExceeded('some error'), | ||
| }, | ||
| ], | ||
| stubLookupNetworkWhileSetting: true, | ||
|
|
@@ -6957,7 +6957,7 @@ function buildFakeClient( | |
| rpcUrl: 'https://test.network', | ||
| }, | ||
| provider, | ||
| blockTracker: new FakeBlockTracker(), | ||
| blockTracker: new FakeBlockTracker() as BlockTracker, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @MajorLift This is an example of us needing to use a type assertion. I guess the type of
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mcmire This seems like it's either been fixed or wasn't needed in the first place: #1833. These silent false negatives are the worse thing about type assertions IMO. In general, when encountering "not assignable to" errors, I would like the underlying types to be reconciled/aligned, at least eventually. Are there maybe "usual suspect" entities in our codebase that I can assume it'll be safe to use type assertion on? |
||
| destroy: () => { | ||
| // do nothing | ||
| }, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.