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

thiagodeev/rpcv08-websocket #651

Draft
wants to merge 13 commits into
base: v0.8.0
Choose a base branch
from
Draft

Conversation

thiagodeev
Copy link
Collaborator

@thiagodeev thiagodeev commented Dec 24, 2024

No description provided.

@thiagodeev thiagodeev force-pushed the v0.8.0 branch 2 times, most recently from 61eb5fb to 9199306 Compare January 6, 2025 11:37
…ith Websocket support

- Added gorilla/websocket v1.5.3 as a direct dependency in go.mod.
- Introduced NewWebsocketProvider function in provider.go to create a Websocket RPC Provider instance, enhancing the existing HTTP provider functionality.
- Removed the dependency on github.com/ethereum/go-ethereum and replaced it with github.com/NethermindEth/starknet.go/client in go.mod and related files.
- Introduced new WebSocket provider functionality in provider.go
- Updated the handler to correctly process subscription IDs for Starknet, accommodating the new structure returned by the Starknet API.
- Modified the subscriptionResult struct to include a Starknet-specific subscription ID field.
- Adjusted the WebSocket provider to support new block header subscriptions, improving the overall subscription mechanism.
- Updated example usage to reflect changes in subscription handling and error management.

These changes improve compatibility with Starknet's API and enhance the robustness of the WebSocket client.
- Updated the main CI workflow to include testing for the client with mocks.
- Modified subscription handling in `subscription.js` to accommodate the new `subscription_id` structure from Starknet.
- Refactored `provider_test.go` to include WebSocket provider support and improved test configurations.
- Introduced a new test file `websocket_test.go` to validate WebSocket subscriptions for new block headers, ensuring robust error handling and compatibility with the testnet environment.

These changes improve the overall robustness of the RPC client and enhance compatibility with Starknet's API.
@thiagodeev thiagodeev force-pushed the thiagodeev/rpcv08-websocket branch from f846bb8 to 05d7e90 Compare January 13, 2025 16:49
@thiagodeev thiagodeev force-pushed the thiagodeev/rpcv08-websocket branch from 4bb568c to c73bfce Compare January 13, 2025 22:37
Note: at the moment it's not possible to omit optional parameters in json-rpc calls using array as structure type with Juno, and the current client implementation only supports sending parameters as arrays. Therefore, I changed the Subscribe function and now we are able to send optional parameters as object too. That way Juno doesn't return an error
…hanced error handling and testing

- Added the SubscribeEvents method to the WebSocket provider, allowing for event subscriptions with optional parameters.
- Introduced a new test case in websocket_test.go to validate event subscriptions under various conditions, including handling of empty arguments and specific address filtering.
- Updated the HexToFeltNoErr utility function to convert hexadecimal strings to felt objects without error handling, suitable for internal use.

These changes improve the robustness of the WebSocket client and enhance compatibility with Starknet's event subscription model.
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