symbol eth payment checked
This commit is contained in:
32
src/app.js
Normal file
32
src/app.js
Normal file
@@ -0,0 +1,32 @@
|
||||
const fs = require("fs")
|
||||
|
||||
function loadConfig() {
|
||||
const configPath = "./config.json";
|
||||
if (!fs.existsSync(configPath)) {
|
||||
throw new Error("Configuration file not found: " + configPath);
|
||||
}
|
||||
const configContent = fs.readFileSync(configPath, "utf-8");
|
||||
if (!configContent) {
|
||||
throw new Error("Configuration file is empty: " + configPath);
|
||||
}
|
||||
try {
|
||||
return JSON.parse(configContent);
|
||||
} catch (error) {
|
||||
throw new Error("Error parsing configuration file: " + error.message);
|
||||
}
|
||||
}
|
||||
|
||||
class App {
|
||||
constructor(){
|
||||
const config = loadConfig();
|
||||
this.ethNodeUrl = config.nodesUrl.ETH
|
||||
const usdterc20_abi = JSON.parse(fs.readFileSync(config.abiPath.usdt_erc20_abi, "utf-8"));
|
||||
const usdcerc20_abi = JSON.parse(fs.readFileSync(config.abiPath.usdc_erc20_abi, "utf-8"));
|
||||
const usdttrc20_abi = JSON.parse(fs.readFileSync(config.abiPath.usdt_trc20_abi, "utf-8"));
|
||||
this.abis = {usdcerc20_abi, usdterc20_abi, usdttrc20_abi};
|
||||
}
|
||||
}
|
||||
|
||||
const app = new App();
|
||||
|
||||
module.exports = app;
|
||||
Reference in New Issue
Block a user