@ledgerhq/coin-hedera
Version:
Ledger Hedera Coin integration
23 lines • 1.15 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.broadcast = void 0;
const operation_1 = require("@ledgerhq/ledger-wallet-framework/operation");
const broadcast_1 = require("../logic/broadcast");
const utils_1 = require("../logic/utils");
const utils_2 = require("./utils");
const broadcast = async ({ signedOperation }) => {
const { signature, operation } = signedOperation;
const response = await (0, broadcast_1.broadcast)(signature);
const base64Hash = Buffer.from(response.transactionHash).toString("base64");
const base64HashUrlSafe = (0, utils_1.base64ToUrlSafeBase64)(base64Hash);
const extra = {
...((0, utils_1.isValidExtra)(operation.extra) ? operation.extra : {}),
transactionId: (0, utils_1.formatTransactionId)(response.transactionId),
};
let patchedOperation = operation;
patchedOperation = (0, operation_1.patchOperationWithHash)(patchedOperation, base64HashUrlSafe);
patchedOperation = (0, utils_2.patchOperationWithExtra)(patchedOperation, extra);
return patchedOperation;
};
exports.broadcast = broadcast;
//# sourceMappingURL=broadcast.js.map