2

I'm getting the following error when I try to deploy my smart contract to Rinkeby using Truffle:

Error: Unknown arguments format passed to new HDWalletProvider. Please check your
configuration and try again

Note: I haven't had any problems deploying this same contract locally using Truffle, only to Rinkeby.

Here's my code:

require('dotenv').config();
const HDWalletProvider = require('@truffle/hdwallet-provider');  

module.exports = {
  networks: {
     development: {
        host: "127.0.0.1",     
        port: 8545,            
        network_id: "*",   
     },

     rinkeby: {
        provider: () => new HDWalletProvider(process.env.RINKEBY_MNENOMIC, 
        "https://rinkeby.infura.io/v3/${process.env.INFURA_API_KEY}"),
         host: "127.0.0.1", 
         network_id: 4,
         gas: 4612388,
         gasPrice: 10000000000
     },
 },

 // Configure your compilers
 compilers: {
    solc: {
       version: "0.6.2",  
    }
 }

}

I'm wondering if this is some sort of version issue cause I'm seeing that my previous contracts used 'truffle-hdwallet-provider', while this one is using '@truffle/hdwallet-provider'

Meanwhile, my .env file contains the following:

#MNENOMIC="word1 word2 word3, ...word12"
RINKEBY_MNENOMIC="word1 word2 word3, ...word12"
PRODUCTION_MNENOMIC="word1 word2 word3, ...word12"

INFURA_API_KEY="xxxxxxxxxxxxxxxxxxxx"

So what might be happening here? What is this Unknown arguments format passed to new HDWalletProvider error all about?

2

Looks like it was a version thing.

According to Truffle's official readme (available here: https://github.com/trufflesuite/truffle/tree/develop/packages/hdwallet-provider#truffle-usage) the way to do this now is as follows:

rinkeby: {
  provider: () =>
    new HDWalletProvider({
      mnemonic: {
        phrase: rinkebyMnemonic
      },
      providerOrUrl: "https://rinkeby.infura.io/v3/" + infuraKey,
      numberOfAddresses: 1,
      shareNonce: true,
    }),
  network_id: '4',
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.