Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Add token to metamask #2267

Merged
merged 2 commits into from
Jan 24, 2022
Merged

Add token to metamask #2267

merged 2 commits into from
Jan 24, 2022

Conversation

anxolin
Copy link
Contributor

@anxolin anxolin commented Jan 23, 2022

Summary

Adds a new button to add to Metamask the VCow token

image

image

To Test

  1. Claim a token
  2. Add it to Metamask

@anxolin anxolin requested review from a team January 23, 2022 21:06
@github-actions
Copy link
Contributor

  • 🔭 GP Swap: CoW Protocol v2 Swap UI

@elena-zh
Copy link

Hey @anxolin , nice changes!
Some my notes:

  1. I'd rather not to show 'Add to MM' buton when I claim on behalf on an account
    on behalf

  2. 'Added to MM' is displayed when the token is not yet added/cancelled adding. Can we add some kind of a loader when it is in 'Adding' state and show 'Added' when the asction is successful/show 'Add to MM' when the action is cancelled?
    I have to notice, that the same behavior is applicable to the the button on an order placement modal.

  3. I have faced an old issue repeatedly asked to add token to MM #243 which we decided not to fix: 'Added to MM' button is clickable, calls add to MM flow again

Comment on lines +34 to +57
const V_COW_TOKEN_MAINNET = new Token(
SupportedChainId.MAINNET,
V_COW_CONTRACT_ADDRESS[SupportedChainId.MAINNET] || '',
18,
'vCOW',
'CoW Protocol Virtual Token'
)

const V_COW_TOKEN_XDAI = new Token(
SupportedChainId.XDAI,
V_COW_CONTRACT_ADDRESS[SupportedChainId.XDAI] || '',
18,
'vCOW',
'CoW Protocol Virtual Token'
)

const V_COW_TOKEN_RINKEBY = new Token(
SupportedChainId.RINKEBY,
V_COW_CONTRACT_ADDRESS[SupportedChainId.RINKEBY] || '',
18,
'vCOW',
'CoW Protocol Virtual Token'
)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for including this in the PR, not a big reason tbh. I needed at first V_COW_TOKEN_MAINNET to be declared to use it for something else. Then i was not needed it any more but I just left it like that.

I think is easier to read though, but happy to roll that back if u feel is better

@anxolin anxolin force-pushed the add-token-to-metamask branch from db66801 to dbcf8ed Compare January 24, 2022 19:34
@anxolin
Copy link
Contributor Author

anxolin commented Jan 24, 2022

  1. I'd rather not to show 'Add to MM' buton when I claim on behalf on an account

Done!

  1. 'Added to MM' is displayed when the token is not yet added/cancelled adding. Can we add some kind of a loader when it is in 'Adding' state and show 'Added' when the asction is successful/show 'Add to MM' when the action is cancelled?
    I have to notice, that the same behavior is applicable to the the button on an order placement modal.

Yes, i used the same code. We rely on Metamask API for this. I'm not sure it can be done. Anyways, I just reuse the code as a low hanging fruit. I think it's goodish enough given the big list of things we have

  1. I have faced an old issue repeatedly asked to add token to MM repeatedly asked to add token to MM #243 which we decided not to fix: 'Added to MM' button is clickable, calls add to MM flow again

Same as above. We depend on MM allowing this

@anxolin
Copy link
Contributor Author

anxolin commented Jan 24, 2022

Just a picture of it for self claiming:

image

@anxolin anxolin merged commit 88c3ce0 into develop Jan 24, 2022
@anxolin anxolin mentioned this pull request Jan 24, 2022
@W3stside
Copy link
Contributor

Approved

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants