Skip to content

Commit

Permalink
Provider method fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Perronef5 committed Dec 12, 2024
1 parent 20f966f commit c4d7185
Show file tree
Hide file tree
Showing 17 changed files with 71 additions and 60 deletions.
6 changes: 3 additions & 3 deletions app.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "HeliumWallet",
"displayName": "Helium Wallet",
"displayName": "Helium",
"expo": {
"scheme": "heliumwallet"
}
},
"name": "HeliumWallet"
}
28 changes: 12 additions & 16 deletions ios/HeliumWallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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 */,
Expand Down Expand Up @@ -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)",
Expand Down Expand Up @@ -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)",
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion ios/HeliumWallet/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>Helium Wallet</string>
<string>Helium</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
Expand Down
2 changes: 1 addition & 1 deletion src/features/provider-methods/Connect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const Connect = () => {

const onCancel = useCallback(() => {
if (navigation.canGoBack()) {
navigation.goBack()
navigation.popToTop()
} else {
navigation.reset({
index: 0,
Expand Down
3 changes: 2 additions & 1 deletion src/features/provider-methods/Disconnect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export const Disconnect = () => {

const onCancel = useCallback(() => {
if (navigation.canGoBack()) {
navigation.goBack()
navigation.popToTop()
} else {
navigation.reset({
index: 0,
Expand Down Expand Up @@ -135,6 +135,7 @@ export const Disconnect = () => {
backgroundColor="primaryText"
titleColor="primaryBackground"
onPress={onDisconnect}
customLoadingColor="primaryBackground"
/>
<ButtonPressable
flex={1}
Expand Down
7 changes: 5 additions & 2 deletions src/features/provider-methods/SignAllTransactions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ export const SignAllTransactions = () => {

const [nonce, encryptedPayload] = encryptPayload(
JSON.stringify({
transactions: signedTransactions?.map((tx) => tx.serialize()),
transactions: signedTransactions?.map((tx) =>
bs58.encode(tx.serialize()),
),
}),
sharedSecret,
)
Expand All @@ -161,7 +163,7 @@ export const SignAllTransactions = () => {

const onCancel = useCallback(() => {
if (navigation.canGoBack()) {
navigation.goBack()
navigation.popToTop()
} else {
navigation.reset({
index: 0,
Expand Down Expand Up @@ -212,6 +214,7 @@ export const SignAllTransactions = () => {
titleColor="primaryBackground"
onPress={onSignAllTransactions}
loading={signing}
customLoadingColor="primaryBackground"
/>
<ButtonPressable
flex={1}
Expand Down
3 changes: 2 additions & 1 deletion src/features/provider-methods/SignAndSendTransaction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export const SignAndSendTransaction = () => {

const onCancel = useCallback(() => {
if (navigation.canGoBack()) {
navigation.goBack()
navigation.popToTop()
} else {
navigation.reset({
index: 0,
Expand Down Expand Up @@ -226,6 +226,7 @@ export const SignAndSendTransaction = () => {
titleColor="primaryBackground"
onPress={onSignAndSendTransaction}
loading={signing}
customLoadingColor="primaryBackground"
/>
<ButtonPressable
flex={1}
Expand Down
5 changes: 3 additions & 2 deletions src/features/provider-methods/SignMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export const SignMessage = () => {
)

const [nonce, encryptedPayload] = encryptPayload(
JSON.stringify({ signature }),
JSON.stringify({ signature: bs58.encode(signature) }),
sharedSecret,
)

Expand All @@ -130,7 +130,7 @@ export const SignMessage = () => {

const onCancel = useCallback(() => {
if (navigation.canGoBack()) {
navigation.goBack()
navigation.popToTop()
} else {
navigation.reset({
index: 0,
Expand Down Expand Up @@ -181,6 +181,7 @@ export const SignMessage = () => {
titleColor="primaryBackground"
onPress={onSignMessage}
loading={signing}
customLoadingColor="primaryBackground"
/>
<ButtonPressable
flex={1}
Expand Down
10 changes: 7 additions & 3 deletions src/features/provider-methods/SignTransaction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export const SignTransaction = () => {
requireAllSignatures: false,
}),
],
theme: 'light',
})

if (!decision) {
Expand Down Expand Up @@ -165,7 +166,9 @@ export const SignTransaction = () => {
)

const [nonce, encryptedPayload] = encryptPayload(
JSON.stringify({ transaction: signedTransaction.serialize() }),
JSON.stringify({
transaction: bs58.encode(signedTransaction.serialize()),
}),
sharedSecret,
)

Expand All @@ -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',
Expand All @@ -188,7 +191,7 @@ export const SignTransaction = () => {

const onCancel = useCallback(() => {
if (navigation.canGoBack()) {
navigation.goBack()
navigation.popToTop()
} else {
navigation.reset({
index: 0,
Expand Down Expand Up @@ -239,6 +242,7 @@ export const SignTransaction = () => {
titleColor="primaryBackground"
onPress={onSignTransaction}
loading={signing}
customLoadingColor="primaryBackground"
/>
<ButtonPressable
flex={1}
Expand Down
8 changes: 3 additions & 5 deletions src/features/provider-methods/hooks/useSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ const useSession = () => {

setCurrentAccount(account)

return payload
return payloadData
},
[accounts, setCurrentAccount, decryptPayload],
)
Expand All @@ -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,
Expand All @@ -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],
)
Expand Down
14 changes: 7 additions & 7 deletions src/features/solana/WalletSIgnBottomSheetSimulated.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -410,11 +410,11 @@ export const WalletSignBottomSheetSimulated = ({
<ButtonPressable
width="100%"
borderRadius="full"
backgroundColor="base.white"
backgroundColor="primaryText"
backgroundColorOpacity={0.1}
backgroundColorOpacityPressed={0.05}
titleColorPressedOpacity={0.3}
titleColor="base.white"
titleColor="primaryBackground"
title={t('generic.loadMore')}
onPress={handleLoadMore}
/>
Expand Down Expand Up @@ -493,7 +493,7 @@ export const WalletSignBottomSheetSimulated = ({
<Box flex={1}>
<SubmitButton
color="error.500"
backgroundColor="base.white"
backgroundColor="cardBackground"
title={
type === WalletStandardMessageTypes.connect
? t('browserScreen.connect')
Expand All @@ -510,7 +510,7 @@ export const WalletSignBottomSheetSimulated = ({
justifyContent: 'center',
}}
borderRadius="full"
backgroundColor="gray.true-700"
backgroundColor="primaryText"
Icon={CancelIcon}
onPress={onCancel}
/>
Expand All @@ -524,7 +524,7 @@ export const WalletSignBottomSheetSimulated = ({
<ButtonPressable
width="48%"
borderRadius="full"
backgroundColor="secondaryBackground"
backgroundColor="cardBackground"
backgroundColorOpacityPressed={0.05}
backgroundColorPressed="fg.secondary-hover"
titleColor="primaryText"
Expand All @@ -536,7 +536,7 @@ export const WalletSignBottomSheetSimulated = ({
<ButtonPressable
width="48%"
borderRadius="full"
backgroundColor="base.white"
backgroundColor="primaryText"
backgroundColorOpacityPressed={0.7}
backgroundColorDisabled="bg.tertiary"
backgroundColorDisabledOpacity={0.5}
Expand All @@ -546,7 +546,7 @@ export const WalletSignBottomSheetSimulated = ({
? t('browserScreen.connect')
: t('browserScreen.approve')
}
titleColor="base.black"
titleColor="primaryBackground"
onPress={onAccept}
/>
</Box>
Expand Down
12 changes: 9 additions & 3 deletions src/features/solana/WalletSignBottomSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -47,6 +47,7 @@ const WalletSignBottomSheet = forwardRef(
serializedTxs: undefined,
header: undefined,
suppressWarnings: false,
theme: 'dark',
})

const hasRenderer = walletSignOpts.renderer !== undefined
Expand Down Expand Up @@ -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}
Expand All @@ -145,7 +149,9 @@ const WalletSignBottomSheet = forwardRef(
}}
enableDynamicSizing
>
<ThemeProvider theme={darkTheme}>
<ThemeProvider
theme={walletSignOpts.theme === 'light' ? lightTheme : darkTheme}
>
<BottomSheetScrollView>
{hasRenderer && !simulated ? (
<WalletSignBottomSheetCompact
Expand Down
Loading

0 comments on commit c4d7185

Please sign in to comment.