{"id":19762840,"url":"https://github.com/dutterbutter/min-viem-example","last_synced_at":"2025-07-07T04:06:53.871Z","repository":{"id":187732208,"uuid":"677473704","full_name":"dutterbutter/min-viem-example","owner":"dutterbutter","description":null,"archived":false,"fork":false,"pushed_at":"2023-09-19T20:24:22.000Z","size":92,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-14T04:07:07.898Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dutterbutter.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-11T16:56:03.000Z","updated_at":"2023-08-11T16:57:11.000Z","dependencies_parsed_at":"2023-08-11T23:42:20.711Z","dependency_job_id":"9af6819f-7c12-4eba-8fd7-5fc1845013eb","html_url":"https://github.com/dutterbutter/min-viem-example","commit_stats":null,"previous_names":["dutterbutter/min-viem-example"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dutterbutter%2Fmin-viem-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dutterbutter%2Fmin-viem-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dutterbutter%2Fmin-viem-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dutterbutter%2Fmin-viem-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dutterbutter","download_url":"https://codeload.github.com/dutterbutter/min-viem-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241094698,"owners_count":19908686,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T04:07:14.415Z","updated_at":"2025-02-28T03:27:22.393Z","avatar_url":"https://github.com/dutterbutter.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Viem \u0026 Paymaster: A Minimal Example\n\nThis repository provides a concise example to highlight the challenges faced when integrating paymasters with `viem`. While `ethers.js` has supported paymasters (as discussed [here](https://github.com/ethers-io/ethers.js/issues/1761) and completed [here](https://github.com/ethers-io/ethers.js/commit/68095a48ae19ed06cbcf2f415f1fcbda90d4b2ae)), we should be advocating for similar improvements to be made in the `viem` framework.\n\n## Comparing Ethers.js and Viem\n\nIn `ethers.js`, using paymasters is used similarly as:\n\n```javascript\nconst tx = await contract.myFunction(\n    ...args,    // regular arguments for the contract method\n    {\n        gasLimit: 30000,    // standard override\n        custom: { customField: \"abacaba\" }  // custom override\n    }\n);\n```\n\nWhile the desired implementation in `viem` would ideally look like this:\n\n```javascript\nconst data = await walletClient.writeContract({\n      address: \"0xbe9bcf56654fd81a921b6Bd07965Dd67Afbb0B69\",\n      abi: ContractArtifact.abi,\n      functionName: \"setGreeting\",\n      account,\n      args: [\"Hello World!\"],\n      customData: {\n        gasPerPubdata: utils.DEFAULT_GAS_PER_PUBDATA_LIMIT,\n        paymasterParams,\n      },\n});\n```\n\n## Getting Started\n\n### Prerequisites\n\nEnsure you have `yarn` or `pnpm` installed.\n\n### Run example\n\n1. Change directories:\n\n```bash\ncd write-contract-example \n```\n\n2. Install the required dependencies:\n\n```bash\npnpm install\n```\n\n3. Run development server:\n\n```bash\npnpm dev\n```\n\n**Note:** There's no requirement to compile or deploy contracts for this example. The script utilizes contracts previously deployed on the zkSync Era testnet.\n\n## Debugging \n\nFor improved debugging I suggest using a local copy of viem so you may add console logs etc. For example,\n\n```\n\"dependencies\": {\n    \"viem\": \"file:\u003cPATH TO LOCAL COPY\u003e\",\n    \"vite\": \"^4.4.9\"\n  }\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdutterbutter%2Fmin-viem-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdutterbutter%2Fmin-viem-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdutterbutter%2Fmin-viem-example/lists"}