@latticexyz/paymaster 2.2.15-entrykit-135988209993ee1688d8f415df09e6b428336079 → 2.2.15-entrykit-b0257a408918ebb4a227e71da0a8e8bc58477896

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,6 +11,12 @@ type GetAllowanceParams = {
11
11
  userAddress: Address;
12
12
  };
13
13
  declare function getAllowance({ client, paymasterAddress, userAddress }: GetAllowanceParams): Promise<bigint>;
14
+ declare function getAllowanceSlot({ userAddress }: {
15
+ userAddress: Address;
16
+ }): `0x${string}`;
17
+ declare function setAllowanceSlot({ client, paymasterAddress, userAddress, allowance, }: GetAllowanceParams & {
18
+ allowance: bigint;
19
+ }): Promise<void>;
14
20
 
15
21
  declare function getPaymasterAddress(chain: Chain): `0x${string}`;
16
22
 
@@ -660,4 +666,4 @@ declare function userOpExecutor({ executor }: {
660
666
  executor: Client<Transport, Chain, Account>;
661
667
  }): Transport;
662
668
 
663
- export { GetAllowanceParams, QuarryPassIssuerRpcSchema, TransportRequestFn, TransportRequestFnMapped, claimGasPass, gasEstimator, getAllowance, getPaymasterAddress, getRpcMethod, getRpcReturnType, getRpcSchema, hasPassIssuer, paymasterAbi, paymasterConfig, paymasterTables, quarryPassIssuer, userOpExecutor };
669
+ export { GetAllowanceParams, QuarryPassIssuerRpcSchema, TransportRequestFn, TransportRequestFnMapped, claimGasPass, gasEstimator, getAllowance, getAllowanceSlot, getPaymasterAddress, getRpcMethod, getRpcReturnType, getRpcSchema, hasPassIssuer, paymasterAbi, paymasterConfig, paymasterTables, quarryPassIssuer, setAllowanceSlot, userOpExecutor };
package/dist/internal.js CHANGED
@@ -1,2 +1,2 @@
1
- import{http as P}from"viem";function m(){return({chain:r})=>{if(!r)throw new Error("No chain provided to issuer transport.");let e="quarryPassIssuer"in r.rpcUrls?r.rpcUrls.quarryPassIssuer.http[0]:void 0;if(!e)throw new Error(`No \`quarryPassIssuer\` RPC URL found for chain ${r.id}.`);return P(e)({chain:r,retryCount:0})}}import R from"debug";var c=R("mud:paymaster");async function j({chain:r,userAddress:e}){let t=m()({chain:r});c("Issuing gas pass to",e),await t.request({method:"quarry_issuePass",params:["0x01",e]}),c("Claiming gas allowance for",e),await t.request({method:"quarry_claimAllowance",params:["0x01",e]})}import{defineStore as g}from"@latticexyz/store";import{parseAbi as O}from"viem";var W=O(["error SpenderSystem_AlreadyRegistered(address spender, address user)","error SpenderSystem_HasOwnBalance(address spender)","function registerSpender(address spender)"]),U=g({namespaces:{root:{namespace:"",tables:{Allowance:{schema:{user:"address",allowance:"uint256"},key:["user"]},Grantor:{schema:{grantor:"address",allowance:"uint256"},key:["grantor"]},PassHolder:{schema:{user:"address",passId:"bytes32",lastRenewed:"uint256",lastClaimed:"uint256"},key:["user","passId"]},PassConfig:{schema:{passId:"bytes32",claimAmount:"uint256",claimInterval:"uint256",validityPeriod:"uint256",grantor:"address"},key:["passId"]},Spender:{schema:{spender:"address",user:"address"},key:["spender"]},SystemConfig:{schema:{entryPoint:"address"},key:[]}}}}}),u=U.namespaces.root.tables;import{getRecord as C}from"@latticexyz/store/internal";async function rr({client:r,paymasterAddress:e,userAddress:t}){return(await C(r,{address:e,table:u.Allowance,key:{user:t},blockTag:"pending"})).allowance}import{getChainContractAddress as w}from"viem";function ar(r){return w({chain:r,contract:"quarryPaymaster"})}function or(r){let t=r?.contracts?.quarryPaymaster?.address,s="quarryPassIssuer"in r.rpcUrls?r.rpcUrls.quarryPassIssuer.http[0]:void 0;return t!=null&&s}import{formatUserOperationRequest as q}from"viem/account-abstraction";async function p(r){return q({callGasLimit:20000000n,preVerificationGas:200000n,verificationGasLimit:2000000n,paymasterVerificationGasLimit:200000n,paymasterPostOpGasLimit:200000n})}function ur(r){return e=>{let{request:t,...s}=r(e);return{request:async({method:a,params:i},n)=>a==="eth_estimateUserOperationGas"?p(i):t({method:a,params:i},n),...s}}}import{createTransport as E,numberToHex as H}from"viem";import{entryPoint07Address as h}from"viem/account-abstraction";import{parseEther as A,parseEventLogs as x}from"viem";import{formatUserOperation as I,toPackedUserOperation as T,getUserOperationHash as _,entryPoint07Address as d,entryPoint07Abi as l}from"viem/account-abstraction";import{setBalance as G,waitForTransactionReceipt as S,writeContract as b}from"viem/actions";import{getAction as f}from"viem/utils";async function y({executor:r,rpcUserOp:e}){r.chain.id===31337&&await G(r.extend(()=>({mode:"anvil"})),{address:r.account.address,value:A("100")});let t=I(e),s=t.preVerificationGas+t.verificationGasLimit+(t.paymasterVerificationGasLimit??0n)+(t.paymasterPostOpGasLimit??0n)+t.callGasLimit,o=T(t),a=_({userOperation:t,chainId:r.chain.id,entryPointVersion:"0.7",entryPointAddress:d}),i=await f(r,b,"writeContract")({abi:l,address:d,functionName:"handleOps",args:[[o],r.account.address],chain:r.chain,account:r.account,gas:s}),n=await f(r,S,"waitForTransactionReceipt")({hash:i});return{success:x({logs:n.logs,abi:l,eventName:"UserOperationEvent"})[0].args.success,userOpHash:a,receipt:n}}function vr({executor:r}){return()=>{let e=new Map;return E({key:"userOpExecutor",type:"userOpExecutor",name:"User Operation Executor Transport",request:async({method:s,params:o})=>{if(s==="eth_chainId")return H(r.chain.id);if(s==="eth_supportedEntryPoints")return[h];if(s==="eth_sendUserOperation"){let[a,i]=o;if(i===h){let n=await y({executor:r,rpcUserOp:a});return e.set(n.userOpHash,n),n.userOpHash}}if(s==="eth_getUserOperationReceipt"){let[a]=o;return e.get(a)??null}if(s==="eth_estimateUserOperationGas")return await p(o);throw new Error("Not implemented")}})}}export{j as claimGasPass,ur as gasEstimator,rr as getAllowance,ar as getPaymasterAddress,or as hasPassIssuer,W as paymasterAbi,U as paymasterConfig,u as paymasterTables,m as quarryPassIssuer,vr as userOpExecutor};
1
+ import{http as R}from"viem";function u(){return({chain:e})=>{if(!e)throw new Error("No chain provided to issuer transport.");let r="quarryPassIssuer"in e.rpcUrls?e.rpcUrls.quarryPassIssuer.http[0]:void 0;if(!r)throw new Error(`No \`quarryPassIssuer\` RPC URL found for chain ${e.id}.`);return R(r)({chain:e,retryCount:0})}}import w from"debug";var m=w("mud:paymaster");async function J({chain:e,userAddress:r}){let t=u()({chain:e});m("Issuing gas pass to",r),await t.request({method:"quarry_issuePass",params:["0x01",r]}),m("Claiming gas allowance for",r),await t.request({method:"quarry_claimAllowance",params:["0x01",r]})}import{numberToHex as U}from"viem";import{defineStore as A}from"@latticexyz/store";import{parseAbi as O}from"viem";var Z=O(["error SpenderSystem_AlreadyRegistered(address spender, address user)","error SpenderSystem_HasOwnBalance(address spender)","function registerSpender(address spender)"]),x=A({namespaces:{root:{namespace:"",tables:{Allowance:{schema:{user:"address",allowance:"uint256"},key:["user"]},Grantor:{schema:{grantor:"address",allowance:"uint256"},key:["grantor"]},PassHolder:{schema:{user:"address",passId:"bytes32",lastRenewed:"uint256",lastClaimed:"uint256"},key:["user","passId"]},PassConfig:{schema:{passId:"bytes32",claimAmount:"uint256",claimInterval:"uint256",validityPeriod:"uint256",grantor:"address"},key:["passId"]},Spender:{schema:{spender:"address",user:"address"},key:["spender"]},SystemConfig:{schema:{entryPoint:"address"},key:[]}}}}}),p=x.namespaces.root.tables;import{getRecord as C,getStaticDataLocation as d}from"@latticexyz/store/internal";import{getKeyTuple as l}from"@latticexyz/protocol-parser/internal";import{setStorageAt as q}from"viem/actions";async function pe({client:e,paymasterAddress:r,userAddress:t}){return(await C(e,{address:r,table:p.Allowance,key:{user:t},blockTag:"pending"})).allowance}function ce({userAddress:e}){return d(p.Allowance.tableId,l(p.Allowance,{user:e}))}async function me({client:e,paymasterAddress:r,userAddress:t,allowance:s}){let a=d(p.Allowance.tableId,l(p.Allowance,{user:t}));await q(e.extend(()=>({mode:"anvil"})),{address:r,index:a,value:U(s,{size:32})})}import{getChainContractAddress as I}from"viem";function fe(e){return I({chain:e,contract:"quarryPaymaster"})}function he(e){let t=e?.contracts?.quarryPaymaster?.address,s="quarryPassIssuer"in e.rpcUrls?e.rpcUrls.quarryPassIssuer.http[0]:void 0;return t!=null&&s}import{formatUserOperationRequest as T}from"viem/account-abstraction";async function c(e){return T({callGasLimit:20000000n,preVerificationGas:200000n,verificationGasLimit:2000000n,paymasterVerificationGasLimit:200000n,paymasterPostOpGasLimit:200000n})}function Ae(e){return r=>{let{request:t,...s}=e(r);return{request:async({method:n,params:o},i)=>n==="eth_estimateUserOperationGas"?c(o):t({method:n,params:o},i),...s}}}import{createTransport as F,numberToHex as L}from"viem";import{entryPoint07Address as g}from"viem/account-abstraction";import{parseEther as S,parseEventLogs as _}from"viem";import{formatUserOperation as b,toPackedUserOperation as G,getUserOperationHash as E,entryPoint07Address as f,entryPoint07Abi as y}from"viem/account-abstraction";import{setBalance as H,waitForTransactionReceipt as k,writeContract as v}from"viem/actions";import{getAction as h}from"viem/utils";async function P({executor:e,rpcUserOp:r}){e.chain.id===31337&&await H(e.extend(()=>({mode:"anvil"})),{address:e.account.address,value:S("100")});let t=b(r),s=G(t),a=E({userOperation:t,chainId:e.chain.id,entryPointVersion:"0.7",entryPointAddress:f}),n=await h(e,v,"writeContract")({abi:y,address:f,functionName:"handleOps",args:[[s],e.account.address],chain:e.chain,account:e.account}),o=await h(e,k,"waitForTransactionReceipt")({hash:n});return{success:_({logs:o.logs,abi:y,eventName:"UserOperationEvent"})[0].args.success,userOpHash:a,receipt:o}}function Ke({executor:e}){return()=>{let r=new Map;return F({key:"userOpExecutor",type:"userOpExecutor",name:"User Operation Executor Transport",request:async({method:s,params:a})=>{if(s==="eth_chainId")return L(e.chain.id);if(s==="eth_supportedEntryPoints")return[g];if(s==="eth_sendUserOperation"){let[n,o]=a;if(o===g){let i=await P({executor:e,rpcUserOp:n});return r.set(i.userOpHash,i),i.userOpHash}}if(s==="eth_getUserOperationReceipt"){let[n]=a;return r.get(n)??null}if(s==="eth_estimateUserOperationGas")return await c(a);throw new Error("Not implemented")}})}}export{J as claimGasPass,Ae as gasEstimator,pe as getAllowance,ce as getAllowanceSlot,fe as getPaymasterAddress,he as hasPassIssuer,Z as paymasterAbi,x as paymasterConfig,p as paymasterTables,u as quarryPassIssuer,me as setAllowanceSlot,Ke as userOpExecutor};
2
2
  //# sourceMappingURL=internal.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/transports/quarryPassIssuer.ts","../src/debug.ts","../src/claimGasPass.ts","../src/paymaster.ts","../src/getAllowance.ts","../src/getPaymasterAddress.ts","../src/hasPassIssuer.ts","../src/transports/methods/estimateUserOperationGas.ts","../src/transports/gasEstimator.ts","../src/transports/userOpExecutor.ts","../src/transports/methods/sendUserOperation.ts"],"sourcesContent":["import { Address, EIP1193RequestFn, Hex, Transport, http } from \"viem\";\n\nexport type QuarryPassIssuerRpcSchema = [\n {\n Method: \"quarry_issuePass\";\n Parameters: [passId: Hex, receiver: Address];\n ReturnType: { message: string };\n },\n {\n Method: \"quarry_claimAllowance\";\n Parameters: [passId: Hex, receiver: Address];\n ReturnType: { message: string };\n },\n];\n\nexport function quarryPassIssuer(): Transport<\"http\", {}, EIP1193RequestFn<QuarryPassIssuerRpcSchema>> {\n return ({ chain }) => {\n if (!chain) throw new Error(\"No chain provided to issuer transport.\");\n\n const url = \"quarryPassIssuer\" in chain.rpcUrls ? chain.rpcUrls.quarryPassIssuer.http[0] : undefined;\n // TODO: add fallback for anvil to do what quarryPassIssuer does internally\n if (!url) throw new Error(`No \\`quarryPassIssuer\\` RPC URL found for chain ${chain.id}.`);\n\n return http(url)({ chain, retryCount: 0 });\n };\n}\n","import createDebug from \"debug\";\n\nexport const debug = createDebug(\"mud:paymaster\");\n","import { Address, Chain } from \"viem\";\nimport { quarryPassIssuer } from \"./transports/quarryPassIssuer\";\nimport { debug } from \"./debug\";\n\nexport async function claimGasPass({ chain, userAddress }: { chain: Chain; userAddress: Address }) {\n const transport = quarryPassIssuer()({ chain });\n\n // TODO: handle case where you already have a pass?\n debug(\"Issuing gas pass to\", userAddress);\n await transport.request({\n method: \"quarry_issuePass\",\n params: [\"0x01\", userAddress],\n });\n\n debug(\"Claiming gas allowance for\", userAddress);\n await transport.request({\n method: \"quarry_claimAllowance\",\n params: [\"0x01\", userAddress],\n });\n}\n","import { defineStore } from \"@latticexyz/store\";\nimport { parseAbi } from \"viem\";\n\n// TODO: move the whole paymaster in here so we can just re-export ABI + MUD config\n\nexport const paymasterAbi = parseAbi([\n \"error SpenderSystem_AlreadyRegistered(address spender, address user)\",\n \"error SpenderSystem_HasOwnBalance(address spender)\",\n \"function registerSpender(address spender)\",\n]);\n\nexport const paymasterConfig = defineStore({\n namespaces: {\n root: {\n namespace: \"\",\n tables: {\n Allowance: {\n schema: {\n user: \"address\",\n allowance: \"uint256\",\n },\n key: [\"user\"],\n },\n Grantor: {\n schema: {\n grantor: \"address\",\n allowance: \"uint256\",\n },\n key: [\"grantor\"],\n },\n PassHolder: {\n schema: {\n user: \"address\",\n passId: \"bytes32\",\n lastRenewed: \"uint256\",\n lastClaimed: \"uint256\",\n },\n key: [\"user\", \"passId\"],\n },\n PassConfig: {\n schema: {\n passId: \"bytes32\",\n claimAmount: \"uint256\",\n claimInterval: \"uint256\",\n validityPeriod: \"uint256\",\n grantor: \"address\",\n },\n key: [\"passId\"],\n },\n Spender: {\n schema: {\n spender: \"address\",\n user: \"address\",\n },\n key: [\"spender\"],\n },\n SystemConfig: {\n schema: {\n entryPoint: \"address\",\n },\n key: [],\n },\n },\n },\n },\n});\n\nexport const paymasterTables = paymasterConfig.namespaces.root.tables;\n","import { Address, Client } from \"viem\";\nimport { paymasterTables } from \"./paymaster\";\nimport { getRecord } from \"@latticexyz/store/internal\";\n\nexport type GetAllowanceParams = {\n client: Client;\n paymasterAddress: Address;\n userAddress: Address;\n};\n\nexport async function getAllowance({ client, paymasterAddress, userAddress }: GetAllowanceParams) {\n const record = await getRecord(client, {\n address: paymasterAddress,\n table: paymasterTables.Allowance,\n key: { user: userAddress },\n blockTag: \"pending\",\n });\n return record.allowance;\n}\n","import { Chain, getChainContractAddress } from \"viem\";\n\nexport function getPaymasterAddress(chain: Chain) {\n return getChainContractAddress({ chain, contract: \"quarryPaymaster\" });\n}\n","import { Chain, ChainContract } from \"viem\";\n\nexport function hasPassIssuer(chain: Chain) {\n const paymasterContract = chain?.contracts?.quarryPaymaster as ChainContract | undefined;\n const paymasterAddress = paymasterContract?.address;\n\n const passIssuerUrl = \"quarryPassIssuer\" in chain.rpcUrls ? chain.rpcUrls.quarryPassIssuer.http[0] : undefined;\n\n return paymasterAddress != null && passIssuerUrl;\n}\n","import { BundlerRpcSchema } from \"viem\";\nimport { formatUserOperationRequest } from \"viem/account-abstraction\";\nimport { getRpcMethod } from \"../common\";\n\n// TODO: revisit after demo (don't hardcode gas)\n\ntype rpcMethod = getRpcMethod<BundlerRpcSchema, \"eth_estimateUserOperationGas\">;\n\nexport async function estimateUserOperationGas(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _params: rpcMethod[\"Parameters\"],\n): Promise<rpcMethod[\"ReturnType\"]> {\n return formatUserOperationRequest({\n callGasLimit: 20_000_000n,\n preVerificationGas: 200_000n,\n verificationGasLimit: 2_000_000n,\n paymasterVerificationGasLimit: 200_000n,\n paymasterPostOpGasLimit: 200_000n,\n });\n}\n","import { BundlerRpcSchema, Transport } from \"viem\";\nimport { estimateUserOperationGas } from \"./methods/estimateUserOperationGas\";\nimport { TransportRequestFn, getRpcSchema } from \"./common\";\n\n// TODO: move to common package?\n\nexport function gasEstimator<const transport extends Transport>(getTransport: transport): transport {\n return ((opts) => {\n const { request: originalRequest, ...rest } = getTransport(opts);\n\n const request: TransportRequestFn<getRpcSchema<BundlerRpcSchema, \"eth_estimateUserOperationGas\">> = async (\n { method, params },\n options,\n ) => {\n if (method === \"eth_estimateUserOperationGas\") {\n return estimateUserOperationGas(params);\n }\n return originalRequest({ method, params }, options);\n };\n\n return { request, ...rest };\n }) as transport;\n}\n","import {\n Account,\n BundlerRpcSchema,\n Chain,\n Client,\n EIP1193RequestFn,\n Hash,\n RpcUserOperationReceipt,\n Transport,\n createTransport,\n numberToHex,\n} from \"viem\";\nimport { entryPoint07Address } from \"viem/account-abstraction\";\nimport { TransportRequestFn } from \"./common\";\nimport { estimateUserOperationGas } from \"./methods/estimateUserOperationGas\";\nimport { sendUserOperation } from \"./methods/sendUserOperation\";\n\n// TODO: move to common package?\n\nexport function userOpExecutor({ executor }: { executor: Client<Transport, Chain, Account> }): Transport {\n return () => {\n const receipts = new Map<Hash, RpcUserOperationReceipt<\"0.7\">>();\n\n // @ts-expect-error TODO\n const request: TransportRequestFn<BundlerRpcSchema> = async ({ method, params }) => {\n // TODO: move chain/ID into args and executors as accounts instead of clients?\n if (method === \"eth_chainId\") {\n return numberToHex(executor.chain.id);\n }\n\n if (method === \"eth_supportedEntryPoints\") {\n return [entryPoint07Address];\n }\n\n if (method === \"eth_sendUserOperation\") {\n const [rpcUserOp, entrypoint] = params;\n if (entrypoint === entryPoint07Address) {\n const result = await sendUserOperation({ executor, rpcUserOp });\n receipts.set(result.userOpHash, result as RpcUserOperationReceipt<\"0.7\">);\n return result.userOpHash;\n }\n }\n\n if (method === \"eth_getUserOperationReceipt\") {\n const [hash] = params;\n return receipts.get(hash) ?? null;\n }\n\n if (method === \"eth_estimateUserOperationGas\") {\n return await estimateUserOperationGas(params);\n }\n\n throw new Error(\"Not implemented\");\n };\n\n return createTransport({\n key: \"userOpExecutor\",\n type: \"userOpExecutor\",\n name: \"User Operation Executor Transport\",\n request: request as EIP1193RequestFn,\n });\n };\n}\n","import {\n Client,\n Transport,\n Chain,\n Account,\n RpcUserOperation,\n RpcUserOperationReceipt,\n parseEther,\n parseEventLogs,\n} from \"viem\";\nimport {\n formatUserOperation,\n toPackedUserOperation,\n getUserOperationHash,\n entryPoint07Address,\n entryPoint07Abi,\n} from \"viem/account-abstraction\";\nimport { setBalance, waitForTransactionReceipt, writeContract } from \"viem/actions\";\nimport { getAction } from \"viem/utils\";\n\n// TODO: move to common package?\n\n// TODO: move this into a generic to support other versions?\nconst entryPointVersion = \"0.7\";\ntype entryPointVersion = typeof entryPointVersion;\n\nexport async function sendUserOperation({\n executor,\n rpcUserOp,\n}: {\n executor: Client<Transport, Chain, Account>;\n rpcUserOp: RpcUserOperation<entryPointVersion>;\n}): Promise<\n Pick<RpcUserOperationReceipt<entryPointVersion>, \"success\" | \"userOpHash\"> & {\n receipt: Pick<RpcUserOperationReceipt<entryPointVersion>[\"receipt\"], \"transactionHash\">;\n }\n> {\n if (executor.chain.id === 31337) {\n await setBalance(\n executor.extend(() => ({ mode: \"anvil\" })),\n {\n address: executor.account.address,\n value: parseEther(\"100\"),\n },\n );\n }\n\n const userOp = formatUserOperation(rpcUserOp);\n const gas =\n userOp.preVerificationGas +\n userOp.verificationGasLimit +\n (userOp.paymasterVerificationGasLimit ?? 0n) +\n (userOp.paymasterPostOpGasLimit ?? 0n) +\n userOp.callGasLimit;\n\n const packedUserOp = toPackedUserOperation(userOp);\n\n const userOpHash = getUserOperationHash({\n userOperation: userOp,\n chainId: executor.chain.id,\n entryPointVersion: \"0.7\",\n entryPointAddress: entryPoint07Address,\n });\n\n const transactionHash = await getAction(\n executor,\n writeContract,\n \"writeContract\",\n )({\n abi: entryPoint07Abi,\n address: entryPoint07Address,\n functionName: \"handleOps\",\n args: [[packedUserOp], executor.account.address],\n chain: executor.chain,\n account: executor.account,\n gas,\n });\n\n const receipt = await getAction(\n executor,\n waitForTransactionReceipt,\n \"waitForTransactionReceipt\",\n )({ hash: transactionHash });\n\n // TODO: replace with `getUserOperationReceipt`?\n const parsedLogs = parseEventLogs({\n logs: receipt.logs,\n abi: entryPoint07Abi,\n eventName: \"UserOperationEvent\" as const,\n });\n\n return {\n success: parsedLogs[0]!.args.success,\n userOpHash,\n receipt,\n };\n}\n"],"mappings":"AAAA,OAAoD,QAAAA,MAAY,OAezD,SAASC,GAAuF,CACrG,MAAO,CAAC,CAAE,MAAAC,CAAM,IAAM,CACpB,GAAI,CAACA,EAAO,MAAM,IAAI,MAAM,wCAAwC,EAEpE,IAAMC,EAAM,qBAAsBD,EAAM,QAAUA,EAAM,QAAQ,iBAAiB,KAAK,CAAC,EAAI,OAE3F,G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O,IAAM,CAElF,GAAID,IAAW,cACb,OAAOE,EAAYL,EAAS,MAAM,EAAE,EAGtC,GAAIG,IAAW,2BACb,MAAO,CAACG,CAAmB,EAG7B,GAAIH,IAAW,wBAAyB,CACtC,GAAM,CAACI,EAAWC,CAAU,EAAIJ,EAChC,GAAII,IAAeF,EAAqB,CACtC,IAAMG,EAAS,MAAMC,EAAkB,CAAE,SAAAV,EAAU,UAAAO,CAAU,CAAC,EAC9D,OAAAN,EAAS,IAAIQ,EAAO,WAAYA,CAAwC,EACjEA,EAAO,YAIlB,GAAIN,IAAW,8BAA+B,CAC5C,GAAM,CAACQ,CAAI,EAAIP,EACf,OAAOH,EAAS,IAAIU,CAAI,GAAK,KAG/B,GAAIR,IAAW,+BACb,OAAO,MAAMS,EAAyBR,CAAM,EAG9C,MAAM,IAAI,MAAM,iBAAiB,CACnC,CAOA,CAAC,CACH,CACF","names":["http","quarryPassIssuer","chain","url","createDebug","debug","claimGasPass","chain","userAddress","transport","quarryPassIssuer","debug","defineStore","parseAbi","paymasterAbi","paymasterConfig","paymasterTables","getRecord","getAllowance","client","paymasterAddress","userAddress","paymasterTables","getChainContractAddress","getPaymasterAddress","chain","hasPassIssuer","chain","paymasterAddress","passIssuerUrl","formatUserOperationRequest","estimateUserOperationGas","_params","gasEstimator","getTransport","opts","originalRequest","rest","method","params","options","estimateUserOperationGas","createTransport","numberToHex","entryPoint07Address","parseEther","parseEventLogs","formatUserOperation","toPackedUserOperation","getUserOperationHash","entryPoint07Address","entryPoint07Abi","setBalance","waitForTransactionReceipt","writeContract","getAction","sendUserOperation","executor","rpcUserOp","setBalance","parseEther","userOp","formatUserOperation","gas","packedUserOp","toPackedUserOperation","userOpHash","getUserOperationHash","entryPoint07Address","transactionHash","getAction","writeContract","entryPoint07Abi","receipt","waitForTransactionReceipt","parseEventLogs","userOpExecutor","executor","receipts","createTransport","method","params","numberToHex","entryPoint07Address","rpcUserOp","entrypoint","result","sendUserOperation","hash","estimateUserOperationGas"]}
