node-lightning icon indicating copy to clipboard operation
node-lightning copied to clipboard

invoice: replace bech32 and bs58check packages

Open bmancini55 opened this issue 4 years ago • 4 comments

In the packages/invoice project, replace the bech32 and bs58check external packages with the internal @node-lightning/bitcoin package. The bitcoin package contains Bech32 and Base58Check classes that contain the same functionality.

Should also remove the bech32-util.ts helper. All of these functions are now included in the Bech32 class of the bitcoin package.

bmancini55 avatar Oct 22 '21 14:10 bmancini55

@bmancini55 I want to work on this issue, @node-lightning/bitcoin does not contain Bech32 class

hack3r-0m avatar Jan 10 '22 13:01 hack3r-0m

seems like changes are not published yet, can you publish them?

hack3r-0m avatar Jan 10 '22 13:01 hack3r-0m

@hack3r-0m sounds good. I'm working on it today. Need to get the secp256k1 lib published, which was the delay.

bmancini55 avatar Jan 10 '22 18:01 bmancini55

Should be in v0.27.0 now. Tip: you can add the npm package reference from the project root with lerna add <package_to_add> <target>. It will make sure everything is bootstrapped correctly.

bmancini55 avatar Jan 10 '22 19:01 bmancini55

I want to take a try at this. It looks like decoder.ts & encoder.ts are no longer required, right? as these functionality is now implemented in the Bech32 class inside the bitcoin package. Shall I remove these two files and their respective tests?

bilthon avatar Feb 17 '23 15:02 bilthon

I want to take a try at this. It looks like decoder.ts & encoder.ts are no longer required, right? as these functionality is now implemented in the Bech32 class inside the bitcoin package. Shall I remove these two files and their respective tests?

Great!

Those two files are still necessary since they perform the encoding and decoding of invoices. Those two files need to replace the bech32 package with the @node-lighting/bitcoin package's Bech32 implementation.

Additionally, invoice.ts has both bech32 and bs58 references. It will need to be modified to replace both with the versions in @node-lightning/bitcoin.

bmancini55 avatar Feb 17 '23 16:02 bmancini55

Ok it seems like I forgot to run prettier and some code style changes in the decoder.test.ts file are required, can I add a new commit to the same PR or shall I just create a new PR?

bilthon avatar Feb 18 '23 18:02 bilthon

You can push a new commit to the same PR. Thanks!

bmancini55 avatar Feb 18 '23 18:02 bmancini55

Done!

bilthon avatar Feb 20 '23 14:02 bilthon