Skip to content

Commit 3dc8387

Browse files
authored
Backport "Fix method registry initialization (#8200)" (#8459)
Backport #8200 to v7.7.9. Original commit description: The method registry was being initialized with the global variable `ethereumProvider` before that variable was set. As a result, the method registry was falling back to an internally constructed provider that used the wrong provider URL (an obsolete Infura API). This was resulting in an error with the message "Project ID not found". The method registry is now initialized lazily, when it's first needed. This should be well after the initialization of `ethereumProvider`, which occurs during the UI initialization.
1 parent f91bd3a commit 3dc8387

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- [#8447](https://github.com/MetaMask/metamask-extension/pull/8447): Delete Dai/Sai migration notification
99
- [#8460](https://github.com/MetaMask/metamask-extension/pull/8460): Update deposit copy for Wyre
1010
- [#8458](https://github.com/MetaMask/metamask-extension/pull/8458): Snapshot txMeta without cloning history
11+
- [#8459](https://github.com/MetaMask/metamask-extension/pull/8459): Fix method registry initialization
1112

1213
## 7.7.8 Wed Mar 11 2020
1314
- [#8176](https://github.com/MetaMask/metamask-extension/pull/8176): Handle and set gas estimation when max mode is clicked

ui/app/helpers/utils/transactions.util.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ async function getMethodFrom4Byte (fourBytePrefix) {
4747
return null
4848
}
4949
}
50-
51-
const registry = new MethodRegistry({ provider: global.ethereumProvider })
50+
let registry
5251

5352
/**
5453
* Attempts to return the method data from the MethodRegistry library, the message registry library and the token abi, in that order of preference
@@ -62,6 +61,10 @@ export async function getMethodDataAsync (fourBytePrefix) {
6261
return null
6362
})
6463

64+
if (!registry) {
65+
registry = new MethodRegistry({ provider: global.ethereumProvider })
66+
}
67+
6568
let sig = await registry.lookup(fourBytePrefix)
6669

6770
if (!sig) {

0 commit comments

Comments
 (0)