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