Skip to content

Commit

Permalink
Merge pull request #65 from marcelooblan2016/hotfix/network_sendto_up…
Browse files Browse the repository at this point in the history
…date

update: default rpc & will be based on env
  • Loading branch information
marcelooblan2016 authored Aug 14, 2022
2 parents 62f2a8c + d8e2f2c commit 31ca2a6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 18 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ APP_NAME=
#################
# Network Used for transaction
PREFERRED_NETWORK="matic-mainnet"
NETWORK_RPC_URL="https://polygon-rpc.com"
##################
# BROWSER CONFIG #
##################
Expand Down
24 changes: 11 additions & 13 deletions dist/constants.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
"use strict";
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
const envMigrations = require("./Records/Migrations/env");
const config = (() => {
let fs = require('fs');
try {
let envFilePath = './.env';
console.log("Env File: Loading...");
if (!fs.existsSync(envFilePath)) {
fs.appendFileSync(envFilePath, envMigrations.default.join("\n"));
}
console.log("Env File: Loaded.");
let rawData = fs.readFileSync(envFilePath, 'utf8');
let envValues = {};
let data = rawData.split("\n")
Expand Down Expand Up @@ -47,16 +45,16 @@ module.exports = {
"slug": "matic-mainnet",
"name": "Matic Mainnet",
"new": true,
"rpc_url": "https://poly-rpc.gateway.pokt.network",
"rpc_url": (_e = config.NETWORK_RPC_URL) !== null && _e !== void 0 ? _e : "https://polygon-rpc.com",
"chain_id": 137,
"currency_symbol": "MATIC",
"block_explorer_url": "https://polygonscan.com/"
}
],
trading: {
options: {
sell_cutloss: parseInt((_e = config.SELL_CUTLOSS) !== null && _e !== void 0 ? _e : -10),
sell_profit: parseInt((_f = config.SELL_PROFIT) !== null && _f !== void 0 ? _f : 5)
sell_cutloss: parseInt((_f = config.SELL_CUTLOSS) !== null && _f !== void 0 ? _f : -10),
sell_profit: parseInt((_g = config.SELL_PROFIT) !== null && _g !== void 0 ? _g : 5)
}
},
elements: {
Expand Down Expand Up @@ -124,8 +122,8 @@ module.exports = {
}
},
mailer: {
host: (_g = config.MAIL_HOST) !== null && _g !== void 0 ? _g : null,
port: (_h = config.MAIL_PORT) !== null && _h !== void 0 ? _h : null,
host: (_h = config.MAIL_HOST) !== null && _h !== void 0 ? _h : null,
port: (_j = config.MAIL_PORT) !== null && _j !== void 0 ? _j : null,
secure: (function () {
var _a;
let mailPort = (_a = config.MAIL_PORT) !== null && _a !== void 0 ? _a : null;
Expand All @@ -135,13 +133,13 @@ module.exports = {
return false;
})(),
auth: {
user: (_j = config.MAIL_USERNAME) !== null && _j !== void 0 ? _j : null,
pass: (_k = config.MAIL_PASSWORD) !== null && _k !== void 0 ? _k : null
user: (_k = config.MAIL_USERNAME) !== null && _k !== void 0 ? _k : null,
pass: (_l = config.MAIL_PASSWORD) !== null && _l !== void 0 ? _l : null
},
to: (_l = config.MAIL_TO) !== null && _l !== void 0 ? _l : null,
from: (_m = config.MAIL_FROM) !== null && _m !== void 0 ? _m : null
to: (_m = config.MAIL_TO) !== null && _m !== void 0 ? _m : null,
from: (_o = config.MAIL_FROM) !== null && _o !== void 0 ? _o : null
},
slack: {
webhook_url: (_o = config.WEBHOOK_URL) !== null && _o !== void 0 ? _o : null
webhook_url: (_p = config.WEBHOOK_URL) !== null && _p !== void 0 ? _p : null
}
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "crypto-bot-trader",
"description": "swapping of ERC-20 Tokens (buy/sell) based on the market health with bot strategy (condition) - by utilizing metamask & pupeteer",
"version": "2.4.2",
"version": "2.4.3",
"main": "./dist/index.js",
"repository": {
"type": "git",
Expand Down
5 changes: 1 addition & 4 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@ const config = (() => {
let fs = require('fs');
try {
let envFilePath = './.env';
console.log("Env File: Loading...");

if (!fs.existsSync(envFilePath)) {
fs.appendFileSync(envFilePath, envMigrations.default.join("\n"));
}

console.log("Env File: Loaded.");

let rawData = fs.readFileSync(envFilePath, 'utf8');
let envValues = {};
let data = rawData.split("\n")
Expand Down Expand Up @@ -53,7 +50,7 @@ module.exports = {
"slug": "matic-mainnet",
"name": "Matic Mainnet",
"new": true,
"rpc_url": "https://poly-rpc.gateway.pokt.network",
"rpc_url": config.NETWORK_RPC_URL ?? "https://polygon-rpc.com",
"chain_id": 137,
"currency_symbol": "MATIC",
"block_explorer_url": "https://polygonscan.com/"
Expand Down

0 comments on commit 31ca2a6

Please sign in to comment.