Skip to content

Commit

Permalink
fix(cardano): change bech32 prefix to drep
Browse files Browse the repository at this point in the history
  • Loading branch information
jaskp committed Dec 8, 2023
1 parent 1275140 commit 8e84fc5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions core/src/apps/cardano/helpers/bech32.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
HRP_REQUIRED_SIGNER_KEY_HASH = "req_signer_vkh"
HRP_OUTPUT_DATUM_HASH = "datum"
HRP_SCRIPT_DATA_HASH = "script_data"
HRP_DREP_CREDENTIAL = 'drep'


def encode(hrp: str, data: bytes) -> str:
Expand Down
4 changes: 2 additions & 2 deletions core/src/apps/cardano/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,13 +744,13 @@ def _format_drep(drep: messages.CardanoDRep) -> tuple[str, str]:
assert drep.key_hash is not None # validate_drep
return (
"Delegating to key hash:",
bech32.encode(bech32.HRP_KEY_HASH, drep.key_hash),
bech32.encode(bech32.HRP_DREP_CREDENTIAL, drep.key_hash),
)
elif drep.type == CardanoDRepType.SCRIPT_HASH:
assert drep.script_hash is not None # validate_drep
return (
"Delegating to script:",
bech32.encode(bech32.HRP_SCRIPT_HASH, drep.script_hash),
bech32.encode(bech32.HRP_DREP_CREDENTIAL, drep.script_hash),
)
elif drep.type == CardanoDRepType.ABSTAIN:
return ("Delegating to:", "Abstain")
Expand Down

0 comments on commit 8e84fc5

Please sign in to comment.