pinheadmz / swap-test

Cross-chain atomic swaps for bcoin and bcash
https://bcoin.io/guides/swaps
16 stars 4 forks source link

Must add HD public keys for watch only wallets. #2

Open shubhambankar2197 opened 3 years ago

shubhambankar2197 commented 3 years ago

Hey,

I am trying to run this locally but I am facing the issue. Whenever I start to swap it gives me an error Must add HD public keys for watch only wallets.

Could you please help to resolve this?

Thanks in advance.

pinheadmz commented 3 years ago

Thanks for checking out this project! However it is a bit outdated. You may have already noticed that bcash is deprecated and no longer maintained. It may work in SPV mode but there are no guarantees. BCH has hard forked several times since the last commit to the bcash repo.

More specifically about your issue, bcoin now requires xpubs when creating watch-only wallets this was added shortly after the original swap article was published.

This means that when we create a watchonly wallet here...

https://github.com/pinheadmz/swap-test/blob/ab519218db52dfaf0b5069484fada7725a7c2577/app/run-swap.js#L450

...and here...

https://github.com/pinheadmz/swap-test/blob/ab519218db52dfaf0b5069484fada7725a7c2577/app/run-swap.js#L417

...we would also need to add the option accountKey: xpub.... The xpub can be any xpub (it won't affect the swaps application) but it is required now so that users don't accidentally generate addresses they don't have the private keys for.