UNPKG

@bigmi/core

Version:

TypeScript library for Bitcoin apps.

20 lines 644 B
import { urlWithParams } from '../../utils/url.js'; import { getRpcErrorCode } from './utils.js'; export const getTransactionFee = async (client, { baseUrl, apiKey }, { txId }) => { const apiUrl = urlWithParams(`${baseUrl}/txs/${txId}`, { token: apiKey, }); const response = (await client.request({ url: apiUrl, fetchOptions: { method: 'GET' }, })); if (response.error) { return { error: { code: getRpcErrorCode(response.error), message: response.error }, }; } return { result: BigInt(response.fees), }; }; //# sourceMappingURL=getTransactionFee.js.map