From c4d7185507bf541f3f1ec96bc6faa562482b27aa Mon Sep 17 00:00:00 2001 From: Luis Perrone Date: Thu, 12 Dec 2024 17:11:19 -0500 Subject: [PATCH] Provider method fixes --- app.json | 6 ++-- ios/HeliumWallet.xcodeproj/project.pbxproj | 28 ++++++++----------- ios/HeliumWallet/Info.plist | 2 +- src/features/provider-methods/Connect.tsx | 2 +- src/features/provider-methods/Disconnect.tsx | 3 +- .../provider-methods/SignAllTransactions.tsx | 7 +++-- .../SignAndSendTransaction.tsx | 3 +- src/features/provider-methods/SignMessage.tsx | 5 ++-- .../provider-methods/SignTransaction.tsx | 10 +++++-- .../provider-methods/hooks/useSession.ts | 8 ++---- .../solana/WalletSIgnBottomSheetSimulated.tsx | 14 +++++----- src/features/solana/WalletSignBottomSheet.tsx | 12 ++++++-- .../solana/WalletSignBottomSheetCompact.tsx | 8 +++--- .../WalletSignBottomSheetTransaction.tsx | 6 ++-- src/features/solana/WarningBox.tsx | 4 +-- .../solana/WritableAccountPreview.tsx | 12 ++++---- .../solana/walletSignBottomSheetTypes.tsx | 1 + 17 files changed, 71 insertions(+), 60 deletions(-) diff --git a/app.json b/app.json index 1ae8a1afb..31b239c2b 100644 --- a/app.json +++ b/app.json @@ -1,7 +1,7 @@ { - "name": "HeliumWallet", - "displayName": "Helium Wallet", + "displayName": "Helium", "expo": { "scheme": "heliumwallet" - } + }, + "name": "HeliumWallet" } diff --git a/ios/HeliumWallet.xcodeproj/project.pbxproj b/ios/HeliumWallet.xcodeproj/project.pbxproj index b921ac023..e749d58f3 100644 --- a/ios/HeliumWallet.xcodeproj/project.pbxproj +++ b/ios/HeliumWallet.xcodeproj/project.pbxproj @@ -18,10 +18,10 @@ 7AA19242A2DE47E8AFC56882 /* Figtree-Italic-VariableFont_wght.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 3440BC62530D461681D28DD7 /* Figtree-Italic-VariableFont_wght.ttf */; }; 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; }; 9609D00027F4DE8D00CE3F93 /* RCTDateModule.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9609CFFF27F4DE8D00CE3F93 /* RCTDateModule.mm */; }; - 962862712BDCCAF70073839C /* BuildFile in Frameworks */ = {isa = PBXBuildFile; }; - 962862722BDCCAF70073839C /* BuildFile in Frameworks */ = {isa = PBXBuildFile; }; - 962862732BDCCAF70073839C /* BuildFile in Frameworks */ = {isa = PBXBuildFile; }; - 962862742BDCCAF70073839C /* BuildFile in Frameworks */ = {isa = PBXBuildFile; }; + 962862712BDCCAF70073839C /* (null) in Frameworks */ = {isa = PBXBuildFile; }; + 962862722BDCCAF70073839C /* (null) in Frameworks */ = {isa = PBXBuildFile; }; + 962862732BDCCAF70073839C /* (null) in Frameworks */ = {isa = PBXBuildFile; }; + 962862742BDCCAF70073839C /* (null) in Frameworks */ = {isa = PBXBuildFile; }; 96E4147327BEE4C300CE6EC1 /* NotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E4147227BEE4C300CE6EC1 /* NotificationService.swift */; }; 96E4147727BEE4C300CE6EC1 /* OneSignalNotificationServiceExtension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 96E4147027BEE4C300CE6EC1 /* OneSignalNotificationServiceExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 9D05C88528527DF0008198FC /* HeliumWalletWidgetProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D05C88428527DF0008198FC /* HeliumWalletWidgetProvider.swift */; }; @@ -197,7 +197,7 @@ buildActionMask = 2147483647; files = ( 9DEC730E2CAB265100DA649B /* Mapbox in Frameworks */, - 962862742BDCCAF70073839C /* BuildFile in Frameworks */, + 962862742BDCCAF70073839C /* (null) in Frameworks */, B3469F859005A4F164D08293 /* libPods-HeliumWallet-HeliumWalletTests.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -207,7 +207,7 @@ buildActionMask = 2147483647; files = ( 9DEC730B2CAB265100DA649B /* Mapbox in Frameworks */, - 962862712BDCCAF70073839C /* BuildFile in Frameworks */, + 962862712BDCCAF70073839C /* (null) in Frameworks */, 31B6D29CFC726A9C37946D71 /* libPods-HeliumWallet.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -217,7 +217,7 @@ buildActionMask = 2147483647; files = ( 9DEC730C2CAB265100DA649B /* Mapbox in Frameworks */, - 962862722BDCCAF70073839C /* BuildFile in Frameworks */, + 962862722BDCCAF70073839C /* (null) in Frameworks */, C4EB4BD0A9AAABC0002181CC /* libPods-OneSignalNotificationServiceExtension.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -227,7 +227,7 @@ buildActionMask = 2147483647; files = ( 9DEC730D2CAB265100DA649B /* Mapbox in Frameworks */, - 962862732BDCCAF70073839C /* BuildFile in Frameworks */, + 962862732BDCCAF70073839C /* (null) in Frameworks */, 9D7DB3B02850EC14004D9409 /* SwiftUI.framework in Frameworks */, 9D7DB3AF2850EC14004D9409 /* WidgetKit.framework in Frameworks */, 9DCA365F28E6781D000F2A66 /* Charts in Frameworks */, @@ -1078,6 +1078,7 @@ ENABLE_BITCODE = NO; "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64; INFOPLIST_FILE = HeliumWallet/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = Helium; IPHONEOS_DEPLOYMENT_TARGET = 13.4; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -1116,6 +1117,7 @@ DEVELOPMENT_TEAM = PVM9KJZ2AD; "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64; INFOPLIST_FILE = HeliumWallet/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = Helium; IPHONEOS_DEPLOYMENT_TARGET = 13.4; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -1204,10 +1206,7 @@ ); MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; - OTHER_LDFLAGS = ( - "$(inherited)", - " ", - ); + OTHER_LDFLAGS = "$(inherited) "; REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; SDKROOT = iphoneos; USE_HERMES = true; @@ -1268,10 +1267,7 @@ ); LIBRARY_SEARCH_PATHS = "$(SDKROOT)/usr/lib/swift\"$(inherited)\""; MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = ( - "$(inherited)", - " ", - ); + OTHER_LDFLAGS = "$(inherited) "; REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; SDKROOT = iphoneos; USE_HERMES = true; diff --git a/ios/HeliumWallet/Info.plist b/ios/HeliumWallet/Info.plist index 7d8cce33b..d07b60610 100644 --- a/ios/HeliumWallet/Info.plist +++ b/ios/HeliumWallet/Info.plist @@ -5,7 +5,7 @@ CFBundleDevelopmentRegion en CFBundleDisplayName - Helium Wallet + Helium CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier diff --git a/src/features/provider-methods/Connect.tsx b/src/features/provider-methods/Connect.tsx index 117056380..0605a089f 100644 --- a/src/features/provider-methods/Connect.tsx +++ b/src/features/provider-methods/Connect.tsx @@ -94,7 +94,7 @@ export const Connect = () => { const onCancel = useCallback(() => { if (navigation.canGoBack()) { - navigation.goBack() + navigation.popToTop() } else { navigation.reset({ index: 0, diff --git a/src/features/provider-methods/Disconnect.tsx b/src/features/provider-methods/Disconnect.tsx index ffd7d1368..762b1bf7c 100644 --- a/src/features/provider-methods/Disconnect.tsx +++ b/src/features/provider-methods/Disconnect.tsx @@ -86,7 +86,7 @@ export const Disconnect = () => { const onCancel = useCallback(() => { if (navigation.canGoBack()) { - navigation.goBack() + navigation.popToTop() } else { navigation.reset({ index: 0, @@ -135,6 +135,7 @@ export const Disconnect = () => { backgroundColor="primaryText" titleColor="primaryBackground" onPress={onDisconnect} + customLoadingColor="primaryBackground" /> { const [nonce, encryptedPayload] = encryptPayload( JSON.stringify({ - transactions: signedTransactions?.map((tx) => tx.serialize()), + transactions: signedTransactions?.map((tx) => + bs58.encode(tx.serialize()), + ), }), sharedSecret, ) @@ -161,7 +163,7 @@ export const SignAllTransactions = () => { const onCancel = useCallback(() => { if (navigation.canGoBack()) { - navigation.goBack() + navigation.popToTop() } else { navigation.reset({ index: 0, @@ -212,6 +214,7 @@ export const SignAllTransactions = () => { titleColor="primaryBackground" onPress={onSignAllTransactions} loading={signing} + customLoadingColor="primaryBackground" /> { const onCancel = useCallback(() => { if (navigation.canGoBack()) { - navigation.goBack() + navigation.popToTop() } else { navigation.reset({ index: 0, @@ -226,6 +226,7 @@ export const SignAndSendTransaction = () => { titleColor="primaryBackground" onPress={onSignAndSendTransaction} loading={signing} + customLoadingColor="primaryBackground" /> { ) const [nonce, encryptedPayload] = encryptPayload( - JSON.stringify({ signature }), + JSON.stringify({ signature: bs58.encode(signature) }), sharedSecret, ) @@ -130,7 +130,7 @@ export const SignMessage = () => { const onCancel = useCallback(() => { if (navigation.canGoBack()) { - navigation.goBack() + navigation.popToTop() } else { navigation.reset({ index: 0, @@ -181,6 +181,7 @@ export const SignMessage = () => { titleColor="primaryBackground" onPress={onSignMessage} loading={signing} + customLoadingColor="primaryBackground" /> { requireAllSignatures: false, }), ], + theme: 'light', }) if (!decision) { @@ -165,7 +166,9 @@ export const SignTransaction = () => { ) const [nonce, encryptedPayload] = encryptPayload( - JSON.stringify({ transaction: signedTransaction.serialize() }), + JSON.stringify({ + transaction: bs58.encode(signedTransaction.serialize()), + }), sharedSecret, ) @@ -175,7 +178,7 @@ export const SignTransaction = () => { }) Linking.openURL(`${params.redirect_link}?${searchParams.toString()}`) - } catch { + } catch (e) { const errorParams = new URLSearchParams({ errorCode: '-32603', errorMessage: 'Failed to connect to the provider', @@ -188,7 +191,7 @@ export const SignTransaction = () => { const onCancel = useCallback(() => { if (navigation.canGoBack()) { - navigation.goBack() + navigation.popToTop() } else { navigation.reset({ index: 0, @@ -239,6 +242,7 @@ export const SignTransaction = () => { titleColor="primaryBackground" onPress={onSignTransaction} loading={signing} + customLoadingColor="primaryBackground" /> { setCurrentAccount(account) - return payload + return payloadData }, [accounts, setCurrentAccount, decryptPayload], ) @@ -274,7 +274,7 @@ const useSession = () => { payload: string, nonce: string, ) => { - const signTxnPayload: string | undefined = await getSignPayload( + const signTxnPayload: SignTransactionPayload = await getSignPayload( dapp_encryption_public_key, payload, nonce, @@ -284,9 +284,7 @@ const useSession = () => { throw new Error('Sign transaction payload not found') } - const parsedPayload: SignTransactionPayload = JSON.parse(signTxnPayload) - - return parsedPayload + return signTxnPayload }, [getSignPayload], ) diff --git a/src/features/solana/WalletSIgnBottomSheetSimulated.tsx b/src/features/solana/WalletSIgnBottomSheetSimulated.tsx index b0494e4cf..89920f20e 100644 --- a/src/features/solana/WalletSIgnBottomSheetSimulated.tsx +++ b/src/features/solana/WalletSIgnBottomSheetSimulated.tsx @@ -410,11 +410,11 @@ export const WalletSignBottomSheetSimulated = ({ @@ -493,7 +493,7 @@ export const WalletSignBottomSheetSimulated = ({ @@ -524,7 +524,7 @@ export const WalletSignBottomSheetSimulated = ({ diff --git a/src/features/solana/WalletSignBottomSheet.tsx b/src/features/solana/WalletSignBottomSheet.tsx index 654ac5207..76f6790e9 100644 --- a/src/features/solana/WalletSignBottomSheet.tsx +++ b/src/features/solana/WalletSignBottomSheet.tsx @@ -17,7 +17,7 @@ import React, { useState, } from 'react' import { ThemeProvider } from '@shopify/restyle' -import { darkTheme } from '@config/theme/theme' +import { darkTheme, lightTheme } from '@config/theme/theme' import { StyleProp, ViewStyle } from 'react-native' import { WalletSignBottomSheetProps, @@ -47,6 +47,7 @@ const WalletSignBottomSheet = forwardRef( serializedTxs: undefined, header: undefined, suppressWarnings: false, + theme: 'dark', }) const hasRenderer = walletSignOpts.renderer !== undefined @@ -128,7 +129,10 @@ const WalletSignBottomSheet = forwardRef( ref={bottomSheetModalRef} index={0} backgroundStyle={{ - backgroundColor: darkTheme.colors.primaryBackground, + backgroundColor: + walletSignOpts.theme === 'light' + ? lightTheme.colors.primaryBackground + : darkTheme.colors.primaryBackground, borderRadius: borderRadii['4xl'] + borderRadii['4xl'], }} backdropComponent={renderBackdrop} @@ -145,7 +149,9 @@ const WalletSignBottomSheet = forwardRef( }} enableDynamicSizing > - + {hasRenderer && !simulated ? ( diff --git a/src/features/solana/WalletSignBottomSheetTransaction.tsx b/src/features/solana/WalletSignBottomSheetTransaction.tsx index df97a24d5..8876d1b50 100644 --- a/src/features/solana/WalletSignBottomSheetTransaction.tsx +++ b/src/features/solana/WalletSignBottomSheetTransaction.tsx @@ -123,7 +123,7 @@ const WalletSignBottomSheetTransaction = ({ {uncollapsedAccounts.map((writableAccount) => ( - + {body} diff --git a/src/features/solana/WritableAccountPreview.tsx b/src/features/solana/WritableAccountPreview.tsx index 469409d62..68a0255f3 100644 --- a/src/features/solana/WritableAccountPreview.tsx +++ b/src/features/solana/WritableAccountPreview.tsx @@ -118,7 +118,7 @@ export const WritableAccountPreview = ({ flexDirection="row" justifyContent="space-between" alignItems="stretch" - backgroundColor="gray.900" + backgroundColor="cardBackground" borderTopLeftRadius="2xl" borderTopRightRadius="2xl" padding="2" @@ -127,7 +127,7 @@ export const WritableAccountPreview = ({ {t('browserScreen.estimatedAccountChanges')} - + {writableAccount.pre.account && !writableAccount.post.account && ( @@ -188,7 +188,7 @@ export const WritableAccountPreview = ({ flexDirection="row" justifyContent="space-between" alignItems="stretch" - backgroundColor="gray.900" + backgroundColor="cardBackground" borderTopLeftRadius="2xl" borderTopRightRadius="2xl" padding="2" @@ -197,14 +197,14 @@ export const WritableAccountPreview = ({ {t('browserScreen.instructionsAndPrograms')} - + {instructions.map(({ parsed, raw }, index) => ( ReactNode + theme?: 'light' | 'dark' } export type WalletSignBottomSheetRef = {