UNPKG

@biconomy/modules

Version:

This package provides different validation modules/plugins for ERC4337 compatible modular account

33 lines 1.42 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BaseValidationModule = void 0; const Constants_1 = require("./utils/Constants"); class BaseValidationModule { constructor(moduleConfig) { const { entryPointAddress } = moduleConfig; this.entryPointAddress = entryPointAddress || Constants_1.DEFAULT_ENTRYPOINT_ADDRESS; } setEntryPointAddress(entryPointAddress) { this.entryPointAddress = entryPointAddress; } async signMessageWalletClientSigner(message, signer) { let signature = await signer.signMessage(message); const potentiallyIncorrectV = parseInt(signature.slice(-2), 16); if (![27, 28].includes(potentiallyIncorrectV)) { const correctV = potentiallyIncorrectV + 27; signature = `0x${signature.slice(0, -2) + correctV.toString(16)}`; } return signature; } async signMessageSigner(message, signer) { let signature = await signer.signMessage(message); const potentiallyIncorrectV = parseInt(signature.slice(-2), 16); if (![27, 28].includes(potentiallyIncorrectV)) { const correctV = potentiallyIncorrectV + 27; signature = signature.slice(0, -2) + correctV.toString(16); } return signature; } } exports.BaseValidationModule = BaseValidationModule; //# sourceMappingURL=BaseValidationModule.js.map