import CommonBase from './CommonBase.mjs';
import * as bindings from '../bindings.mjs'
-import * as InternalUtils from '../InternalUtils.mjs'
+/** An implementation of Sign */
export interface SignInterface {
+ /**Serialize the object into a byte array
+ */
write(): Uint8Array;
}
held: Sign;
}
+/**
+ * A cloneable signer.
+ *
+ * Although we require signers to be cloneable, it may be useful for developers to be able to use
+ * signers in an un-sized way, for example as `dyn BaseSign`. Therefore we separate the Clone trait,
+ * which implies Sized, into this derived trait.
+ */
export class Sign extends CommonBase {
/* @internal */
public bindings_instance?: bindings.LDKSign;
this.bindings_instance = null;
}
- static new_impl(arg: SignInterface, baseSign_impl: BaseSignInterface, pubkeys: ChannelPublicKeys): Sign {
+ /** Creates a new instance of Sign from a given implementation */
+ public static new_impl(arg: SignInterface, baseSign_impl: BaseSignInterface, pubkeys: ChannelPublicKeys): Sign {
const impl_holder: LDKSignHolder = new LDKSignHolder();
let structImplementation = {
- write (): Uint8Array {
+ write (): number {
const ret: Uint8Array = arg.write();
- return ret;
+ const result: number = bindings.encodeUint8Array(ret);
+ return result;
},
} as bindings.LDKSign;
const baseSign = BaseSign.new_impl(baseSign_impl, pubkeys, );
impl_holder.held.ptrs_to.push(baseSign);
return impl_holder.held;
}
+
+ /**
+ * Serialize the object into a byte array
+ */
public write(): Uint8Array {
- const ret: Uint8Array = bindings.Sign_write(this.ptr);
- return ret;
+ const ret: number = bindings.Sign_write(this.ptr);
+ const ret_conv: Uint8Array = bindings.decodeUint8Array(ret);
+ return ret_conv;
}
public clone_ptr(): number {
return ret;
}
+ /**
+ * Creates a copy of a Sign
+ */
public clone(): Sign {
const ret: number = bindings.Sign_clone(this.ptr);
const ret_hu_conv: Sign = new Sign(null, ret);