-
Notifications
You must be signed in to change notification settings - Fork 312
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
CU-864efmq36 - Change NWD to use wallet-connect-sdk-wallet-react #2498
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.
We should not combine the scope of this task with the renaming of the import of neon-js
Done |
61bd289
to
409dbe6
Compare
481e3fd
to
13edd57
Compare
const { network: proposalNetwork } = getNetworkFromProposal(proposal) | ||
|
||
if (proposalNetwork !== net) { | ||
showModal(MODAL_TYPES.NETWORK_SWITCH, { |
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.
showModal(MODAL_TYPES.NETWORK_SWITCH, { | |
return showModal(MODAL_TYPES.NETWORK_SWITCH, { | |
dAppName: metadata.name, | |
onSwitch: () => approveSession(proposalNetwork), | |
onCancel: rejectSession, | |
proposalNetwork, | |
}) |
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.
nitpick suggestion ☝️
@@ -0,0 +1,73 @@ | |||
// @flow | |||
|
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.
@@ -0,0 +1,250 @@ | |||
/* eslint-disable no-nested-ternary */ | |||
// @flow | |||
|
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.
@@ -0,0 +1,61 @@ | |||
/* eslint-disable no-nested-ternary */ | |||
// @flow | |||
|
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.
@@ -0,0 +1,28 @@ | |||
import { withRouter } from 'react-router-dom' |
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.
import { withRouter } from 'react-router-dom' | |
// @flow | |
import { withRouter } from 'react-router-dom' |
@@ -0,0 +1,39 @@ | |||
// @flow | |||
|
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.
@@ -0,0 +1,144 @@ | |||
/* eslint-disable no-nested-ternary */ | |||
// @flow | |||
|
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.
@@ -0,0 +1,144 @@ | |||
/* eslint-disable no-nested-ternary */ |
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.
/* eslint-disable no-nested-ternary */ |
setLoading(false) | ||
} | ||
} | ||
|
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.
if (loading) return <ConnectionLoader /> |
} | ||
} | ||
|
||
return loading ? ( |
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.
return loading ? ( | |
return success ? ( | |
<MessageSuccess isVerify={false} /> | |
) : |
async () => { | ||
try { | ||
setLoading(true) | ||
const account = new n3Wallet.Account(isHardwareLogin ? publicKey : wif) |
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 could be wrong but I dont think we ever need to instantiate the account with wif
when performing invokeFunction
👀
@@ -0,0 +1,162 @@ | |||
/* eslint-disable no-nested-ternary */ |
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.
Lets follow the pattern in the above file and keep the rule in place
})() | ||
}, | ||
[rejectRequest, Component, request, showErrorNotification, history], | ||
) |
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.
This is some pretty weird looking syntax, I think something like this would be cleaner:
useEffect(() => {
async function checkUnsupportedMethod() {
if (!Component) {
showErrorNotification({
message: 'unsupportedMethod',
});
await rejectRequest(request, {
code: 1,
message: 'unsupportedMethod',
});
history.push(ROUTES.DASHBOARD);
}
};
checkUnsupportedMethod();
}, [rejectRequest, Component, request, showErrorNotification, history]);
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.
Yea, I would even put the checkUnsupportedMethod
on a separated useCallback
const { method } = request.params.request | ||
const { rejectRequest } = useWalletConnectWallet() | ||
|
||
const Component = useMemo(() => componentsByMethod[method], [method]) |
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 like this 💪 nice work @raulduartep
app/ledger/n3NeonLedger.js
Outdated
const id = showInfoNotification({ | ||
message: 'Please sign the transaction on your hardware device', | ||
autoDismiss: 0, | ||
})(store.dispatch) |
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.
Have you tested this change?? We already dispatch this notification from other places in the application so adding it here is probably going to cause it to render twice
app/util/walletConnect.js
Outdated
export const walletConnectOptions: TOptions = { | ||
clientOptions: { | ||
metadata: { | ||
name: 'CoZ Wallet Prototype', |
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.
Shouldnt this be Neon Wallet
not CoZ Wallet Prototype
13edd57
to
83760f9
Compare
83760f9
to
8503de4
Compare
What current issue(s) from Trello/Github does this address?
What problem does this PR solve?
How did you solve this problem?
How did you make sure your solution works?
Are there any special changes in the code that we should be aware of?
Is there anything else we should know?