]> git.bitcoin.ninja Git - ldk-java/blob - ts/structs/Access.ts
bindings updates
[ldk-java] / ts / structs / Access.ts
1
2             
3 import CommonBase from './CommonBase';
4 import * as bindings from '../bindings' // TODO: figure out location
5
6
7
8             export class Access extends CommonBase {
9
10                 bindings_instance?: bindings.LDKAccess;
11
12                 constructor(ptr?: number, arg?: bindings.LDKAccess) {
13                     if (Number.isFinite(ptr)) {
14                                         super(ptr);
15                                         this.bindings_instance = null;
16                                     } else {
17                                         // TODO: private constructor instantiation
18                                         super(bindings.LDKAccess_new(arg));
19                                         this.ptrs_to.push(arg);
20                                         
21                                     }
22                 }
23
24                 protected finalize() {
25                     if (this.ptr != 0) {
26                         bindings.Access_free(this.ptr);
27                     }
28                     super.finalize();
29                 }
30
31                 static new_impl(arg: AccessInterface): Access {
32                     const impl_holder: LDKAccessHolder = new LDKAccessHolder();
33                     let structImplementation = <bindings.LDKAccess>{
34                         // todo: in-line interface filling
35                         get_utxo (genesis_hash: Uint8Array, short_channel_id: number): number {
36                                                         Result_TxOutAccessErrorZ ret = arg.get_utxo(genesis_hash, short_channel_id);
37                                 result: number = ret != null ? ret.ptr : 0;
38                                 return result;
39                                                 },
40
41                                                 
42                     };
43                     impl_holder.held = new Access (null, structImplementation);
44                 }
45             }
46
47             export interface AccessInterface {
48                 get_utxo(genesis_hash: Uint8Array, short_channel_id: number): Result_TxOutAccessErrorZ;
49                                 
50             }
51
52             class LDKAccessHolder {
53                 held: Access;
54             }
55         public Result_TxOutAccessErrorZ get_utxo(Uint8Array genesis_hash, number short_channel_id) {
56                 number ret = bindings.Access_get_utxo(this.ptr, genesis_hash, short_channel_id);
57                 Result_TxOutAccessErrorZ ret_hu_conv = Result_TxOutAccessErrorZ.constr_from_ptr(ret);
58                 return ret_hu_conv;
59         }
60
61 }