3 import CommonBase from './CommonBase';
4 import * as bindings from '../bindings' // TODO: figure out location
8 export default class InMemorySigner extends CommonBase {
9 constructor(_dummy: object, ptr: number) {
14 protected finalize() {
18 bindings.InMemorySigner_free(this.ptr);
21 public Uint8Array get_funding_key() {
22 Uint8Array ret = bindings.InMemorySigner_get_funding_key(this.ptr);
26 public void set_funding_key(Uint8Array val) {
27 bindings.InMemorySigner_set_funding_key(this.ptr, val);
30 public Uint8Array get_revocation_base_key() {
31 Uint8Array ret = bindings.InMemorySigner_get_revocation_base_key(this.ptr);
35 public void set_revocation_base_key(Uint8Array val) {
36 bindings.InMemorySigner_set_revocation_base_key(this.ptr, val);
39 public Uint8Array get_payment_key() {
40 Uint8Array ret = bindings.InMemorySigner_get_payment_key(this.ptr);
44 public void set_payment_key(Uint8Array val) {
45 bindings.InMemorySigner_set_payment_key(this.ptr, val);
48 public Uint8Array get_delayed_payment_base_key() {
49 Uint8Array ret = bindings.InMemorySigner_get_delayed_payment_base_key(this.ptr);
53 public void set_delayed_payment_base_key(Uint8Array val) {
54 bindings.InMemorySigner_set_delayed_payment_base_key(this.ptr, val);
57 public Uint8Array get_htlc_base_key() {
58 Uint8Array ret = bindings.InMemorySigner_get_htlc_base_key(this.ptr);
62 public void set_htlc_base_key(Uint8Array val) {
63 bindings.InMemorySigner_set_htlc_base_key(this.ptr, val);
66 public Uint8Array get_commitment_seed() {
67 Uint8Array ret = bindings.InMemorySigner_get_commitment_seed(this.ptr);
71 public void set_commitment_seed(Uint8Array val) {
72 bindings.InMemorySigner_set_commitment_seed(this.ptr, val);
75 public InMemorySigner clone() {
76 number ret = bindings.InMemorySigner_clone(this.ptr);
77 const ret_hu_conv: InMemorySigner = new InMemorySigner(null, ret);
78 ret_hu_conv.ptrs_to.add(this);
82 public static InMemorySigner constructor_new(Uint8Array funding_key, Uint8Array revocation_base_key, Uint8Array payment_key, Uint8Array delayed_payment_base_key, Uint8Array htlc_base_key, Uint8Array commitment_seed, number channel_value_satoshis, Uint8Array channel_keys_id) {
83 number ret = bindings.InMemorySigner_new(funding_key, revocation_base_key, payment_key, delayed_payment_base_key, htlc_base_key, commitment_seed, channel_value_satoshis, channel_keys_id);
84 const ret_hu_conv: InMemorySigner = new InMemorySigner(null, ret);
85 ret_hu_conv.ptrs_to.add(ret_hu_conv);
89 public ChannelPublicKeys counterparty_pubkeys() {
90 number ret = bindings.InMemorySigner_counterparty_pubkeys(this.ptr);
91 const ret_hu_conv: ChannelPublicKeys = new ChannelPublicKeys(null, ret);
92 ret_hu_conv.ptrs_to.add(this);
96 public number counterparty_selected_contest_delay() {
97 number ret = bindings.InMemorySigner_counterparty_selected_contest_delay(this.ptr);
101 public number holder_selected_contest_delay() {
102 number ret = bindings.InMemorySigner_holder_selected_contest_delay(this.ptr);
106 public boolean is_outbound() {
107 boolean ret = bindings.InMemorySigner_is_outbound(this.ptr);
111 public OutPoint funding_outpoint() {
112 number ret = bindings.InMemorySigner_funding_outpoint(this.ptr);
113 const ret_hu_conv: OutPoint = new OutPoint(null, ret);
114 ret_hu_conv.ptrs_to.add(this);
118 public ChannelTransactionParameters get_channel_parameters() {
119 number ret = bindings.InMemorySigner_get_channel_parameters(this.ptr);
120 const ret_hu_conv: ChannelTransactionParameters = new ChannelTransactionParameters(null, ret);
121 ret_hu_conv.ptrs_to.add(this);
125 public Result_CVec_CVec_u8ZZNoneZ sign_counterparty_payment_input(Uint8Array spend_tx, number input_idx, StaticPaymentOutputDescriptor descriptor) {
126 number ret = bindings.InMemorySigner_sign_counterparty_payment_input(this.ptr, spend_tx, input_idx, descriptor == null ? 0 : descriptor.ptr & ~1);
127 Result_CVec_CVec_u8ZZNoneZ ret_hu_conv = Result_CVec_CVec_u8ZZNoneZ.constr_from_ptr(ret);
128 this.ptrs_to.add(descriptor);
132 public Result_CVec_CVec_u8ZZNoneZ sign_dynamic_p2wsh_input(Uint8Array spend_tx, number input_idx, DelayedPaymentOutputDescriptor descriptor) {
133 number ret = bindings.InMemorySigner_sign_dynamic_p2wsh_input(this.ptr, spend_tx, input_idx, descriptor == null ? 0 : descriptor.ptr & ~1);
134 Result_CVec_CVec_u8ZZNoneZ ret_hu_conv = Result_CVec_CVec_u8ZZNoneZ.constr_from_ptr(ret);
135 this.ptrs_to.add(descriptor);
139 public BaseSign as_BaseSign() {
140 number ret = bindings.InMemorySigner_as_BaseSign(this.ptr);
141 BaseSign ret_hu_conv = new BaseSign(null, ret);
142 ret_hu_conv.ptrs_to.add(this);
146 public Sign as_Sign() {
147 number ret = bindings.InMemorySigner_as_Sign(this.ptr);
148 Sign ret_hu_conv = new Sign(null, ret);
149 ret_hu_conv.ptrs_to.add(this);
153 public Uint8Array write() {
154 Uint8Array ret = bindings.InMemorySigner_write(this.ptr);
158 public static Result_InMemorySignerDecodeErrorZ constructor_read(Uint8Array ser) {
159 number ret = bindings.InMemorySigner_read(ser);
160 Result_InMemorySignerDecodeErrorZ ret_hu_conv = Result_InMemorySignerDecodeErrorZ.constr_from_ptr(ret);