Skip to content

Commit a9ce756

Browse files
committed
feat: gas estimator
1 parent d5faf23 commit a9ce756

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+175263
-30
lines changed

.golangci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ run:
44
concurrency: 0
55
timeout: 10m
66
issues-exit-code: 1
7-
tests: true
7+
tests: false
88

99
output:
1010
formats:
@@ -32,6 +32,7 @@ linters:
3232
# You can't disable typecheck, see:
3333
# https://github.com/golangci/golangci-lint/blob/master/docs/src/docs/welcome/faq.mdx#why-do-you-have-typecheck-errors
3434
- unconvert
35+
- bodyclose
3536
settings:
3637
errcheck:
3738
check-type-assertions: false
@@ -46,6 +47,9 @@ linters:
4647
goconst:
4748
min-len: 3
4849
min-occurrences: 2
50+
gosec:
51+
excludes:
52+
- G115
4953

5054
formatters:
5155
exclusions:

README.md

Lines changed: 86 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,42 @@ go get github.com/status-im/go-wallet-sdk
1717
- Smart fallback between different fetching methods
1818
- Chain-agnostic design
1919

20+
- **`pkg/multicall`**: Efficient batching of contract calls using Multicall3
21+
- Batch multiple contract calls into single transactions
22+
- Support for ETH, ERC20, ERC721, and ERC1155 balance queries
23+
- Automatic chunking and error handling
24+
- Synchronous and asynchronous execution modes
25+
2026
### Ethereum Client
2127
- **`pkg/ethclient`**: Full-featured Ethereum client with go-ethereum compatibility
2228
- Complete RPC method coverage (eth_*, net_*, web3_*)
2329
- Go-ethereum ethclient compatible interface for easy migration
30+
- Chain-agnostic methods for any EVM-compatible network
31+
32+
### Gas Estimation
33+
- **`pkg/gas`**: Comprehensive gas fee estimation and suggestions
34+
- Smart fee estimation for three priority levels (low, medium, high)
35+
- Transaction inclusion time predictions
36+
- Multi-chain support (L1, Arbitrum, Optimism, Linea)
37+
- Network congestion analysis for L1 chains
38+
- Chain-specific optimizations
39+
40+
### Event Filtering & Parsing
41+
- **`pkg/eventfilter`**: Efficient event filtering for ERC20, ERC721, and ERC1155 transfers
42+
- Minimizes eth_getLogs API calls
43+
- Direction-based filtering (send, receive, both)
44+
- Concurrent query processing
45+
46+
- **`pkg/eventlog`**: Automatic event log detection and parsing
47+
- Type-safe access to parsed event data
48+
- Support for Transfer, Approval, and other standard events
49+
- Works seamlessly with eventfilter
50+
51+
### Smart Contract Bindings
52+
- **`pkg/contracts`**: Go bindings for smart contracts
53+
- Multicall3 with 200+ chain deployments
54+
- ERC20, ERC721, and ERC1155 token standards
55+
- Automated deployment address management
2456

2557
### Common Utilities
2658
- **`pkg/common`**: Shared utilities and constants used across the SDK
@@ -43,6 +75,32 @@ cd examples/ethclient-usage
4375
go run .
4476
```
4577

78+
### Gas Comparison Tool
79+
80+
```bash
81+
cd examples/gas-comparison
82+
83+
# Test with local mock data
84+
go run . -fake
85+
86+
# Test with real networks (requires Infura API key)
87+
go run . -infura-api-key YOUR_API_KEY
88+
```
89+
90+
### Multicall Usage
91+
92+
```bash
93+
cd examples/multiclient3-usage
94+
go run .
95+
```
96+
97+
### Event Filter Example
98+
99+
```bash
100+
cd examples/eventfilter-example
101+
go run . -account 0xYourAddress -start 19000000 -end 19100000
102+
```
103+
46104
## Testing
47105

48106
```bash
@@ -54,18 +112,43 @@ go test ./...
54112
```
55113
go-wallet-sdk/
56114
├── pkg/ # Core SDK packages
57-
│ ├── balance/ # Balance-related functionality
115+
│ ├── balance/ # Balance fetching functionality
116+
│ ├── multicall/ # Multicall3 batching
58117
│ ├── ethclient/ # Ethereum client with full RPC support
118+
│ ├── gas/ # Gas estimation and fee suggestions
119+
│ ├── eventfilter/ # Event filtering for transfers
120+
│ ├── eventlog/ # Event log parsing
121+
│ ├── contracts/ # Smart contract bindings
59122
│ └── common/ # Shared utilities
60123
├── examples/ # Usage examples
61-
└── README.md # This file
124+
│ ├── balance-fetcher-web/ # Web interface for balance fetching
125+
│ ├── ethclient-usage/ # Ethereum client examples
126+
│ ├── gas-comparison/ # Gas fee comparison tool
127+
│ ├── multiclient3-usage/ # Multicall examples
128+
│ ├── multistandardfetcher-example/ # Multi-standard balance fetching
129+
│ └── eventfilter-example/ # Event filtering examples
130+
└── README.md # This file
62131
```
63132

64133
## Documentation
65134

135+
### Package Documentation
66136
- [Balance Fetcher](pkg/balance/fetcher/README.md) - Balance fetching functionality
137+
- [Multicall](pkg/multicall/README.md) - Efficient contract call batching
67138
- [Ethereum Client](pkg/ethclient/README.md) - Complete Ethereum RPC client
68-
- [Web Example](examples/balance-fetcher-web/README.md) - Complete web application
139+
- [Gas Estimation](pkg/gas/README.md) - Gas fee estimation and suggestions
140+
- [Event Filter](pkg/eventfilter/README.md) - Event filtering for transfers
141+
- [Event Log Parser](pkg/eventlog/README.md) - Event log parsing
142+
143+
### Example Documentation
144+
- [Web Balance Fetcher](examples/balance-fetcher-web/README.md) - Web interface for balance fetching
145+
- [Ethereum Client Usage](examples/ethclient-usage/README.md) - Ethereum client examples
146+
- [Gas Comparison](examples/gas-comparison/README.md) - Gas fee comparison tool
147+
- [Multicall Usage](examples/multiclient3-usage/README.md) - Multicall examples
148+
- [Event Filter Example](examples/eventfilter-example/README.md) - Event filtering examples
149+
150+
### Specifications
151+
- [Technical Specifications](docs/specs.md) - Complete SDK specifications and architecture
69152

70153
## Contributing
71154

0 commit comments

Comments
 (0)