Skip to content

Commit 6b2049e

Browse files
committed
update readme
1 parent 8398d2f commit 6b2049e

File tree

1 file changed

+44
-32
lines changed

1 file changed

+44
-32
lines changed

typescript/solver/README.md

Lines changed: 44 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -15,45 +15,56 @@ The solver directory contains the implementation of the Intent Solver, a TypeScr
1515
solver/
1616
├── index.ts
1717
├── logger.ts
18+
├── NonceKeeperWallet.ts
1819
├── patch-bigint-buffer-warn.js
19-
├── solvers/
20-
│ ├── BaseListener.ts
21-
│ ├── eco/
22-
│ │ ├── listener.ts
23-
│ │ ├── filler.ts
24-
│ │ └── contracts/
25-
│ ├── onChain/
26-
│ │ ├── listener.ts
27-
│ │ ├── filler.ts
28-
│ │ └── contracts/
29-
│ └── index.ts
30-
├── types.ts
31-
├── package.json
32-
└── tsconfig.json
20+
├── test/
21+
├── config/
22+
│ ├── index.ts
23+
│ ├── allowBlockLists.ts
24+
│ ├── chainMetadata.ts
25+
│ └── types.ts
26+
└── solvers/
27+
├── index.ts
28+
├── BaseFiller.ts
29+
├── BaseListener.ts
30+
├── types.ts
31+
├── utils.ts
32+
├── contracts/
33+
└── <eco|hyperlane7683>/
34+
├── index.ts
35+
├── listener.ts
36+
├── filler.ts
37+
├── types.ts
38+
├── utils.ts
39+
├── contracts/
40+
└── config/
41+
├── index.ts
42+
├── metadata.ts
43+
└── allowBlockLists.ts
3344
```
3445

3546
### Description of Key Files and Directories
3647

37-
- **index.ts**: The main entry point of the solver application. It initializes and starts the listeners and fillers for different solvers.
48+
- **solver/index.ts**: The main entry point of the solver application. It initializes and starts the listeners and fillers for different solvers.
3849

3950
- **logger.ts**: Contains the Logger class used for logging messages with various formats and levels.
4051

52+
- **NonceKeeperWallet.ts**: A class that extends ethers Wallet and prevents nonces race conditions when the solver needs to fill different intents (from different solutions) in the same network.
53+
4154
- **patch-bigint-buffer-warn.js**: A script to suppress specific warnings related to BigInt and Buffer, ensuring cleaner console output.
4255

4356
- **solvers/**: Contains implementations of different solvers and common utilities.
4457
- **BaseListener.ts**: An abstract base class that provides common functionality for event listeners. It handles setting up contract connections and defines the interface for parsing event arguments.
45-
- **eco/**: Implements the solver for the ECO domain.
46-
- **listener.ts**: Extends `BaseListener` to handle ECO-specific events.
47-
- **filler.ts**: Processes ECO events and executes the required actions.
48-
- **contracts/**: Contains contract ABI and type definitions for interacting with ECO contracts.
49-
- **onChain/**: Implements the solver for on-chain events.
50-
- **listener.ts**: Extends `BaseListener` to handle on-chain events.
51-
- **filler.ts**: Processes on-chain events and executes the necessary actions.
52-
- **contracts/**: Contains contract factories and types for on-chain contracts.
58+
- **BaseFiller.ts**: An abstract base class that provides common functionality for fillers. It handles the solver's lifecycle `prepareIntent`, `fill`, and `settle`.
59+
- **`prepareIntent`**: evaluate allow/block lists, balances, and run the defined rules to decide wether to fill or not an intent.
60+
- **`fill`**: The actual filling.
61+
- **`settle`**: The settlement step, can be avoided.
62+
- **<eco|hyperlane7683>/**: Implements the solvers for the ECO and Hyperlane7683 domains.
63+
- **listener.ts**: Extends `BaseListener` to handle domain-specific events.
64+
- **filler.ts**: Extends `BaseFiller` to handle domain-specific intents.
65+
- **contracts/**: Contains contract ABI and type definitions for interacting with domain-specific contracts.
5366
- **index.ts**: Exports the solvers to be used in the main application.
5467

55-
- **types.ts**: Contains shared type definitions used across different solvers.
56-
5768
## Installation
5869

5970
### Prerequisites
@@ -119,6 +130,7 @@ const allowBlockLists: AllowBlockLists = {
119130
blockList: [],
120131
};
121132
```
133+
122134
as object of the following format:
123135

124136
```typescript
@@ -154,16 +166,16 @@ To integrate a new solver into the application, follow these steps:
154166
155167
```
156168
solvers/
157-
── yourSolver/
158-
├── listener.ts
159-
├── filler.ts
160-
└── contracts/
161-
└── YourContract.json
169+
── yourSolver/
170+
├── listener.ts
171+
├── filler.ts
172+
└── contracts/
173+
└── YourContract.json
162174
```
163175
164176
2. **Implement the Listener**: In listener.ts, extend the `BaseListener` class and implement the required methods to handle your specific event.
165177
166-
3. **Implement the Filler**: In filler.ts, write the logic to process events captured by your listener.
178+
3. **Implement the Filler**: In filler.ts, extend the `BaseFiller` class and implement the required logic to process events captured by your listener.
167179
168180
4. **Add Contract Definitions**: Place your contract ABI and type definitions in the `contracts/` directory.
169181
@@ -187,7 +199,7 @@ To integrate a new solver into the application, follow these steps:
187199
// ... existing code ...
188200

189201
const yourSolverListener = solvers['yourSolver'].listener.create();
190-
const yourSolverFiller = solvers['yourSolver'].filler.create();
202+
const yourSolverFiller = solvers['yourSolver'].filler.create(multiProvider);
191203

192204
yourSolverListener(yourSolverFiller);
193205
```

0 commit comments

Comments
 (0)