I'm using nami wallet's api, and if I call cardano.getUsedAddresses() it return a "hex encoded bytes string" and I would like to know how I can convert that to something readable
1 Answer
First, getUsedAddresses()
returns a list of all used (included in some on-chain transaction) addresses controlled by the wallet1.
To decode, can use decodeHexAddress
on getUsedAddresses()
elements.
1 https://cips.cardano.org/cips/cip30/#apigetusedaddressespaginatepaginateundefinedpromiseaddress
-
that file is written in typescript. I have used javascript. should I switch to typescript? Commented Nov 29, 2022 at 16:50
-
Entirely up to you. You can import this function inside your JS project, like so:
import { decodeHexAddress } from '@cardano-foundation/cardano-connect-with-wallet'
.– SourabhCommented Dec 5, 2022 at 7:23