@bigmi/core
Version:
TypeScript library for Bitcoin apps.
19 lines • 566 B
JavaScript
import { urlWithParams } from '../../utils/url.js';
export const getBalance = async (client, { baseUrl, apiKey }, { address }) => {
const apiUrl = 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),
};
};
//# sourceMappingURL=getBalance.js.map