Some of the cardano-wallet API endpoints ask for 'walletId'. Does anyone know where to retrieve this value from Daedalus? I only see wallet public key/wallet multi-sig public key.
2 Answers
cardano-wallet is able to create/store multiple wallets - https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/listWallets
Daedalus wallet IDs have nothing in common with these - I think you need to re-create the wallet in cardano-wallet using either mnemonic words or using account xPub from Daedalus.
Also check out https://github.com/input-output-hk/cardano-addresses which contains examples of deriving various key types and addresses.
As sorki replied you can indeed run a new cardano-node
+ cardano-wallet
instance and restore the desired wallet by specifying its mnemonic sentence and copying the wallet_id
shown in the API response.
Since Daedalus already runs cardano-node
+ cardano-wallet
in the background you could perfectly query that API directly. If you're in a *nix system you could run Daedalus from the terminal like this
daedalus-mainnet 2>&1 | sed -u -n '/cardano-wallet/p' | sed -u -n 's/^.* --port \([0-9]*\) .*$/PORT: \1/p'
to get Daedalus cardano-wallet
's port. Also since Daedalus' front-end communicates with Daedalus' back-end using a client certificate you'd have to use the very same one. Their location depends where did you install Daedalus, in my case they're located here
CLIENT_CRT='~/.local/share/Daedalus/mainnet/tls/client/client.crt'
CLIENT_KEY='~/.local/share/Daedalus/mainnet/tls/client/client.key'
CA_CRT='~/.local/share/Daedalus/mainnet/tls/client/ca.crt'
Then you can query the list of wallets and get the wallet_id
curl --cert "${CLIENT_CRT}" --key "${CLIENT_KEY}" --cacert "${CA_CRT}" https://localhost:<PORT_NUMBER>/v2/wallets