X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=ts%2Fstructs%2FKeysInterface.mts;h=deca3ae4a031c2b601559debe5267b59a1851452;hb=31a1b84c2ca25db2978865e9ca9573974f79cc79;hp=7eed65bb4939751ebe10480895fdb7c392a67121;hpb=9dd77adc1df59cdcceb68a6d38683b2f8f390201;p=ldk-java diff --git a/ts/structs/KeysInterface.mts b/ts/structs/KeysInterface.mts index 7eed65bb..deca3ae4 100644 --- a/ts/structs/KeysInterface.mts +++ b/ts/structs/KeysInterface.mts @@ -67,6 +67,9 @@ import { Result_PaymentPurposeDecodeErrorZ } from '../structs/Result_PaymentPurp import { ClosureReason } from '../structs/ClosureReason.mjs'; import { Option_ClosureReasonZ } from '../structs/Option_ClosureReasonZ.mjs'; import { Result_COption_ClosureReasonZDecodeErrorZ } from '../structs/Result_COption_ClosureReasonZDecodeErrorZ.mjs'; +import { HTLCDestination } from '../structs/HTLCDestination.mjs'; +import { Option_HTLCDestinationZ } from '../structs/Option_HTLCDestinationZ.mjs'; +import { Result_COption_HTLCDestinationZDecodeErrorZ } from '../structs/Result_COption_HTLCDestinationZDecodeErrorZ.mjs'; import { ChannelUpdate } from '../structs/ChannelUpdate.mjs'; import { NetworkUpdate } from '../structs/NetworkUpdate.mjs'; import { Option_NetworkUpdateZ } from '../structs/Option_NetworkUpdateZ.mjs'; @@ -104,10 +107,13 @@ import { TwoTuple_usizeTransactionZ } from '../structs/TwoTuple_usizeTransaction import { Result_NoneChannelMonitorUpdateErrZ } from '../structs/Result_NoneChannelMonitorUpdateErrZ.mjs'; import { HTLCUpdate } from '../structs/HTLCUpdate.mjs'; import { MonitorEvent } from '../structs/MonitorEvent.mjs'; -import { TwoTuple_OutPointCVec_MonitorEventZZ } from '../structs/TwoTuple_OutPointCVec_MonitorEventZZ.mjs'; +import { ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ } from '../structs/ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ.mjs'; import { Option_C2Tuple_usizeTransactionZZ } from '../structs/Option_C2Tuple_usizeTransactionZZ.mjs'; import { FixedPenaltyScorer } from '../structs/FixedPenaltyScorer.mjs'; import { Result_FixedPenaltyScorerDecodeErrorZ } from '../structs/Result_FixedPenaltyScorerDecodeErrorZ.mjs'; +import { TwoTuple_u64u64Z } from '../structs/TwoTuple_u64u64Z.mjs'; +import { Option_C2Tuple_u64u64ZZ } from '../structs/Option_C2Tuple_u64u64ZZ.mjs'; +import { NodeId } from '../structs/NodeId.mjs'; import { Record } from '../structs/Record.mjs'; import { Logger, LoggerInterface } from '../structs/Logger.mjs'; import { NetworkGraph } from '../structs/NetworkGraph.mjs'; @@ -122,7 +128,6 @@ import { Result_NodeFeaturesDecodeErrorZ } from '../structs/Result_NodeFeaturesD import { InvoiceFeatures } from '../structs/InvoiceFeatures.mjs'; import { Result_InvoiceFeaturesDecodeErrorZ } from '../structs/Result_InvoiceFeaturesDecodeErrorZ.mjs'; import { Result_ChannelTypeFeaturesDecodeErrorZ } from '../structs/Result_ChannelTypeFeaturesDecodeErrorZ.mjs'; -import { NodeId } from '../structs/NodeId.mjs'; import { Result_NodeIdDecodeErrorZ } from '../structs/Result_NodeIdDecodeErrorZ.mjs'; import { Result_COption_NetworkUpdateZDecodeErrorZ } from '../structs/Result_COption_NetworkUpdateZDecodeErrorZ.mjs'; import { Access, AccessInterface } from '../structs/Access.mjs'; @@ -136,9 +141,12 @@ import { ChannelInfo } from '../structs/ChannelInfo.mjs'; import { Result_ChannelInfoDecodeErrorZ } from '../structs/Result_ChannelInfoDecodeErrorZ.mjs'; import { RoutingFees } from '../structs/RoutingFees.mjs'; import { Result_RoutingFeesDecodeErrorZ } from '../structs/Result_RoutingFeesDecodeErrorZ.mjs'; +import { Hostname } from '../structs/Hostname.mjs'; import { NetAddress } from '../structs/NetAddress.mjs'; import { NodeAnnouncementInfo } from '../structs/NodeAnnouncementInfo.mjs'; import { Result_NodeAnnouncementInfoDecodeErrorZ } from '../structs/Result_NodeAnnouncementInfoDecodeErrorZ.mjs'; +import { NodeAlias } from '../structs/NodeAlias.mjs'; +import { Result_NodeAliasDecodeErrorZ } from '../structs/Result_NodeAliasDecodeErrorZ.mjs'; import { NodeInfo } from '../structs/NodeInfo.mjs'; import { Result_NodeInfoDecodeErrorZ } from '../structs/Result_NodeInfoDecodeErrorZ.mjs'; import { Result_NetworkGraphDecodeErrorZ } from '../structs/Result_NetworkGraphDecodeErrorZ.mjs'; @@ -352,7 +360,9 @@ import * as bindings from '../bindings.mjs' /** An implementation of KeysInterface */ export interface KeysInterfaceInterface { - /**Get node secret key (aka node_id or network_key) based on the provided [`Recipient`]. + /**Get node secret key based on the provided [`Recipient`]. + * + * The node_id/network_key is the public key that corresponds to this secret key. * * This method must return the same value each time it is called with a given `Recipient` * parameter. @@ -425,7 +435,7 @@ export class KeysInterface extends CommonBase { public bindings_instance?: bindings.LDKKeysInterface; /* @internal */ - constructor(_dummy: object, ptr: number) { + constructor(_dummy: object, ptr: bigint) { super(ptr, bindings.KeysInterface_free); this.bindings_instance = null; } @@ -434,9 +444,9 @@ export class KeysInterface extends CommonBase { public static new_impl(arg: KeysInterfaceInterface): KeysInterface { const impl_holder: LDKKeysInterfaceHolder = new LDKKeysInterfaceHolder(); let structImplementation = { - get_node_secret (recipient: Recipient): number { + get_node_secret (recipient: Recipient): bigint { const ret: Result_SecretKeyNoneZ = arg.get_node_secret(recipient); - const result: number = ret == null ? 0 : ret.clone_ptr(); + const result: bigint = ret == null ? 0n : ret.clone_ptr(); return result; }, get_destination_script (): number { @@ -444,14 +454,14 @@ export class KeysInterface extends CommonBase { const result: number = bindings.encodeUint8Array(ret); return result; }, - get_shutdown_scriptpubkey (): number { + get_shutdown_scriptpubkey (): bigint { const ret: ShutdownScript = arg.get_shutdown_scriptpubkey(); - const result: number = ret == null ? 0 : ret.clone_ptr(); + const result: bigint = ret == null ? 0n : ret.clone_ptr(); return result; }, - get_channel_signer (inbound: boolean, channel_value_satoshis: bigint): number { + get_channel_signer (inbound: boolean, channel_value_satoshis: bigint): bigint { const ret: Sign = arg.get_channel_signer(inbound, channel_value_satoshis); - const result: number = ret == null ? 0 : ret.clone_ptr(); + const result: bigint = ret == null ? 0n : ret.clone_ptr(); CommonBase.add_ref_from(impl_holder.held, ret); return result; }, @@ -460,13 +470,13 @@ export class KeysInterface extends CommonBase { const result: number = bindings.encodeUint8Array(bindings.check_arr_len(ret, 32)); return result; }, - read_chan_signer (reader: number): number { + read_chan_signer (reader: number): bigint { const reader_conv: Uint8Array = bindings.decodeUint8Array(reader); const ret: Result_SignDecodeErrorZ = arg.read_chan_signer(reader_conv); - const result: number = ret == null ? 0 : ret.clone_ptr(); + const result: bigint = ret == null ? 0n : ret.clone_ptr(); return result; }, - sign_invoice (hrp_bytes: number, invoice_data: number, receipient: Recipient): number { + sign_invoice (hrp_bytes: number, invoice_data: number, receipient: Recipient): bigint { const hrp_bytes_conv: Uint8Array = bindings.decodeUint8Array(hrp_bytes); const invoice_data_conv_7_len: number = bindings.getArrayLength(invoice_data); const invoice_data_conv_7_arr: UInt5[] = new Array(invoice_data_conv_7_len).fill(null); @@ -477,7 +487,7 @@ export class KeysInterface extends CommonBase { } bindings.freeWasmMemory(invoice_data) const ret: Result_RecoverableSignatureNoneZ = arg.sign_invoice(hrp_bytes_conv, invoice_data_conv_7_arr, receipient); - const result: number = ret == null ? 0 : ret.clone_ptr(); + const result: bigint = ret == null ? 0n : ret.clone_ptr(); return result; }, get_inbound_payment_key_material (): number { @@ -486,7 +496,7 @@ export class KeysInterface extends CommonBase { return result; }, } as bindings.LDKKeysInterface; - const ptr: number = bindings.LDKKeysInterface_new(structImplementation); + const ptr: bigint = bindings.LDKKeysInterface_new(structImplementation); impl_holder.held = new KeysInterface(null, ptr); impl_holder.held.bindings_instance = structImplementation; @@ -494,13 +504,15 @@ export class KeysInterface extends CommonBase { } /** - * Get node secret key (aka node_id or network_key) based on the provided [`Recipient`]. + * Get node secret key based on the provided [`Recipient`]. + * + * The node_id/network_key is the public key that corresponds to this secret key. * * This method must return the same value each time it is called with a given `Recipient` * parameter. */ public get_node_secret(recipient: Recipient): Result_SecretKeyNoneZ { - const ret: number = bindings.KeysInterface_get_node_secret(this.ptr, recipient); + const ret: bigint = bindings.KeysInterface_get_node_secret(this.ptr, recipient); const ret_hu_conv: Result_SecretKeyNoneZ = Result_SecretKeyNoneZ.constr_from_ptr(ret); return ret_hu_conv; } @@ -524,7 +536,7 @@ export class KeysInterface extends CommonBase { * on-chain funds across channels as controlled to the same user. */ public get_shutdown_scriptpubkey(): ShutdownScript { - const ret: number = bindings.KeysInterface_get_shutdown_scriptpubkey(this.ptr); + const ret: bigint = bindings.KeysInterface_get_shutdown_scriptpubkey(this.ptr); const ret_hu_conv: ShutdownScript = new ShutdownScript(null, ret); CommonBase.add_ref_from(ret_hu_conv, this); return ret_hu_conv; @@ -537,7 +549,7 @@ export class KeysInterface extends CommonBase { * This method must return a different value each time it is called. */ public get_channel_signer(inbound: boolean, channel_value_satoshis: bigint): Sign { - const ret: number = bindings.KeysInterface_get_channel_signer(this.ptr, inbound, channel_value_satoshis); + const ret: bigint = bindings.KeysInterface_get_channel_signer(this.ptr, inbound, channel_value_satoshis); const ret_hu_conv: Sign = new Sign(null, ret); CommonBase.add_ref_from(ret_hu_conv, this); return ret_hu_conv; @@ -565,7 +577,7 @@ export class KeysInterface extends CommonBase { * you've read all of the provided bytes to ensure no corruption occurred. */ public read_chan_signer(reader: Uint8Array): Result_SignDecodeErrorZ { - const ret: number = bindings.KeysInterface_read_chan_signer(this.ptr, bindings.encodeUint8Array(reader)); + const ret: bigint = bindings.KeysInterface_read_chan_signer(this.ptr, bindings.encodeUint8Array(reader)); const ret_hu_conv: Result_SignDecodeErrorZ = Result_SignDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; } @@ -580,7 +592,7 @@ export class KeysInterface extends CommonBase { * The secret key used to sign the invoice is dependent on the [`Recipient`]. */ public sign_invoice(hrp_bytes: Uint8Array, invoice_data: UInt5[], receipient: Recipient): Result_RecoverableSignatureNoneZ { - const ret: number = bindings.KeysInterface_sign_invoice(this.ptr, bindings.encodeUint8Array(hrp_bytes), bindings.encodeUint8Array(invoice_data != null ? bindings.uint5ArrToBytes(invoice_data) : null), receipient); + const ret: bigint = bindings.KeysInterface_sign_invoice(this.ptr, bindings.encodeUint8Array(hrp_bytes), bindings.encodeUint8Array(invoice_data != null ? bindings.uint5ArrToBytes(invoice_data) : null), receipient); const ret_hu_conv: Result_RecoverableSignatureNoneZ = Result_RecoverableSignatureNoneZ.constr_from_ptr(ret); return ret_hu_conv; }