freeCodeCamp / near-curriculum

BSD 3-Clause "New" or "Revised" License
26 stars 12 forks source link

[review]: learn-near-accounts-by-creating-a-named-testnet-account #45

Open ShaunSHamilton opened 1 year ago

ShaunSHamilton commented 1 year ago

Overview

I enjoyed the course 🙂 Nice one getting this out 🚀 . It is a lot of commands to learn and understand the implications of.

So, I do suggest adding a **Summary** to the final lesson with a step-by-step of commands.

Lessons

1. Typo

- ...you need, run...
+ ...you need. Run...

4. Need to add near-cli to .gitpod.Dockerfile 7. Typo

- ...locally that allow...
+ ...locally which allow...

10. Do you want me to create an <account>.json file (description)? Or, a an <account>.testnet.json file? 11. Unfinished last sentence? 26. Test permission error:

image

33. First sentence seems very unrelated. 39. Test permission error

image

placeholder: reached lesson 70

71. Possibly the container's fault when restarting

Error ```bash gitpod /workspace/near-curriculum (next) $ near keys wg.fcctom.testnet Keys for account wg.fcctom.testnet [ { access_key: { nonce: 124493139000004, permission: 'FullAccess' }, public_key: 'ed25519:3aK7xX7vCKz7FDujBVDF3tQEPT82Bmd6Fefm6TxMFzq5' }, { access_key: { nonce: 124493376000000, permission: { FunctionCall: { allowance: null, method_names: [], receiver_id: 'wg.fcctom.testnet' } } }, public_key: 'ed25519:3uAaoPFaPnFRNEvuXy3bRSPVES9hgXdquc9SSgbb6opy' } ] gitpod /workspace/near-curriculum (next) $ near delete-key wg.fcctom.testnet "ed25519:3aK7xX7vCKz7FDujBVDF3tQEPT82Bmd6Fefm6TxMFzq5" Unable to find [ testnet ] credentials for [ wg.fcctom.testnet ]... Key ed25519:3aK7xX7vCKz7FDujBVDF3tQEPT82Bmd6Fefm6TxMFzq5 is a Full Access key. Make sure it's not your recovery method. Do you want to proceed? (y/n) y Key ed25519:3aK7xX7vCKz7FDujBVDF3tQEPT82Bmd6Fefm6TxMFzq5 is the last Full Access key on your account. In case of deleting you will not be able to restore access to the account wg.fcctom.testnet. Do you want to proceed? (y/n) y Deleting key ed25519:3aK7xX7vCKz7FDujBVDF3tQEPT82Bmd6Fefm6TxMFzq5 on wg.fcctom.testnet. An error occured Error: Can not sign transactions for account wg.fcctom.testnet on network testnet, no matching key pair found in InMemorySigner(MergeKeyStore(UnencryptedFileSystemKeyStore(/home/gitpod/.near-credentials), UnencryptedFileSystemKeyStore(/workspace/near-curriculum/neardev))). at Account.signTransaction (/home/gitpod/.nvm/versions/node/v18.9.0/lib/node_modules/near-cli/node_modules/near-api-js/lib/account.js:93:19) at async /home/gitpod/.nvm/versions/node/v18.9.0/lib/node_modules/near-cli/node_modules/near-api-js/lib/account.js:118:34 at async Object.exponentialBackoff [as default] (/home/gitpod/.nvm/versions/node/v18.9.0/lib/node_modules/near-cli/node_modules/near-api-js/lib/utils/exponential-backoff.js:7:24) at async Account.signAndSendTransactionV2 (/home/gitpod/.nvm/versions/node/v18.9.0/lib/node_modules/near-cli/node_modules/near-api-js/lib/account.js:117:24) at async deleteAccessKey (/home/gitpod/.nvm/versions/node/v18.9.0/lib/node_modules/near-cli/commands/delete-key.js:26:24) at async Object.handler (/home/gitpod/.nvm/versions/node/v18.9.0/lib/node_modules/near-cli/utils/exit-on-error.js:52:9) TypedError: Can not sign transactions for account wg.fcctom.testnet on network testnet, no matching key pair found in InMemorySigner(MergeKeyStore(UnencryptedFileSystemKeyStore(/home/gitpod/.near-credentials), UnencryptedFileSystemKeyStore(/workspace/near-curriculum/neardev))). at Account.signTransaction (/home/gitpod/.nvm/versions/node/v18.9.0/lib/node_modules/near-cli/node_modules/near-api-js/lib/account.js:93:19) at async /home/gitpod/.nvm/versions/node/v18.9.0/lib/node_modules/near-cli/node_modules/near-api-js/lib/account.js:118:34 at async Object.exponentialBackoff [as default] (/home/gitpod/.nvm/versions/node/v18.9.0/lib/node_modules/near-cli/node_modules/near-api-js/lib/utils/exponential-backoff.js:7:24) at async Account.signAndSendTransactionV2 (/home/gitpod/.nvm/versions/node/v18.9.0/lib/node_modules/near-cli/node_modules/near-api-js/lib/account.js:117:24) at async deleteAccessKey (/home/gitpod/.nvm/versions/node/v18.9.0/lib/node_modules/near-cli/commands/delete-key.js:26:24) at async Object.handler (/home/gitpod/.nvm/versions/node/v18.9.0/lib/node_modules/near-cli/utils/exit-on-error.js:52:9) { type: 'KeyNotFound', context: undefined } ````

72. Test update to find config:

const userFile = fs.readFileSync(
  join(process.env.HOME, `.near-credentials/testnet/${file}`),
  'utf-8'
);
const userCreds = JSON.parse(userFile);

77. Is this because you (we) will need them for the next project(s)?

Make sure you have the seed for your main account saved somewhere and, when you are done, enter done in the terminal.

moT01 commented 1 year ago

Thanks for taking a look @ShaunSHamilton 👍

Did you run it in gitpod? and what does placeholder: reached lesson 70 mean? Did you just stop, or did the course get stuck or something?

ShaunSHamilton commented 1 year ago

Yes, I ran this in Gitpod. Yes, I had to stop for the day, so I will need to finish the review later.

ShaunSHamilton commented 1 year ago

As we discussed, it appears all those permission/access errors are just related to https://github.com/freeCodeCamp/freeCodeCampOS/issues/239.

It would be nice if you could change the tests to allow for the Gitpod setup to work. But, there is still the fact that Gitpod needs to be configured to store the .near-credentials folder in the correct place to not be deleted when the container is restarted.