"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
    for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.formatTransactionStatus = exports.formatTransaction = exports.toTransactionStatusRaw = exports.fromTransactionStatusRaw = exports.toTransactionRaw = exports.fromTransactionRaw = void 0;
__exportStar(require("@ledgerhq/coin-framework/transaction/common"), exports);
__exportStar(require("./signOperation"), exports);
__exportStar(require("./deviceTransactionConfig"), exports);
const transaction_1 = __importDefault(require("../generated/transaction"));
const fromTransactionRaw = (tr) => {
    const TM = transaction_1.default[tr.family];
    // FIXME: something is wrong with TM.fromTransactionRaw expecting a (arg: never) => for some reasons
    return TM.fromTransactionRaw(tr);
};
exports.fromTransactionRaw = fromTransactionRaw;
const toTransactionRaw = (t) => {
    const TM = transaction_1.default[t.family];
    // FIXME: something is wrong with TM.toTransactionRaw expecting a (arg: never) => for some reasons
    return TM.toTransactionRaw(t);
};
exports.toTransactionRaw = toTransactionRaw;
const fromTransactionStatusRaw = (tr, family) => {
    const TM = transaction_1.default[family];
    return TM.fromTransactionStatusRaw(tr);
};
exports.fromTransactionStatusRaw = fromTransactionStatusRaw;
const toTransactionStatusRaw = (t, family) => {
    const TM = transaction_1.default[family];
    return TM.toTransactionStatusRaw(t);
};
exports.toTransactionStatusRaw = toTransactionStatusRaw;
const formatTransaction = async (t, a) => {
    const TM = transaction_1.default[t.family];
    // FIXME: something is wrong with TM.formatTransaction expecting a (arg: never) => for some reasons
    return TM.formatTransaction ? await TM.formatTransaction(t, a) : "";
};
exports.formatTransaction = formatTransaction;
const formatTransactionStatus = (t, ts, mainAccount) => {
    const TM = transaction_1.default[t.family];
    return TM.formatTransactionStatus(t, ts, mainAccount);
};
exports.formatTransactionStatus = formatTransactionStatus;
//# sourceMappingURL=index.js.map