Initial checkin
[ldk-swift-linux] / LDKSwift / Sources / LDKSwift / options / SpendableOutputDescriptor.swift
1 import LDKCHeaders
2
3 public class SpendableOutputDescriptor {
4
5     public internal(set) var cOpaqueStruct: LDKSpendableOutputDescriptor?;
6
7         
8
9     public init(pointer: LDKSpendableOutputDescriptor){
10                 self.cOpaqueStruct = pointer
11         }
12
13     /* OPTION_METHODS_START */
14
15                                 public enum SpendableOutputDescriptorValueType {
16                                         case StaticOutput, DelayedPaymentOutput, StaticPaymentOutput
17                                 }
18                                 
19                                 public func getValueType() -> SpendableOutputDescriptorValueType? {
20                                         switch self.cOpaqueStruct?.tag {
21                     
22                                         case LDKSpendableOutputDescriptor_StaticOutput:
23                                                 return .StaticOutput
24                                         case LDKSpendableOutputDescriptor_DelayedPaymentOutput:
25                                                 return .DelayedPaymentOutput
26                                         case LDKSpendableOutputDescriptor_StaticPaymentOutput:
27                                                 return .StaticPaymentOutput
28                     default:
29                         return nil
30                     }
31                                 }
32                                 
33                                 
34                                         public func getValueAsStaticOutput() -> StaticOutput? {
35                                                 if self.cOpaqueStruct?.tag != LDKSpendableOutputDescriptor_StaticOutput {
36                                                         return nil
37                                                 }
38                                                 return StaticOutput(pointer: self.cOpaqueStruct!.static_output)
39                                         }
40                                 
41                                         public func getValueAsDelayedPaymentOutput() -> DelayedPaymentOutputDescriptor? {
42                                                 if self.cOpaqueStruct?.tag != LDKSpendableOutputDescriptor_DelayedPaymentOutput {
43                                                         return nil
44                                                 }
45                                                 return DelayedPaymentOutputDescriptor(pointer: self.cOpaqueStruct!.delayed_payment_output)
46                                         }
47                                 
48                                         public func getValueAsStaticPaymentOutput() -> StaticPaymentOutputDescriptor? {
49                                                 if self.cOpaqueStruct?.tag != LDKSpendableOutputDescriptor_StaticPaymentOutput {
50                                                         return nil
51                                                 }
52                                                 return StaticPaymentOutputDescriptor(pointer: self.cOpaqueStruct!.static_payment_output)
53                                         }
54                                 
55                         
56     /* OPTION_METHODS_END */
57
58         
59
60                         public class StaticOutput {
61                                 
62                                 
63                                 var cOpaqueStruct: LDKSpendableOutputDescriptor_LDKStaticOutput_Body?;
64                                 fileprivate init(pointer: LDKSpendableOutputDescriptor_LDKStaticOutput_Body) {
65                                         self.cOpaqueStruct = pointer
66                                 }
67                         
68                                 
69                                 
70                                         public func getOutpoint() -> OutPoint {
71                                                 return OutPoint(pointer: self.cOpaqueStruct!.outpoint)
72                                         }
73                                 
74                                         public func getOutput() -> TxOut {
75                                                 return TxOut(pointer: self.cOpaqueStruct!.output)
76                                         }
77                                 
78                                 
79                         }
80                 
81 }