-
Notifications
You must be signed in to change notification settings - Fork 6
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
US-1574 Mainnet!!! #740
Conversation
There was a problem hiding this 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
There was a problem hiding this 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()], |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
onPress={onSwitchChains}> | ||
<Typography type={'h3'}> | ||
Switch to{' '} | ||
{chainType === ChainTypeEnum.MAINNET |
There was a problem hiding this comment.
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)
?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why totally?
There was a problem hiding this comment.
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 😸
e2f46de
to
9ed755d
Compare
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. |
There was a problem hiding this 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()], |
There was a problem hiding this comment.
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?
The ticket has been created here https://rsklabs.atlassian.net/browse/US-1936 |
Already taken care of.
There was a problem hiding this 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!
* 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
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.