Previously, I was a a new user to near-cli and was not sure if I was passing the network name correctly.
Upon inspecting, it seems the existing error message does a redundant helperAccount to networkName matching for only a subset of networks.
Solution
Update to directly use the network configurations that was set.
Also, updated network name from local to localnet as that's what's written on our documentations.
Tests
Nonexistent network
soonnear@Chees-MacBook-Pro nearup % NEAR_ENV=localnet2 near state node45
/Users/soonnear/Github/modified-near/near-cli/config.js:85
throw Error(Unconfigured environment '${env}'. Can be configured in src/config.js.);
^
Error: Unconfigured environment 'localnet2'. Can be configured in src/config.js.
at getConfig (/Users/soonnear/Github/modified-near/near-cli/config.js:85:15)
at getConfig (/Users/soonnear/Github/modified-near/near-cli/get-config.js:14:54)
at Object. (/Users/soonnear/Github/modified-near/near-cli/utils/inspect-response.js:2:40)
at Module._compile (node:internal/modules/cjs/loader:1275:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
at Module.load (node:internal/modules/cjs/loader:1133:32)
at Module._load (node:internal/modules/cjs/loader:972:12)
at Module.require (node:internal/modules/cjs/loader:1157:19)
at require (node:internal/modules/helpers:119:18)
at object. (/users/soonnear/github/modified-near/near-cli/index.js:16:25)
node.js v19.8.1
Nonexistent node
soonnear@Chees-MacBook-Pro nearup % NEAR_ENV=localnet near state node45
Loaded master account test.near key from /Users/soonnear/.near/validator_key.json with public key = redacted Account node45 is not found in localnet
Proer usage
soonnear@Chees-MacBook-Pro nearup % NEAR_ENV=localnet near state node1
Problem
Solution
Tests
Nonexistent network
soonnear@Chees-MacBook-Pro nearup % NEAR_ENV=localnet2 near state node45
/Users/soonnear/Github/modified-near/near-cli/config.js:85 throw Error(
Unconfigured environment '${env}'. Can be configured in src/config.js.
); ^Error: Unconfigured environment 'localnet2'. Can be configured in src/config.js. at getConfig (/Users/soonnear/Github/modified-near/near-cli/config.js:85:15) at getConfig (/Users/soonnear/Github/modified-near/near-cli/get-config.js:14:54) at Object. (/Users/soonnear/Github/modified-near/near-cli/utils/inspect-response.js:2:40)
at Module._compile (node:internal/modules/cjs/loader:1275:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
at Module.load (node:internal/modules/cjs/loader:1133:32)
at Module._load (node:internal/modules/cjs/loader:972:12)
at Module.require (node:internal/modules/cjs/loader:1157:19)
at require (node:internal/modules/helpers:119:18)
at object. (/users/soonnear/github/modified-near/near-cli/index.js:16:25)
node.js v19.8.1
Nonexistent node
soonnear@Chees-MacBook-Pro nearup % NEAR_ENV=localnet near state node45
Loaded master account test.near key from /Users/soonnear/.near/validator_key.json with public key = redacted Account node45 is not found in localnet
Proer usage
soonnear@Chees-MacBook-Pro nearup % NEAR_ENV=localnet near state node1
Loaded master account test.near key from /Users/soonnear/.near/validator_key.json with public key = redacted Account node1 { amount: '950000000000000000000000000000000', block_hash: '46Vc4CVx7giRpEKSQL3ywrr7dFe1vrZTzwBnPMXYY9as', block_height: 0, code_hash: '11111111111111111111111111111111', locked: '50000000000000000000000000000000', storage_paid_at: 0, storage_usage: 182, formattedAmount: '950,000,000' }