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_usizeTransactionZ[] txdata_conv_28_arr = new TwoTuple_usizeTransactionZ[txdata.length];
37                                 for (int c = 0; c < txdata.length; c++) {
38                                         number txdata_conv_28 = txdata[c];
39                                         TwoTuple_usizeTransactionZ txdata_conv_28_hu_conv = new TwoTuple_usizeTransactionZ(null, txdata_conv_28);
40                                         txdata_conv_28_hu_conv.ptrs_to.add(this);
41                                         txdata_conv_28_arr[c] = txdata_conv_28_hu_conv;
42                                 }
43                                                         arg.transactions_confirmed(header, txdata_conv_28_arr, height);
44                                                 },
45
46                                                 transaction_unconfirmed (txid: Uint8Array): void {
47                                                         arg.transaction_unconfirmed(txid);
48                                                 },
49
50                                                 best_block_updated (header: Uint8Array, height: number): void {
51                                                         arg.best_block_updated(header, height);
52                                                 },
53
54                                                 get_relevant_txids (): Uint8Array[] {
55                                                         Uint8Array[] ret = arg.get_relevant_txids();
56                                 result: Uint8Array[] = ret != null ? Arrays.stream(ret).map(ret_conv_12 -> InternalUtils.check_arr_len(ret_conv_12, 32)).toArray(Uint8Array[]::new) : null;
57                                 return result;
58                                                 },
59
60                                                 
61                     };
62                     impl_holder.held = new Confirm (null, structImplementation);
63                 }
64             }
65
66             export interface ConfirmInterface {
67                 transactions_confirmed(header: Uint8Array, txdata: TwoTuple_usizeTransactionZ[], height: number): void;
68                                 transaction_unconfirmed(txid: Uint8Array): void;
69                                 best_block_updated(header: Uint8Array, height: number): void;
70                                 get_relevant_txids(): Uint8Array[];
71                                 
72             }
73
74             class LDKConfirmHolder {
75                 held: Confirm;
76             }
77         public void transactions_confirmed(Uint8Array header, TwoTuple_usizeTransactionZ[] txdata, number height) {
78                 bindings.Confirm_transactions_confirmed(this.ptr, InternalUtils.check_arr_len(header, 80), txdata != null ? Arrays.stream(txdata).map(txdata_conv_28 -> txdata_conv_28 != null ? txdata_conv_28.ptr : 0).toArray(number[]::new) : null, height);
79         }
80
81         public void transaction_unconfirmed(Uint8Array txid) {
82                 bindings.Confirm_transaction_unconfirmed(this.ptr, InternalUtils.check_arr_len(txid, 32));
83         }
84
85         public void best_block_updated(Uint8Array header, number height) {
86                 bindings.Confirm_best_block_updated(this.ptr, InternalUtils.check_arr_len(header, 80), height);
87         }
88
89         public Uint8Array[] get_relevant_txids() {
90                 Uint8Array[] ret = bindings.Confirm_get_relevant_txids(this.ptr);
91                 return ret;
92         }
93
94 }