Accept keys with or without hex prefix
All checks were successful
Lint / lint (18.x) (pull_request) Successful in 1m9s
Tests / cli_tests (18.x) (pull_request) Successful in 8m58s

This commit is contained in:
Prathamesh Musale 2024-08-14 10:14:20 +05:30
parent 30654bb0ef
commit a5be88ed6c
2 changed files with 15 additions and 2 deletions

View File

@ -54,7 +54,15 @@ Registering records in registry requires an account. To get account private key
laconicd keys export alice --keyring-backend test --unarmored-hex --unsafe
```
In `config.yml` file assign the account private key to `userKey`.
In `config.yml` file assign the account private key to `userKey`:
```yml
services:
registry:
..
userKey: "<user-key>"
..
```
## Gas and Fees

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;
}