UNPKG

@bigmi/core

Version:

TypeScript library for Bitcoin apps.

23 lines 708 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getBalance = void 0; const url_js_1 = require("../../utils/url.js"); const getBalance = async (client, { baseUrl, apiKey }, { address }) => { const apiUrl = (0, url_js_1.urlWithParams)(`${baseUrl}/addrs/${address}`, { token: apiKey, }); const response = (await client.request({ url: apiUrl, fetchOptions: { method: 'GET' }, })); if (response.error) { return { error: { code: -1, message: response.error }, }; } return { result: BigInt(response.balance), }; }; exports.getBalance = getBalance; //# sourceMappingURL=getBalance.js.map