Skip to content

Commit f24dc21

Browse files
committed
alchemy free tier
1 parent bb16756 commit f24dc21

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

pkg/ethutil/filter.go

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,25 @@ var (
1919

2020
// read chunkedFilterLogs comment for additional information.
2121
//
22-
// NOTE: There is no standard reply among providers, add as needed. This
23-
// function assumes that any server side error codes represent block range that
24-
// is too large.
25-
// ┌────────────────────────────┬───────┬────────┬────────────┐
26-
// │ provider │ limit │ code │ checked at │
27-
// ├────────────────────────────┼───────┼────────┼────────────┤
28-
// │ https://cloudflare-eth.com │ 800 │ -32047 │ 2025-01-24 │
29-
// └────────────────────────────┴───────┴────────┴────────────┘
22+
// NOTE: There is no standard reply among providers, add as needed. To handle a
23+
// new provider add it to the table below and make queryBlockRangeTooLarge
24+
// return true when encountering its RPC error code.
25+
// ┌───────────────────────────────────────────────────┬───────┬────────┬────────────┐
26+
// │ provider │ limit │ code │ checked at │
27+
// ├───────────────────────────────────────────────────┼───────┼────────┼────────────┤
28+
// │ https://cloudflare-eth.com/ │ 800 │ -32047 │ 2025-01-24 │
29+
// │ https://eth-mainnet.g.alchemy.com/v2/{key} (free) │ 500 │ -32600 │ 2025-05-13 │
30+
// │ https://mainnet.infura.io/v3/{key} (free) │ 10000 │ -32005 │ 2025-05-15 │
31+
// │ https://site1.moralis-nodes.com/eth/{key} (free) │ 100 │ 400 │ 2025-05-15 │
32+
// └───────────────────────────────────────────────────┴───────┴────────┴────────────┘
3033
func queryBlockRangeTooLarge(err error) bool {
3134
if err != nil {
3235
switch e := err.(type) {
3336
case rpc.Error:
34-
return -32099 <= e.ErrorCode() && e.ErrorCode() <= -32000
37+
return (e.ErrorCode() == -32047) || // cloudflare (free)
38+
(e.ErrorCode() == -32600) || // alchemy (free)
39+
(e.ErrorCode() == -32005) || // infura (free)
40+
(e.ErrorCode() == 400) // moralis (free)
3541
}
3642
}
3743
return false

0 commit comments

Comments
 (0)