Commit 22b7991
authored
Enable transactions look-up by signatures (#117)
### TL;DR
Implemented signature lookup for transactions and improved query filtering.
### What changed?
- Activated signature lookup in `GetTransactionsByContractAndSignature` function
- Exported `ExtractFunctionSelector` function
- Updated ClickHouse queries to include function selector for transactions
- Generalised signature clause handling for both logs and transactions in ClickHouse queries
### How to test?
1. Make a GET request to `/{chainId}/transactions/{to}/{signature}` endpoint with a valid contract address and function signature
```
curl --location 'http://localhost:3000/660279/transactions/0x6e55472109e6abe4054a8e8b8d9edffcb31032c5/setMinDstGas(uint16,uint16,uint256)?limit=1' \
--header 'Authorization: Basic ...'
```
2. Verify that the returned transactions are filtered correctly based on the provided signature
```json
{
"meta": {
"chain_id": 660279,
"address": "0x6e55472109e6abe4054a8e8b8d9edffcb31032c5",
"signature": "0xdf2a5b3b87f900bae4c01587a04a2d9f5990f0066e443e87fe88cf2ce9974ff0",
"page": 0,
"limit": 5,
"total_items": 5,
"total_pages": 0
},
"data": [
{
...
"to_address": "0x6e55472109e6abe4054a8e8b8d9edffcb31032c5",
"value": 0,
"gas": 52119,
"gas_price": 1600000000,
"data": "0xdf2a5b3b00000000000000000000000000000000000000000000000000000000000000af00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000030d40",
"function_selector": "0xdf2a5b3b",
...
}
]
}
```
### Why make this change?
This change enables more precise filtering of transactions based on function signatures, improving the ability to query specific contract interactions. It also aligns the transaction querying capabilities with those already available for logs, providing a more consistent and powerful API for data retrieval.File tree
3 files changed
+22
-11
lines changed- internal
- handlers
- rpc
- storage
3 files changed
+22
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
104 | 106 | | |
105 | 107 | | |
106 | 108 | | |
107 | | - | |
108 | | - | |
| 109 | + | |
| 110 | + | |
109 | 111 | | |
110 | 112 | | |
111 | 113 | | |
| |||
122 | 124 | | |
123 | 125 | | |
124 | 126 | | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
129 | 130 | | |
130 | 131 | | |
131 | 132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
188 | | - | |
| 188 | + | |
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
| |||
270 | 270 | | |
271 | 271 | | |
272 | 272 | | |
273 | | - | |
| 273 | + | |
274 | 274 | | |
275 | 275 | | |
276 | 276 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
339 | 339 | | |
340 | 340 | | |
341 | 341 | | |
342 | | - | |
| 342 | + | |
343 | 343 | | |
344 | 344 | | |
345 | 345 | | |
| |||
359 | 359 | | |
360 | 360 | | |
361 | 361 | | |
362 | | - | |
| 362 | + | |
363 | 363 | | |
364 | 364 | | |
365 | 365 | | |
| |||
452 | 452 | | |
453 | 453 | | |
454 | 454 | | |
455 | | - | |
| 455 | + | |
456 | 456 | | |
457 | 457 | | |
458 | 458 | | |
| |||
516 | 516 | | |
517 | 517 | | |
518 | 518 | | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
519 | 528 | | |
520 | 529 | | |
521 | 530 | | |
| |||
545 | 554 | | |
546 | 555 | | |
547 | 556 | | |
| 557 | + | |
548 | 558 | | |
549 | 559 | | |
550 | 560 | | |
| |||
0 commit comments