Skip to content
This repository was archived by the owner on Nov 10, 2023. It is now read-only.

Add coin by network#1505

Merged
dasanra merged 7 commits intodevelopmentfrom
issue-1498
Oct 23, 2020
Merged

Add coin by network#1505
dasanra merged 7 commits intodevelopmentfrom
issue-1498

Conversation

@nicosampler
Copy link
Contributor

@nicosampler nicosampler commented Oct 20, 2020

Closes #1498.

  • moved token images from src/assets/icons to src/config/assets.
  • add the logoUri to xdai in config
  • make AVAILABLE_CURRENCIES dynamic (we have lost the type)

@nicosampler nicosampler self-assigned this Oct 20, 2020
@github-actions
Copy link

CLA Assistant Lite All Contributors have signed the CLA.

@github-actions
Copy link

github-actions bot commented Oct 20, 2020

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 5 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

@ghost
Copy link

ghost commented Oct 20, 2020

Travis automatic deployment:
https://pr1505--safereact.review.gnosisdev.com/app

1 similar comment
@ghost
Copy link

ghost commented Oct 20, 2020

Travis automatic deployment:
https://pr1505--safereact.review.gnosisdev.com/app

Copy link
Contributor

@fernandomg fernandomg left a comment

Choose a reason for hiding this comment

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

There's this function sameAddress that what it does is just string comparison. Can we use it instead of making the conversion explicit in every place?

And thinking forward, a rename of the function would be great or create a different function sameString and make sameAddress return the result of calling sameString(this is to preserve sameAddress, and if for any reason in the future we need to extend the way we compare addresses).

(ok, that was unnecessarily long 🤷‍♂️)

WDY?

let rate = 0

if (targetCurrencyValue === AVAILABLE_CURRENCIES.ETH) {
if (targetCurrencyValue === nativeCoin.symbol.toUpperCase()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

given all the other cases, shouldn't it be toLocaleUpperCase() instead?

Comment on lines +44 to +45
//export type AVAILABLE_CURRENCIES_KEYS = keyof typeof AVAILABLE_CURRENCIES
//export type AVAILABLE_CURRENCIES_VALUES = typeof AVAILABLE_CURRENCIES[AVAILABLE_CURRENCIES_KEYS]
Copy link
Contributor

@fernandomg fernandomg Oct 20, 2020

Choose a reason for hiding this comment

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

Can we get rid of the commented code?

@ghost
Copy link

ghost commented Oct 20, 2020

Travis automatic deployment:
https://pr1505--safereact.review.gnosisdev.com/app

* @returns {boolean}
*/
export const sameString = (str1: string | undefined, str2: string | undefined): boolean => {
if (!str1 || !str2) {
Copy link
Contributor

Choose a reason for hiding this comment

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

what if both are empty string? 😬 or it's a case intentionally left out?

Copy link
Contributor

Choose a reason for hiding this comment

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

sameAddress has the same approach. Well, maybe it's better that way to not break anything else

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes.. they are the same string literal, it would be incorrect to return false IMHO.

let rate = 0

if (targetCurrencyValue === AVAILABLE_CURRENCIES.ETH) {
if (sameString(targetCurrencyValue, nativeCoin.symbol)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need to import nativeCoin here? Shouldn't we still use AVAILABLE_CURRENCIES?
As I can see you added the network token here.
Should we rename it to AVAILABLE_CURRENCIES.NETWORK_TOKEN?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

super correct!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done!

@nicosampler nicosampler requested a review from dasanra October 21, 2020 20:36
@ghost
Copy link

ghost commented Oct 21, 2020

Travis automatic deployment:
https://pr1505--safereact.review.gnosisdev.com/app

@ghost
Copy link

ghost commented Oct 22, 2020

Travis automatic deployment:
https://pr1505--safereact.review.gnosisdev.com/app

1 similar comment
@ghost
Copy link

ghost commented Oct 22, 2020

Travis automatic deployment:
https://pr1505--safereact.review.gnosisdev.com/app

@francovenica
Copy link
Contributor

I had to deploy this in my local env because the PR is automatically set for the Rinkeby network

In the Rinkeby network itself shows the ETH default value
In the my local env with the network set on xDai it shows the xDAI token with its icon as well as default, replacing the ETH

Looks good to me

@ghost
Copy link

ghost commented Oct 23, 2020

Travis automatic deployment:
https://pr1505--safereact.review.gnosisdev.com/app

@dasanra dasanra merged commit 8aeb5a1 into development Oct 23, 2020
@dasanra dasanra deleted the issue-1498 branch October 23, 2020 10:58
@github-actions github-actions bot locked and limited conversation to collaborators Oct 23, 2020
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.

xDai - Remove the ETH in the Fiat token selector

5 participants