Update auto-generated bindings
[ldk-java] / ts / structs / Confirm.ts
1
2             
3 import CommonBase from './CommonBase';
4 import * as bindings from '../bindings' // TODO: figure out location
5
6
7
8             export class Confirm extends CommonBase {
9
10                 bindings_instance?: bindings.LDKConfirm;
11
12                 constructor(ptr?: number, arg?: bindings.LDKConfirm) {
13                     if (Number.isFinite(ptr)) {
14                                         super(ptr);
15                                         this.bindings_instance = null;
16                                     } else {
17                                         // TODO: private constructor instantiation
18                                         super(bindings.LDKConfirm_new(arg));
19                                         this.ptrs_to.push(arg);
20                                         
21                                     }
22                 }
23
24                 protected finalize() {
25                     if (this.ptr != 0) {
26                         bindings.Confirm_free(this.ptr);
27                     }
28                     super.finalize();
29                 }
30
31                 static new_impl(arg: ConfirmInterface): Confirm {
32                     const impl_holder: LDKConfirmHolder = new LDKConfirmHolder();
33                     let structImplementation = <bindings.LDKConfirm>{
34                         // todo: in-line interface filling
35                         transactions_confirmed (header: Uint8Array, txdata: number[], height: number): void {
36                                                         TwoTuple<Number, Uint8Array>[] txdata_conv_30_arr = new TwoTuple[txdata.length];
37                                 for (int e = 0; e < txdata.length; e++) {
38                                         number txdata_conv_30 = txdata[e];
39                                         number txdata_conv_30_a = bindings.LDKC2Tuple_usizeTransactionZ_get_a(txdata_conv_30);
40                                         Uint8Array txdata_conv_30_b = bindings.LDKC2Tuple_usizeTransactionZ_get_b(txdata_conv_30);
41                                         TwoTuple<Number, Uint8Array> txdata_conv_30_conv = new TwoTuple<Number, Uint8Array>(txdata_conv_30_a, txdata_conv_30_b, () -> {
42                                                 bindings.C2Tuple_usizeTransactionZ_free(txdata_conv_30);
43                                         });
44                                         txdata_conv_30_arr[e] = txdata_conv_30_conv;
45                                 }
46                                                         arg.transactions_confirmed(header, txdata_conv_30_arr, height);
47                                                 },
48
49                                                 transaction_unconfirmed (txid: Uint8Array): void {
50                                                         arg.transaction_unconfirmed(txid);
51                                                 },
52
53                                                 best_block_updated (header: Uint8Array, height: number): void {
54                                                         arg.best_block_updated(header, height);
55                                                 },
56
57                                                 get_relevant_txids (): Uint8Array[] {
58                                                         Uint8Array[] ret = arg.get_relevant_txids();
59                                 return ret;
60                                                 },
61
62                                                 
63                     };
64                     impl_holder.held = new Confirm (null, structImplementation);
65                 }
66             }
67
68             export interface ConfirmInterface {
69                 transactions_confirmed(header: Uint8Array, txdata: TwoTuple<Number, Uint8Array>[], height: number): void;
70                                 transaction_unconfirmed(txid: Uint8Array): void;
71                                 best_block_updated(header: Uint8Array, height: number): void;
72                                 get_relevant_txids(): Uint8Array[];
73                                 
74             }
75
76             class LDKConfirmHolder {
77                 held: Confirm;
78             }
79         public void transactions_confirmed(Uint8Array header, TwoTuple<Number, Uint8Array>[] txdata, number height) {
80                 bindings.Confirm_transactions_confirmed(this.ptr, header, Arrays.stream(txdata).map(txdata_conv_30 -> bindings.C2Tuple_usizeTransactionZ_new(txdata_conv_30.a, txdata_conv_30.b)).toArray(number[]::new), height);
81                 /* TODO 2 TwoTuple<Number, Uint8Array>  */;
82         }
83
84         public void transaction_unconfirmed(Uint8Array txid) {
85                 bindings.Confirm_transaction_unconfirmed(this.ptr, txid);
86         }
87
88         public void best_block_updated(Uint8Array header, number height) {
89                 bindings.Confirm_best_block_updated(this.ptr, header, height);
90         }
91
92         public Uint8Array[] get_relevant_txids() {
93                 Uint8Array[] ret = bindings.Confirm_get_relevant_txids(this.ptr);
94                 return ret;
95         }
96
97 }