Skip to content

Commit

Permalink
fixup! Add json serializers for invoices and offers (#662) (#663)
Browse files Browse the repository at this point in the history
  • Loading branch information
pm47 authored Jun 14, 2024
1 parent f739e46 commit 1397654
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@ object JsonSerializers {
contextual(TransactionSerializer)
contextual(ByteVectorSerializer)
contextual(ByteVector32Serializer)

contextual(Bolt11InvoiceSerializer)
contextual(OfferSerializer)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ class JsonTestsCommon : LightningTestSuite() {
val invoice =
Bolt11Invoice.read("lntb123450n1pnx4cf2pp565tka26famjckm35lakwsrtnmfk7nzwm3va2u8tdu3kw7u80n5hqcqpjsp5guyuj6v84zyfxm3ae8y49rffgkcxsky73hun8mwvqfjdxw46ea0q9q7sqqqqqqqqqqqqqqqqqqqsqqqqqysgqdq523jhxapqd9h8vmmfvdjsmqz9gxqyjw5qrzjqwfn3p9278ttzzpe0e00uhyxhned3j5d9acqak5emwfpflp8z2cnfl6m5dzjwjw4hyqqqqlgqqqqqeqqjqedwgzyf2kuzyu4erj4xhdtknc9d8y8xkt8z80cpulg2q0mvgdcv4e7mgntf2nhur0x72k57ql7zx8ydzwtrxcnx9nk4pj65vfnhd3hsqyzlyxm")
.get()
JsonSerializers.json.encodeToString(JsonSerializers.Bolt11InvoiceSerializer, invoice)
JsonSerializers.json.encodeToString(invoice)
}

@Test
fun `serialize bolt12 offer`() {
val offer =
OfferTypes.Offer.decode("lno1qgsyxjtl6luzd9t3pr62xr7eemp6awnejusgf6gw45q75vcfqqqqqqqsespexwyy4tcadvgg89l9aljus6709kx235hhqrk6n8dey98uyuftzdqrt2gkjvf2rj2vnt7m7chnmazen8wpur2h65ttgftkqaugy6ql9dcsyq39xc2g084xfn0s50zlh2ex22vvaqxqz3vmudklz453nns4d0624sqr8ux4p5usm22qevld4ydfck7hwgcg9wc3f78y7jqhc6hwdq7e9dwkhty3svq5ju4dptxtldjumlxh5lw48jsz6pnagtwrmeus7uq9rc5g6uddwcwldpklxexvlezld8egntua4gsqqy8auz966nksacdac8yv3maq6elp")
.get()
JsonSerializers.json.encodeToString(JsonSerializers.OfferSerializer, offer)
JsonSerializers.json.encodeToString(offer)
}
}

0 comments on commit 1397654

Please sign in to comment.