X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=ts%2Fstructs%2FKeysInterface.ts;h=bfc1777fc4f770000b41cd16dc26904642e492c2;hb=0fee03a8095f5599f8eccd920c1b1af6b3a20260;hp=a49aaf0b516fc4f0495771273c2952afc2f88a18;hpb=246459dcbc3be28c38b4951140a5933f4b3aa024;p=ldk-java diff --git a/ts/structs/KeysInterface.ts b/ts/structs/KeysInterface.ts index a49aaf0b..bfc1777f 100644 --- a/ts/structs/KeysInterface.ts +++ b/ts/structs/KeysInterface.ts @@ -34,7 +34,8 @@ import * as bindings from '../bindings' // TODO: figure out location // todo: in-line interface filling get_node_secret (): Uint8Array { Uint8Array ret = arg.get_node_secret(); - return ret; + result: Uint8Array = InternalUtils.check_arr_len(ret, 32); + return result; }, get_destination_script (): Uint8Array { @@ -42,26 +43,40 @@ import * as bindings from '../bindings' // TODO: figure out location return ret; }, - get_shutdown_pubkey (): Uint8Array { - Uint8Array ret = arg.get_shutdown_pubkey(); - return ret; + get_shutdown_scriptpubkey (): number { + ShutdownScript ret = arg.get_shutdown_scriptpubkey(); + result: number = ret == null ? 0 : ret.clone_ptr(); + return result; }, get_channel_signer (inbound: boolean, channel_value_satoshis: number): number { Sign ret = arg.get_channel_signer(inbound, channel_value_satoshis); - result: number = ret == null ? 0 : ret.ptr; + result: number = ret == null ? 0 : ret.clone_ptr(); impl_holder.held.ptrs_to.add(ret); return result; }, get_secure_random_bytes (): Uint8Array { Uint8Array ret = arg.get_secure_random_bytes(); - return ret; + result: Uint8Array = InternalUtils.check_arr_len(ret, 32); + return result; }, read_chan_signer (reader: Uint8Array): number { Result_SignDecodeErrorZ ret = arg.read_chan_signer(reader); - result: number = ret != null ? ret.ptr : 0; + result: number = ret == null ? 0 : ret.clone_ptr(); + return result; + }, + + sign_invoice (invoice_preimage: Uint8Array): number { + Result_RecoverableSignatureNoneZ ret = arg.sign_invoice(invoice_preimage); + result: number = ret == null ? 0 : ret.clone_ptr(); + return result; + }, + + get_inbound_payment_key_material (): Uint8Array { + Uint8Array ret = arg.get_inbound_payment_key_material(); + result: Uint8Array = InternalUtils.check_arr_len(ret, 32); return result; }, @@ -74,10 +89,12 @@ import * as bindings from '../bindings' // TODO: figure out location export interface KeysInterfaceInterface { get_node_secret(): Uint8Array; get_destination_script(): Uint8Array; - get_shutdown_pubkey(): Uint8Array; + get_shutdown_scriptpubkey(): ShutdownScript; get_channel_signer(inbound: boolean, channel_value_satoshis: number): Sign; get_secure_random_bytes(): Uint8Array; read_chan_signer(reader: Uint8Array): Result_SignDecodeErrorZ; + sign_invoice(invoice_preimage: Uint8Array): Result_RecoverableSignatureNoneZ; + get_inbound_payment_key_material(): Uint8Array; } @@ -94,9 +111,11 @@ import * as bindings from '../bindings' // TODO: figure out location return ret; } - public Uint8Array get_shutdown_pubkey() { - Uint8Array ret = bindings.KeysInterface_get_shutdown_pubkey(this.ptr); - return ret; + public ShutdownScript get_shutdown_scriptpubkey() { + number ret = bindings.KeysInterface_get_shutdown_scriptpubkey(this.ptr); + const ret_hu_conv: ShutdownScript = new ShutdownScript(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; } public Sign get_channel_signer(boolean inbound, number channel_value_satoshis) { @@ -117,4 +136,15 @@ import * as bindings from '../bindings' // TODO: figure out location return ret_hu_conv; } + public Result_RecoverableSignatureNoneZ sign_invoice(Uint8Array invoice_preimage) { + number ret = bindings.KeysInterface_sign_invoice(this.ptr, invoice_preimage); + Result_RecoverableSignatureNoneZ ret_hu_conv = Result_RecoverableSignatureNoneZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + public Uint8Array get_inbound_payment_key_material() { + Uint8Array ret = bindings.KeysInterface_get_inbound_payment_key_material(this.ptr); + return ret; + } + }