Skip to content

Conversation

sumitvekariya
Copy link
Contributor

This adds a Viem-based alternative to SemaphoreEthers, allowing developers to choose their preferred Ethereum library for @semaphore-protocol/data package.

Description

This PR implements the SemaphoreViem class in the @semaphore-protocol/data package, which provides a Viem-based alternative to the existing SemaphoreEthers class.

  • What kind of change does this PR introduce? This is a feature addition that introduces a new class for interacting with the Semaphore smart contract using the Viem library.

  • What is the current behavior? Currently, the data package only offers Ethers.js integration through the SemaphoreEthers class.

  • What is the new behavior? Developers can now choose between Ethers.js and Viem when interacting with the Semaphore smart contract.

  • Does this PR introduce a breaking change? No, this is an additive change that doesn't affect existing functionality.

The implementation includes:

  • Full implementation of all methods available in SemaphoreEthers:
    • getGroupIds
    • getGroup
    • getGroupMembers
    • getGroupValidatedProofs
    • isGroupMember
  • Implementes tests
  • Proper TypeScript types for Viem-specific interfaces
  • Documentation for all methods and parameters

Related Issue(s)

Closes #343

Other information

The Viem library is known for being lighter and more efficient than Ethers.js, which may lead to performance improvements for applications using this implementation.

Checklist

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have run yarn format and yarn lint without getting any errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

…rotocol/data package class

This adds a Viem-based alternative to SemaphoreEthers, allowing
developers to choose their preferred Ethereum library.

Closes semaphore-protocol#343
@sumitvekariya sumitvekariya requested a review from a team as a code owner March 7, 2025 10:28
@sumitvekariya sumitvekariya changed the title feat(data): implement Viem lib alternative to Ethers for @semaphore-p… feat(data): implement Viem lib alternative to SemaphoreEthers Mar 7, 2025
Copy link

feat(data): implement Viem lib alternative to SemaphoreEthers

Generated at commit: f31c19b2e50d35839c2721ce681d2c8b83a84cdb

🚨 Report Summary

Severity Level Results
Contracts Critical
High
Medium
Low
Note
Total
0
0
0
4
15
19
Dependencies Critical
High
Medium
Low
Note
Total
0
0
0
0
0
0

For more details view the full report in OpenZeppelin Code Inspector

Copy link
Member

@vplasencia vplasencia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @sumitvekariya 🚀

Thank you very much!

@vplasencia vplasencia merged commit f3c4cf2 into semaphore-protocol:main May 20, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create lib that uses Viem

2 participants