NEAR-Edu / near-certification-tools

2 stars 2 forks source link

Use official near-api-js instead of Walsh's fork #29

Open ryancwalsh opened 2 years ago

ryancwalsh commented 2 years ago

Related to https://github.com/NEAR-Edu/near-certification-tools/issues/18 but could potentially be completed sooner.

Daryl Collins has a helpful message at https://github.com/near/near-api-js/pull/748#issuecomment-993941118 and then also later pointed me to https://stackoverflow.com/questions/66952972/cannot-add-web3-to-react-project which is probably relevant.

ryancwalsh commented 2 years ago

@norrec99 @ozanisgor This issue seems like something you could figure out. Currently package.json uses a fork of near-api-js, which is bad.

Create a branch and uninstall that fork, then reinstall near-api-js.

Then explore how to solve the problem that the fork was solving but without using that fork.

norrec99 commented 2 years ago

@ryancwalsh

Create a branch and uninstall that fork, then reinstall near-api-js.

After I did this step, here is my update:

I couldn't figure out this error: ReferenceError: window is not defined I read this issue https://github.com/near/near-api-js/pull/748#issuecomment-993941118 and they talk about this error but I couldn't understand how to fix it.

Also, can't say that I fully understand what is happening here but I spotted something about this const keyStore = new BrowserLocalStorageKeyStore();

Because, we also get an error about this ☝️ as you can see in this image image

I try to look into details of BrowserLocalStorageKeyStore()

Both in NEAR docs https://docs.near.org/docs/api/naj-quick-reference#key-store and NEAR Repo https://github.com/near/near-api-js/search?q=BrowserLocalStorageKeyStore they use it like const keyStore = new keyStores.BrowserLocalStorageKeyStore();

And I change our code with this ☝️ Unfortunately got the same error.

If you can give more details about this issue I can continue working on this.

ryancwalsh commented 2 years ago

@norrec99 Are you sure nothing from that StackOverflow link (or elsewhere on SO or the rest of the web) helped?