Skip to content

Commit

Permalink
Update network.js
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsmithies committed Jan 18, 2022
1 parent cc393fd commit 1cab825
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions app/hashgraph/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,16 @@ const networkForEnvironment = {
let hederaNetworkClient = null

const getNodeNetworkClient = () => {

const network = networkForEnvironment[Config.network]

if (!network || !network.nodes) {
throw `Network from environment ${Config.network} could not match for any hedera network. Change your "HEDERA_NETWORK" environment variable to either: "testnet", "previewnet" or "mainnet"`
}

if (hederaNetworkClient === null) {
hederaNetworkClient = new Client({ network: network.nodes.network }).setOperator(
Config.accountId,
Config.privateKey
)
hederaNetworkClient = new Client({
network: network.nodes.network
}).setOperator(Config.accountId, Config.privateKey)
}

return hederaNetworkClient
Expand Down

0 comments on commit 1cab825

Please sign in to comment.