@bigmi/core
Version:
TypeScript library for Bitcoin apps.
24 lines • 819 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getTransactionFee = void 0;
const url_js_1 = require("../../utils/url.js");
const utils_js_1 = require("./utils.js");
const getTransactionFee = async (client, { baseUrl, apiKey }, { txId }) => {
const apiUrl = (0, url_js_1.urlWithParams)(`${baseUrl}/txs/${txId}`, {
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.fees),
};
};
exports.getTransactionFee = getTransactionFee;
//# sourceMappingURL=getTransactionFee.js.map