Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrapping matic for payment #77

Merged
merged 31 commits into from
Oct 17, 2023
Merged

Wrapping matic for payment #77

merged 31 commits into from
Oct 17, 2023

Conversation

jamiehewitt15
Copy link
Member

@jamiehewitt15 jamiehewitt15 commented Oct 4, 2023

Fixes #58

Steps for testing:

  1. Go to the preview link
  2. make sure that you have Matic in your wallet but no Wrapped Matic.
  3. connect your wallet and check that you are on polygon mainnet.
  4. Choose a file to upload.
  5. Request a quote
  6. Wrap your matic
  7. Upload the file
  8. Request the DDO link
  9. Go to arweave.net/{TRANSACTION_ID} to check that the upload worked

@vercel
Copy link

vercel bot commented Oct 4, 2023

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

Name Status Preview Comments Updated (UTC)
dbs-ui-lib ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 12, 2023 8:38pm

@jamiehewitt15
Copy link
Member Author

right now we still say "MATIC" on the title of the token in polygon, but this needs to change to "WMATIC" as for contract ("0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270")

That's been done on the Arweave microservice, I'll ask Marian to deploy it.

can we add mumbai on this PR to avoid having to spend MATIC on testing?

Yeah, I've added the contract Address for WMATIC on mumbai

@EnzoVezzaro
Copy link
Contributor

I don't know 🥲 I need a little more time to review this PR. I feel like we're not explaining well what's happening. For me, it's a bit confusing why I need to convert all the time to have the upload going. For example:

Screenshot 2023-10-06 at 11 48 53 AM

here I have MATIC and WMATIC, but still I need to swap to finish the upload.

@jamiehewitt15
Copy link
Member Author

Can you check the console for the log of your balance?

console.log('Check if user has wrapped matic in their wallet')
console.log('balanceData', balanceData)

@jamiehewitt15
Copy link
Member Author

I tried to recreate that error with the following steps:

  1. request quote
  2. wrap matic
  3. refresh page
  4. Request quote again (but this time I have wrapped matic in my wallet)
  5. This time, the "upload" button is shown directly bypassing the "Wrap Matic" step

(See video below)

https://www.loom.com/share/d60be29c09cc4468bf34c00b4b6e6396

What network are you testing on?

@EnzoVezzaro
Copy link
Contributor

I'm testing on mumbai, I'm still having the same issue. On the console I see undefined on the balance:

Screenshot 2023-10-06 at 2 12 19 PM

@EnzoVezzaro
Copy link
Contributor

Also when you reject the transaction, the upload button kind of reset but it gets stuck.

https://www.loom.com/share/6363da9cee06418d8f55a69d1ed602cd?sid=9dcc7611-cbe8-4dac-af53-d0623f9dc4af

if you reject the "wrap matic" transaction, the app breaks.

Screenshot 2023-10-06 at 3 48 35 PM

On mumbai I get this error:

Screenshot 2023-10-06 at 3 46 14 PM

@EnzoVezzaro
Copy link
Contributor

probably this is due to mumbai.

I have enough MATIC and WMATIC for the transaction, but I still see the "WRAP MATIC" button. I should see the "Upload" button directly.

Screenshot 2023-10-09 at 2 45 51 PM

I'm investigating the cause.

Screenshot 2023-10-09 at 2 45 34 PM

@jamiehewitt15
Copy link
Member Author

The issue in the screenshot you shared above is that the contract call is made to the wrong WMATIC address for Mumbai. It should be fixed in the latest changes, could you test again?

@EnzoVezzaro
Copy link
Contributor

i keep getting the following error on upload:
"Error uploading to IPFS: Error processing the uploaded files: File() got unexpected keyword arguments: 'content_type'"

@jamiehewitt15
Copy link
Member Author

i keep getting the following error on upload: "Error uploading to IPFS: Error processing the uploaded files: File() got unexpected keyword arguments: 'content_type'"

Yeah true, not good timing. I broke something on the backend which I'm fixing separately to this. I'll let you know when it works again

@jamiehewitt15
Copy link
Member Author

@EnzoVezzaro the backend issues are fixed now. Can you test again?

@EnzoVezzaro
Copy link
Contributor

EnzoVezzaro commented Oct 12, 2023

I found a couple of issues (testing local - polygon and mumbai):

  1. if you connect to polygon and then change to polygon mumbai, the app crashes
Screenshot 2023-10-12 at 12 09 38 PM
  1. I still see "WRAP MATIC" even if I have enought WMATIC on my wallet
Screenshot 2023-10-12 at 12 10 09 PM
  1. If you click "WRAP MATIC" and then you reject the tx, the app crashes
Screenshot 2023-10-12 at 12 10 24 PM

@EnzoVezzaro
Copy link
Contributor

EnzoVezzaro commented Oct 12, 2023

Hi @jamiehewitt15 I made some changes to this PR to solve some of the issues I commented.
I fixed some minor thing I found, and also worked on the issues I found.

Can you please just take a look at ALL of the SWAP MATIC states:

  • user has MATIC, but not WMATIC --> show WRAP MATIC
  • user has WMATIC, but it's not enough --> check if user has MATIC, if so, show WRAP MATIC
  • user doesn't have MATIC nor WMATIC --> show error message, button is disabled
  • user doesn't have MATIC, but has enough WMATIC --> show Upload
  • user has MATIC and WMATIC --> show upload

not sure if I'm forgetting another state. If so, please let me know, but they should be all there.

Take a look and test it out please.

@EnzoVezzaro
Copy link
Contributor

merging to update as much as possible

@EnzoVezzaro EnzoVezzaro merged commit d822d57 into main Oct 17, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UI should accept payments in MATIC rather than just wrapped matic
2 participants