Accept keys with or without hex prefix

This commit is contained in:
Prathamesh Musale 2024-08-14 10:14:20 +05:30
parent 30654bb0ef
commit 741942194f

View File

@ -6,11 +6,16 @@ export const getConnectionInfo = (argv: Arguments, config: any) => {
const result = {
...config,
userKey: stripHexPrefix(config.userKey),
...clean({ server, userKey, bondId, txKey, chainId }),
privateKey: txKey || userKey || config.userKey,
privateKey: stripHexPrefix(txKey || userKey || config.userKey),
gas: String(gas || config.gas),
fees: String(fees || config.fees)
};
return result;
};
function stripHexPrefix (hex: string): string {
return hex && hex.startsWith('0x') ? hex.slice(2) : hex;
}