2023-01-31 15:52:19 -08:00
|
|
|
# OpenBook crank script
|
|
|
|
|
|
|
|
OpenBook needs to be cranked to process orderbook events.
|
|
|
|
The initial code was taken from the same crank script for openbook in mango-v3-client, so most credit goes to Mango team.
|
|
|
|
|
2023-01-31 16:05:10 -08:00
|
|
|
#### Install deps first:
|
2023-01-31 15:52:19 -08:00
|
|
|
|
|
|
|
```
|
|
|
|
yarn install
|
|
|
|
```
|
|
|
|
|
2023-01-31 16:05:10 -08:00
|
|
|
#### Run:
|
2023-01-31 15:52:19 -08:00
|
|
|
|
|
|
|
make sure to create a JSON file containing the keypair formatted as a byte array e.g. [1,3,4...]
|
|
|
|
|
|
|
|
```
|
2023-02-01 03:55:20 -08:00
|
|
|
ENDPOINT_URL=... WALLET_PATH=./path/to/wallet.json ./start-cranker.sh
|
|
|
|
```
|
|
|
|
|
|
|
|
Or run with KEYPAIR directly:
|
|
|
|
|
|
|
|
```
|
|
|
|
ENDPOINT_URL=... KEYPAIR=[1,3,4...] ./start-cranker.sh
|
2023-01-31 15:52:19 -08:00
|
|
|
```
|
2023-01-31 16:05:10 -08:00
|
|
|
|
2023-01-31 16:10:39 -08:00
|
|
|
to run in the background, pass "-d" or "--daemon"
|
|
|
|
|
2023-02-11 07:11:22 -08:00
|
|
|
optional env args:
|
2023-01-31 16:10:39 -08:00
|
|
|
|
|
|
|
```
|
2023-02-11 07:11:22 -08:00
|
|
|
BUMP_MARKETS // comma seperated list to force PRIORITY_CU_PRICE for market addresses
|
|
|
|
CU_PRICE // minimum additional micro lamports for all transactions
|
|
|
|
PRIORITY_QUEUE_LIMIT // force PRIORITY_CU_PRICE for transactions when events exceed this value
|
|
|
|
PRIORITY_CU_PRICE // additional micro lamports for BUMP_MARKETS & PRIORITY_QUEUE_LIMIT
|
2023-01-31 16:10:39 -08:00
|
|
|
```
|
|
|
|
|
2023-01-31 16:05:10 -08:00
|
|
|
#### TODO:
|
|
|
|
|
|
|
|
- Dynamic priority fee using getRecentPrioritizationFees
|
|
|
|
- Dynamic frequency based on queue length
|