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

Add HTTP and WebSocket handlers for JSON-RPC server #11

Merged
merged 30 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
a32d801
Add HTTP and WebSocket handlers for JSON-RPC server
m-Peter Nov 22, 2023
57f4553
Fetch chainID from flow-go repository
m-Peter Nov 22, 2023
ab6e342
Add a basic indexing functionality
m-Peter Nov 23, 2023
03c6a9a
Add description for commented-out code
m-Peter Nov 27, 2023
f291025
Use hexutil.Bytes as type for input on SendRawTransaction rpc method
m-Peter Dec 15, 2023
0ddb302
Add tests for JSON-RPC HTTP handler & BlockChainAPI service
m-Peter Dec 18, 2023
4251feb
Add a basic Makefile and CI workflow for GitHub
m-Peter Dec 18, 2023
9f9375f
Run JSON-RPC HTTP handler on port 8545 which most clients default to …
m-Peter Dec 18, 2023
00f6a43
Test more JSON-RPC methods and some mock data
m-Peter Dec 18, 2023
78b1e39
Use empty value for sync.RWMutex when initializing the Store
m-Peter Dec 19, 2023
de90c62
Acquire read lock in LatestBlockHeight
m-Peter Dec 19, 2023
4d47834
Add reconnect functionality in indexer
m-Peter Dec 19, 2023
2b36693
Add a heartbeatInterval parameter to SubscribeEvents and check that a…
m-Peter Dec 19, 2023
97553aa
Remove all redundant functionality from JSON-RPC HTTP & WebSocket han…
m-Peter Dec 20, 2023
b343e74
Run go mod tidy
m-Peter Dec 20, 2023
42be5cd
Introduce a basic Config type for the BlockChainAPI
m-Peter Dec 22, 2023
130b167
Add eth RPC methods for getting uncles
m-Peter Dec 22, 2023
8545330
Base indexer functionality on flow-go-sdk's BaseClient
m-Peter Dec 22, 2023
974e834
Add check-tidy and ci recipes in Makefile and use in CI workflow
m-Peter Jan 4, 2024
b8b8ac9
Add TODO for including more options in Config
m-Peter Jan 6, 2024
ed60231
Rename blockHeight to latestHeight and add a TODO for requiring it in…
m-Peter Jan 6, 2024
f55dc7b
Replace fmt.Println with a proper logger
m-Peter Jan 6, 2024
24cab8e
Add a time.Sleep before reconnecting the indexer
m-Peter Jan 6, 2024
e893a6f
Create dedicated fixtures for eth JSON-RPC requests & responses
m-Peter Jan 6, 2024
eb14c1e
Remove workaround for chainhash ambiguous import
m-Peter Jan 6, 2024
df9553c
Add a panic in BlockNumber() when retrieval from storage fails
m-Peter Jan 6, 2024
328de2f
Refactor the reconnect method to be able to re-use it
m-Peter Jan 6, 2024
fc18d38
Add disclaimer about the source of inspiration for the httpServer
m-Peter Jan 6, 2024
6173b96
Add TODO for getting rid of mock data in favor of storage & indexer i…
m-Peter Jan 6, 2024
aaf3ba3
Run make test recipe with -cover flag
m-Peter Jan 6, 2024
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
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: CI
Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally, in the future try to keep these kinds of changes in separate PRs so they are more focused.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Makes sense 👍 Will do.


on:
pull_request:
branches: [main]
push:
branches: [main]

jobs:
test:
name: "Test"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: '1.20.x'
- uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run tests
run: make test
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.PHONY: test
test:
# test all packages
go test -parallel 8 ./...
227 changes: 200 additions & 27 deletions api/api.go

Large diffs are not rendered by default.

Loading
Loading