viem
Version:
26 lines • 1.11 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.getTransactionType = getTransactionType;
const transaction_js_1 = require("../../errors/transaction.js");
function getTransactionType(transaction) {
if (transaction.type)
return transaction.type;
if (typeof transaction.authorizationList !== 'undefined')
return 'eip7702';
if (typeof transaction.blobs !== 'undefined' ||
typeof transaction.blobVersionedHashes !== 'undefined' ||
typeof transaction.maxFeePerBlobGas !== 'undefined' ||
typeof transaction.sidecars !== 'undefined')
return 'eip4844';
if (typeof transaction.maxFeePerGas !== 'undefined' ||
typeof transaction.maxPriorityFeePerGas !== 'undefined') {
return 'eip1559';
}
if (typeof transaction.gasPrice !== 'undefined') {
if (typeof transaction.accessList !== 'undefined')
return 'eip2930';
return 'legacy';
}
throw new transaction_js_1.InvalidSerializableTransactionError({ transaction });
}
//# sourceMappingURL=getTransactionType.js.map
;