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

Paul/core2.0 #4641

Merged
merged 1 commit into from
Jan 5, 2024
Merged

Paul/core2.0 #4641

merged 1 commit into from
Jan 5, 2024

Conversation

paullinator
Copy link
Member

@paullinator paullinator commented Dec 19, 2023

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

#4677

Requirements

If you have made any visual changes to the GUI. Make sure you have:

  • Tested on iOS device
  • Tested on Android device
  • Tested on small-screen device (iPod Touch)
  • Tested on large-screen device (tablet)

@paullinator paullinator force-pushed the paul/core2.0 branch 4 times, most recently from 9f56e43 to 8990c50 Compare December 22, 2023 02:16
Copy link
Contributor

@swansontec swansontec left a comment

Choose a reason for hiding this comment

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

Besides the comments here, I have a sidecar branch that includes a bunch of additional fixes.

The sidecar branch focuses on the GuiCurrencyInfo and WalletListResult, which are using tokenId: undefined to mean both "parent currency" and "none specified". We aren't using null in general, but only to indicate parent currencies. This means we can't use tokenId: null to mean "none specified".

In the GuiCurrencyInfo case, I simply made the tokenId mandatory in all cases. In the WalletListResult case, I use a discriminated union to simply remove the tokenId when it is not relevant.

This branch will need to be rebased on top of the sidecar branch. The merge conflicts are things we need to fix in any case.

src/util/CurrencyInfoHelpers.ts Outdated Show resolved Hide resolved
src/util/CurrencyInfoHelpers.ts Outdated Show resolved Hide resolved
src/types/types.ts Outdated Show resolved Hide resolved
src/actions/CryptoExchangeActions.tsx Outdated Show resolved Hide resolved
src/actions/PaymentProtoActions.tsx Outdated Show resolved Hide resolved
src/controllers/edgeProvider/types/edgeProviderCleaners.ts Outdated Show resolved Hide resolved
src/controllers/edgeProvider/types/edgeProviderCleaners.ts Outdated Show resolved Hide resolved
src/hooks/redux/useContactThumbnail.ts Outdated Show resolved Hide resolved
src/util/ActionProgramUtils.ts Outdated Show resolved Hide resolved
@swansontec swansontec mentioned this pull request Dec 22, 2023
6 tasks
@paullinator paullinator force-pushed the paul/core2.0 branch 6 times, most recently from 1661d3a to 47ec4f5 Compare December 31, 2023 17:59
src/types/types.ts Outdated Show resolved Hide resolved
Comment on lines 178 to 189
React.useEffect(() => {
const interval = setInterval(() => {
setDirty(dirty => ({
...dirty,
rates: true
}))
}, REFRESH_RATES_MS)
return () => clearInterval(interval)
}, [])

Copy link
Contributor

Choose a reason for hiding this comment

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

Do not use setInterval! There are subtle dangers here. Use makePeriodicTask to handle this in a better way.

Copy link
Contributor

Choose a reason for hiding this comment

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

I moved this fix to #4677

@@ -175,7 +175,7 @@ export function handleWalletUris(
fioAddress?: string
): ThunkAction<Promise<void>> {
return async (dispatch, getState) => {
const { legacyAddress, metadata, minNativeAmount, nativeAmount, publicAddress, uniqueIdentifier, tokenId } = parsedUri
const { legacyAddress, metadata, minNativeAmount, nativeAmount, publicAddress, uniqueIdentifier, tokenId = null } = parsedUri
Copy link
Contributor

@swansontec swansontec Jan 4, 2024

Choose a reason for hiding this comment

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

A note about this one: I made EdgeParsedUri.tokenId optional, since it doesn't apply in all scenarios. For instance, something like a bitId URI would not include a currency code / tokenId at all.

More importantly, we would need to add upgrade logic into the core, in case an older currency plugin fails to pass tokenId, we can still derive it from the currency code so the GUI can rely on it being present. We don't want illegal values slipping past the type system, since that's a recipe for crashes.

I did not want to enter this minefield, so I'm leaving the status quo for now.

The correct fix is to make EdgeParsedUri a union type, reflecting the different types of things we might scan (payments / private keys / wallet connect / bitId / request for address / etc.), so we can make tokenId mandatory in the places where it matters. This is a bigger project, so I left it for another day.

@swansontec swansontec force-pushed the paul/core2.0 branch 2 times, most recently from 0de260d to f7f0038 Compare January 4, 2024 22:41
@paullinator paullinator force-pushed the paul/core2.0 branch 2 times, most recently from 163f262 to 1c48dcf Compare January 5, 2024 00:27
@paullinator paullinator enabled auto-merge January 5, 2024 00:27
edge-core-js to 2.0.0
edge-exchange-plugins to 2.0.0
@paullinator paullinator merged commit 59f1c5e into develop Jan 5, 2024
2 checks passed
@paullinator paullinator deleted the paul/core2.0 branch January 5, 2024 01:24
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.

2 participants