feat: WIF private key sweeps
Description
Relates to issue: ZEUS-2791
This PR aims to implement WIF private key sweeps
This pull request is categorized as a:
- [x] New feature
- [ ] Bug fix
- [ ] Code refactor
- [ ] Configuration change
- [ ] Locales update
- [ ] Quality assurance
- [ ] Other
Checklist
- [x] I’ve run
yarn run tscand made sure my code compiles correctly - [x] I’ve run
yarn run lintand made sure my code didn’t contain any problematic patterns - [x] I’ve run
yarn run prettierand made sure my code is formatted correctly - [x] I’ve run
yarn run testand made sure all of the tests pass
Testing
If you modified or added a utility file, did you add new unit tests?
- [ ] No, I’m a fool
- [ ] Yes
- [x] N/A
I have tested this PR on the following platforms (please specify OS version and phone model/VM):
- [x] Android
- [ ] iOS
I have tested this PR with the following types of nodes (please specify node version and API version where appropriate):
- [ ] Embedded LND
- [ ] LND (REST)
- [ ] LND (Lightning Node Connect)
- [x] Core Lightning (CLNRest)
- [ ] Nostr Wallet Connect
- [ ] LndHub
Locales
- [ ] I’ve added new locale text that requires translations
- [ ] I’m aware that new translations should be made on the ZEUS Transfix page and not directly to this repo
Third Party Dependencies and Packages
- [ ] Contributors will need to run
yarnafter this PR is merged in - [ ] 3rd party dependencies have been modified:
- verify that
package.jsonandyarn.lockhave been properly updated - verify that dependencies are installed for both iOS and Android platforms
- verify that
Other:
- [ ] Changes were made that require an update to the README
- [ ] Changes were made that require an update to onboarding
@kaloudis, the code rn, validates the WIF entered, the sweeps functionality is pending, please review the current changes.
@kaloudis, how should the user choose the destination address to sweep the UTXOs to?
@kaloudis, how should the user choose the destination address to sweep the UTXOs to?
can I use getNewAddress from backendUtils to generate a new address where the UTXOs will be swept?
@kaloudis, how should the user choose the destination address to sweep the UTXOs to?
can I use
getNewAddressfrombackendUtilsto generate a new address where the UTXOs will be swept?
In the new swaps branch we have both a field where a user can input a destination address manually as well as a button to to autogenerate one. This is probably the best approach here as well.
In the new
swapsbranch we have both a field where a user can input a destination address manually as well as a button to to autogenerate one. This is probably the best approach here as well.
got it, will check that out.
@kaloudis, can i use tiny-secp256k1 library, because
import ECPairFactory from 'ecpair';
import * as ecc from '@noble/secp256k1';
const ECPair = ECPairFactory(ecc);
this has an error saying ecc is not of type TinySecp256k1Interface
i need use it as ECPair.fromWIF(wif) for getting keypair
Try import ecc from '../zeus_modules/noble_ecc';
import ECPairFactory from 'ecpair';
import ecc from '../zeus_modules/noble_ecc';
const ECPair = ECPairFactory(ecc);
@kaloudis i'm using the above, but getting error:
commenting those 3 lines makes the app run.
import ECPairFactory from 'ecpair'; import ecc from '../zeus_modules/noble_ecc'; const ECPair = ECPairFactory(ecc);@kaloudis i'm using the above, but getting error:
![]()
commenting those 3 lines makes the app run.
this has been resolved, in the current code by not using ECPair itself, instead import ecc from '../zeus_modules/noble_ecc'; is sufficient and function calls have been made on it.
@kaloudis can you review this?
https://github.com/user-attachments/assets/f15ff459-8cf0-408a-8d17-09cf2a48f17d
current working of the sweep
@a-khushal Please resolve the conflicts
@a-khushal Please resolve the conflicts
@shubhamkmr04 done
Should we put it in Tools section? cc @kaloudis
Yes, let's put it under Tools.
Should we put it in Tools section? cc @kaloudis
Yes, let's put it under
Tools.
done, i've moved it to tools
the generated on-chain address stays on until we refresh the app. I think we should be able to create a new one each time we come on the view
@shubhamkmr04 it should be fixed now(259892a)
@a-khushal can you add a list of checkboxes in the PR description for us to keep track of which script types have been implemented so far?
@a-khushal can you add a list of checkboxes in the PR description for us to keep track of which script types have been implemented so far?
@kaloudis I have updated
@a-khushal please rebase
Also, thoughts on P2TR sweeps? Is it practical to do? If not, should we just include a disclaimer instead. Is that necessary?
can we have a message stating P2TR sweeps aren't supported yet? if an user is trying to sweep a p2tr addr
can we have a message stating
P2TR sweeps aren't supported yet? if an user is trying to sweep ap2traddr
Yes, create a separate commit for this that includes commented code that links to the issue and/or potential draft PR of the work you started on it, so we can keep track of it.
@kaloudis i've removed the code for p2tr. i will raise another PR specific to p2tr sweep once this PR get's merged.
@kaloudis i've removed the code for
p2tr. i will raise another PR specific top2trsweep once this PR get's merged.
Still see the P2TR stuff in 627f2b4576e494621ce617b2e316ff744bd87d2d
@kaloudis should be fixed now.
The only thing I would really like to see is some sort of warning when using
Mempool.spaceinstead of your own to broadcast
@kaloudis
@a-khushal, i think we should move WIFSweeper.tsx to the tools folder