/* 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 { MovementTimestamp } from './MovementTimestamp'; import { MovementTimestampFromJSON, MovementTimestampFromJSONTyped, MovementTimestampToJSON, MovementTimestampToJSONTyped, } from './MovementTimestamp'; import type { MovementDestination } from './MovementDestination'; import { MovementDestinationFromJSON, MovementDestinationFromJSONTyped, MovementDestinationToJSON, MovementDestinationToJSONTyped, } from './MovementDestination'; import type { MovementStatus } from './MovementStatus'; import { MovementStatusFromJSON, MovementStatusFromJSONTyped, MovementStatusToJSON, MovementStatusToJSONTyped, } from './MovementStatus'; import type { MovementSubsystem } from './MovementSubsystem'; import { MovementSubsystemFromJSON, MovementSubsystemFromJSONTyped, MovementSubsystemToJSON, MovementSubsystemToJSONTyped, } from './MovementSubsystem'; /** * Describes an attempted movement of offchain funds within the [bark::Wallet]. * @export * @interface Movement */ export interface Movement { /** * How much the wallet balance actually changed by. Positive numbers indicate an increase and * negative numbers indicate a decrease. This is often inclusive of applicable fees, and it * should be the most accurate number. * @type {number} * @memberof Movement */ effectiveBalanceSat: number; /** * A list of IDs for VTXOs that were marked for unilateral exit as a result of this movement. * This could happen for many reasons, e.g. an unsuccessful lightning payment which can't be * revoked but is about to expire. VTXOs listed here will result in a reduction of spendable * balance due to the VTXOs being managed by the [bark::exit::Exit] system. * @type {Array} * @memberof Movement */ exitedVtxos: Array; /** * The internal ID of the movement. * @type {number} * @memberof Movement */ id: number; /** * A list of [Vtxo](ark::Vtxo) IDs that were consumed by this movement and * are either locked or unavailable. * @type {Array} * @memberof Movement */ inputVtxos: Array; /** * How much the movement was expected to increase or decrease the balance by. This is always an * estimate and often discounts any applicable fees. * @type {number} * @memberof Movement */ intendedBalanceSat: number; /** * Miscellaneous metadata for the movement. This is JSON containing arbitrary information as * defined by the subsystem that created the movement. * @type {{ [key: string]: any; }} * @memberof Movement */ metadata?: { [key: string]: any; }; /** * How much the movement cost the user in offchain fees. If there are applicable onchain fees * they will not be included in this value but, depending on the subsystem, could be found in * the metadata. * @type {number} * @memberof Movement */ offchainFeeSat: number; /** * A list of IDs for new VTXOs that were produced as a result of this movement. Often change * VTXOs will be found here for outbound actions unless this was an inbound action. * @type {Array} * @memberof Movement */ outputVtxos: Array; /** * Describes the means by which the wallet received funds in this movement. This could include * BOLT11 invoices or other useful data. * @type {Array} * @memberof Movement */ receivedOn: Array; /** * A list of external recipients that received funds from this movement. * @type {Array} * @memberof Movement */ sentTo: Array; /** * The status of the movement. * @type {MovementStatus} * @memberof Movement */ status: MovementStatus; /** * Contains information about the subsystem that created the movement as well as the purpose * of the movement. * @type {MovementSubsystem} * @memberof Movement */ subsystem: MovementSubsystem; /** * Contains the times at which the movement was created, updated and completed. * @type {MovementTimestamp} * @memberof Movement */ time: MovementTimestamp; } /** * Check if a given object implements the Movement interface. */ export function instanceOfMovement(value: object): value is Movement { if (!('effectiveBalanceSat' in value) || value['effectiveBalanceSat'] === undefined) return false; if (!('exitedVtxos' in value) || value['exitedVtxos'] === undefined) return false; if (!('id' in value) || value['id'] === undefined) return false; if (!('inputVtxos' in value) || value['inputVtxos'] === undefined) return false; if (!('intendedBalanceSat' in value) || value['intendedBalanceSat'] === undefined) return false; if (!('offchainFeeSat' in value) || value['offchainFeeSat'] === undefined) return false; if (!('outputVtxos' in value) || value['outputVtxos'] === undefined) return false; if (!('receivedOn' in value) || value['receivedOn'] === undefined) return false; if (!('sentTo' in value) || value['sentTo'] === undefined) return false; if (!('status' in value) || value['status'] === undefined) return false; if (!('subsystem' in value) || value['subsystem'] === undefined) return false; if (!('time' in value) || value['time'] === undefined) return false; return true; } export function MovementFromJSON(json: any): Movement { return MovementFromJSONTyped(json, false); } export function MovementFromJSONTyped(json: any, ignoreDiscriminator: boolean): Movement { if (json == null) { return json; } return { 'effectiveBalanceSat': json['effective_balance_sat'], 'exitedVtxos': json['exited_vtxos'], 'id': json['id'], 'inputVtxos': json['input_vtxos'], 'intendedBalanceSat': json['intended_balance_sat'], 'metadata': json['metadata'] == null ? undefined : json['metadata'], 'offchainFeeSat': json['offchain_fee_sat'], 'outputVtxos': json['output_vtxos'], 'receivedOn': ((json['received_on'] as Array).map(MovementDestinationFromJSON)), 'sentTo': ((json['sent_to'] as Array).map(MovementDestinationFromJSON)), 'status': MovementStatusFromJSON(json['status']), 'subsystem': MovementSubsystemFromJSON(json['subsystem']), 'time': MovementTimestampFromJSON(json['time']), }; } export function MovementToJSON(json: any): Movement { return MovementToJSONTyped(json, false); } export function MovementToJSONTyped(value?: Movement | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } return { 'effective_balance_sat': value['effectiveBalanceSat'], 'exited_vtxos': value['exitedVtxos'], 'id': value['id'], 'input_vtxos': value['inputVtxos'], 'intended_balance_sat': value['intendedBalanceSat'], 'metadata': value['metadata'], 'offchain_fee_sat': value['offchainFeeSat'], 'output_vtxos': value['outputVtxos'], 'received_on': ((value['receivedOn'] as Array).map(MovementDestinationToJSON)), 'sent_to': ((value['sentTo'] as Array).map(MovementDestinationToJSON)), 'status': MovementStatusToJSON(value['status']), 'subsystem': MovementSubsystemToJSON(value['subsystem']), 'time': MovementTimestampToJSON(value['time']), }; }