3

So far when I try to create a wallet with a recovery phrase that already exist the server returns 409 conflict and an error message saying: "This operation would yield a wallet with the following id: {id} However, I already know of a wallet with this id."

So the question is: Is there another way rather than extracting the id from the response message? I mean hopefully there is a better way to get the wallet Id, from the recovery phrase maybe?

leobelizquierdo
  • 1,648
  • 12
  • 20

2 Answers2

4

Not at present, POST /v2/wallets is the only way the app allows a user to provide a mnemonic phrase, and as you've found it doesn't return the ID as a separate field.

If you're using cardano-wallet to handle only a single wallet, one could just 'List' all wallets, and pick it from the list.

soccer193
  • 413
  • 2
  • 7
  • how can I pick it from the list, I guess that by name right? – leobelizquierdo Mar 31 '21 at 01:38
  • if you're only handling one wallet at a time, then `GET /v2/wallets` will return a JSON array with only one element in the array. So, you'd do something like `myWallet = result[0]`, if you had saved the JSON array to `result`. – soccer193 Apr 06 '21 at 05:15
0

As soccer193 already point out, there isn't a way to get back the wallet Id from the mnemonic phrase right now although there are plans to include it in some way as you can confirm from this issue from cardano-wallet's github repo.

leobelizquierdo
  • 1,648
  • 12
  • 20