Created
March 24, 2020 14:01
-
-
Save javier-tarazaga/4ab80dc58d2d0e8523ec29963b5b974c to your computer and use it in GitHub Desktop.
This file contains 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
const { SuperHDWalletProvider, ManualSignProvider } = require("super-web3-provider"); | |
... | |
The rest of your configuration here | |
... | |
// IMPORTANT: We need to globally store these providers here due to the fact that Truffle decides to call | |
// the provider() function multiple times during a deployment, therefore we would be re-creating | |
// a deployment on every call. | |
let rinkebyMetamaskProvider; | |
module.exports = { | |
... | |
networks: { | |
... | |
rinkeby_metamask: { | |
provider: () => { | |
// Let's not double create the provider (as we will create many deployments) as Truffle calls this function many times (◔_◔) | |
if (!rinkebyMetamaskProvider) { | |
rinkebyMetamaskProvider = new ManualSignProvider({ | |
projectId, | |
projectToken, | |
from: '0x742980bB2B17ca355Fef76969326bab47c27baD4', | |
endpoint: 'https://rinkeby.infura.io/v3/14a9bebf5c374938b2476abe29ca5564', | |
networkId: '4', | |
}) | |
} | |
return rinkebyMetamaskProvider; | |
}, | |
network_id: '4' | |
}, | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment