Error message for undefined node directly includes network name #1058
+2
−8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
- 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 node45Loaded 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 node1Loaded 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'
}