diff --git a/paymaster/src/config.ts b/paymaster/src/config.ts new file mode 100644 index 0000000..d9a1919 --- /dev/null +++ b/paymaster/src/config.ts @@ -0,0 +1,7 @@ +// If set to true, all transactions will be sponsored +export const whitelistAll: Boolean = true; + +// Whitelisted addresses for paymaster to sponsor transactions +export const whitelistedAddresses: string[] = [ + // add addresses here +]; \ No newline at end of file diff --git a/paymaster/src/rpcMethods.ts b/paymaster/src/rpcMethods.ts index 0db3f88..e981580 100644 --- a/paymaster/src/rpcMethods.ts +++ b/paymaster/src/rpcMethods.ts @@ -1,6 +1,7 @@ import { BigNumberish, ethers } from 'ethers'; import { paymasterAbi } from './abis'; import { BytesLike } from '@ethersproject/bytes'; +import { whitelistAll, whitelistedAddresses } from './config'; import dotenv from 'dotenv'; dotenv.config(); @@ -29,8 +30,14 @@ export async function sponsorTransaction(userOp: UserOperation): Promise address.toLowerCase() + ).includes(userOp.sender.toLowerCase()) + ) { + return userOp; + } const coder = new ethers.AbiCoder(); const validAfter = (await provider.getBlock('latest'))?.timestamp;