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

feat: reown #713

Open
wants to merge 34 commits into
base: feat/lavamoat
Choose a base branch
from
Open

feat: reown #713

wants to merge 34 commits into from

Conversation

andreabadesso
Copy link
Contributor

@andreabadesso andreabadesso commented Dec 26, 2024

Screen.Recording.2025-01-02.at.10.39.57.mov

Acceptance Criteria

  • We should support reown connections, including adding new ones and managing existing
  • We should support all nano contract operations, including CreateNanoContractTx and SignOracleData
  • The wallet-desktop production build should be protected with LavaMoat

Security Checklist

  • Make sure you do not include new dependencies in the project unless strictly necessary and do not include dev-dependencies as production ones. More dependencies increase the possibility of one of them being hijacked and affecting us.

@andreabadesso andreabadesso self-assigned this Dec 26, 2024
@andreabadesso andreabadesso added the enhancement New feature or request label Dec 26, 2024
@@ -898,7 +898,7 @@ class TxData extends React.Component {
<label>Type:</label> {upperFirst(action.type)}
</div>
<div>
<label>Amount:</label> {numberUtils.prettyValue(action.amount, this.props.decimalPlaces)} {this.getSymbol(action.token_uid)}
<label>Amount:</label> {numberUtils.prettyValue(typeof action.amount === 'bigint' ? action.amount : BigInt(action.amount), this.props.decimalPlaces)} {this.getSymbol(action.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.

This was crashing

Copy link
Collaborator

Choose a reason for hiding this comment

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

Fixed by #715

@andreabadesso andreabadesso requested review from tuliomir and removed request for r4mmer January 2, 2025 16:37
src/components/Reown/NanoContractActions.js Outdated Show resolved Hide resolved
src/components/Reown/NanoContractActions.js Outdated Show resolved Hide resolved
src/components/Reown/ReownModal.js Show resolved Hide resolved
Comment on lines 49 to 53
{typeof value === 'string' && value.length > 20
? helpers.truncateText(value, 8, 4)
: typeof value === 'bigint'
? value.toString()
: value.toString()}
Copy link
Collaborator

Choose a reason for hiding this comment

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

suggestion(non-blocking): It seems our linter did not complain about the use of nested ternaries here, so it's not a necessary change.

But it's worth avoiding, if possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed! Thanks

Copy link
Collaborator

Choose a reason for hiding this comment

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

thought(non-blocking): We already have @reduxjs/toolkit@v2 in this repository. It enables us to write reducers using Immer ( reference ) and slices ( reference ).

This is a migration we can do at any pace, but since this section of the reducers seem simple enough, we could make our pilot implementation here.

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 think this PR is large enough as it is, let's do it in a later PR

* @param {Object} action.payload.modalProps - The props to pass to the modal
*/
function* showModal({ payload: { modalType, modalProps } }) {
if (modalContext) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

suggestion(non-blocking): Add an error message if the modalContext was not provided, allowing for easier debugging.

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! Thanks

Comment on lines 19 to 20
const connectionFailed = useSelector(state => state.reown.connectionFailed);
const sessions = useSelector(state => state.reown.sessions || {});
Copy link
Collaborator

Choose a reason for hiding this comment

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

suggestion(non-blocking): Retrieve all data from store in a single fetch.

Suggested change
const connectionFailed = useSelector(state => state.reown.connectionFailed);
const sessions = useSelector(state => state.reown.sessions || {});
const { connectionFailed, sessions } = useSelector(state => ({
connectionFailed: state.reown.connectionFailed,
sessions: state.reown.sessions || {},
}));

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! Thanks

src/store/index.js Show resolved Hide resolved
});

export function* onSignMessageRequest({ payload }) {
const { accept, deny: denyCb, data, dapp } = payload;
Copy link
Collaborator

Choose a reason for hiding this comment

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

question(non-blocking): Why not name the variable acceptCb to match denyCb?

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, thanks

Copy link
Collaborator

@tuliomir tuliomir left a comment

Choose a reason for hiding this comment

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

None of the remaining open comments are blocking, so this code is approved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In Review (WIP)
Development

Successfully merging this pull request may close these issues.

2 participants