3 import CommonBase from './CommonBase';
4 import * as bindings from '../bindings' // TODO: figure out location
8 export class Access extends CommonBase {
10 bindings_instance?: bindings.LDKAccess;
12 constructor(ptr?: number, arg?: bindings.LDKAccess) {
13 if (Number.isFinite(ptr)) {
15 this.bindings_instance = null;
17 // TODO: private constructor instantiation
18 super(bindings.LDKAccess_new(arg));
19 this.ptrs_to.push(arg);
24 protected finalize() {
26 bindings.Access_free(this.ptr);
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;
43 impl_holder.held = new Access (null, structImplementation);
47 export interface AccessInterface {
48 get_utxo(genesis_hash: Uint8Array, short_channel_id: number): Result_TxOutAccessErrorZ;
52 class LDKAccessHolder {
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);