+ internal static Amount constr_from_ptr(long ptr) {
+ long raw_ty = bindings.LDKAmount_ty_from_ptr(ptr);
+ switch (raw_ty) {
+ case 0: return new Amount_Bitcoin(ptr);
+ case 1: return new Amount_Currency(ptr);
+ default:
+ throw new ArgumentException("Impossible enum variant");
+ }
+ }
+
+ /** A Amount of type Bitcoin */
+ public class Amount_Bitcoin : Amount {
+ /**
+ * The amount in millisatoshi.
+ */
+ public long amount_msats;
+ internal Amount_Bitcoin(long ptr) : base(null, ptr) {
+ this.amount_msats = bindings.LDKAmount_Bitcoin_get_amount_msats(ptr);
+ }
+ }
+ /** A Amount of type Currency */
+ public class Amount_Currency : Amount {
+ /**
+ * The currency that the amount is denominated in.
+ */
+ public byte[] iso4217_code;
+ /**
+ * The amount in the currency unit adjusted by the ISO 4712 exponent (e.g., USD cents).
+ */
+ public long amount;
+ internal Amount_Currency(long ptr) : base(null, ptr) {
+ long iso4217_code = bindings.LDKAmount_Currency_get_iso4217_code(ptr);
+ byte[] iso4217_code_conv = InternalUtils.decodeUint8Array(iso4217_code);
+ this.iso4217_code = iso4217_code_conv;
+ this.amount = bindings.LDKAmount_Currency_get_amount(ptr);
+ }
+ }