Skip to content

Commit 72b6844

Browse files
committed
add hrp argument
1 parent 7df0a2c commit 72b6844

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

multiversx_sdk_cli/cli_faucet.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def setup_parser(args: list[str], subparsers: Any) -> Any:
3030
sub.add_argument("--chain", choices=["D", "T"], help="the chain identifier")
3131
sub.add_argument("--api", type=str, help="custom api url for the native auth client")
3232
sub.add_argument("--wallet-url", type=str, help="custom wallet url to call the faucet from")
33+
sub.add_argument("--hrp", type=str, help="The hrp used to convert the address to its bech32 representation")
3334
sub.set_defaults(func=faucet)
3435

3536
parser.epilog = cli_shared.build_group_epilog(subparsers)

multiversx_sdk_cli/cli_shared.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ def add_wallet_args(args: list[str], sub: Any):
176176
help="🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: %(default)s)",
177177
)
178178
sub.add_argument("--sender-username", required=False, help="🖄 the username of the sender")
179+
sub.add_argument(
180+
"--hrp", required=False, type=str, help="The hrp used to convert the address to its bech32 representation"
181+
)
179182

180183

181184
def add_guardian_wallet_args(args: list[str], sub: Any):
@@ -304,9 +307,11 @@ def prepare_account(args: Any):
304307

305308

306309
def _get_address_hrp(args: Any) -> str:
307-
"""If proxy is provided, fetch the hrp from the network, otherwise get the hrp from config"""
308-
hrp: str = ""
310+
"""Use hrp provided by the user. If not provided, fetch from network. If proxy not provided, get hrp from config."""
311+
if hasattr(args, "hrp") and args.hrp:
312+
return args.hrp
309313

314+
hrp: str = ""
310315
if hasattr(args, "proxy") and args.proxy:
311316
hrp = _get_hrp_from_proxy(args)
312317
elif hasattr(args, "api") and args.api:

0 commit comments

Comments
 (0)