UNPKG

@etherspot/remote-signer

Version:

Etherspot Permissioned Signer SDK - signs the UserOp with SessionKey and sends it to the Bundler

49 lines (47 loc) 1.48 kB
import { sessionKeyValidatorAbi } from "./chunk-KNNHGAPS.mjs"; import { parseAbi } from "./chunk-VPBLFL5G.mjs"; // src/sdk/session-keys/erc20-sessionkey-onchain.ts var getOnchainSessionKeyData = async (etherspotWalletAddress, publicClient, sesssionKeyValidatorAddress, sessionKey) => { const data = await publicClient.simulateContract({ account: etherspotWalletAddress, address: sesssionKeyValidatorAddress, abi: parseAbi(sessionKeyValidatorAbi), functionName: "sessionData", args: [sessionKey, etherspotWalletAddress] }); if (!data.result || data.result == null) { throw new Error("Session data not found"); } const { token, funcSelector, spendingLimit, validAfter, validUntil, live } = data.result; return { account: etherspotWalletAddress, token, funcSelector, spendingLimit, validAfter, validUntil, live }; }; var isSessionKeyLiveOnChain = async (etherspotWalletAddress, publicClient, sesssionKeyValidatorAddress, sessionKey) => { const data = await publicClient.simulateContract({ account: etherspotWalletAddress, address: sesssionKeyValidatorAddress, abi: parseAbi(sessionKeyValidatorAbi), functionName: "isSessionKeyLive", args: [sessionKey] }); if (!data.result || data.result == null) { throw new Error("Session data not found"); } return data.result; }; export { getOnchainSessionKeyData, isSessionKeyLiveOnChain }; //# sourceMappingURL=chunk-M2QU7VOG.mjs.map