/* 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 * as runtime from '../runtime'; import type { BoardRequest, InternalServerError, PendingBoardInfo, } from '../models/index'; import { BoardRequestFromJSON, BoardRequestToJSON, InternalServerErrorFromJSON, InternalServerErrorToJSON, PendingBoardInfoFromJSON, PendingBoardInfoToJSON, } from '../models/index'; export interface BoardAmountRequest { boardRequest: BoardRequest; } /** * */ export class BoardsApi extends runtime.BaseAPI { /** * Creates request options for boardAll without sending the request */ async boardAllRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("bearer", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/api/v1/boards/board-all`; return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, }; } /** * Moves all bitcoin in the on-chain wallet onto the Ark protocol. Creates and broadcasts a funding transaction that drains the on-chain balance into a single VTXO, then returns the pending board details. The resulting VTXO is not spendable off-chain until the funding transaction reaches the number of on-chain confirmations required by the Ark server. * Board all on-chain bitcoin */ async boardAllRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.boardAllRequestOpts(); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => PendingBoardInfoFromJSON(jsonValue)); } /** * Moves all bitcoin in the on-chain wallet onto the Ark protocol. Creates and broadcasts a funding transaction that drains the on-chain balance into a single VTXO, then returns the pending board details. The resulting VTXO is not spendable off-chain until the funding transaction reaches the number of on-chain confirmations required by the Ark server. * Board all on-chain bitcoin */ async boardAll(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.boardAllRaw(initOverrides); return await response.value(); } /** * Creates request options for boardAmount without sending the request */ async boardAmountRequestOpts(requestParameters: BoardAmountRequest): Promise { if (requestParameters['boardRequest'] == null) { throw new runtime.RequiredError( 'boardRequest', 'Required parameter "boardRequest" was null or undefined when calling boardAmount().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("bearer", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/api/v1/boards/board-amount`; return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: BoardRequestToJSON(requestParameters['boardRequest']), }; } /** * Moves the specified amount of bitcoin in the on-chain wallet onto the Ark protocol. Creates and broadcasts a funding transaction, then returns the pending board details. The resulting VTXO is not spendable off-chain until the funding transaction reaches the number of on-chain confirmations required by the Ark server. * Board a specific amount */ async boardAmountRaw(requestParameters: BoardAmountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.boardAmountRequestOpts(requestParameters); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => PendingBoardInfoFromJSON(jsonValue)); } /** * Moves the specified amount of bitcoin in the on-chain wallet onto the Ark protocol. Creates and broadcasts a funding transaction, then returns the pending board details. The resulting VTXO is not spendable off-chain until the funding transaction reaches the number of on-chain confirmations required by the Ark server. * Board a specific amount */ async boardAmount(requestParameters: BoardAmountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.boardAmountRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates request options for getPendingBoards without sending the request */ async getPendingBoardsRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("bearer", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/api/v1/boards/pending`; return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }; } /** * Returns all boards whose funding transactions have not yet reached the number of on-chain confirmations required by the Ark server. * List pending boards */ async getPendingBoardsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { const requestOptions = await this.getPendingBoardsRequestOpts(); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(PendingBoardInfoFromJSON)); } /** * Returns all boards whose funding transactions have not yet reached the number of on-chain confirmations required by the Ark server. * List pending boards */ async getPendingBoards(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const response = await this.getPendingBoardsRaw(initOverrides); return await response.value(); } }