This PR adds a workaround for an Infura issue (that becomes a problem with our MetaMask implementation) as documented here and more specifically here.
The crux of our issue is that purser-metamask's signTransaction method attempts to get the transaction that MetaMask sent in the callback of sendTransaction, when it is pending. With most providers, the getTransaction method will respond with the transaction when it is pending, but Infura recently started returning an empty response.
The workaround involves attempting to get the transaction immediately, and if that fails, using a web3 0.20.x-compatible package (await-transaction-mined) to wait for the transaction to be confirmed before getting the transaction.
This PR also makes some improvements to various defaults as suggested in #261 .
Update chain defaults
Add HARDFORKS defaults constant
Add NETWORK_NAMES defaults constant
Add tentative support for more chains for getChainDefinition
Rename NETWORK_IDS defaults constant to CHAIN_IDS
Use hardfork and network name constants getChainDefinition
Add MetaMask/Infura workaround
Add await-transaction-mined dependency
Define a method to get a pending MetaMask transaction and if necessary (given e.g. an Infura provider), wait for the transaction to be confirmed before getting it (otherwise, the provider will return null)
This PR adds a workaround for an Infura issue (that becomes a problem with our MetaMask implementation) as documented here and more specifically here.
The crux of our issue is that
purser-metamask
'ssignTransaction
method attempts to get the transaction that MetaMask sent in the callback ofsendTransaction
, when it is pending. With most providers, thegetTransaction
method will respond with the transaction when it is pending, but Infura recently started returning an empty response.The workaround involves attempting to get the transaction immediately, and if that fails, using a
web3
0.20.x-compatible package (await-transaction-mined
) to wait for the transaction to be confirmed before getting the transaction.This PR also makes some improvements to various defaults as suggested in #261 .
Update chain defaults
HARDFORKS
defaults constantNETWORK_NAMES
defaults constantgetChainDefinition
NETWORK_IDS
defaults constant toCHAIN_IDS
getChainDefinition
Add MetaMask/Infura workaround
await-transaction-mined
dependency