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.ptr & ~1));
19 this.ptrs_to.push(arg);
20 this.ptrs_to.push(baseSign);
21 this.ptrs_to.add(pubkeys);
26 protected finalize() {
28 bindings.Sign_free(this.ptr);
33 static new_impl(arg: SignInterface, baseSign_impl: BaseSign.BaseSignInterface, pubkeys: ChannelPublicKeys): Sign {
34 const impl_holder: LDKSignHolder = new LDKSignHolder();
35 let structImplementation = <bindings.LDKSign>{
36 // todo: in-line interface filling
37 write (): Uint8Array {
38 Uint8Array ret = arg.write();
44 impl_holder.held = new Sign (null, structImplementation, BaseSign.new_impl(BaseSign_impl, pubkeys).bindings_instance, pubkeys);
48 export interface SignInterface {
56 public Uint8Array write() {
57 Uint8Array ret = bindings.Sign_write(this.ptr);
62 number ret = bindings.Sign_clone(this.ptr);
63 Sign ret_hu_conv = new Sign(null, ret);
64 ret_hu_conv.ptrs_to.add(this);