lightningdevkit
Version:
Lightning Development Kit
142 lines • 5.12 kB
JavaScript
import { Address } from '../structs/Address.mjs';
import { Option_AddressZ } from '../structs/Option_AddressZ.mjs';
import { Option_u16Z } from '../structs/Option_u16Z.mjs';
import { LSPSDateTime } from '../structs/LSPSDateTime.mjs';
import { CommonBase } from './CommonBase.mjs';
import * as bindings from '../bindings.mjs';
/**
* An onchain payment.
*/
export class LSPS1OnchainPaymentInfo extends CommonBase {
/* @internal */
constructor(_dummy, ptr) {
super(ptr, bindings.LSPS1OnchainPaymentInfo_free);
}
/**
* Indicates the current state of the payment.
*/
get_state() {
const ret = bindings.LSPS1OnchainPaymentInfo_get_state(this.ptr);
return ret;
}
/**
* Indicates the current state of the payment.
*/
set_state(val) {
bindings.LSPS1OnchainPaymentInfo_set_state(this.ptr, val);
}
/**
* The datetime when the payment option expires.
*/
get_expires_at() {
const ret = bindings.LSPS1OnchainPaymentInfo_get_expires_at(this.ptr);
const ret_hu_conv = new LSPSDateTime(null, ret);
CommonBase.add_ref_from(ret_hu_conv, this);
return ret_hu_conv;
}
/**
* The datetime when the payment option expires.
*/
set_expires_at(val) {
bindings.LSPS1OnchainPaymentInfo_set_expires_at(this.ptr, CommonBase.get_ptr_of(val));
}
/**
* The total fee the LSP will charge to open this channel in satoshi.
*/
get_fee_total_sat() {
const ret = bindings.LSPS1OnchainPaymentInfo_get_fee_total_sat(this.ptr);
return ret;
}
/**
* The total fee the LSP will charge to open this channel in satoshi.
*/
set_fee_total_sat(val) {
bindings.LSPS1OnchainPaymentInfo_set_fee_total_sat(this.ptr, val);
}
/**
* The amount the client needs to pay to have the requested channel openend.
*/
get_order_total_sat() {
const ret = bindings.LSPS1OnchainPaymentInfo_get_order_total_sat(this.ptr);
return ret;
}
/**
* The amount the client needs to pay to have the requested channel openend.
*/
set_order_total_sat(val) {
bindings.LSPS1OnchainPaymentInfo_set_order_total_sat(this.ptr, val);
}
/**
* An on-chain address the client can send [`Self::order_total_sat`] to to have the channel
* opened.
*/
get_address() {
const ret = bindings.LSPS1OnchainPaymentInfo_get_address(this.ptr);
const ret_conv = new Address(null, ret);
return ret_conv;
}
/**
* An on-chain address the client can send [`Self::order_total_sat`] to to have the channel
* opened.
*/
set_address(val) {
bindings.LSPS1OnchainPaymentInfo_set_address(this.ptr, CommonBase.get_ptr_of(val));
}
/**
* The minimum number of block confirmations that are required for the on-chain payment to be
* considered confirmed.
*/
get_min_onchain_payment_confirmations() {
const ret = bindings.LSPS1OnchainPaymentInfo_get_min_onchain_payment_confirmations(this.ptr);
const ret_hu_conv = Option_u16Z.constr_from_ptr(ret);
CommonBase.add_ref_from(ret_hu_conv, this);
return ret_hu_conv;
}
/**
* The minimum number of block confirmations that are required for the on-chain payment to be
* considered confirmed.
*/
set_min_onchain_payment_confirmations(val) {
bindings.LSPS1OnchainPaymentInfo_set_min_onchain_payment_confirmations(this.ptr, CommonBase.get_ptr_of(val));
}
/**
* The address where the LSP will send the funds if the order fails.
*/
get_refund_onchain_address() {
const ret = bindings.LSPS1OnchainPaymentInfo_get_refund_onchain_address(this.ptr);
const ret_hu_conv = Option_AddressZ.constr_from_ptr(ret);
CommonBase.add_ref_from(ret_hu_conv, this);
return ret_hu_conv;
}
/**
* The address where the LSP will send the funds if the order fails.
*/
set_refund_onchain_address(val) {
bindings.LSPS1OnchainPaymentInfo_set_refund_onchain_address(this.ptr, CommonBase.get_ptr_of(val));
CommonBase.add_ref_from(this, val);
}
clone_ptr() {
const ret = bindings.LSPS1OnchainPaymentInfo_clone_ptr(this.ptr);
return ret;
}
/**
* Creates a copy of the LSPS1OnchainPaymentInfo
*/
clone() {
const ret = bindings.LSPS1OnchainPaymentInfo_clone(this.ptr);
const ret_hu_conv = new LSPS1OnchainPaymentInfo(null, ret);
CommonBase.add_ref_from(ret_hu_conv, this);
return ret_hu_conv;
}
/**
* Checks if two LSPS1OnchainPaymentInfos contain equal inner contents.
* This ignores pointers and is_owned flags and looks at the values in fields.
* Two objects with NULL inner values will be considered "equal" here.
*/
eq(b) {
const ret = bindings.LSPS1OnchainPaymentInfo_eq(this.ptr, CommonBase.get_ptr_of(b));
CommonBase.add_ref_from(this, b);
return ret;
}
}
//# sourceMappingURL=LSPS1OnchainPaymentInfo.mjs.map