UNPKG

@abstract-foundation/agw-client

Version:
21 lines 1.09 kB
import { BaseError, } from "viem"; import { SESSION_KEY_VALIDATOR_ADDRESS } from "../constants.js"; import { encodeSessionWithPeriodIds, getPeriodIdsForTransaction, } from "../sessions.js"; import { sendTransactionInternal } from "./sendTransactionInternal.js"; export async function sendTransactionForSession(client, signerClient, publicClient, parameters, session, customPaymasterHandler = undefined) { const selector = parameters.data ? `0x${parameters.data.slice(2, 10)}` : undefined; if (!parameters.to) { throw new BaseError("Transaction to field is not specified"); } return sendTransactionInternal(client, signerClient, publicClient, parameters, SESSION_KEY_VALIDATOR_ADDRESS, { [SESSION_KEY_VALIDATOR_ADDRESS]: encodeSessionWithPeriodIds(session, getPeriodIdsForTransaction({ sessionConfig: session, target: parameters.to, selector, timestamp: BigInt(Math.floor(Date.now() / 1000)), })), }, customPaymasterHandler); } //# sourceMappingURL=sendTransactionForSession.js.map