@axiom-crypto/tools
Version:
Useful data, field, and byte manipulation tools for Axiom.
20 lines (19 loc) • 583 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.calculateCalldataGas = void 0;
const byteStringReader_1 = require("./byteStringReader");
function calculateCalldataGas(hexString) {
let gas = 0;
const reader = new byteStringReader_1.ByteStringReader(hexString);
while (reader.getNumBytesRemaining() > 0) {
const byte = reader.readBytes(1);
if (byte === "0x00") {
gas += 4;
}
else {
gas += 16;
}
}
return gas;
}
exports.calculateCalldataGas = calculateCalldataGas;