3 import CommonBase from './CommonBase';
4 import * as bindings from '../bindings' // TODO: figure out location
8 export default class KeysManager extends CommonBase {
9 constructor(_dummy: object, ptr: number) {
14 protected finalize() {
18 bindings.KeysManager_free(this.ptr);
21 public static KeysManager constructor_new(Uint8Array seed, number starting_time_secs, number starting_time_nanos) {
22 number ret = bindings.KeysManager_new(seed, starting_time_secs, starting_time_nanos);
23 const ret_hu_conv: KeysManager = new KeysManager(null, ret);
24 ret_hu_conv.ptrs_to.add(ret_hu_conv);
28 public InMemorySigner derive_channel_keys(number channel_value_satoshis, Uint8Array params) {
29 number ret = bindings.KeysManager_derive_channel_keys(this.ptr, channel_value_satoshis, params);
30 const ret_hu_conv: InMemorySigner = new InMemorySigner(null, ret);
31 ret_hu_conv.ptrs_to.add(this);
35 public Result_TransactionNoneZ spend_spendable_outputs(SpendableOutputDescriptor[] descriptors, TxOut[] outputs, Uint8Array change_destination_script, number feerate_sat_per_1000_weight) {
36 number ret = bindings.KeysManager_spend_spendable_outputs(this.ptr, Arrays.stream(descriptors).map(descriptors_conv_27 -> descriptors_conv_27.ptr).toArray(number[]::new), Arrays.stream(outputs).map(outputs_conv_7 -> outputs_conv_7.ptr).toArray(number[]::new), change_destination_script, feerate_sat_per_1000_weight);
37 Result_TransactionNoneZ ret_hu_conv = Result_TransactionNoneZ.constr_from_ptr(ret);
38 /* TODO 2 SpendableOutputDescriptor */;
43 public KeysInterface as_KeysInterface() {
44 number ret = bindings.KeysManager_as_KeysInterface(this.ptr);
45 KeysInterface ret_hu_conv = new KeysInterface(null, ret);
46 ret_hu_conv.ptrs_to.add(this);