]> git.bitcoin.ninja Git - ldk-java/blob - ts/structs/BroadcasterInterface.ts
Merge pull request #2 from TheBlueMatt/main
[ldk-java] / ts / structs / BroadcasterInterface.ts
1
2             
3 import CommonBase from './CommonBase';
4 import * as bindings from '../bindings' // TODO: figure out location
5
6
7
8             export class BroadcasterInterface extends CommonBase {
9
10                 bindings_instance?: bindings.LDKBroadcasterInterface;
11
12                 constructor(ptr?: number, arg?: bindings.LDKBroadcasterInterface) {
13                     if (Number.isFinite(ptr)) {
14                                         super(ptr);
15                                         this.bindings_instance = null;
16                                     } else {
17                                         // TODO: private constructor instantiation
18                                         super(bindings.LDKBroadcasterInterface_new(arg));
19                                         this.ptrs_to.push(arg);
20                                         
21                                     }
22                 }
23
24                 protected finalize() {
25                     if (this.ptr != 0) {
26                         bindings.BroadcasterInterface_free(this.ptr);
27                     }
28                     super.finalize();
29                 }
30
31                 static new_impl(arg: BroadcasterInterfaceInterface): BroadcasterInterface {
32                     const impl_holder: LDKBroadcasterInterfaceHolder = new LDKBroadcasterInterfaceHolder();
33                     let structImplementation = <bindings.LDKBroadcasterInterface>{
34                         // todo: in-line interface filling
35                         broadcast_transaction (tx: Uint8Array): void {
36                                                         arg.broadcast_transaction(tx);
37                                                 },
38
39                                                 
40                     };
41                     impl_holder.held = new BroadcasterInterface (null, structImplementation);
42                 }
43             }
44
45             export interface BroadcasterInterfaceInterface {
46                 broadcast_transaction(tx: Uint8Array): void;
47                                 
48             }
49
50             class LDKBroadcasterInterfaceHolder {
51                 held: BroadcasterInterface;
52             }
53         public void broadcast_transaction(Uint8Array tx) {
54                 bindings.BroadcasterInterface_broadcast_transaction(this.ptr, tx);
55         }
56
57 }