mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Fix method registry initialization (#8200)
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.
This commit is contained in:
parent
e3b68579ca
commit
91f6dfc6e0
@ -49,8 +49,7 @@ async function getMethodFrom4Byte (fourBytePrefix) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
const registry = new MethodRegistry({ provider: global.ethereumProvider })
|
||||
let registry
|
||||
|
||||
/**
|
||||
* Attempts to return the method data from the MethodRegistry library, the message registry library and the token abi, in that order of preference
|
||||
@ -64,6 +63,10 @@ export async function getMethodDataAsync (fourBytePrefix) {
|
||||
return null
|
||||
})
|
||||
|
||||
if (!registry) {
|
||||
registry = new MethodRegistry({ provider: global.ethereumProvider })
|
||||
}
|
||||
|
||||
let sig = await registry.lookup(fourBytePrefix)
|
||||
|
||||
if (!sig) {
|
||||
|
Loading…
Reference in New Issue
Block a user