-
Notifications
You must be signed in to change notification settings - Fork 24
Add optional viem support for encryption and decryption operations #692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: epic-v0.7.x
Are you sure you want to change the base?
Add optional viem support for encryption and decryption operations #692
Conversation
6891988
to
b30259d
Compare
- Added eslint disable comments for necessary any types in dynamic viem type declarations - Fixed import order in examples and tests - Added file-level eslint disables for complex wrapper implementations - Resolved all lint errors while maintaining functionality
- Fixed eslint disable comment placement for any type assertions - Ensured all CI/CD lint checks pass successfully
(it was removed in another PR that is not yet merged with the target branch)
(to prevent making unnecessary network calls)
61c4fda
to
55fbaa2
Compare
55fbaa2
to
b222cf7
Compare
@@ -128,65 +128,5 @@ describe.skipIf(!process.env.RUNNING_IN_CI)( | |||
// Verify decryption | |||
expect(decryptedMessageString).toEqual(messageString); | |||
}, 15000); // 15s timeout | |||
|
|||
test('should encrypt and decrypt according to wallet allowlist condition', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is no more working. And it has been already deleted at #688.
c364fbd
to
7872080
Compare
7872080
to
0ab9cb3
Compare
in addition to some minor changes like updating pinata library, add `downloadBytes` to the bas storage provider and add some constants and comments...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds optional viem support for encryption and decryption operations in the TACo SDK. It provides viem-compatible wrapper functions that internally convert viem objects to ethers.js objects for seamless integration with existing TACo functionality.
Key Changes
- Added
encryptWithViem()
anddecryptWithViem()
functions as viem alternatives to existing ethers.js functions - Created viem wrapper utilities in shared package for consistent cross-package integration
- Implemented
ViemEIP4361AuthProvider
for viem-native authentication support
Reviewed Changes
Copilot reviewed 20 out of 22 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
packages/taco/src/viem-taco.ts | Core viem encryption/decryption functions with type casting to ethers.js |
packages/taco/src/wrappers/viem-wrappers.ts | TACo-specific viem wrapper implementations extending shared base classes |
packages/shared/src/viem-utils.ts | Shared viem utilities with base provider and signer classes |
packages/taco-auth/src/providers/viem/viem-auth-providers.ts | Viem-compatible EIP4361 authentication provider |
packages/taco/test/viem-unit.test.ts | Unit tests for viem functionality with mocked adapters |
packages/taco/integration-test/viem-encrypt-decrypt.test.ts | Integration tests for real viem encryption/decryption flows |
packages/taco/VIEM_SUPPORT.md | Documentation for viem usage patterns and API reference |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
* ); | ||
* | ||
|
||
* ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JSDoc example comment is incomplete - it ends with an incomplete code block. Either complete the example or remove the trailing backticks.
Copilot uses AI. Check for mistakes.
const feeData = await this.viemPublicClient.getFeeHistory({ | ||
blockCount: 4, | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
blockNumber: 'latest' as any, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using 'as any' type assertion bypasses TypeScript safety. Consider using a proper type or checking if 'latest' is a valid blockNumber type for the getFeeHistory method.
blockNumber: 'latest' as any, | |
blockNumber: 'latest' as "latest", |
Copilot uses AI. Check for mistakes.
try { | ||
return await this.viemPublicClient.getEnsAddress({ | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
name: name as any, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using 'as any' type assertion bypasses TypeScript safety. Consider defining proper types for ENS name resolution or checking the expected type for the name parameter.
name: name as any, | |
name: name, |
Copilot uses AI. Check for mistakes.
Type of PR:
Required reviews:
What this does:
Issues fixed/closed:
Closes https://github.com/nucypher/sprints/issues/212
Why it's needed:
Notes for reviewers: