Skip to content

Commit 0ca5521

Browse files
authored
docs: update readme (#10)
1 parent 94965f8 commit 0ca5521

File tree

13 files changed

+54
-27
lines changed

13 files changed

+54
-27
lines changed

README.md

+33-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
1-
# Goldrush Decoder
1+
<div align="center">
2+
<img alt="GoldRush Kit Logo" src="assets/goldrush-decoder-banner.png" style="max-width: 100%;"/>
3+
</div>
4+
5+
<p align="center">
6+
<img src="https://img.shields.io/github/license/covalenthq/goldrush-decoder" alt="MIT">
7+
</p>
8+
9+
<h1 align="center">
10+
Decode unstructured, raw event logs into structured data with a simple API.
11+
</h1>
12+
13+
<div align="center">
14+
Open-source. Public Good. 200+ Chains.
15+
</div>
16+
17+
<br>
218

319
This repository contains the logic for decoding a `raw_log_event` of a transaction to meaningful, human-readable, structured data.
420

@@ -15,13 +31,13 @@ This repository contains the logic for decoding a `raw_log_event` of a transacti
1531
}[];
1632
```
1733

18-
2. **Decoder**: The `Decoder` class has different methods that enable the decoding logic to run. The various methods are
34+
2. **GoldRushDecoder**: The `GoldRushDecoder` class has different methods that enable the decoding logic to run. The various methods are
1935

2036
1. `initDecoder`: Scans the `./services/decoder/protocols` directory for all the protocols, extracts the `configs` from them and creates a mapping to the respective decoding function. It is run when the server starts.
2137
2. `on`: Creates a decoding function for the specified protocol name on the specified networks. Its declaration is:
2238

2339
```ts
24-
Decoder.on(
40+
GoldRushDecoder.on(
2541
"<protocol-name>:<EventName>",
2642
["<network_1>", "<network_2>"],
2743
ABI as Abi,
@@ -42,7 +58,7 @@ This repository contains the logic for decoding a `raw_log_event` of a transacti
4258

4359
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.
4460

45-
## 1. Running the Development Server
61+
### 1. Running the Development Server
4662

4763
Follow the following steps to start the development server of the **GoldRush Decoder**.
4864

@@ -62,7 +78,7 @@ Follow the following steps to start the development server of the **GoldRush Dec
6278

6379
The development server will start on the URL - `http://localhost:8080` (port number may change based on the `.env`, 8080 is default).
6480

65-
## 2. API Endpoints
81+
### 2. API Endpoints
6682

6783
1. `/api/v1`: The default endpoint for the v1 of the server. A header of the key `x-covalent-api-key` with the value as the [Covalent API key](https://www.covalenthq.com/platform/apikey/) is **mandatory** for the Decoder to work.
6884

@@ -83,7 +99,7 @@ Follow the following steps to start the development server of the **GoldRush Dec
8399
}'
84100
```
85101

86-
## 3. Adding a Decoder
102+
### 3. Adding a Decoder
87103

88104
Follow the following steps to add a Decoding logic for an event from a contract of a chain.
89105

@@ -138,4 +154,15 @@ Follow the following steps to add a Decoding logic for an event from a contract
138154
}
139155
```
140156

157+
## Contributing
158+
159+
Contributions, issues and feature requests are welcome!
160+
Feel free to check [issues](https://github.com/covalenthq/goldrush-decoder/issues) page.
161+
162+
## Show your support
163+
164+
Give a ⭐️ if this project helped you!
165+
166+
## License
141167

168+
This project is [MIT](LICENSE) licensed.

api/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import express, {
66
} from "express";
77
import cors from "cors";
88
import { config as dotenvConfig } from "dotenv";
9-
import { Decoder } from "../services";
9+
import { GoldRushDecoder } from "../services";
1010
import { txRouter } from "../microservices/tx/tx.routes";
1111
import { TimestampParser } from "../utils/functions";
1212

@@ -56,7 +56,7 @@ app.use(
5656

5757
(async () => {
5858
try {
59-
await Promise.all([Decoder.initDecoder()]);
59+
await Promise.all([GoldRushDecoder.initDecoder()]);
6060
const env: string = process.env.NODE_ENV || "development";
6161
if (env !== "test") {
6262
const port: number = +(process.env.PORT || 8080);

assets/goldrush-decoder-banner.png

636 KB
Loading

microservices/tx/tx.service.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Decoder } from "../../services";
1+
import { GoldRushDecoder } from "../../services";
22
import {
33
CovalentClient,
44
type Chain,
@@ -50,7 +50,7 @@ export const fetchEventsFromLogs = async (
5050
logs: LogEvent[],
5151
covalentApiKey: string
5252
) => {
53-
const events = await Decoder.decode(
53+
const events = await GoldRushDecoder.decode(
5454
network,
5555
logs.reverse(),
5656
covalentApiKey

services/decoder/decoder.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
} from "./decoder.types";
1616
import { encodeEventTopics, type Abi } from "viem";
1717

18-
export class Decoder {
18+
export class GoldRushDecoder {
1919
private static configs: DecoderConfig = {};
2020
private static decoders: Decoders = {};
2121
private static decoding_functions: DecodingFunctions = [];

services/decoder/protocols/4337-entry-point/4337-entry-point.decoders.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Decoder } from "../../decoder";
1+
import { GoldRushDecoder } from "../../decoder";
22
import { type EventType } from "../../decoder.types";
33
import {
44
DECODED_ACTION,
@@ -7,7 +7,7 @@ import {
77
import { decodeEventLog, type Abi } from "viem";
88
import ABI from "./abis/4337-entry-point.abi.json";
99

10-
Decoder.on(
10+
GoldRushDecoder.on(
1111
"4337-entry-point:UserOperationEvent",
1212
["matic-mainnet"],
1313
ABI as Abi,

services/decoder/protocols/covalent-network/covalent-network.decoders.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Decoder } from "../../decoder";
1+
import { GoldRushDecoder } from "../../decoder";
22
import { type EventType } from "../../decoder.types";
33
import {
44
DECODED_ACTION,
@@ -7,7 +7,7 @@ import {
77
import { decodeEventLog, type Abi } from "viem";
88
import TransparentUpgradeableProxyABI from "./abis/transparent-upgradeable-proxy.abi.json";
99

10-
Decoder.on(
10+
GoldRushDecoder.on(
1111
"covalent-network:BlockSpecimenProductionProofSubmitted",
1212
["moonbeam-mainnet"],
1313
TransparentUpgradeableProxyABI as Abi,

services/decoder/protocols/grindery-one/grindery-one.decoders.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Decoder } from "../../decoder";
1+
import { GoldRushDecoder } from "../../decoder";
22
import { type EventType } from "../../decoder.types";
33
import {
44
DECODED_ACTION,
@@ -7,7 +7,7 @@ import {
77
import { decodeEventLog, type Abi } from "viem";
88
import ABI from "./abis/grindery-one.abi.json";
99

10-
Decoder.on(
10+
GoldRushDecoder.on(
1111
"grindery-one:Transfer",
1212
["matic-mainnet"],
1313
ABI as Abi,

services/decoder/protocols/opensea/opensea.decoders.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Decoder } from "../../decoder";
1+
import { GoldRushDecoder } from "../../decoder";
22
import {
33
type EventDetails,
44
type EventNFTs,
@@ -14,7 +14,7 @@ import Seaport from "./abis/seaport-1.1.abi.json";
1414
import { TimestampParser } from "../../../../utils/functions";
1515
import { prettifyCurrency } from "@covalenthq/client-sdk";
1616

17-
Decoder.on(
17+
GoldRushDecoder.on(
1818
"opensea:OrderFulfilled",
1919
["eth-mainnet", "matic-mainnet"],
2020
Seaport as Abi,

services/decoder/protocols/paraswap-v5/paraswap-v5.decoders.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Decoder } from "../../decoder";
1+
import { GoldRushDecoder } from "../../decoder";
22
import {
33
type EventTokens,
44
type EventDetails,
@@ -15,7 +15,7 @@ import {
1515
prettifyCurrency,
1616
} from "@covalenthq/client-sdk";
1717

18-
Decoder.on(
18+
GoldRushDecoder.on(
1919
"paraswap-v5:SwappedV3",
2020
["eth-mainnet", "matic-mainnet"],
2121
SimpleSwapABI as Abi,

services/decoder/protocols/source-zorb/source-zorb.decoders.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Decoder } from "../../decoder";
1+
import { GoldRushDecoder } from "../../decoder";
22
import { type EventType } from "../../decoder.types";
33
import {
44
DECODED_ACTION,
@@ -7,7 +7,7 @@ import {
77
import SourceZorbABI from "./abis/source-zorb.abi.json";
88
import { type Abi, decodeEventLog } from "viem";
99

10-
Decoder.on(
10+
GoldRushDecoder.on(
1111
"source-zorb:Transfer",
1212
["zora-mainnet"],
1313
SourceZorbABI as Abi,

services/decoder/protocols/uniswap-v2/uniswap-v2.decoders.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { prettifyCurrency, type Token } from "@covalenthq/client-sdk";
22
import { type Abi, decodeEventLog } from "viem";
3-
import { Decoder } from "../../decoder";
3+
import { GoldRushDecoder } from "../../decoder";
44
import { TimestampParser } from "../../../../utils/functions";
55
import { type EventType } from "../../decoder.types";
66
import PairABI from "./abis/uniswap-v2.pair.abi.json";
@@ -9,7 +9,7 @@ import {
99
DECODED_EVENT_CATEGORY,
1010
} from "../../decoder.constants";
1111

12-
Decoder.on(
12+
GoldRushDecoder.on(
1313
"uniswap-v2:Swap",
1414
["eth-mainnet"],
1515
PairABI as Abi,
@@ -139,7 +139,7 @@ Decoder.on(
139139
}
140140
);
141141

142-
Decoder.on(
142+
GoldRushDecoder.on(
143143
"uniswap-v2:Mint",
144144
["eth-mainnet"],
145145
PairABI as Abi,

services/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export { Decoder } from "./decoder/decoder";
1+
export { GoldRushDecoder } from "./decoder/decoder";

0 commit comments

Comments
 (0)