3 import CommonBase from './CommonBase';
4 import * as bindings from '../bindings' // TODO: figure out location
8 export default class NodeId extends CommonBase {
9 constructor(_dummy: object, ptr: number) {
14 protected finalize() {
18 bindings.NodeId_free(this.ptr);
21 public NodeId clone() {
22 number ret = bindings.NodeId_clone(this.ptr);
23 const ret_hu_conv: NodeId = new NodeId(null, ret);
24 ret_hu_conv.ptrs_to.add(this);
28 public static NodeId constructor_from_pubkey(Uint8Array pubkey) {
29 number ret = bindings.NodeId_from_pubkey(pubkey);
30 const ret_hu_conv: NodeId = new NodeId(null, ret);
31 ret_hu_conv.ptrs_to.add(ret_hu_conv);
35 public Uint8Array as_slice() {
36 Uint8Array ret = bindings.NodeId_as_slice(this.ptr);
40 public number hash() {
41 number ret = bindings.NodeId_hash(this.ptr);
45 public Uint8Array write() {
46 Uint8Array ret = bindings.NodeId_write(this.ptr);
50 public static Result_NodeIdDecodeErrorZ constructor_read(Uint8Array ser) {
51 number ret = bindings.NodeId_read(ser);
52 Result_NodeIdDecodeErrorZ ret_hu_conv = Result_NodeIdDecodeErrorZ.constr_from_ptr(ret);