Accept keys with or without hex prefix
This commit is contained in:
parent
30654bb0ef
commit
a5be88ed6c
10
README.md
10
README.md
@ -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
|
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
|
## Gas and Fees
|
||||||
|
|
||||||
|
@ -6,11 +6,16 @@ export const getConnectionInfo = (argv: Arguments, config: any) => {
|
|||||||
|
|
||||||
const result = {
|
const result = {
|
||||||
...config,
|
...config,
|
||||||
|
userKey: stripHexPrefix(config.userKey),
|
||||||
...clean({ server, userKey, bondId, txKey, chainId }),
|
...clean({ server, userKey, bondId, txKey, chainId }),
|
||||||
privateKey: txKey || userKey || config.userKey,
|
privateKey: stripHexPrefix(txKey || userKey || config.userKey),
|
||||||
gas: String(gas || config.gas),
|
gas: String(gas || config.gas),
|
||||||
fees: String(fees || config.fees)
|
fees: String(fees || config.fees)
|
||||||
};
|
};
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function stripHexPrefix (hex: string): string {
|
||||||
|
return hex && hex.startsWith('0x') ? hex.slice(2) : hex;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user