/* tslint:disable */ /* eslint-disable */ /** * barkd REST API * A simple REST API for barkd, a wallet daemon for integrating bitcoin payments into your app over HTTP. Supports self-custodial Lightning, Ark, and on-chain out of the box. barkd is a long-running daemon best suited for always-on or high-connectivity environments like nodes, servers, desktops, and point-of-sale terminals. All endpoints return JSON. Amounts are denominated in satoshis. * * The version of the OpenAPI document: 0.6.1 * Contact: hello@second.tech * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { mapValues } from '../runtime'; import type { WalletVtxoInfo } from './WalletVtxoInfo'; import { WalletVtxoInfoFromJSON, WalletVtxoInfoFromJSONTyped, WalletVtxoInfoToJSON, WalletVtxoInfoToJSONTyped, } from './WalletVtxoInfo'; /** * * @export * @interface LightningReceiveInfo */ export interface LightningReceiveInfo { /** * The amount of the lightning receive, if known. * @type {number} * @memberof LightningReceiveInfo */ amountSat: number; /** * The timestamp at which the lightning receive was finished. * @type {Date} * @memberof LightningReceiveInfo * @deprecated */ finishedAt?: Date | null; /** * IDs of the HTLC-recv VTXOs granted by the server, if any. * * Empty until the inbound HTLC has been received and prepared. * @type {Array} * @memberof LightningReceiveInfo */ htlcVtxoIds: Array; /** * The HTLC VTXOs granted by the server for the lightning receive. * @type {Array} * @memberof LightningReceiveInfo */ htlcVtxos: Array; /** * The invoice string, if known. * @type {string} * @memberof LightningReceiveInfo */ invoice: string; /** * The payment hash linked to the lightning receive * @type {string} * @memberof LightningReceiveInfo */ paymentHash: string; /** * The payment preimage, if known. * @type {string} * @memberof LightningReceiveInfo */ paymentPreimage?: string | null; /** * The timestamp at which the preimage was revealed. * @type {Date} * @memberof LightningReceiveInfo * @deprecated */ preimageRevealedAt?: Date | null; /** * The timestamp at which the receive settled, if it has. * @type {Date} * @memberof LightningReceiveInfo */ settledAt?: Date | null; /** * Lifecycle phase of the receive: `awaiting-payment`, `htlcs-ready`, * `preimage-revealed`, `delivering`, or `settled`. * @type {string} * @memberof LightningReceiveInfo */ state: string; } /** * Check if a given object implements the LightningReceiveInfo interface. */ export function instanceOfLightningReceiveInfo(value: object): value is LightningReceiveInfo { if (!('amountSat' in value) || value['amountSat'] === undefined) return false; if (!('htlcVtxoIds' in value) || value['htlcVtxoIds'] === undefined) return false; if (!('htlcVtxos' in value) || value['htlcVtxos'] === undefined) return false; if (!('invoice' in value) || value['invoice'] === undefined) return false; if (!('paymentHash' in value) || value['paymentHash'] === undefined) return false; if (!('state' in value) || value['state'] === undefined) return false; return true; } export function LightningReceiveInfoFromJSON(json: any): LightningReceiveInfo { return LightningReceiveInfoFromJSONTyped(json, false); } export function LightningReceiveInfoFromJSONTyped(json: any, ignoreDiscriminator: boolean): LightningReceiveInfo { if (json == null) { return json; } return { 'amountSat': json['amount_sat'], 'finishedAt': json['finished_at'] == null ? undefined : (new Date(json['finished_at'])), 'htlcVtxoIds': json['htlc_vtxo_ids'], 'htlcVtxos': ((json['htlc_vtxos'] as Array).map(WalletVtxoInfoFromJSON)), 'invoice': json['invoice'], 'paymentHash': json['payment_hash'], 'paymentPreimage': json['payment_preimage'] == null ? undefined : json['payment_preimage'], 'preimageRevealedAt': json['preimage_revealed_at'] == null ? undefined : (new Date(json['preimage_revealed_at'])), 'settledAt': json['settled_at'] == null ? undefined : (new Date(json['settled_at'])), 'state': json['state'], }; } export function LightningReceiveInfoToJSON(json: any): LightningReceiveInfo { return LightningReceiveInfoToJSONTyped(json, false); } export function LightningReceiveInfoToJSONTyped(value?: LightningReceiveInfo | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } return { 'amount_sat': value['amountSat'], 'finished_at': value['finishedAt'] == null ? value['finishedAt'] : value['finishedAt'].toISOString(), 'htlc_vtxo_ids': value['htlcVtxoIds'], 'htlc_vtxos': ((value['htlcVtxos'] as Array).map(WalletVtxoInfoToJSON)), 'invoice': value['invoice'], 'payment_hash': value['paymentHash'], 'payment_preimage': value['paymentPreimage'], 'preimage_revealed_at': value['preimageRevealedAt'] == null ? value['preimageRevealedAt'] : value['preimageRevealedAt'].toISOString(), 'settled_at': value['settledAt'] == null ? value['settledAt'] : value['settledAt'].toISOString(), 'state': value['state'], }; }