3 import CommonBase from './CommonBase';
4 import * as bindings from '../bindings' // TODO: figure out location
8 export class Sign extends CommonBase {
10 bindings_instance?: bindings.LDKSign;
12 constructor(ptr?: number, arg?: bindings.LDKSign, baseSign?: bindings.LDKBaseSign, pubkeys?: ChannelPublicKeys) {
13 if (Number.isFinite(ptr)) {
15 this.bindings_instance = null;
17 // TODO: private constructor instantiation
18 super(bindings.LDKSign_new(arg, baseSign, pubkeys == null ? 0 : pubkeys.clone_ptr()));
19 this.ptrs_to.push(arg);
20 this.ptrs_to.push(baseSign);
25 protected finalize() {
27 bindings.Sign_free(this.ptr);
32 static new_impl(arg: SignInterface, baseSign_impl: BaseSign.BaseSignInterface, pubkeys: ChannelPublicKeys): Sign {
33 const impl_holder: LDKSignHolder = new LDKSignHolder();
34 let structImplementation = <bindings.LDKSign>{
35 // todo: in-line interface filling
36 write (): Uint8Array {
37 Uint8Array ret = arg.write();
43 impl_holder.held = new Sign (null, structImplementation, BaseSign.new_impl(BaseSign_impl, pubkeys).bindings_instance, pubkeys);
47 export interface SignInterface {
55 public Uint8Array write() {
56 Uint8Array ret = bindings.Sign_write(this.ptr);
60 public number clone_ptr() {
61 number ret = bindings.Sign_clone_ptr(this.ptr);
66 number ret = bindings.Sign_clone(this.ptr);
67 Sign ret_hu_conv = new Sign(null, ret);
68 ret_hu_conv.ptrs_to.add(this);