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

(Feature) [xDai] - Create network-based configurations#1420

Merged
fernandomg merged 14 commits intofeature/#1353-xDai-compatibilityfrom
feature/#1414-xDai-generic-configs
Oct 2, 2020
Merged

(Feature) [xDai] - Create network-based configurations#1420
fernandomg merged 14 commits intofeature/#1353-xDai-compatibilityfrom
feature/#1414-xDai-generic-configs

Conversation

@fernandomg
Copy link
Contributor

Closes #1414, by:

  • setting config files for mainnet, rinkeby and xdai.
  • defining types for config files

A special note for reviewers: we added GAS_PRICE

Co-authored-by: Matias Dastugue <matias.dastugue@altoros.com>
@github-actions
Copy link

CLA Assistant Lite All Contributors have signed the CLA.

@github-actions
Copy link

github-actions bot commented Sep 30, 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 Sep 30, 2020

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

@ghost
Copy link

ghost commented Oct 1, 2020

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

fernandomg and others added 4 commits October 1, 2020 13:55
Co-authored-by: Matias Dastugue <matias.dastugue@altoros.com>
Co-authored-by: Matias Dastugue <matias.dastugue@altoros.com>
Co-authored-by: Matias Dastugue <matias.dastugue@altoros.com>
Co-authored-by: Matias Dastugue <matias.dastugue@altoros.com>
@ghost
Copy link

ghost commented Oct 1, 2020

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

Co-authored-by: Matias Dastugue <matias.dastugue@altoros.com>
@ghost
Copy link

ghost commented Oct 1, 2020

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

@ghost
Copy link

ghost commented Oct 1, 2020

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

"!src/**/test/**/*",
"!src/**/assets/**",
"!src/config/**/*"
"!src/**/assets/**"
Copy link
Contributor

Choose a reason for hiding this comment

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

not to be done now, but should we change the version to v3.0.0?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Something to consider. We should talk about this when preparing release

@@ -0,0 +1,59 @@
import { ETHEREUM_NETWORK } from 'src/logic/wallets/getWeb3'
Copy link
Contributor

Choose a reason for hiding this comment

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

can we do the opposite? I mean defining the networks here and import them in 'src/logic/wallets/getWeb3'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, but we preferred doing it later (in a different PR) because there are lots of files that import this enum, and it will make a lot of noise.

And probably we should wrap the ETHEREUM_NETWORK[getNetwork()] into a function.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't forget to create a ticket for this

Copy link
Contributor Author

@fernandomg fernandomg Oct 2, 2020

Choose a reason for hiding this comment

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

}

type GasPrice = {
gasPrice: number
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure about this, I thought it was going to be a URL or NULL, if a URL is provided, then the service in charge to resolve the gas calculation will do all it's needed to return a value. If it's NULL the service will return a hardcoded value.

If you don't like that alternative and would suggest typing this value like so:
gasPriceInfo: number | string

Copy link
Contributor Author

Choose a reason for hiding this comment

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

mhh... but, where will you define the hardcoded value depending on the network you're using?

In regard to the type, why will you need a string type for that value?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't see the problem here. This may be necessary to be different depending on the network, so the fallback value should be configurable

Any more feedback to add @nicosampler ?

Copy link
Contributor

Choose a reason for hiding this comment

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

no, that's fine

import { ETHEREUM_NETWORK } from 'src/logic/wallets/getWeb3'
import { isValidURL } from 'src/utils/url'

describe('Network config file test', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't it be Networks config files?

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, makes sense

const { color } = networkConfig.network

// Then
const s = new Option().style
Copy link
Contributor

Choose a reason for hiding this comment

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

just curious, is there a reason to use an Option instead of another element?

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... totally

}

export type EnvironmentSettings = GasPrice & {
txServiceUri: string
Copy link
Contributor

Choose a reason for hiding this comment

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

didn't know the difference between URL and URI, so I found this: https://danielmiessler.com/study/difference-between-uri-url/#:~:text=A%20URI%20is%20an%20identifier,as%20HTTPs%20%2C%20FTP%20%2C%20etc.

Seems like we should use URL instead of URI.

@ghost
Copy link

ghost commented Oct 2, 2020

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

@ghost
Copy link

ghost commented Oct 2, 2020

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

@fernandomg fernandomg merged commit 6a4e353 into feature/#1353-xDai-compatibility Oct 2, 2020
@fernandomg fernandomg deleted the feature/#1414-xDai-generic-configs branch October 2, 2020 19:52
@github-actions github-actions bot locked and limited conversation to collaborators Oct 2, 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.

5 participants