diff --git a/Platform/Client/githubServer.js b/Platform/Client/githubServer.js index ea8569e6d..32debc9da 100644 --- a/Platform/Client/githubServer.js +++ b/Platform/Client/githubServer.js @@ -75,7 +75,7 @@ exports.newGithubServer = function newGithubServer() { async function doGithub() { - const { Octokit } = require("@octokit/rest") + const { Octokit } = SA.nodeModules.octokit const octokit = new Octokit({ auth: token, @@ -204,7 +204,7 @@ exports.newGithubServer = function newGithubServer() { try { const repo = repository const owner = 'Superalgos' - const { Octokit } = require("@octokit/rest") + const { Octokit } = SA.nodeModules.octokit const octokit = new Octokit({ auth: token, userAgent: 'Superalgos Beta 11' diff --git a/Platform/Client/web3Server.js b/Platform/Client/web3Server.js index 48745b979..c1cf61683 100644 --- a/Platform/Client/web3Server.js +++ b/Platform/Client/web3Server.js @@ -15,7 +15,7 @@ exports.newWeb3Server = function newWeb3Server() { run: run } - const Web3 = require('web3'); + const Web3 = SA.nodeModules.web3 let web3Map = new Map() return thisObject @@ -241,7 +241,7 @@ exports.newWeb3Server = function newWeb3Server() { async function mnemonicToPrivateKey(mnemonic) { try { - const ethers = require('ethers') + const ethers = SA.nodeModules.ethers let wallet = ethers.Wallet.fromMnemonic(mnemonic) if (wallet.privateKey !== undefined) { @@ -288,14 +288,14 @@ exports.newWeb3Server = function newWeb3Server() { console.log('---------------------------------------------------------------------------------------------------------------------------------------------------') console.log('') - const Tx = require('ethereumjs-tx').Transaction; + const Tx = SA.nodeModules.ethereumjsTx.Transaction; const web3 = new Web3(new Web3.providers.HttpProvider('https://bsc-dataseed.binance.org/')) const amount = web3.utils.toHex(tokenAmount) privateKey = privateKey.replace('0x', '') const privateKeyBuffer = Buffer.from(privateKey, 'hex') const contractAbiObject = JSON.parse(contractAbi) const contract = new web3.eth.Contract(contractAbiObject, contractAddress, { from: fromAddress }) - const Common = require('ethereumjs-common').default + const Common = SA.nodeModules.ethereumjsCommon.default const BSC_FORK = Common.forCustomChain( 'mainnet', { diff --git a/Platform/Client/webSocketsInterface.js b/Platform/Client/webSocketsInterface.js index aaabd15d2..1e2f39c23 100644 --- a/Platform/Client/webSocketsInterface.js +++ b/Platform/Client/webSocketsInterface.js @@ -7,7 +7,7 @@ finalize: finalize } - const WEB_SOCKET = require('ws') + const WEB_SOCKET = SA.nodeModules.ws let socketServer let port = global.env.CLIENT_WEB_SOCKETS_INTERFACE_PORT diff --git a/PlatformRoot.js b/PlatformRoot.js index 75fe87c15..3e3e06cf8 100644 --- a/PlatformRoot.js +++ b/PlatformRoot.js @@ -35,6 +35,10 @@ Setting up external dependencies. */ SA.nodeModules = { fs: require('fs'), + web3: require('web3'), + ethers: require('ethers'), + ethereumjsTx: require('ethereumjs-tx'), + ethereumjsCommon: require('ethereumjs-common'), nodeFetch: require('node-fetch'), open: require('open'), http: require('http'),