Support passing trait instance references from C to Java without clone or double...
[ldk-java] / ts / structs / KeysInterface.ts
index e9a689be522106aae525e8e491ec4b58db36d808..7f48672c537653a1dc94d330f947129c0332b7a8 100644 (file)
@@ -42,13 +42,14 @@ 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.ptr & ~1;
+                               return result;
                                                },
 
-                                               get_channel_keys (inbound: boolean, channel_value_satoshis: number): number {
-                                                       ChannelKeys ret = arg.get_channel_keys(inbound, channel_value_satoshis);
+                                               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;
                                impl_holder.held.ptrs_to.add(ret);
                                return result;
@@ -60,7 +61,13 @@ import * as bindings from '../bindings' // TODO: figure out location
                                                },
 
                                                read_chan_signer (reader: Uint8Array): number {
-                                                       Result_ChannelKeysDecodeErrorZ ret = arg.read_chan_signer(reader);
+                                                       Result_SignDecodeErrorZ ret = arg.read_chan_signer(reader);
+                               result: number = ret != null ? ret.ptr : 0;
+                               return result;
+                                               },
+
+                                               sign_invoice (invoice_preimage: Uint8Array): number {
+                                                       Result_RecoverableSignatureNoneZ ret = arg.sign_invoice(invoice_preimage);
                                result: number = ret != null ? ret.ptr : 0;
                                return result;
                                                },
@@ -74,10 +81,11 @@ 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_channel_keys(inbound: boolean, channel_value_satoshis: number): ChannelKeys;
+                               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_ChannelKeysDecodeErrorZ;
+                               read_chan_signer(reader: Uint8Array): Result_SignDecodeErrorZ;
+                               sign_invoice(invoice_preimage: Uint8Array): Result_RecoverableSignatureNoneZ;
                                
             }
 
@@ -94,14 +102,16 @@ 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 ChannelKeys get_channel_keys(boolean inbound, number channel_value_satoshis) {
-               number ret = bindings.KeysInterface_get_channel_keys(this.ptr, inbound, channel_value_satoshis);
-               ChannelKeys ret_hu_conv = new ChannelKeys(null, ret);
+       public Sign get_channel_signer(boolean inbound, number channel_value_satoshis) {
+               number ret = bindings.KeysInterface_get_channel_signer(this.ptr, inbound, channel_value_satoshis);
+               Sign ret_hu_conv = new Sign(null, ret);
                ret_hu_conv.ptrs_to.add(this);
                return ret_hu_conv;
        }
@@ -111,9 +121,15 @@ import * as bindings from '../bindings' // TODO: figure out location
                return ret;
        }
 
-       public Result_ChannelKeysDecodeErrorZ read_chan_signer(Uint8Array reader) {
+       public Result_SignDecodeErrorZ read_chan_signer(Uint8Array reader) {
                number ret = bindings.KeysInterface_read_chan_signer(this.ptr, reader);
-               Result_ChannelKeysDecodeErrorZ ret_hu_conv = Result_ChannelKeysDecodeErrorZ.constr_from_ptr(ret);
+               Result_SignDecodeErrorZ ret_hu_conv = Result_SignDecodeErrorZ.constr_from_ptr(ret);
+               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;
        }