Commit 3fbdb48
ffi: use dictionary for PaidBolt12Invoice due to UniFFI limitation
This patch reverts PaidBolt12Invoice to a dictionary format in the UDL
while keeping the simplified structure without the redundant kind field.
Problem:
UniFFI doesn't support Object types (interfaces) in enum variant data.
The previous commit attempted to use [Enum] interface format, but this
fails to compile because Bolt12Invoice and StaticInvoice are defined
as interfaces.
Solution:
Use a dictionary with optional fields instead of an enum. Users check
which field is Some to determine the invoice type:
- bolt12_invoice: A standard BOLT12 invoice (supports proof of payment)
- static_invoice: A static invoice for async payments
This is still an improvement over the original implementation as it
removes the redundant PaidBolt12InvoiceKind enum field.
The non-uniffi Rust API keeps the cleaner enum representation.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>1 parent 4442e83 commit 3fbdb48
2 files changed
+36
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
873 | 873 | | |
874 | 874 | | |
875 | 875 | | |
876 | | - | |
877 | | - | |
878 | | - | |
879 | | - | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
880 | 882 | | |
881 | 883 | | |
882 | 884 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
801 | 801 | | |
802 | 802 | | |
803 | 803 | | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
804 | 809 | | |
805 | 810 | | |
806 | | - | |
807 | | - | |
808 | | - | |
809 | | - | |
810 | | - | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
811 | 816 | | |
812 | 817 | | |
813 | 818 | | |
814 | 819 | | |
815 | 820 | | |
816 | | - | |
817 | | - | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
818 | 824 | | |
819 | | - | |
820 | | - | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
821 | 828 | | |
822 | 829 | | |
823 | 830 | | |
824 | 831 | | |
825 | 832 | | |
826 | 833 | | |
827 | 834 | | |
828 | | - | |
829 | | - | |
830 | | - | |
831 | | - | |
832 | | - | |
833 | | - | |
834 | | - | |
835 | | - | |
836 | | - | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
837 | 841 | | |
838 | 842 | | |
839 | 843 | | |
| |||
847 | 851 | | |
848 | 852 | | |
849 | 853 | | |
850 | | - | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
851 | 858 | | |
852 | 859 | | |
853 | 860 | | |
854 | 861 | | |
855 | | - | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
856 | 866 | | |
857 | 867 | | |
858 | 868 | | |
| |||
0 commit comments