[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / WitnessProgram.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
7
8 public class WitnessProgram : CommonBase {
9         /** The witness program bytes themselves */
10         public readonly byte[] program;
11         /** The witness version */
12         public readonly WitnessVersion version;
13
14         internal WitnessProgram(object _dummy, long ptr) : base(ptr) {
15                 this.program = InternalUtils.decodeUint8Array(bindings.WitnessProgram_get_program(ptr));
16                 this.version = new WitnessVersion(bindings.WitnessProgram_get_version(ptr));
17         }
18         static private long check_args(byte[] program, WitnessVersion version) {
19                 if (program.Length < 2 || program.Length > 40) throw new ArgumentException();
20                 if (version.getVal() == 0 && program.Length != 20 && program.Length != 32) throw new ArgumentException();
21                 return InternalUtils.encodeUint8Array(program);
22         }
23         public WitnessProgram(byte[] program, WitnessVersion version) :
24                 this(null, bindings.WitnessProgram_new(version.getVal(), check_args(program, version))) {}
25
26         ~WitnessProgram() {
27                 if (ptr != 0) { bindings.WitnessProgram_free(ptr); }
28         }
29 }} } }