Skip to content

Commit

Permalink
fix merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
brunobar79 committed Nov 19, 2024
2 parents 84004e8 + 9bf4998 commit 71cb10f
Show file tree
Hide file tree
Showing 39 changed files with 384 additions and 425 deletions.
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,41 @@ and this project adheres to [Semantic Versioning](http://semver.org/)

### Fixed

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

### Added

- Upgraded to new notifications endpoint for notifications v2 (#6190, #6223, #6229, #6251)
- Added option to sort NFTs by ascending and descending (#6068)
- We added isHardwareWallet to swap analytic events (#6238)

### Changed

- Featured results now uses redirect_url for recents (#6203)
- Removed direct usage of web3Provider (#6200)
- Now using backend endpoint for determining output based quotes for Swaps v2 (#6212)
- We now navigate back to last screen after swap confirmation (#6207)
- ChainSelector row is now fixed at top of list in swaps v2 (#6206)
- Removed all of WC v1 (#6214)
- Removed unused references and did updates to ExplainSheet (#6222)
- Removed Swaps v1 code (#6181, #6250)
- Updated featured results to use native card styling (#6246)
- We now exclude hardware wallet related transactions from TTS tracking (#6247)
- We are now subtracting hidden assets from total wallet balances (#6205)
- We converted discover screen content to typescript (#6226)

### Fixed

- Fixed broken context menus on asset expanded state in search results (#6209)
- Fixed a bug with positions total value display (#6185)
- Fixed CI build issues (#6232, #6225, #6244, #6248)
- Fixed a crash with animated inputs (#6227)
- Fixed a bug where balance would show as NaN value (#6239)
- Fixed transaction details not showing native asset symbol but always showing ETH instead (#6245)
- Fixed a bug where an empty account balances prevents a swap from being done (#6243)
- Fixed a bug where Apecoin wasn’t being set as the inputAsset when set as the preferred network (#6252)
- Fixed a bug where change wallet sheet was missing balance value (#6253)

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

### Fixed
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 238
versionName "1.9.45"
versionCode 239
versionName "1.9.46"
missingDimensionStrategy 'react-native-camera', 'general'
renderscriptTargetApi 23
renderscriptSupportModeEnabled true
Expand Down
25 changes: 25 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1876,6 +1876,27 @@ PODS:
- TOCropViewController (2.7.4)
- ToolTipMenu (5.2.1):
- React
- TurboHaptics (1.0.4):
- DoubleConversion
- glog
- hermes-engine
- RCT-Folly (= 2024.01.01.00)
- RCTRequired
- RCTTypeSafety
- React-Codegen
- React-Core
- React-debug
- React-Fabric
- React-featureflags
- React-graphics
- React-ImageManager
- React-NativeModulesApple
- React-RCTFabric
- React-rendererdebug
- React-utils
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- VisionCamera (4.4.2):
- VisionCamera/Core (= 4.4.2)
- VisionCamera/React (= 4.4.2)
Expand Down Expand Up @@ -2035,6 +2056,7 @@ DEPENDENCIES:
- TcpSockets (from `../node_modules/react-native-tcp`)
- TOCropViewController (~> 2.7.4)
- ToolTipMenu (from `../node_modules/react-native-tooltip`)
- TurboHaptics (from `../node_modules/react-native-turbo-haptics`)
- VisionCamera (from `../node_modules/react-native-vision-camera`)
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)

Expand Down Expand Up @@ -2345,6 +2367,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-tcp"
ToolTipMenu:
:path: "../node_modules/react-native-tooltip"
TurboHaptics:
:path: "../node_modules/react-native-turbo-haptics"
VisionCamera:
:path: "../node_modules/react-native-vision-camera"
Yoga:
Expand Down Expand Up @@ -2524,6 +2548,7 @@ SPEC CHECKSUMS:
TcpSockets: bd31674146c0931a064fc254a59812dfd1a73ae0
TOCropViewController: 80b8985ad794298fb69d3341de183f33d1853654
ToolTipMenu: 8ac61aded0fbc4acfe7e84a7d0c9479d15a9a382
TurboHaptics: 6381613d33ab97aeb30d9b15c3df94dc616a25e4
VisionCamera: 2af28201c3de77245f8c58b7a5274d5979df70df
Yoga: 04f1db30bb810187397fa4c37dd1868a27af229c

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 @@ -1870,7 +1870,7 @@
"$(PROJECT_DIR)",
);
LLVM_LTO = YES;
MARKETING_VERSION = 1.9.45;
MARKETING_VERSION = 1.9.46;
OTHER_CFLAGS = "$(inherited)";
OTHER_LDFLAGS = (
"$(inherited)",
Expand Down Expand Up @@ -1935,7 +1935,7 @@
"$(PROJECT_DIR)",
);
LLVM_LTO = YES;
MARKETING_VERSION = 1.9.45;
MARKETING_VERSION = 1.9.46;
OTHER_CFLAGS = "$(inherited)";
OTHER_LDFLAGS = (
"$(inherited)",
Expand Down Expand Up @@ -2053,7 +2053,7 @@
"$(PROJECT_DIR)",
);
LLVM_LTO = YES;
MARKETING_VERSION = 1.9.45;
MARKETING_VERSION = 1.9.46;
OTHER_CFLAGS = "$(inherited)";
OTHER_LDFLAGS = (
"$(inherited)",
Expand Down Expand Up @@ -2170,7 +2170,7 @@
"$(PROJECT_DIR)",
);
LLVM_LTO = YES;
MARKETING_VERSION = 1.9.45;
MARKETING_VERSION = 1.9.46;
OTHER_CFLAGS = "$(inherited)";
OTHER_LDFLAGS = (
"$(inherited)",
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Rainbow",
"version": "1.9.45-1",
"version": "1.9.46-1",
"private": true,
"scripts": {
"setup": "yarn graphql-codegen:install && yarn ds:install && yarn allow-scripts && yarn postinstall && yarn graphql-codegen && yarn fetch:networks",
Expand Down Expand Up @@ -272,6 +272,7 @@
"react-native-text-size": "rainbow-me/react-native-text-size#15b21c9f88c6df0d1b5e0f2ba792fe59b5dc255a",
"react-native-tooltip": "rainbow-me/react-native-tooltip#e0e88d212b5b7f350e5eabba87f588a32e0f2590",
"react-native-tooltips": "rainbow-me/react-native-tooltips#fdafbc7ba33ee231229f5d3f58b29d0d1c55ddfa",
"react-native-turbo-haptics": "1.0.4",
"react-native-udp": "2.7.0",
"react-native-url-polyfill": "2.0.0",
"react-native-version-number": "0.3.6",
Expand Down
32 changes: 14 additions & 18 deletions src/__swaps__/screens/Swap/components/SearchInputButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import React, { useCallback } from 'react';
import { GestureHandlerButton } from './GestureHandlerButton';
import { AnimatedText, Box } from '@/design-system';
import Animated, { SharedValue, runOnJS, useAnimatedStyle, useDerivedValue, withTiming } from 'react-native-reanimated';
import { triggerHaptics } from 'react-native-turbo-haptics';
import { NavigationSteps, useSwapContext } from '@/__swaps__/screens/Swap/providers/swap-provider';
import Clipboard from '@react-native-clipboard/clipboard';
import { useSwapsStore } from '@/state/swaps/swapsStore';
import * as i18n from '@/languages';
import { THICK_BORDER_WIDTH } from '../constants';
import { useClipboard } from '@/hooks';
import { TIMING_CONFIGS } from '@/components/animations/animationConfigs';
import { triggerHapticFeedback } from '@/screens/points/constants';
import { IS_ANDROID } from '@/env';

const CANCEL_LABEL = i18n.t(i18n.l.button.cancel);
Expand Down Expand Up @@ -54,22 +54,14 @@ export const SearchInputButton = ({
return PASTE_LABEL;
});

const onPaste = useCallback(
(isPasteDisabled: boolean) => {
if (isPasteDisabled) {
triggerHapticFeedback('notificationError');
return;
}

Clipboard.getString().then(text => {
// Slice the pasted text to the length of an ETH address
const v = text.trim().slice(0, 42);
pastedSearchInputValue.value = v;
useSwapsStore.setState({ outputSearchQuery: v });
});
},
[pastedSearchInputValue]
);
const onPaste = useCallback(() => {
Clipboard.getString().then(text => {
// Slice the pasted text to the length of an ETH address
const v = text.trim().slice(0, 42);
pastedSearchInputValue.value = v;
useSwapsStore.setState({ outputSearchQuery: v });
});
}, [pastedSearchInputValue]);

const buttonInfo = useDerivedValue(() => {
const isInputSearchFocused = inputProgress.value === NavigationSteps.SEARCH_FOCUSED;
Expand Down Expand Up @@ -106,7 +98,11 @@ export const SearchInputButton = ({
onPressWorklet={() => {
'worklet';
if (output && outputProgress.value === NavigationSteps.TOKEN_LIST_FOCUSED && !internalSelectedOutputAsset.value) {
runOnJS(onPaste)(buttonInfo.value.isPasteDisabled);
if (buttonInfo.value.isPasteDisabled) {
triggerHaptics('notificationError');
} else {
runOnJS(onPaste)();
}
}

if (isSearchFocused.value || (output && internalSelectedOutputAsset.value) || (!output && internalSelectedInputAsset.value)) {
Expand Down
14 changes: 3 additions & 11 deletions src/__swaps__/screens/Swap/components/SwapBottomPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,15 @@ import { Box, Separator, globalColors, useColorMode } from '@/design-system';
import React from 'react';
import { StyleSheet } from 'react-native';
import { PanGestureHandler } from 'react-native-gesture-handler';
import Animated, {
Easing,
runOnJS,
useAnimatedStyle,
useDerivedValue,
useSharedValue,
withSpring,
withTiming,
} from 'react-native-reanimated';
import Animated, { Easing, useAnimatedStyle, useDerivedValue, useSharedValue, withSpring, withTiming } from 'react-native-reanimated';
import { triggerHaptics } from 'react-native-turbo-haptics';
import { useBottomPanelGestureHandler } from '../hooks/useBottomPanelGestureHandler';
import { GasButton } from './GasButton';
import { GasPanel } from './GasPanel';
import { ReviewPanel } from './ReviewPanel';
import { SwapActionButton } from './SwapActionButton';
import { SettingsPanel } from './SettingsPanel';
import { SPRING_CONFIGS } from '@/components/animations/animationConfigs';
import { triggerHapticFeedback } from '@/screens/points/constants';

const HOLD_TO_SWAP_DURATION_MS = 400;

Expand Down Expand Up @@ -123,7 +115,7 @@ export function SwapBottomPanel() {
onLongPressWorklet={() => {
'worklet';
if (type.value === 'hold') {
runOnJS(triggerHapticFeedback)('notificationSuccess');
triggerHaptics('notificationSuccess');
SwapNavigation.handleSwapAction();
}
}}
Expand Down
8 changes: 4 additions & 4 deletions src/__swaps__/screens/Swap/components/SwapSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import Animated, {
withSpring,
withTiming,
} from 'react-native-reanimated';
import { triggerHaptics } from 'react-native-turbo-haptics';
import { SPRING_CONFIGS, TIMING_CONFIGS } from '@/components/animations/animationConfigs';
import { AnimatedText, Bleed, Box, Column, Columns, Inline, globalColors, useColorMode, useForegroundColor } from '@/design-system';
import { IS_IOS } from '@/env';
import { triggerHapticFeedback } from '@/screens/points/constants';
import { greaterThanWorklet } from '@/safe-math/SafeMath';
import {
SCRUBBER_WIDTH,
Expand Down Expand Up @@ -124,10 +124,10 @@ export const SwapSlider = ({
(current, previous) => {
if (current !== previous && SwapInputController.inputMethod.value === 'slider') {
if (current.x >= width * 0.995 && previous?.x && previous?.x < width * 0.995) {
runOnJS(triggerHapticFeedback)('impactMedium');
triggerHaptics('impactMedium');
}
if (current.x < width * 0.005 && previous?.x && previous?.x >= width * 0.005) {
runOnJS(triggerHapticFeedback)('impactLight');
triggerHaptics('impactLight');
}
}
},
Expand Down Expand Up @@ -160,7 +160,7 @@ export const SwapSlider = ({
ctx.exceedsMax = true;
isQuoteStale.value = 1;
sliderXPosition.value = width * 0.999;
runOnJS(triggerHapticFeedback)('impactMedium');
triggerHaptics('impactMedium');
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/__swaps__/screens/Swap/hooks/useSwapEstimatedGasLimit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { useQuery } from '@tanstack/react-query';

import { ParsedSearchAsset } from '@/__swaps__/types/assets';
import { ChainId } from '@/chains/types';
import { estimateUnlockAndCrosschainSwap } from '@/raps/unlockAndCrosschainSwap';
import { estimateUnlockAndSwap } from '@/raps/unlockAndSwap';
import { estimateUnlockAndCrosschainSwap } from '@/raps/actions/crosschainSwap';
import { estimateUnlockAndSwap } from '@/raps/actions/swap';
import { QueryConfigWithSelect, QueryFunctionArgs, QueryFunctionResult, createQueryKey } from '@/react-query';
import { gasUnits } from '@/references/gasUnits';

Expand Down
8 changes: 4 additions & 4 deletions src/__swaps__/screens/Swap/hooks/useSwapInputsController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ import {
externalTokenQueryKey,
fetchExternalToken,
} from '@/resources/assets/externalAssetsQuery';
import { triggerHapticFeedback } from '@/screens/points/constants';
import { swapsStore } from '@/state/swaps/swapsStore';
import { CrosschainQuote, Quote, QuoteError, getCrosschainQuote, getQuote } from '@rainbow-me/swaps';
import { useCallback } from 'react';
import { SharedValue, runOnJS, runOnUI, useAnimatedReaction, useDerivedValue, useSharedValue, withSpring } from 'react-native-reanimated';
import { triggerHaptics } from 'react-native-turbo-haptics';
import { useDebouncedCallback } from 'use-debounce';
import { NavigationSteps } from './useSwapNavigation';
import { deepEqualWorklet } from '@/worklets/comparisons';
Expand Down Expand Up @@ -496,7 +496,7 @@ export function useSwapInputsController({
? Number(
convertRawAmountToDecimalFormat(
quoteResponse.sellAmount.toString(),
inputAsset?.networks[inputAsset.chainId]?.decimals || inputAsset?.decimals || 18
inputAsset?.networks[inputAsset.chainId]?.decimals ?? inputAsset?.decimals ?? 18
)
)
: undefined;
Expand All @@ -506,7 +506,7 @@ export function useSwapInputsController({
? Number(
convertRawAmountToDecimalFormat(
quoteResponse.buyAmountMinusFees.toString(),
outputAsset?.networks[outputAsset.chainId]?.decimals || outputAsset?.decimals || 18
outputAsset?.networks[outputAsset.chainId]?.decimals ?? outputAsset?.decimals ?? 18
)
)
: undefined;
Expand Down Expand Up @@ -584,7 +584,7 @@ export function useSwapInputsController({
const exceedsMax = maxSwappableAmount ? greaterThanWorklet(currentInputValue, maxSwappableAmount) : false;

if (isAlreadyMax) {
runOnJS(triggerHapticFeedback)('impactMedium');
triggerHaptics('impactMedium');
} else {
quoteFetchingInterval.stop();

Expand Down
7 changes: 6 additions & 1 deletion src/__swaps__/screens/Swap/providers/swap-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ import { queryClient } from '@/react-query';
import { userAssetsQueryKey } from '@/resources/assets/UserAssetsQuery';
import { userAssetsStore } from '@/state/assets/userAssets';
import { swapsStore } from '@/state/swaps/swapsStore';
import { getNextNonce } from '@/state/nonces';

import { haptics } from '@/utils';
import { CrosschainQuote, Quote, QuoteError, SwapType } from '@rainbow-me/swaps';

Expand Down Expand Up @@ -202,7 +204,7 @@ export const SwapProvider = ({ children }: SwapProviderProps) => {

const provider =
parameters.flashbots && supportedFlashbotsChainIds.includes(parameters.chainId)
? await getFlashbotsProvider()
? getFlashbotsProvider()
: getProvider({ chainId: parameters.chainId });
const connectedToHardhat = useConnectedToHardhatStore.getState().connectedToHardhat;

Expand Down Expand Up @@ -261,6 +263,8 @@ export const SwapProvider = ({ children }: SwapProviderProps) => {
}

const chainId = connectedToHardhat ? ChainId.hardhat : parameters.chainId;
const nonce = await getNextNonce({ address: parameters.quote.from, chainId });

const { errorMessage } = await performanceTracking.getState().executeFn({
fn: walletExecuteRap,
screen: Screens.SWAPS,
Expand All @@ -270,6 +274,7 @@ export const SwapProvider = ({ children }: SwapProviderProps) => {
},
})(wallet, type, {
...parameters,
nonce,
chainId,
gasParams,
// @ts-expect-error - collision between old gas types and new
Expand Down
Loading

0 comments on commit 71cb10f

Please sign in to comment.