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

feat: add an approval/funding UI #30

Open
wants to merge 40 commits into
base: development
Choose a base branch
from

Conversation

zugdev
Copy link

@zugdev zugdev commented Nov 21, 2024

Resolves #29

I like the word funding better than approval, allowance or permit2, as it is better aligned with the "ubiquity banking" concept. Don't worry bout the text, it still needs rephrasing.

Current UI:

image

I have a couple questions:

  1. Should I force UUSD or should I offer an input field for token. If I should force, what about chains where UUSD is not at currently? I've included all permit2 chains I could, for now.

  2. I don't want to have user authenticate with GitHub, it's an unnecessary step, but if I did I could read what chain he has payments setup in. Is there a way to read what token he is using as reward too? If that was the case I should consider adding GitHub auth.

  3. I am waiting on the above to integrate ethers.

@zugdev zugdev requested a review from rndquu as a code owner November 21, 2024 03:26
@zugdev zugdev requested a review from 0x4007 November 21, 2024 03:26
Copy link

Unused dependencies (4)

Filename dependencies
package.json @coinbase/wallet-sdk
@reown/appkit
@reown/appkit-adapter-ethers5
ethers

Unused devDependencies (2)

Filename devDependencies
package.json @types/react
react

@ubiquity-os-deployer
Copy link

ubiquity-os-deployer bot commented Nov 21, 2024

@rndquu rndquu requested review from rndquu and removed request for rndquu November 21, 2024 08:25
@rndquu
Copy link
Member

rndquu commented Nov 21, 2024

Should I force UUSD or should I offer an input field for token. If I should force, what about chains where UUSD is not at currently? I've included all permit2 chains I could, for now.

There should be a separate input for a token. When mainnet or gnosis is selected the UUSD should be set in the input token field by default but user should have the ability to change the token address.

I don't want to have user authenticate with GitHub, it's an unnecessary step, but if I did I could read what chain he has payments setup in. Is there a way to read what token he is using as reward too? If that was the case I should consider adding GitHub auth.

Check this comment. Overall github auth is not necessary as a part of the current github issue and can be solved in another PR.

@rndquu rndquu marked this pull request as draft November 21, 2024 08:43
Copy link

ubiquity-os bot commented Nov 22, 2024

@zugdev, this task has been idle for a while. Please provide an update.

@ubiquity-os ubiquity-os bot closed this Nov 24, 2024
@zugdev zugdev reopened this Nov 24, 2024
@0x4007
Copy link
Member

0x4007 commented Nov 24, 2024

  1. Should I force UUSD or should I offer an input field for token. If I should force, what about chains where UUSD is not at currently? I've included all permit2 chains I could, for now.

I wonder if it makes sense for us to bridge over to as many chains as we can. I suppose anybody can do this and we just need to aggregate the addresses.

  1. I don't want to have user authenticate with GitHub, it's an unnecessary step, but if I did I could read what chain he has payments setup in. Is there a way to read what token he is using as reward too? If that was the case I should consider adding GitHub auth.

This is actually determined by the partner project currently. So in theory we could have partner A, B, and C and each pays with their own preferred token on their own preferred chain. This is because they need to fund their wallets with whatever asset they want.

  1. I am waiting on the above to integrate ethers.

@zugdev
Copy link
Author

zugdev commented Nov 26, 2024

I think aside from providers that's it. I need to find a smart way to use providers in all 10+ chains, why don't we use Alchemy or some service like that?

@zugdev zugdev marked this pull request as ready for review November 26, 2024 21:10
@EresDev
Copy link

EresDev commented Dec 19, 2024

yarn start prints wrong ip

It's not a wrong ip, 0.0.0.0 means all available network interfaces including localhost. Though it's not something I've set myself.

Interesting. Makes it accessible to all devices in the network. I can run it on my PC and phone without any extra config. Cool

@rndquu rndquu requested review from rndquu and removed request for rndquu December 19, 2024 08:18
@rndquu
Copy link
Member

rndquu commented Dec 19, 2024

@rndquu @0x4007

Using @reown/appkit for wallet connection is a major change I think. We use ethers.js in pay.ubq.fi. If we are going to use @reown/appkit here, it will be expected everywhere else too. Looks cool though. Card minting expects token to be USD equal and also card minting needs transaction confirmation with certain checks that may vary across networks. It will need testing and probably some enhancement for each network.

Also, existing onboard page is in light mode, this one is in dark mode. I also couldn't find support for both dark/light modes in template. Looks like we are sticking with one for now.

@reown/appkit is used only for wallet connection and saves tremendous amount of time while ethers.js is still used for onchain interactions, seems fine.

Regarding the dark/light theme, this was not in scope for this task, so sticking to only the dark one is also fine.

@rndquu
Copy link
Member

rndquu commented Dec 19, 2024

Regarding the changes:

  1. Getting the same error on "approve" button click
  2. These fixes should be applied
  3. Alchemy RPC nodes should be removed
  4. CI should be passing

Since e2e tests and responsive CSS were not in the initial task scope it makes sense to increase the estimated time to <1 Day.

@zugdev Overall looks good. Pls fix the above comments.

@rndquu rndquu marked this pull request as draft December 19, 2024 08:53
@whilefoo
Copy link

I also get the same error as rndquu and EresDev

{\"jsonrpc\":\"2.0\",\"id\":152,\"error\":{\"code\":32601,\"message\":\"the method eth_sendtransaction does not exist/is not available\"}}", error={"code":32601}, requestBody="{\"method\":\"eth_sendTransaction\",\"params\":[{\"gas\":\"0xb54e\",\"from\":\"0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266\",\"to\":\"0xe91d153e0b41518a2ce8dd3d7944fa863463a97d\",\"data\":\"0x095ea7b3000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba30000000000000000000000000000000000000000000000056bc75e2d63100000\"}],\"id\":152,\"jsonrpc\":\"2.0\"}"

It seems that it's trying to send a transaction using eth_sendTransaction which accepts an unassigned tx and assumes that the RPC node will sign the transaction, we should just use user's wallet to send the transaction instead

.github/workflows/no-empty-strings.yml Outdated Show resolved Hide resolved
static/populate-dropdown.ts Outdated Show resolved Hide resolved
static/permit2-addresses.ts Outdated Show resolved Hide resolved
static/main.ts Outdated Show resolved Hide resolved
static/main.ts Outdated Show resolved Hide resolved
static/main.ts Outdated Show resolved Hide resolved
static/main.ts Outdated Show resolved Hide resolved
static/index.html Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
static/handle-approval.ts Outdated Show resolved Hide resolved
@zugdev
Copy link
Author

zugdev commented Dec 21, 2024

thanks for the input guys, very valid. I kinda disagree with needing an e2e test set, cause it's just a mere approve() transaction, can we reconsider it? transactions weren't going through cause reown isn't properly injecting pk into signer, I have changed to capture injected wallet (standard window.ethereum stuff)

@zugdev zugdev marked this pull request as ready for review December 21, 2024 02:50
Copy link

ubiquity-os bot commented Dec 24, 2024

@zugdev, this task has been idle for a while. Please provide an update.

@ubiquity-os ubiquity-os bot marked this pull request as draft December 24, 2024 06:30
@zugdev zugdev marked this pull request as ready for review December 24, 2024 16:52
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.

Add permit2 approval
5 participants