/* 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 { InternalServerError, TipResponse, } from '../models/index'; import { InternalServerErrorFromJSON, InternalServerErrorToJSON, TipResponseFromJSON, TipResponseToJSON, } from '../models/index'; /** * */ export class BitcoinApi extends runtime.BaseAPI { /** * Creates request options for tip without sending the request */ async tipRequestOpts(): 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/bitcoin/tip`; return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }; } /** * Queries the wallet\'s chain source for the block height of the latest block on the best chain. * Get bitcoin tip height */ async tipRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const requestOptions = await this.tipRequestOpts(); const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => TipResponseFromJSON(jsonValue)); } /** * Queries the wallet\'s chain source for the block height of the latest block on the best chain. * Get bitcoin tip height */ async tip(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.tipRaw(initOverrides); return await response.value(); } }