@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
18 lines • 849 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.genericBroadcast = void 0;
const operation_1 = require("@ledgerhq/ledger-wallet-framework/operation");
const alpaca_1 = require("./alpaca");
const genericBroadcast = (_network, kind) => async ({ signedOperation: { signature, operation }, account, broadcastConfig }) => {
const api = (0, alpaca_1.getAlpacaApi)(account.currency.id, kind);
if (api.validateTransaction) {
const validation = await api.validateTransaction(signature);
if (validation.error !== undefined) {
throw validation.error;
}
}
const hash = await api.broadcast(signature, broadcastConfig);
return (0, operation_1.patchOperationWithHash)(operation, hash);
};
exports.genericBroadcast = genericBroadcast;
//# sourceMappingURL=broadcast.js.map