Skip to content

Commit 574bc26

Browse files
committed
docs: update readme
1 parent 29b8cd1 commit 574bc26

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

README.md

+26-3
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,40 @@ This repository contains the logic for decoding a `raw_log_event` of a transacti
4747
);
4848
```
4949

50-
The method has 3 arguments:
50+
The method has 4 arguments:
5151

5252
1. **Event Id**: A case-sensitive string concatenation of the `protocol name` with the `event name` by a `:`.
53-
2. **Networks**: An array of all the networks the defined decoding function will run for
53+
2. **Networks**: An array of all the networks the defined decoding function will run for.
54+
3. **ABI**: The ABI of the contract on which the event exists.
55+
4. **Decoding Function**: The actual decoding function, it has 3 arguments passed to it:
56+
1. `log_event`: The raw log event that is being decoded.
57+
2. `tx`: The transaction object that generated this log.
58+
3. `chain_name`: Network to which the log belongs to.
59+
4. `covalent_client`: The covalent client created with your covalent API key.
60+
61+
3. `fallback`: Creates a fallback function for the specified event name. This function is not linked to any chain or contract. Its declaration is:
62+
63+
```ts
64+
GoldRushDecoder.fallback(
65+
"EventName",
66+
ABI as Abi,
67+
async (log_event, tx, chain_name, covalent_client): Promise<EventType> => {
68+
<!-- decoding logic -->
69+
}
70+
);
71+
```
72+
73+
The method has 3 arguments:
74+
75+
1. **Event Name**: A case-sensitive name of the event to be decoded.
76+
2. **ABI**: The ABI of the contract on which the event exists.
5477
3. **Decoding Function**: The actual decoding function, it has 3 arguments passed to it:
5578
1. `log_event`: The raw log event that is being decoded.
5679
2. `tx`: The transaction object that generated this log.
5780
3. `chain_name`: Network to which the log belongs to.
5881
4. `covalent_client`: The covalent client created with your covalent API key.
5982

60-
3. `decode`: The function that chooses which decoding function needs to be called for which log event. It collects all the decoded events for a transaction and returns them in an array of structured data. It is run when the API server receives a request.
83+
4. `decode`: The function that chooses which decoding function needs to be called for which log event. It collects all the decoded events for a transaction and returns them in an array of structured data. It is run when the API server receives a request.
6184

6285
### 1. Running the Development Server
6386

0 commit comments

Comments
 (0)