UNPKG

@bigmi/core

Version:

TypeScript library for Bitcoin apps.

27 lines 840 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getBalance = void 0; const url_js_1 = require("../../utils/url.js"); const utils_js_1 = require("./utils.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: (0, utils_js_1.getRpcErrorCode)(response.error), message: response.error, }, }; } return { result: BigInt(response.balance), }; }; exports.getBalance = getBalance; //# sourceMappingURL=getBalance.js.map