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

US-1574 Mainnet!!! #740

Merged
merged 8 commits into from
Sep 27, 2023
Merged

US-1574 Mainnet!!! #740

merged 8 commits into from
Sep 27, 2023

Conversation

Freshenext
Copy link
Collaborator

@Freshenext Freshenext commented Sep 13, 2023

Test this!

There is a button in the Settings Screen that says "Switch to CHAIN" - tap on it and see the magic.

Explanation:

Due to how the current store implementation is done - this is the easiest way to implement the mainnet change. By placing the store into the React code, when we restart the app, it'll get the current chainId from the mmkv storage (which is set when we tap on the Switch to CHAIN button) and will initialize the storage with the correct mmkv key, and also will initialize the settings slice with the correct chainId. Use flipper to see.

Copy link
Member

@jessgusclark jessgusclark left a comment

Choose a reason for hiding this comment

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

I haven't tested it fully but the first thing that noticed is that I have the same EOA address for both mainnet and testnet. They should have different deveration paths when being created which would result in different addresses. You can test this out here.

Looking at the code, from what I can tell, the 'createRIFWalletFactory' isn't being touched or called so it seems like it might still be using the same 31. This is in src/core/setup.ts

Copy link
Collaborator

@TravellerOnTheRun TravellerOnTheRun left a comment

Choose a reason for hiding this comment

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

Some propositions/changes to review/address

initialState: () => ({
...initialState,
chainId: getCurrentChainId(),
chainType: chainTypesById[getCurrentChainId()],
Copy link
Collaborator

Choose a reason for hiding this comment

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

My question is here: why do we need both TYPE and chainId? Can we just use one or another?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I do understand what you are saying and for now the wallet has been built requiring both. We can, in the future, remove chainType, and only focus on chainId.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Okay, wait a second, I remember last PR you did on chaindId I noticed this and you said later and now you're saying later, when this later is going to come?

src/redux/store.ts Show resolved Hide resolved
onPress={onSwitchChains}>
<Typography type={'h3'}>
Switch to{' '}
{chainType === ChainTypeEnum.MAINNET
Copy link
Collaborator

Choose a reason for hiding this comment

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

For example: we can add Map which chaindTypeMap.get(chainId)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I totally disagree with the Maps, we can create an object and use it

Copy link
Collaborator

Choose a reason for hiding this comment

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

Why totally?

Copy link
Collaborator Author

@Freshenext Freshenext Sep 15, 2023

Choose a reason for hiding this comment

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

No need to use a map.get if we can just object[string]. We leverage JS native way of working and use objects as a map instead of the Map data structure 😸

@Freshenext Freshenext force-pushed the US-1574 branch 2 times, most recently from e2f46de to 9ed755d Compare September 15, 2023 13:56
@Freshenext
Copy link
Collaborator Author

This PR has hit a roadblock in the functional tests:

The RIF Relay mainnet server /estimate endpoint is not returning the expected data. We've reached their support to see how we can move this issue forward.

Copy link
Collaborator

@TravellerOnTheRun TravellerOnTheRun left a comment

Choose a reason for hiding this comment

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

We need to come up with the decision on chainId and/or chainType cause they are essentially the same things and there's no need to store them separately.

initialState: () => ({
...initialState,
chainId: getCurrentChainId(),
chainType: chainTypesById[getCurrentChainId()],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Okay, wait a second, I remember last PR you did on chaindId I noticed this and you said later and now you're saying later, when this later is going to come?

@Freshenext
Copy link
Collaborator Author

We need to come up with the decision on chainId and/or chainType cause they are essentially the same things and there's no need to store them separately.

The ticket has been created here https://rsklabs.atlassian.net/browse/US-1936

@Freshenext Freshenext dismissed stale reviews from jessgusclark and TravellerOnTheRun September 27, 2023 12:38

Already taken care of.

Copy link
Collaborator

@rodrigoncalves rodrigoncalves left a comment

Choose a reason for hiding this comment

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

Let's go main net!

@Freshenext Freshenext merged commit 7843a37 into develop Sep 27, 2023
@Freshenext Freshenext deleted the US-1574 branch September 27, 2023 12:49
jormelCoin pushed a commit that referenced this pull request Sep 28, 2023
* US-1574 Mainnet!!!

* Will now have mainnet wallet

* Fixed config.json

* Creted inversed object map

* Updated rif relay version

* Removed chainId from Redux Persist

* Linted

* Updated rif-relay sdk to version 11
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.

4 participants