@ledgerhq/coin-hedera
Version:
Ledger Hedera Coin integration
19 lines • 1.03 kB
JavaScript
import { patchOperationWithHash } from "@ledgerhq/ledger-wallet-framework/operation";
import { broadcast as logicBroadcast } from "../logic/broadcast";
import { base64ToUrlSafeBase64, isValidExtra, formatTransactionId } from "../logic/utils";
import { patchOperationWithExtra } from "./utils";
export const broadcast = async ({ signedOperation }) => {
const { signature, operation } = signedOperation;
const response = await logicBroadcast(signature);
const base64Hash = Buffer.from(response.transactionHash).toString("base64");
const base64HashUrlSafe = base64ToUrlSafeBase64(base64Hash);
const extra = {
...(isValidExtra(operation.extra) ? operation.extra : {}),
transactionId: formatTransactionId(response.transactionId),
};
let patchedOperation = operation;
patchedOperation = patchOperationWithHash(patchedOperation, base64HashUrlSafe);
patchedOperation = patchOperationWithExtra(patchedOperation, extra);
return patchedOperation;
};
//# sourceMappingURL=broadcast.js.map