]> git.bitcoin.ninja Git - ldk-java/blob - ts/structs/Sign.ts
Fix CI
[ldk-java] / ts / structs / Sign.ts
1
2             
3 import CommonBase from './CommonBase';
4 import * as bindings from '../bindings' // TODO: figure out location
5
6
7
8             export class Sign extends CommonBase {
9
10                 bindings_instance?: bindings.LDKSign;
11
12                 constructor(ptr?: number, arg?: bindings.LDKSign, baseSign?: bindings.LDKBaseSign, pubkeys?: ChannelPublicKeys) {
13                     if (Number.isFinite(ptr)) {
14                                         super(ptr);
15                                         this.bindings_instance = null;
16                                     } else {
17                                         // TODO: private constructor instantiation
18                                         super(bindings.LDKSign_new(arg, baseSign, pubkeys == null ? 0 : pubkeys.ptr & ~1));
19                                         this.ptrs_to.push(arg);
20                                         this.ptrs_to.push(baseSign);
21 this.ptrs_to.add(pubkeys);
22
23                                     }
24                 }
25
26                 protected finalize() {
27                     if (this.ptr != 0) {
28                         bindings.Sign_free(this.ptr);
29                     }
30                     super.finalize();
31                 }
32
33                 static new_impl(arg: SignInterface, baseSign_impl: BaseSign.BaseSignInterface, pubkeys: ChannelPublicKeys): Sign {
34                     const impl_holder: LDKSignHolder = new LDKSignHolder();
35                     let structImplementation = <bindings.LDKSign>{
36                         // todo: in-line interface filling
37                         write (): Uint8Array {
38                                                         Uint8Array ret = arg.write();
39                                 return ret;
40                                                 },
41
42                                                 
43                     };
44                     impl_holder.held = new Sign (null, structImplementation, BaseSign.new_impl(BaseSign_impl, pubkeys).bindings_instance, pubkeys);
45                 }
46             }
47
48             export interface SignInterface {
49                 write(): Uint8Array;
50                                 
51             }
52
53             class LDKSignHolder {
54                 held: Sign;
55             }
56         public Uint8Array write() {
57                 Uint8Array ret = bindings.Sign_write(this.ptr);
58                 return ret;
59         }
60
61         public Sign clone() {
62                 number ret = bindings.Sign_clone(this.ptr);
63                 Sign ret_hu_conv = new Sign(null, ret);
64                 ret_hu_conv.ptrs_to.add(this);
65                 return ret_hu_conv;
66         }
67
68 }