Adds an option to provide an alternate markets.json file. (#11)

This commit is contained in:
Brian Long 2023-02-13 07:24:25 -06:00 committed by GitHub
parent c275c7f9f6
commit 20122bcc6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -39,6 +39,12 @@ to run in the background, pass "-d" or "--daemon"
// every market.
INTERVAL // Sleep interval, in ms, between each loop. Default is
// 1000 ms
MARKETS_FILE // Specify the full path to an alternate markets.json
// file. Default is '../markets.json'. This option will
// let you run multiple instances with different
// settings for the markets. e.g. bump with "high fees"
// or "medium fees" or other markets not included in the
// default markets.json file.
MAX_TX_INSTRUCTIONS // Max number of instructions for each transaction.
// Default is 1.
MAX_UNIQUE_ACCOUNTS // Max number of unique accounts to process in each

View File

@ -3,7 +3,6 @@
*/
import * as os from 'os';
import * as fs from 'fs';
import markets from '../markets.json';
import {
Keypair,
Commitment,
@ -43,8 +42,13 @@ const {
MAX_TX_INSTRUCTIONS, // max instructions per transaction
CU_PRICE, // extra microlamports per cu for any transaction
PRIORITY_MARKETS, // input to add comma seperated list of markets that force fee bump
MARKETS_FILE // Specify the full path to an alternate markets.json file.
} = process.env;
// Read the alternate markets file if provided
const marketsFile = MARKETS_FILE || '../markets.json';
const markets = require(marketsFile);
const cluster = CLUSTER || 'mainnet';
const interval = INTERVAL || 1000;
const maxUniqueAccounts = parseInt(MAX_UNIQUE_ACCOUNTS || '10');