1
+ {"version":3,"sources":["../src/transports/quarryPassIssuer.ts","../src/debug.ts","../src/claimGasPass.ts","../src/getAllowance.ts","../src/paymaster.ts","../src/getPaymasterAddress.ts","../src/hasPassIssuer.ts","../src/transports/methods/estimateUserOperationGas.ts","../src/transports/gasEstimator.ts","../src/transports/userOpExecutor.ts","../src/transports/methods/sendUserOperation.ts"],"sourcesContent":["import { Address, EIP1193RequestFn, Hex, Transport, http } from \"viem\";\n\nexport type QuarryPassIssuerRpcSchema = [\n {\n Method: \"quarry_issuePass\";\n Parameters: [passId: Hex, receiver: Address];\n ReturnType: { message: string };\n },\n {\n Method: \"quarry_claimAllowance\";\n Parameters: [passId: Hex, receiver: Address];\n ReturnType: { message: string };\n },\n];\n\nexport function quarryPassIssuer(): Transport<\"http\", {}, EIP1193RequestFn<QuarryPassIssuerRpcSchema>> {\n return ({ chain }) => {\n if (!chain) throw new Error(\"No chain provided to issuer transport.\");\n\n const url = \"quarryPassIssuer\" in chain.rpcUrls ? chain.rpcUrls.quarryPassIssuer.http[0] : undefined;\n // TODO: add fallback for anvil to do what quarryPassIssuer does internally\n if (!url) throw new Error(`No \\`quarryPassIssuer\\` RPC URL found for chain ${chain.id}.`);\n\n return http(url)({ chain, retryCount: 0 });\n };\n}\n","import createDebug from \"debug\";\n\nexport const debug = createDebug(\"mud:paymaster\");\n","import { Address, Chain } from \"viem\";\nimport { quarryPassIssuer } from \"./transports/quarryPassIssuer\";\nimport { debug } from \"./debug\";\n\nexport async function claimGasPass({ chain, userAddress }: { chain: Chain; userAddress: Address }) {\n const transport = quarryPassIssuer()({ chain });\n\n // TODO: handle case where you already have a pass?\n debug(\"Issuing gas pass to\", userAddress);\n await transport.request({\n method: \"quarry_issuePass\",\n params: [\"0x01\", userAddress],\n });\n\n debug(\"Claiming gas allowance for\", userAddress);\n await transport.request({\n method: \"quarry_claimAllowance\",\n params: [\"0x01\", userAddress],\n });\n}\n","import { Address, Client, numberToHex } from \"viem\";\nimport { paymasterTables } from \"./paymaster\";\nimport { getRecord, getStaticDataLocation } from \"@latticexyz/store/internal\";\nimport { getKeyTuple } from \"@latticexyz/protocol-parser/internal\";\nimport { setStorageAt } from \"viem/actions\";\n\nexport type GetAllowanceParams = {\n client: Client;\n paymasterAddress: Address;\n userAddress: Address;\n};\n\nexport async function getAllowance({ client, paymasterAddress, userAddress }: GetAllowanceParams) {\n const record = await getRecord(client, {\n address: paymasterAddress,\n table: paymasterTables.Allowance,\n key: { user: userAddress },\n blockTag: \"pending\",\n });\n return record.allowance;\n}\n\nexport function getAllowanceSlot({ userAddress }: { userAddress: Address }) {\n return getStaticDataLocation(\n paymasterTables.Allowance.tableId,\n getKeyTuple(paymasterTables.Allowance, { user: userAddress }),\n );\n}\n\n// TODO: move this into some sort of store util to `setField`\nexport async function setAllowanceSlot({\n client,\n paymasterAddress,\n userAddress,\n allowance,\n}: GetAllowanceParams & { allowance: bigint }) {\n const slot = getStaticDataLocation(\n paymasterTables.Allowance.tableId,\n getKeyTuple(paymasterTables.Allowance, { user: userAddress }),\n );\n\n await setStorageAt(\n client.extend(() => ({ mode: \"anvil\" })),\n {\n address: paymasterAddress,\n index: slot,\n value: numberToHex(allowance, { size: 32 }),\n },\n );\n}\n","import { defineStore } from \"@latticexyz/store\";\nimport { parseAbi } from \"viem\";\n\n// TODO: move the whole paymaster in here so we can just re-export ABI + MUD config\n\nexport const paymasterAbi = parseAbi([\n \"error SpenderSystem_AlreadyRegistered(address spender, address user)\",\n \"error SpenderSystem_HasOwnBalance(address spender)\",\n \"function registerSpender(address spender)\",\n]);\n\nexport const paymasterConfig = defineStore({\n namespaces: {\n root: {\n namespace: \"\",\n tables: {\n Allowance: {\n schema: {\n user: \"address\",\n allowance: \"uint256\",\n },\n key: [\"user\"],\n },\n Grantor: {\n schema: {\n grantor: \"address\",\n allowance: \"uint256\",\n },\n key: [\"grantor\"],\n },\n PassHolder: {\n schema: {\n user: \"address\",\n passId: \"bytes32\",\n lastRenewed: \"uint256\",\n lastClaimed: \"uint256\",\n },\n key: [\"user\", \"passId\"],\n },\n PassConfig: {\n schema: {\n passId: \"bytes32\",\n claimAmount: \"uint256\",\n claimInterval: \"uint256\",\n validityPeriod: \"uint256\",\n grantor: \"address\",\n },\n key: [\"passId\"],\n },\n Spender: {\n schema: {\n spender: \"address\",\n user: \"address\",\n },\n key: [\"spender\"],\n },\n SystemConfig: {\n schema: {\n entryPoint: \"address\",\n },\n key: [],\n },\n },\n },\n },\n});\n\nexport const paymasterTables = paymasterConfig.namespaces.root.tables;\n","import { Chain, getChainContractAddress } from \"viem\";\n\nexport function getPaymasterAddress(chain: Chain) {\n return getChainContractAddress({ chain, contract: \"quarryPaymaster\" });\n}\n","import { Chain, ChainContract } from \"viem\";\n\nexport function hasPassIssuer(chain: Chain) {\n const paymasterContract = chain?.contracts?.quarryPaymaster as ChainContract | undefined;\n const paymasterAddress = paymasterContract?.address;\n\n const passIssuerUrl = \"quarryPassIssuer\" in chain.rpcUrls ? chain.rpcUrls.quarryPassIssuer.http[0] : undefined;\n\n return paymasterAddress != null && passIssuerUrl;\n}\n","import { BundlerRpcSchema } from \"viem\";\nimport { formatUserOperationRequest } from \"viem/account-abstraction\";\nimport { getRpcMethod } from \"../common\";\n\n// TODO: revisit after demo (don't hardcode gas)\n\ntype rpcMethod = getRpcMethod<BundlerRpcSchema, \"eth_estimateUserOperationGas\">;\n\nexport async function estimateUserOperationGas(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _params: rpcMethod[\"Parameters\"],\n): Promise<rpcMethod[\"ReturnType\"]> {\n return formatUserOperationRequest({\n callGasLimit: 20_000_000n,\n preVerificationGas: 200_000n,\n verificationGasLimit: 2_000_000n,\n paymasterVerificationGasLimit: 200_000n,\n paymasterPostOpGasLimit: 200_000n,\n });\n}\n","import { BundlerRpcSchema, Transport } from \"viem\";\nimport { estimateUserOperationGas } from \"./methods/estimateUserOperationGas\";\nimport { TransportRequestFn, getRpcSchema } from \"./common\";\n\n// TODO: move to common package?\n\nexport function gasEstimator<const transport extends Transport>(getTransport: transport): transport {\n return ((opts) => {\n const { request: originalRequest, ...rest } = getTransport(opts);\n\n const request: TransportRequestFn<getRpcSchema<BundlerRpcSchema, \"eth_estimateUserOperationGas\">> = async (\n { method, params },\n options,\n ) => {\n if (method === \"eth_estimateUserOperationGas\") {\n return estimateUserOperationGas(params);\n }\n return originalRequest({ method, params }, options);\n };\n\n return { request, ...rest };\n }) as transport;\n}\n","import {\n Account,\n BundlerRpcSchema,\n Chain,\n Client,\n EIP1193RequestFn,\n Hash,\n RpcUserOperationReceipt,\n Transport,\n createTransport,\n numberToHex,\n} from \"viem\";\nimport { entryPoint07Address } from \"viem/account-abstraction\";\nimport { TransportRequestFn } from \"./common\";\nimport { estimateUserOperationGas } from \"./methods/estimateUserOperationGas\";\nimport { sendUserOperation } from \"./methods/sendUserOperation\";\n\n// TODO: move to common package?\n\nexport function userOpExecutor({ executor }: { executor: Client<Transport, Chain, Account> }): Transport {\n return () => {\n const receipts = new Map<Hash, RpcUserOperationReceipt<\"0.7\">>();\n\n // @ts-expect-error TODO\n const request: TransportRequestFn<BundlerRpcSchema> = async ({ method, params }) => {\n // TODO: move chain/ID into args and executors as accounts instead of clients?\n if (method === \"eth_chainId\") {\n return numberToHex(executor.chain.id);\n }\n\n if (method === \"eth_supportedEntryPoints\") {\n return [entryPoint07Address];\n }\n\n if (method === \"eth_sendUserOperation\") {\n const [rpcUserOp, entrypoint] = params;\n if (entrypoint === entryPoint07Address) {\n const result = await sendUserOperation({ executor, rpcUserOp });\n receipts.set(result.userOpHash, result as RpcUserOperationReceipt<\"0.7\">);\n return result.userOpHash;\n }\n }\n\n if (method === \"eth_getUserOperationReceipt\") {\n const [hash] = params;\n return receipts.get(hash) ?? null;\n }\n\n if (method === \"eth_estimateUserOperationGas\") {\n return await estimateUserOperationGas(params);\n }\n\n throw new Error(\"Not implemented\");\n };\n\n return createTransport({\n key: \"userOpExecutor\",\n type: \"userOpExecutor\",\n name: \"User Operation Executor Transport\",\n request: request as EIP1193RequestFn,\n });\n };\n}\n","import {\n Client,\n Transport,\n Chain,\n Account,\n RpcUserOperation,\n RpcUserOperationReceipt,\n parseEther,\n parseEventLogs,\n} from \"viem\";\nimport {\n formatUserOperation,\n toPackedUserOperation,\n getUserOperationHash,\n entryPoint07Address,\n entryPoint07Abi,\n} from \"viem/account-abstraction\";\nimport { setBalance, waitForTransactionReceipt, writeContract } from \"viem/actions\";\nimport { getAction } from \"viem/utils\";\n\n// TODO: move to common package?\n\n// TODO: move this into a generic to support other versions?\nconst entryPointVersion = \"0.7\";\ntype entryPointVersion = typeof entryPointVersion;\n\nexport async function sendUserOperation({\n executor,\n rpcUserOp,\n}: {\n executor: Client<Transport, Chain, Account>;\n rpcUserOp: RpcUserOperation<entryPointVersion>;\n}): Promise<\n Pick<RpcUserOperationReceipt<entryPointVersion>, \"success\" | \"userOpHash\"> & {\n receipt: Pick<RpcUserOperationReceipt<entryPointVersion>[\"receipt\"], \"transactionHash\">;\n }\n> {\n if (executor.chain.id === 31337) {\n await setBalance(\n executor.extend(() => ({ mode: \"anvil\" })),\n {\n address: executor.account.address,\n value: parseEther(\"100\"),\n },\n );\n }\n\n const userOp = formatUserOperation(rpcUserOp);\n const packedUserOp = toPackedUserOperation(userOp);\n\n const userOpHash = getUserOperationHash({\n userOperation: userOp,\n chainId: executor.chain.id,\n entryPointVersion: \"0.7\",\n entryPointAddress: entryPoint07Address,\n });\n\n const transactionHash = await getAction(\n executor,\n writeContract,\n \"writeContract\",\n )({\n abi: entryPoint07Abi,\n address: entryPoint07Address,\n functionName: \"handleOps\",\n args: [[packedUserOp], executor.account.address],\n chain: executor.chain,\n account: executor.account,\n });\n\n const receipt = await getAction(\n executor,\n waitForTransactionReceipt,\n \"waitForTransactionReceipt\",\n )({ hash: transactionHash });\n\n // TODO: replace with `getUserOperationReceipt`?\n const parsedLogs = parseEventLogs({\n logs: receipt.logs,\n abi: entryPoint07Abi,\n eventName: \"UserOperationEvent\" as const,\n });\n\n return {\n success: pars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BACb,OAAO,MAAMS,EAAyBR,CAAM,EAG9C,MAAM,IAAI,MAAM,iBAAiB,CACnC,CAOA,CAAC,CACH,CACF","names":["http","quarryPassIssuer","chain","url","createDebug","debug","claimGasPass","chain","userAddress","transport","quarryPassIssuer","debug","numberToHex","defineStore","parseAbi","paymasterAbi","paymasterConfig","paymasterTables","getRecord","getStaticDataLocation","getKeyTuple","setStorageAt","getAllowance","client","paymasterAddress","userAddress","paymasterTables","getAllowanceSlot","setAllowanceSlot","allowance","slot","numberToHex","getChainContractAddress","getPaymasterAddress","chain","hasPassIssuer","chain","paymasterAddress","passIssuerUrl","formatUserOperationRequest","estimateUserOperationGas","_params","gasEstimator","getTransport","opts","originalRequest","rest","method","params","options","estimateUserOperationGas","createTransport","numberToHex","entryPoint07Address","parseEther","parseEventLogs","formatUserOperation","toPackedUserOperation","getUserOperationHash","entryPoint07Address","entryPoint07Abi","setBalance","waitForTransactionReceipt","writeContract","getAction","sendUserOperation","executor","rpcUserOp","setBalance","parseEther","userOp","formatUserOperation","packedUserOp","toPackedUserOperation","userOpHash","getUserOperationHash","entryPoint07Address","transactionHash","getAction","writeContract","entryPoint07Abi","receipt","waitForTransactionReceipt","parseEventLogs","userOpExecutor","executor","receipts","createTransport","method","params","numberToHex","entryPoint07Address","rpcUserOp","entrypoint","result","sendUserOperation","hash","estimateUserOperationGas"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@latticexyz/paymaster",
3
- "version": "2.2.15-entrykit-135988209993ee1688d8f415df09e6b428336079",
3
+ "version": "2.2.15-entrykit-b0257a408918ebb4a227e71da0a8e8bc58477896",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/latticexyz/mud.git",
@@ -23,8 +23,9 @@
23
23
  ],
24
24
  "dependencies": {
25
25
  "debug": "^4.3.4",
26
- "@latticexyz/common": "2.2.15-entrykit-135988209993ee1688d8f415df09e6b428336079",
27
- "@latticexyz/store": "2.2.15-entrykit-135988209993ee1688d8f415df09e6b428336079"
26
+ "@latticexyz/common": "2.2.15-entrykit-b0257a408918ebb4a227e71da0a8e8bc58477896",
27
+ "@latticexyz/store": "2.2.15-entrykit-b0257a408918ebb4a227e71da0a8e8bc58477896",
28
+ "@latticexyz/protocol-parser": "2.2.15-entrykit-b0257a408918ebb4a227e71da0a8e8bc58477896"
28
29
  },
29
30
  "devDependencies": {
30
31
  "@types/debug": "^4.1.7",