Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

First argument to new HDWalletProvider() must be a mnemonic phrase, a single private key, or a list of private keys #11

Open
ltfschoen opened this issue Jun 21, 2023 · 1 comment

Comments

@ltfschoen
Copy link

ltfschoen commented Jun 21, 2023

Using the latest "@truffle/hdwallet-provider": "^2.1.12",, when I tried to run truffle migrate --reset --compile-all --network moonbase it gave me an error First argument to new HDWalletProvider() must be a mnemonic phrase, a single private key, or a list of private keys., it now expects the private key is a Uint8Array with length 32 to be provided as an array.
so provide a parameter privateKeys and type string[] as mentioned here https://github.com/trufflesuite/truffle/tree/develop/packages/hdwallet-provider

so i change it to

let args = {
   privateKeys: [privateKeyDev],
   providerOrUrl: 'http://localhost:9944/',
};
return new HDWalletProvider(args);

...

let args = {
   privateKeys: [privateKeyMoonbase],
   providerOrUrl: 'https://rpc.api.moonbase.moonbeam.network',
};
return new HDWalletProvider(args);
@eshaben
Copy link
Contributor

eshaben commented Jul 3, 2023

hello! even with ^2.1.12 the private key as a string should work as it is a legacy parameter, but this raises a good point that we should update to the current accepted parameters (which also apply to the current version ^2.0.8).

I'll submit a PR for it. thanks for bringing this up!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants