I struggle with these conversions all the time. I found this guide. But the array that I get back is of length 64 instead of 32.
To work with dfx I sometimes used a function on the invoice canister to do the conversion but I really need this to work in the front end now.
I’m just trying to call a local version of the ICP ledger to do a transaction.