I'm looking for a Javascript implementation of the CLI's cardano-cli transaction policyid
function, can anyone point me in the right direction here?
Trying to replicate it with blakejs (https://github.com/dcposch/blakejs) and cbor-web (https://github.com/hildjj/node-cbor/tree/main/packages/cbor-web), but failing to get the hashes to match the output of the CLI.
Eg I want to create a PolicyID / ScriptHash from this policy script:
{
"type": "all",
"scripts":
[
{
"type": "before",
"slot": 42863577
},
{
"type": "sig",
"keyHash": "46a26617f9b59cc48945ccc6c0aecee732f7698fadbe8b5624b44b9e"
}
]
}
(CLI gives me this policyid: 463e9264962cea64efafa576d44c8d2821d09c0c7495c253d4101a9a)
In JS I'm trying something along these lines:
[removed, see correct answer below]
(gives me this: 5db35cd45775e7d7b0d1bd5491a9baea7ac54b41772a8c96ce587579)
Any guidance is very much appreciated