-
Notifications
You must be signed in to change notification settings - Fork 686
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: link mode #5141
feat: link mode #5141
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.
Looking lit! writing down my initial thoughts, will dig more 💯
… param to getPayloadType
…it for some relayer subscriptions
# Conflicts: # packages/sign-client/src/controllers/engine.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.
Left some minor comments but very good job 💪
if (transportType === TRANSPORT_TYPES.link_mode) { | ||
setTimeout(() => { | ||
if (this.relayer.connected || this.relayer.connecting) { | ||
this.relayer.request(request).catch((e) => this.logger.warn(e)); | ||
} | ||
}, toMiliseconds(ONE_SECOND)); | ||
return subId; | ||
} |
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.
Is this kind of delay really needed ? Wouldn't this add a 1 second delay in every case (even if airplane mode is off).
On another note we should clear the timeout.
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.
Wouldn't this add a 1 second delay in every case (even if airplane mode is off).
with link mode, yes but it doesn't cause any issues as we need sometime for the react-native netinfo
to register network changes when the app is back in foreground
On another note we should clear the timeout.
why? there isn't a case where the timeout has to be stopped mid execution
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.
with link mode, yes but it doesn't cause any issues as we need sometime for the react-native netinfo to register network changes when the app is back in foreground
Ideally we should detect when this operation is needed instead of having the delay in every situation but I understand it's probably not trivial.
why? there isn't a case where the timeout has to be stopped mid execution
It's just a good practice I've been used to because of React development.
From Chat GPT
Using clearTimeout is not strictly necessary every time you use setTimeout, but there are specific situations where it is beneficial or required:
Preventing Unwanted Execution: If there's a possibility that the action scheduled with setTimeout should not occur in certain conditions (for example, if the user navigates away from a page or a component is unmounted), then you should clear the timeout to prevent the action from executing when it's no longer needed or relevant.
Memory Leaks: In React components or other dynamic UI environments, not clearing timeouts can lead to memory leaks. If a timeout is set on a component and the component is unmounted before the timeout fires, the callback function may still be executed, which can lead to errors or unintended behavior, especially if the callback modifies component state.
Resource Management: Timers hold onto resources until they execute. Clearing them when no longer needed frees up these resources, which is beneficial for performance, especially in environments with limited resources like mobile devices.
Control Over Asynchronous Actions: In complex applications where multiple timeouts might be set and their behavior could overlap or interfere with each other, managing timeouts with clearTimeout ensures that only the desired timers are running at any given time.
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.
Nice one Nacho 💪
…^2.16.0 (#5951) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@walletconnect/react-native-compat](https://redirect.github.com/walletconnect/walletconnect-monorepo) | [`^2.15.2` -> `^2.16.0`](https://renovatebot.com/diffs/npm/@walletconnect%2freact-native-compat/2.15.2/2.16.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@walletconnect%2freact-native-compat/2.16.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@walletconnect%2freact-native-compat/2.16.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@walletconnect%2freact-native-compat/2.15.2/2.16.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@walletconnect%2freact-native-compat/2.15.2/2.16.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>walletconnect/walletconnect-monorepo (@​walletconnect/react-native-compat)</summary> ### [`v2.16.0`](https://redirect.github.com/WalletConnect/walletconnect-monorepo/releases/tag/2.16.0) [Compare Source](https://redirect.github.com/walletconnect/walletconnect-monorepo/compare/2.15.3...2.16.0) #### What's Changed - chore: prep for 2.15.3 release by [@​ganchoradkov](https://redirect.github.com/ganchoradkov) in [https://github.com/WalletConnect/walletconnect-monorepo/pull/5331](https://redirect.github.com/WalletConnect/walletconnect-monorepo/pull/5331) - feat: link mode by [@​ignaciosantise](https://redirect.github.com/ignaciosantise) in [https://github.com/WalletConnect/walletconnect-monorepo/pull/5141](https://redirect.github.com/WalletConnect/walletconnect-monorepo/pull/5141) **Full Changelog**: WalletConnect/walletconnect-monorepo@2.15.3...2.16.0 ### [`v2.15.3`](https://redirect.github.com/WalletConnect/walletconnect-monorepo/releases/tag/2.15.3) [Compare Source](https://redirect.github.com/walletconnect/walletconnect-monorepo/compare/2.15.2...2.15.3) #### What's Changed - chore: prep for `2.15.2` release by [@​ganchoradkov](https://redirect.github.com/ganchoradkov) in [https://github.com/WalletConnect/walletconnect-monorepo/pull/5319](https://redirect.github.com/WalletConnect/walletconnect-monorepo/pull/5319) - Fix getVerifyContext when onSessionAuthenticateRequest by [@​quetool](https://redirect.github.com/quetool) in [https://github.com/WalletConnect/walletconnect-monorepo/pull/5324](https://redirect.github.com/WalletConnect/walletconnect-monorepo/pull/5324) - fix: avoid deeplinking if document isn't in focus by [@​ganchoradkov](https://redirect.github.com/ganchoradkov) in [https://github.com/WalletConnect/walletconnect-monorepo/pull/5229](https://redirect.github.com/WalletConnect/walletconnect-monorepo/pull/5229) - fix: enforces origin url to be verified to produce verify context by [@​ganchoradkov](https://redirect.github.com/ganchoradkov) in [https://github.com/WalletConnect/walletconnect-monorepo/pull/5327](https://redirect.github.com/WalletConnect/walletconnect-monorepo/pull/5327) - feat: auto publish to npm by [@​ganchoradkov](https://redirect.github.com/ganchoradkov) in [https://github.com/WalletConnect/walletconnect-monorepo/pull/5202](https://redirect.github.com/WalletConnect/walletconnect-monorepo/pull/5202) **Full Changelog**: WalletConnect/walletconnect-monorepo@2.15.2...2.15.3 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "after 5pm,every weekend" in timezone America/Los_Angeles, Automerge - "after 5pm,every weekend" in timezone America/Los_Angeles. 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/valora-inc/wallet). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC41OS4yIiwidXBkYXRlZEluVmVyIjoiMzguNTkuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsibnBtIiwicmVub3ZhdGUiXX0=--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: valora-bot <valorabot@valoraapp.com>
This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@walletconnect/utils](https://redirect.github.com/walletconnect/walletconnect-monorepo) | [`^2.15.2` -> `^2.16.0`](https://renovatebot.com/diffs/npm/@walletconnect%2futils/2.15.2/2.16.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@walletconnect%2futils/2.16.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@walletconnect%2futils/2.16.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@walletconnect%2futils/2.15.2/2.16.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@walletconnect%2futils/2.15.2/2.16.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>walletconnect/walletconnect-monorepo (@​walletconnect/utils)</summary> ### [`v2.16.0`](https://redirect.github.com/WalletConnect/walletconnect-monorepo/releases/tag/2.16.0) [Compare Source](https://redirect.github.com/walletconnect/walletconnect-monorepo/compare/2.15.3...2.16.0) #### What's Changed - chore: prep for 2.15.3 release by [@​ganchoradkov](https://redirect.github.com/ganchoradkov) in [https://github.com/WalletConnect/walletconnect-monorepo/pull/5331](https://redirect.github.com/WalletConnect/walletconnect-monorepo/pull/5331) - feat: link mode by [@​ignaciosantise](https://redirect.github.com/ignaciosantise) in [https://github.com/WalletConnect/walletconnect-monorepo/pull/5141](https://redirect.github.com/WalletConnect/walletconnect-monorepo/pull/5141) **Full Changelog**: WalletConnect/walletconnect-monorepo@2.15.3...2.16.0 ### [`v2.15.3`](https://redirect.github.com/WalletConnect/walletconnect-monorepo/releases/tag/2.15.3) [Compare Source](https://redirect.github.com/walletconnect/walletconnect-monorepo/compare/2.15.2...2.15.3) #### What's Changed - chore: prep for `2.15.2` release by [@​ganchoradkov](https://redirect.github.com/ganchoradkov) in [https://github.com/WalletConnect/walletconnect-monorepo/pull/5319](https://redirect.github.com/WalletConnect/walletconnect-monorepo/pull/5319) - Fix getVerifyContext when onSessionAuthenticateRequest by [@​quetool](https://redirect.github.com/quetool) in [https://github.com/WalletConnect/walletconnect-monorepo/pull/5324](https://redirect.github.com/WalletConnect/walletconnect-monorepo/pull/5324) - fix: avoid deeplinking if document isn't in focus by [@​ganchoradkov](https://redirect.github.com/ganchoradkov) in [https://github.com/WalletConnect/walletconnect-monorepo/pull/5229](https://redirect.github.com/WalletConnect/walletconnect-monorepo/pull/5229) - fix: enforces origin url to be verified to produce verify context by [@​ganchoradkov](https://redirect.github.com/ganchoradkov) in [https://github.com/WalletConnect/walletconnect-monorepo/pull/5327](https://redirect.github.com/WalletConnect/walletconnect-monorepo/pull/5327) - feat: auto publish to npm by [@​ganchoradkov](https://redirect.github.com/ganchoradkov) in [https://github.com/WalletConnect/walletconnect-monorepo/pull/5202](https://redirect.github.com/WalletConnect/walletconnect-monorepo/pull/5202) **Full Changelog**: WalletConnect/walletconnect-monorepo@2.15.2...2.15.3 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "after 5pm,every weekend" in timezone America/Los_Angeles, Automerge - "after 5pm,every weekend" in timezone America/Los_Angeles. 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/valora-inc/wallet). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC41OS4yIiwidXBkYXRlZEluVmVyIjoiMzguNTkuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsibnBtIiwicmVub3ZhdGUiXX0=--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jean Regisser <jean.regisser@gmail.com>
Description
TODO: cleanup logs before mergingType of change
How has this been tested?
Tested in RN sample dapp and wallet
Checklist
Additional Information (Optional)
Please include any additional information that may be useful for the reviewer.