market icon indicating copy to clipboard operation
market copied to clipboard

allow price calculation when users are on unsupported network / not connected

Open EnzoVezzaro opened this issue 2 years ago • 12 comments

Fixes comment.

Continuing discussion from comment

Changes proposed in this PR:

  • block users from selection when on unsupported asset

EnzoVezzaro avatar Jun 06 '22 14:06 EnzoVezzaro

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
market ✅ Ready (Inspect) Visit Preview Nov 14, 2022 at 4:21PM (UTC)
1 Ignored Deployment
Name Status Preview Updated
market-v3 ⬜️ Ignored (Inspect) Nov 14, 2022 at 4:21PM (UTC)

vercel[bot] avatar Jun 06 '22 14:06 vercel[bot]

but why? We should be able to show a price for any asset, no matter if user is connected with wallet or not. This here simply circumvents actually fixing the reason the app crashes

kremalicious avatar Jun 14 '22 12:06 kremalicious

If network not supported just treat it as if the user is not connected at all.

mihaisc avatar Jun 14 '22 16:06 mihaisc

if the user is not connected at all.

there's actually another issue on that. Right now, if you're not connected it doesn't calculate the price. I'll take at look at it.

https://user-images.githubusercontent.com/13741335/173661943-9679770e-46b8-4c25-abf9-0aa1a03ac8fd.mp4

EnzoVezzaro avatar Jun 14 '22 18:06 EnzoVezzaro

that is not an issue, you don't have an infura id in .env

mihaisc avatar Jun 14 '22 20:06 mihaisc

that is not an issue, you don't have an infura id in .env

Mmmm... I do have this NEXT_PUBLIC_INFURA_PROJECT_ID on my .env file. I'll check again to see if it's still valid.

EnzoVezzaro avatar Jun 15 '22 10:06 EnzoVezzaro

sorry, i just saw that we are on c2d branch , might be a bug , my bad.

mihaisc avatar Jun 15 '22 11:06 mihaisc

sorry, i just saw that we are on c2d branch , might be a bug , my bad.

No worries 😊 Yes, it's not really a bug per se', it's actually missing the logic for users not connected 😅. I'm working on it right now. Once I have in place the dummyWeb3 and changed a couple of lines, we should be good to go.

EnzoVezzaro avatar Jun 15 '22 11:06 EnzoVezzaro

please update PR titles as the scope of a PR changes. I only see that this PR is supposed to block price calculation on unsupported networks, but the latest code changes seem to do the opposite. So PR title needs to be updated

kremalicious avatar Jun 21 '22 13:06 kremalicious

I just ran into this when testing compute. Super confusing with no wallet connected, as simply nothing happens in the UI when I click on an algo

kremalicious avatar Jun 22 '22 11:06 kremalicious

When doing this without a wallet we should use the internal math, not do contract calls. It's faster and we don't waste rpc calls.

mihaisc avatar Jun 22 '22 12:06 mihaisc

please merge main

mihaisc avatar Sep 27 '22 14:09 mihaisc

Deploy Preview for market-oceanprotocol ready!

Name Link
Latest commit 3ad213c4443b314a00828163ee87eb854bd254f2
Latest deploy log https://app.netlify.com/sites/market-oceanprotocol/deploys/6340099507b2ac0008b64647
Deploy Preview https://deploy-preview-1487--market-oceanprotocol.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

netlify[bot] avatar Oct 07 '22 11:10 netlify[bot]

it seems to not work as expected

alt text

mihaisc avatar Oct 11 '22 06:10 mihaisc

Just go to url , connected on goerli it work it seems to not work as expected alt text i swith network to kovan, refresh page, select random algo , the price is stuck in loop alt text console: alt text

mihaisc avatar Oct 14 '22 10:10 mihaisc

I'm also able to reproduce the issue @mihaisc is facing, tested on both preview and locally. I'm also having issues when connected to networks like Energy Web Chain or BSC, getting errors and price is not calculated, works smoothly when no wallet connected tho. I think the market should behave like that in all scenarios:

  • no wallet connected
  • connected to another network than the asset but supported by market
  • or being connected to an unsupported network

bogdanfazakas avatar Oct 17 '22 15:10 bogdanfazakas

price tooltip seems broken when no wallet is connected. It seems that the dataset price is always 0 Screenshot 2022-10-19 at 14 59 29 Screenshot 2022-10-19 at 15 17 13

bogdanfazakas avatar Oct 19 '22 12:10 bogdanfazakas

UPDATE: fixed total calculation also as it's wrong too. I see also that it has been fixed in #1715

EnzoVezzaro avatar Oct 19 '22 13:10 EnzoVezzaro

tested the various scenarios on this asset from Mumbai: did:op:85d859a9a5e307b4ca001dc81ea35d9acc9fc4b4e8d2d223f1cefaab15282eb4 works as expected in the following scenario:

  • no wallet connected
  • wallet connected to an unsupported network
  • wallet connected to asset network (Mumbai in this case)
  • wallet connected to Goerli network

fails with the out of gas issue:

  • when connected to other supported networks rather than the assets network or Goerli (Eth main, polygon, EWC, BSC, Moonbase, etc)

https://user-images.githubusercontent.com/13447142/196925215-77766d68-d169-424a-b96b-b27c088e4896.mov

bogdanfazakas avatar Oct 20 '22 10:10 bogdanfazakas

The issue mentioned above still persists on my end when connected to the mentioned networks Screenshot 2022-10-25 at 10 58 07

bogdanfazakas avatar Oct 25 '22 07:10 bogdanfazakas

This needs a rebase, and there are also some conflicts that popped up after the merge of the compute fixes PR that need to be taken care off

bogdanfazakas avatar Nov 03 '22 14:11 bogdanfazakas

This needs a rebase, and there are also some conflicts that popped up after the merge of the compute fixes PR that need to be taken care off

ready for review 👍🏽

EnzoVezzaro avatar Nov 04 '22 11:11 EnzoVezzaro

This needs a rebase, and there are also some conflicts that popped up after the merge of the compute fixes PR that need to be taken care off

ready for review 👍🏽

think new conflicts appeared, we should fix them and merge this 😃

bogdanfazakas avatar Nov 08 '22 05:11 bogdanfazakas

Code Climate has analyzed commit 072d3469 and detected 4 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 3
Duplication 1

The test coverage on the diff in this pull request is 30.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 21.4% (0.0% change).

View more on Code Climate.

codeclimate[bot] avatar Nov 14 '22 16:11 codeclimate[bot]