added dotenv to automate reading .env file, updated readme

This commit is contained in:
Drew Aquino 2021-07-22 08:52:16 -07:00 committed by Maximilian Schneider
parent 266f1e15be
commit 727caaf3b4
7 changed files with 30 additions and 10 deletions

3
.gitignore vendored
View File

@ -1,2 +1,5 @@
dist
node_modules
.env
.DS_Store

View File

@ -11,14 +11,19 @@ To run the liquidator you will need:
### Setup
Make sure to edit the .env file to look something like this:
```
export CLUSTER="mainnet-beta"
export CLUSTER_URL="https://solana-api.projectserum.com"
export KEYPAIR=~/.config/solana/id.json
export NODE_ENV=production
export TARGETS="0.1 2.0 100.0 500.0"
export GROUP_NAME="BTC_ETH_SOL_SRM_USDT"
export CHECK_INTERVAL="1000.0"
export FILTER_ACCOUNTS=true
CLUSTER="mainnet-beta"
CLUSTER_URL="https://solana-api.projectserum.com"
KEYPAIR=${HOME}/.config/solana/id.json
NODE_ENV=production
TARGETS="0.1 2.0 100.0 500.0"
GROUP_NAME="BTC_ETH_SOL_SRM_USDC"
CHECK_INTERVAL="1000.0"
FILTER_ACCOUNTS=true
```
Replace `${HOME}` with your actual path to home. For example,
```
KEYPAIR=/Users/john/.config/solana/id.json
```
TARGETS represents the amounts of each token the partial liquidator should try to maintain

View File

@ -23,6 +23,7 @@
"@typescript-eslint/parser": "^4.6.0",
"babel-eslint": "^10.0.3",
"cross-env": "^7.0.2",
"dotenv": "^10.0.0",
"eslint": "^7.6.0",
"eslint-config-prettier": "^6.11.0",
"jest": "^26.4.0",

View File

@ -1,3 +1,5 @@
import * as Env from 'dotenv';
Env.config();
import { IDS, MangoClient, MarginAccount, NUM_MARKETS } from '@blockworks-foundation/mango-client';
import { Account, Connection, PublicKey } from '@solana/web3.js';

View File

@ -1,3 +1,5 @@
import * as Env from 'dotenv';
Env.config();
import {
findLargestTokenAccountForOwner,
getMultipleAccounts,

View File

@ -1,3 +1,5 @@
import * as Env from 'dotenv';
Env.config();
import {
findLargestTokenAccountForOwner,
getMultipleAccounts,

View File

@ -1246,9 +1246,9 @@ boolbase@~1.0.0:
resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e"
integrity sha1-aN/1++YMUes3cl6p4+0xDcwed24=
"borsh@git+https://github.com/defactojob/borsh-js.git#field-mapper":
"borsh@https://github.com/defactojob/borsh-js#field-mapper":
version "0.3.1"
resolved "git+https://github.com/defactojob/borsh-js.git#33a0d24af281112c0a48efb3fa503f3212443de9"
resolved "https://github.com/defactojob/borsh-js#33a0d24af281112c0a48efb3fa503f3212443de9"
dependencies:
"@types/bn.js" "^4.11.5"
bn.js "^5.0.0"
@ -1853,6 +1853,11 @@ dotenv@8.2.0:
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.2.0.tgz#97e619259ada750eea3e4ea3e26bceea5424b16a"
integrity sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==
dotenv@^10.0.0:
version "10.0.0"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-10.0.0.tgz#3d4227b8fb95f81096cdd2b66653fb2c7085ba81"
integrity sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==
ecc-jsbn@~0.1.1:
version "0.1.2"
resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9"