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

Open
wants to merge 36 commits into
base: v0.8.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
2d3dcce
Update go.mod to include gorilla/websocket and enhance RPC provider w…
thiagodeev Dec 24, 2024
418db12
Enhance NewWebsocketProvider with cookie support in provider.go
thiagodeev Jan 3, 2025
1247764
Added new errors
thiagodeev Jan 6, 2025
f7f342f
Refactor RPC client and enhance WebSocket support
thiagodeev Jan 7, 2025
6d54e5a
adds remaining test data and improves tests, and adapt subscribe meth…
thiagodeev Jan 8, 2025
f188b94
Enhance Starknet WebSocket support and subscription handling
thiagodeev Jan 8, 2025
71d5a4e
improves newHeads method and WS close message
thiagodeev Jan 10, 2025
05d7e90
Enhance Starknet compatibility and testing framework
thiagodeev Jan 10, 2025
c73bfce
Fixes linter and test errors
thiagodeev Jan 13, 2025
76d01c8
draft implementation of subscribeEvents
thiagodeev Jan 14, 2025
f678b3f
client adaptation and functional version of subscribeEvents
thiagodeev Jan 14, 2025
245dbac
Implement SubscribeEvents functionality in WebSocket provider with en…
thiagodeev Jan 15, 2025
094d21f
finish subscribeEvents tests
thiagodeev Jan 15, 2025
d01082f
add starknet-spec updates
thiagodeev Jan 16, 2025
f386d32
Finish subscribeTransactionStatus
thiagodeev Jan 16, 2025
4d61a71
Implement SubscribePendingTransactions
thiagodeev Jan 22, 2025
67c1eb7
revert mistake in the account_test.go file
thiagodeev Jan 22, 2025
6c22c90
improve SubscribeNewHeads param
thiagodeev Jan 22, 2025
c5c147f
improve SubscribeEvents method
thiagodeev Jan 22, 2025
8f99018
Add SubscribePendingTransactions tests
thiagodeev Jan 22, 2025
087ed79
Add support for Reorg notifications
thiagodeev Jan 23, 2025
e3bc2d1
add TestUnsubscribe
thiagodeev Jan 24, 2025
8b908c5
Create WebsocketProvider interface
thiagodeev Jan 30, 2025
a0dd75a
Remove some TODO comments
thiagodeev Jan 30, 2025
ecfe19f
Reorg ws methods alphabetically
thiagodeev Jan 30, 2025
838bd82
Improve ws methods description
thiagodeev Jan 30, 2025
35023f8
Add WebSocket example with detailed usage and README update
thiagodeev Jan 30, 2025
359fc44
Merge branch 'v0.8.0' into thiagodeev/rpcv08-websocket
thiagodeev Jan 30, 2025
2457999
Update README with WebSocket example documentation
thiagodeev Jan 30, 2025
9bae8fb
Update CI workflow to build WebSocket and typedData projects
thiagodeev Jan 30, 2025
956df89
Remove HexToFeltNoErr
thiagodeev Jan 30, 2025
4beb3ff
Refactor WebSocket subscription types with SubscriptionBlockID and re…
thiagodeev Jan 30, 2025
3dc8e5f
Fix PR review comments
thiagodeev Jan 30, 2025
4cf22d8
Improve TestSubscribeEvents testcase description and fix PR comment
thiagodeev Jan 30, 2025
03ba2e3
Fix SubscribeTransactionStatus with new Juno update
thiagodeev Jan 31, 2025
cb50e23
New 'is_reverted' field from spec update
thiagodeev Jan 31, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/main_ci_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,12 @@ jobs:
cd ../simpleCall && go build
cd ../simpleInvoke && go build
cd ../deployContractUDC && go build
cd ../typedData && go build
cd ../websocket && go build

# Test client on mock
- name: Test client with mocks
run: cd client && go test -v


#TODO: handle websocket tests in the CI
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ operations on the wallets. The package has excellent documentation for a smooth
- [invoke transaction example](./examples/simpleInvoke) to add a new invoke transaction on testnet.
- [deploy contract UDC example](./examples/deployContractUDC) to deploy an ERC20 token using [UDC (Universal Deployer Contract)](https://docs.starknet.io/architecture-and-concepts/accounts/universal-deployer/) on testnet.
- [typed data example](./examples/typedData) to sign and verify a typed data.
- [websocket example](./examples/websocket) to learn how to subscribe to WebSocket methods.

### Run Examples

Expand Down Expand Up @@ -105,6 +106,15 @@ go run main.go

> Check [here](examples/typedData/README.md) for more details.

***starknet websocket***

```sh
cd examples/websocket
go run main.go
```

> Check [here](examples/websocket/README.md) for more details.

<br/> Check [here](https://github.com/NethermindEth/starknet.go/tree/main/examples) for some FAQ answered by these examples.


Expand Down
4 changes: 2 additions & 2 deletions account/account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,7 @@ func TestWaitForTransactionReceipt(t *testing.T) {
Timeout: 3, // Should poll 3 times
Hash: new(felt.Felt).SetUint64(100),
ExpectedReceipt: rpc.TransactionReceipt{},
ExpectedErr: rpc.Err(rpc.InternalError, &rpc.RPCData{Message: "Post \"http://localhost:5050\": context deadline exceeded"}),
ExpectedErr: rpc.Err(rpc.InternalError, &rpc.RPCData{Message: "context deadline exceeded"}),
},
},
}[testEnv]
Expand All @@ -1090,7 +1090,7 @@ func TestWaitForTransactionReceipt(t *testing.T) {
rpcErr, ok := err.(*rpc.RPCError)
require.True(t, ok)
require.Equal(t, test.ExpectedErr.Code, rpcErr.Code)
require.Equal(t, test.ExpectedErr.Data.Message, rpcErr.Data.Message)
require.Contains(t, rpcErr.Data.Message, test.ExpectedErr.Data.Message) // sometimes the error message starts with "Post \"http://localhost:5050\":..."
} else {
require.Equal(t, test.ExpectedReceipt.ExecutionStatus, (*resp).ExecutionStatus)
}
Expand Down
Loading