Skip to content

Commit

Permalink
Merge branch 'develop' into @christian/performance-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
christianbaroni committed Jan 7, 2025
2 parents 5809c11 + f9f0e84 commit 59cb998
Show file tree
Hide file tree
Showing 13 changed files with 76 additions and 19 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/)

### Fixed

## [1.9.52] (https://github.com/rainbow-me/rainbow/releases/tag/v1.9.52)

### Fixed

- Fixed a bug where back up sheet kept showing for imported wallets (#6377)
- Fixed an issue with isSwappingToTrendingAsset flag not tracking events properly (#6378)
- Fixed an issue where the icon sheet was not showing up correctly, and we now prioritize back up sheet before the icon sheet (#6379)

## [1.9.51] (https://github.com/rainbow-me/rainbow/releases/tag/v1.9.51)

### Added
Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ android {
applicationId "me.rainbow"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 246
versionName "1.9.52"
versionCode 247
versionName "1.9.53"
missingDimensionStrategy 'react-native-camera', 'general'
renderscriptTargetApi 23
renderscriptSupportModeEnabled true
Expand Down
8 changes: 4 additions & 4 deletions ios/Rainbow.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1883,7 +1883,7 @@
"$(PROJECT_DIR)",
);
LLVM_LTO = YES;
MARKETING_VERSION = 1.9.52;
MARKETING_VERSION = 1.9.53;
OTHER_CFLAGS = "$(inherited)";
OTHER_LDFLAGS = (
"$(inherited)",
Expand Down Expand Up @@ -1951,7 +1951,7 @@
"$(PROJECT_DIR)",
);
LLVM_LTO = YES;
MARKETING_VERSION = 1.9.52;
MARKETING_VERSION = 1.9.53;
OTHER_CFLAGS = "$(inherited)";
OTHER_LDFLAGS = (
"$(inherited)",
Expand Down Expand Up @@ -2072,7 +2072,7 @@
"$(PROJECT_DIR)",
);
LLVM_LTO = YES;
MARKETING_VERSION = 1.9.52;
MARKETING_VERSION = 1.9.53;
OTHER_CFLAGS = "$(inherited)";
OTHER_LDFLAGS = (
"$(inherited)",
Expand Down Expand Up @@ -2192,7 +2192,7 @@
"$(PROJECT_DIR)",
);
LLVM_LTO = YES;
MARKETING_VERSION = 1.9.52;
MARKETING_VERSION = 1.9.53;
OTHER_CFLAGS = "$(inherited)";
OTHER_LDFLAGS = (
"$(inherited)",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Rainbow",
"version": "1.9.52-1",
"version": "1.9.53-1",
"private": true,
"scripts": {
"setup": "yarn graphql-codegen:install && yarn ds:install && yarn allow-scripts && yarn graphql-codegen && yarn fetch:networks",
Expand Down Expand Up @@ -224,7 +224,7 @@
"react-native-branch": "5.3.1",
"react-native-change-icon": "4.0.0",
"react-native-circular-progress": "1.3.8",
"react-native-cloud-fs": "rainbow-me/react-native-cloud-fs#9b204615b76cf3d29bd86a9094dbd95d717b6a7a",
"react-native-cloud-fs": "rainbow-me/react-native-cloud-fs#d73f055c441566e5a57eebd621da8df3cf2499bb",
"react-native-crypto": "2.2.0",
"react-native-dark-mode": "0.2.2",
"react-native-device-info": "5.3.1",
Expand Down
8 changes: 8 additions & 0 deletions src/analytics/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ export const event = {
wcNewSessionApproved: 'Approved new WalletConnect session',
wcShowingSigningRequest: 'Showing Walletconnect signing request',

wcRequestFailed: 'wc.failed_request',

nftOffersOpenedOffersSheet: 'Opened NFT Offers Sheet',
nftOffersOpenedSingleOfferSheet: 'Opened NFT Single Offer Sheet',
nftOffersViewedExternalOffer: 'Viewed external NFT Offer',
Expand Down Expand Up @@ -375,6 +377,12 @@ export type EventProperties = {
dappName: string;
dappUrl: string;
};
[event.wcRequestFailed]: {
type: 'session_proposal' | 'session_request' | 'read only wallet' | 'method not supported' | 'invalid namespaces' | 'dapp browser';
reason: string;
method?: string;
};

[event.nftOffersOpenedOffersSheet]: {
entryPoint: string;
};
Expand Down
2 changes: 1 addition & 1 deletion src/appIcons/appIcons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const ZORB_NFT_ADDRESS: EthereumAddress = '0x12e4527e2807978a49469f8d757abf5e07b
const POOLBOY_NFT_ADDRESS: EthereumAddress = '0xf25298fa62a2eb94fc06626966f6f21399b4c508';

// adworld app icon unlocking NFTs
const ADWORLD_NFT_ADDRESS: EthereumAddress = '0x6171f829e107f70b58d67594c6b62a7d3eb7f23b';
const ADWORLD_NFT_ADDRESS: EthereumAddress = '0x87073e9a3f85bb59821bb01acf0e8fde92891e4e';

// farcaster app icon unlocking NFTs
const FARCASTER_NFT_ADDRESS: EthereumAddress = '0x76843c8f8a369d29c719141a065ff561abe2420b';
Expand Down
5 changes: 3 additions & 2 deletions src/handlers/cloudBackup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@ export type GoogleDriveUserData = {
avatarUrl?: string;
};

export async function getGoogleAccountUserData(): Promise<GoogleDriveUserData | undefined> {
export async function getGoogleAccountUserData(checkPermissions = false): Promise<GoogleDriveUserData | undefined> {
if (!IS_ANDROID) {
return;
}
return RNCloudFs.getCurrentlySignedInUserData();
const options = { checkPermissions };
return RNCloudFs.getCurrentlySignedInUserData(options);
}

// This is used for dev purposes only!
Expand Down
10 changes: 9 additions & 1 deletion src/screens/NoNeedWCSheet.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as lang from '@/languages';
import React, { useCallback } from 'react';
import React, { useCallback, useEffect } from 'react';
import { Centered } from '../components/layout';
import { Sheet, SheetActionButton } from '../components/sheet';
import { Text } from '../components/text';
Expand All @@ -9,6 +9,7 @@ import { useTheme } from '@/theme';
import { Colors } from '../styles/colors';
import { Box } from '@/design-system';
import { useRoute } from '@react-navigation/native';
import { analyticsV2 } from '@/analytics';

const BodyText = styled(Text).attrs(({ theme: { colors } }: { theme: { colors: Colors } }) => ({
align: 'center',
Expand All @@ -25,6 +26,13 @@ const WalletConnectRedirectSheet = () => {
const { goBack } = useNavigation();
const { params } = useRoute();

useEffect(() => {
analyticsV2.track(analyticsV2.event.wcRequestFailed, {
type: 'dapp browser',
reason: 'tried to connect with WalletConnect in the dapp browser',
});
}, []);

const handleOnPress = useCallback(() => {
(params as { cb?: () => void })?.cb?.();
goBack();
Expand Down
2 changes: 1 addition & 1 deletion src/screens/SignTransactionSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ export const SignTransactionSheet = () => {
logger.error(new RainbowError('[SignTransactionSheet]: error estimating gas'), { error });
}
// clean gas prices / fees sent from the dapp
const cleanTxPayload = omitFlatten(txPayload, ['gasPrice', 'maxFeePerGas', 'maxPriorityFeePerGas']);
const cleanTxPayload = omitFlatten(txPayload, ['gasPrice', 'maxFeePerGas', 'maxPriorityFeePerGas', 'extParams']);
const gasParams = parseGasParamsForTransaction(selectedGasFee);
const calculatedGasLimit = gas || gasLimitFromPayload || gasLimit;

Expand Down
12 changes: 11 additions & 1 deletion src/state/backups/backups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const backupsStore = createRainbowStore<BackupsStore>((set, get) => ({
}

if (IS_ANDROID) {
const gdata = await getGoogleAccountUserData();
const gdata = await getGoogleAccountUserData(true);
if (!gdata) {
logger.debug('[backupsStore]: Google account is not available');
set({ backupProvider: undefined, status: CloudBackupState.NotAvailable, backups: { files: [] }, mostRecentBackup: undefined });
Expand Down Expand Up @@ -145,6 +145,16 @@ export const backupsStore = createRainbowStore<BackupsStore>((set, get) => ({
error: e,
});
set({ status: CloudBackupState.FailedToInitialize });

// See https://developers.google.com/android/reference/com/google/android/gms/auth/api/signin/GoogleSignInStatusCodes#public-static-final-int-sign_in_cancelled
const stringifiedError = JSON.stringify(e);
if (stringifiedError.includes('12501')) {
logger.warn('[backupsStore]: Google sign in / oauth cancelled');
return {
success: false,
retry: false,
};
}
}

return {
Expand Down
2 changes: 2 additions & 0 deletions src/utils/ethereumUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,8 @@ const calculateL1FeeOptimism = async (
delete newTx?.from;
// @ts-expect-error gas is not in type RainbowTransaction
delete newTx?.gas;
// @ts-expect-error extParams is not in type RainbowTransaction
delete newTx?.extParams;

// contract call will fail if these are passed
delete newTx.maxPriorityFeePerGas;
Expand Down
22 changes: 21 additions & 1 deletion src/walletConnect/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { toUtf8String } from '@ethersproject/strings';
import { logger, RainbowError } from '@/logger';
import Navigation, { getActiveRoute } from '@/navigation/Navigation';
import Routes from '@/navigation/routesNames';
import { analyticsV2 as analytics } from '@/analytics';
import { analyticsV2 as analytics, analyticsV2 } from '@/analytics';
import { maybeSignUri } from '@/handlers/imgix';
import Alert from '@/components/alerts/Alert';
import * as lang from '@/languages';
Expand Down Expand Up @@ -541,6 +541,8 @@ export async function onSessionProposal(proposal: WalletKitTypes.SessionProposal
reason: 'INVALID_SESSION_SETTLE_REQUEST',
});

analyticsV2.track(analyticsV2.event.wcRequestFailed, { type: `invalid namespaces`, reason: namespaces.error.message });

showErrorSheet({
title: lang.t(T.errors.generic_title),
body: `${lang.t(T.errors.namespaces_invalid)} \n \n ${namespaces.error.message}`,
Expand Down Expand Up @@ -650,6 +652,11 @@ export async function onSessionRequest(event: SignClientTypes.EventArguments['se
message,
});

analyticsV2.track(analyticsV2.event.wcRequestFailed, {
type: 'session_request',
reason: 'session_request exited, signing request had no address and/or messsage',
});

await client.respondSessionRequest({
topic,
response: formatJsonRpcError(id, `Invalid RPC params`),
Expand Down Expand Up @@ -680,6 +687,11 @@ export async function onSessionRequest(event: SignClientTypes.EventArguments['se

const errorMessageBody = isReadOnly ? lang.t(T.errors.read_only_wallet_on_signing_method) : lang.t(T.errors.generic_error);

analyticsV2.track(analyticsV2.event.wcRequestFailed, {
type: 'read only wallet',
reason: 'session_request exited, selectedWallet was falsy or read only',
});

await client.respondSessionRequest({
topic,
response: formatJsonRpcError(id, `Wallet is read-only`),
Expand All @@ -703,6 +715,8 @@ export async function onSessionRequest(event: SignClientTypes.EventArguments['se
if (!session) {
logger.error(new RainbowError(`[walletConnect]: session_request topic was not found`));

analyticsV2.track(analyticsV2.event.wcRequestFailed, { type: 'session_request', reason: 'session_request topic was not found' });

await client.respondSessionRequest({
topic,
response: formatJsonRpcError(id, `Session not found`),
Expand Down Expand Up @@ -768,6 +782,12 @@ export async function onSessionRequest(event: SignClientTypes.EventArguments['se
method,
});

analyticsV2.track(analyticsV2.event.wcRequestFailed, {
type: `method not supported`,
reason: 'received unsupported session_request RPC method',
method: method,
});

try {
await client.respondSessionRequest({
topic,
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8874,7 +8874,7 @@ __metadata:
react-native-branch: "npm:5.3.1"
react-native-change-icon: "npm:4.0.0"
react-native-circular-progress: "npm:1.3.8"
react-native-cloud-fs: "rainbow-me/react-native-cloud-fs#9b204615b76cf3d29bd86a9094dbd95d717b6a7a"
react-native-cloud-fs: "rainbow-me/react-native-cloud-fs#d73f055c441566e5a57eebd621da8df3cf2499bb"
react-native-crypto: "npm:2.2.0"
react-native-dark-mode: "npm:0.2.2"
react-native-device-info: "npm:5.3.1"
Expand Down Expand Up @@ -22272,10 +22272,10 @@ __metadata:
languageName: node
linkType: hard

"react-native-cloud-fs@rainbow-me/react-native-cloud-fs#9b204615b76cf3d29bd86a9094dbd95d717b6a7a":
"react-native-cloud-fs@rainbow-me/react-native-cloud-fs#d73f055c441566e5a57eebd621da8df3cf2499bb":
version: 2.6.2
resolution: "react-native-cloud-fs@https://github.com/rainbow-me/react-native-cloud-fs.git#commit=9b204615b76cf3d29bd86a9094dbd95d717b6a7a"
checksum: 10c0/db1c719b90475201aa1e1177209723598ac38689a827d387dd281ea5190ad09f3e6c8fee77caff70b46a228b6552459d9a9e73e4159c18a29d19d235e17d7907
resolution: "react-native-cloud-fs@https://github.com/rainbow-me/react-native-cloud-fs.git#commit=d73f055c441566e5a57eebd621da8df3cf2499bb"
checksum: 10c0/0d78db6a3978bf9a0fe485d2dc0cf80fb1185a63eec1d22d7e3afd6c693417b011779d8318c603a9a81ff6c9c67f194dd469fc16a220ac0cd2b9b1ec374f1e2b
languageName: node
linkType: hard

Expand Down

0 comments on commit 59cb998

Please sign in to comment.