Skip to content

Commit

Permalink
remove paymaster validUntil limit
Browse files Browse the repository at this point in the history
  • Loading branch information
mouseless0x committed Jun 27, 2024
1 parent 44fd3ae commit 3bffc6f
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 53 deletions.
102 changes: 51 additions & 51 deletions mock-verifying-paymaster/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
import cors from "@fastify/cors"
import Fastify from "fastify"
import { ENTRYPOINT_ADDRESS_V06, ENTRYPOINT_ADDRESS_V07 } from "permissionless"
import { createPimlicoBundlerClient } from "permissionless/clients/pimlico"
import { http } from "viem"
import { foundry } from "viem/chains"
import { getAnvilWalletClient } from "./helpers/utils"
import cors from "@fastify/cors";
import Fastify from "fastify";
import { ENTRYPOINT_ADDRESS_V06, ENTRYPOINT_ADDRESS_V07 } from "permissionless";
import { createPimlicoBundlerClient } from "permissionless/clients/pimlico";
import { http } from "viem";
import { foundry } from "viem/chains";
import { getAnvilWalletClient } from "./helpers/utils";
import {
setupVerifyingPaymasterV06,
setupVerifyingPaymasterV07
} from "./helpers/verifyingPaymasters"
import { createRpcHandler } from "./relay"
setupVerifyingPaymasterV06,
setupVerifyingPaymasterV07,
} from "./helpers/verifyingPaymasters";
import { createRpcHandler } from "./relay";

const main = async () => {
const walletClient = getAnvilWalletClient()
const verifyingPaymasterV07 = await setupVerifyingPaymasterV07(walletClient)
const verifyingPaymasterV06 = await setupVerifyingPaymasterV06(walletClient)

const altoBundlerV07 = createPimlicoBundlerClient({
chain: foundry,
transport: http(process.env.ALTO_RPC),
entryPoint: ENTRYPOINT_ADDRESS_V07
})

const altoBundlerV06 = createPimlicoBundlerClient({
chain: foundry,
transport: http(process.env.ALTO_RPC),
entryPoint: ENTRYPOINT_ADDRESS_V06
})

const app = Fastify({})

app.register(cors, {
origin: "*",
methods: ["POST", "GET", "OPTIONS"]
})

const rpcHandler = createRpcHandler(
altoBundlerV07,
altoBundlerV06,
verifyingPaymasterV07,
verifyingPaymasterV06,
walletClient
)
app.post("/", {}, rpcHandler)

app.get("/ping", async (_request, reply) => {
return reply.code(200).send({ message: "pong" })
})

await app.listen({ host: "0.0.0.0", port: 3000 })
}

main()
const walletClient = getAnvilWalletClient();
const verifyingPaymasterV07 = await setupVerifyingPaymasterV07(walletClient);
const verifyingPaymasterV06 = await setupVerifyingPaymasterV06(walletClient);

const altoBundlerV07 = createPimlicoBundlerClient({
chain: foundry,
transport: http(process.env.ALTO_RPC),
entryPoint: ENTRYPOINT_ADDRESS_V07,
});

const altoBundlerV06 = createPimlicoBundlerClient({
chain: foundry,
transport: http(process.env.ALTO_RPC),
entryPoint: ENTRYPOINT_ADDRESS_V06,
});

const app = Fastify({});

app.register(cors, {
origin: "*",
methods: ["POST", "GET", "OPTIONS"],
});

const rpcHandler = createRpcHandler(
altoBundlerV07,
altoBundlerV06,
verifyingPaymasterV07,
verifyingPaymasterV06,
walletClient,
);
app.post("/", {}, rpcHandler);

app.get("/ping", async (_request, reply) => {
return reply.code(200).send({ message: "pong" });
});

await app.listen({ host: "0.0.0.0", port: 3000 });
};

main();
4 changes: 2 additions & 2 deletions mock-verifying-paymaster/src/relay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const handleMethodV06 = async (
}

const validAfter = 0;
const validUntil = Math.floor(Date.now() / 1000) + 6000;
const validUntil = 0;
op.paymasterAndData = concat([
verifyingPaymasterV06.address,
encodeAbiParameters(
Expand Down Expand Up @@ -208,7 +208,7 @@ const handleMethodV07 = async (
}

const validAfter = 0;
const validUntil = Math.floor(Date.now() / 1000) + 6000;
const validUntil = 0;
op.paymasterData = concat([
encodeAbiParameters(
[
Expand Down

0 comments on commit 3bffc6f

Please sign in to comment.