Skip to content
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

feat: add Defly Web extension wallet provider #317

Merged
merged 15 commits into from
Nov 26, 2024
Merged

Conversation

drichar
Copy link
Collaborator

@drichar drichar commented Nov 26, 2024

Description

This PR migrates the Defly Web provider implementation from #256 to the v4 architecture, adapting it to work with the new network configuration system and algosdk v3. See the original PR for details about the initial Defly Web provider implementation, which will be closed in favor of this v4-compatible version.

It also improves type safety across AVM provider tests by removing @ts-nocheck comments and introducing proper TypeScript patterns.

Details

  • Update Defly Web provider to use new network configuration builder
  • Adapt transaction signing to use algosdk v3 API
  • Fix genesis hash handling with network config fallback
  • Remove @ts-nocheck comments from AVM provider tests
  • Add type-safe utility types for testing protected methods
  • Update test spies to use proper TypeScript type assertions
  • Maintain consistent type checking across wallet provider tests

This refactors the Kibisis wallet client to use an extendable `AVMProvider` class, laying the groundwork for future wallet implementations that also use `@agoralabs-sh/avm-web-provider`.

- Created new `AVMProvider` abstract class
- Refactored `KibisisWallet` to extend `AVMProvider`
- Moved common AVM Web Provider functionality to `AVMProvider`
- Implemented abstract methods in `KibisisWallet` for Kibisis-specific behavior
- Created new `DeflyWebWallet` class extending `AVMProvider`
- Implemented Defly-specific methods for enable, disable, and sign transactions
- Added `DEFLY_WEB` to `WalletId` enum and `WalletMap`
- Updated utility functions to include Defly Web Wallet
This addresses an issue where certain frameworks are unable to dynamically import `@agoralabs-sh/avm-web-provider` due to module format incompatibilities.

- Modified `_initializeAVMWebProviderSDK` method to handle both default and named exports
- Ensured compatibility between CommonJS (AVM Web Provider) and ESM (use-wallet)
Extract common AVM Web Provider functionality into abstract base class to support
both Kibisis and Defly Web providers. Update implementations to use `algosdk` v3
and new network configuration system.

- Create abstract `AVMProvider` class with shared provider logic
- Move common methods from Kibisis to `AVMProvider`
- Update transaction handling for `algosdk` v3 API
- Add network configuration and genesis hash fallback
- Implement Defly Web provider using shared base class
Enable proper TypeScript type checking in AVM provider tests by introducing
type-safe utility types for testing protected methods.

- Remove `@ts-nocheck` comments from Defly Web and Kibisis tests
- Add `TestableDeflyWebWallet` and `TestableKibisisWallet` utility types
- Update `vi.spyOn` calls to use proper type assertions
- Remove unnecessary type assertions from mock implementations
- Add proper return type to `mockSignTransactionsResponseOnce`
@drichar drichar merged commit 412e688 into v4 Nov 26, 2024
1 check passed
@drichar drichar deleted the feat/defly-web-provider-v4 branch November 26, 2024 03:25
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.

1 participant