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

Release 1.28 #1218

Merged
merged 3 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 21 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "temple-wallet",
"version": "1.27.0",
"version": "1.28.0",
"private": true,
"scripts": {
"start-run": "cross-env TS_NODE_PROJECT=\"webpack/tsconfig.json\" webpack --watch --stats errors-warnings",
Expand Down Expand Up @@ -31,7 +31,7 @@
"audit-deps": "node ./audit-deps.js"
},
"engines": {
"node": ">=18"
"node": ">=20"
},
"dependencies": {
"@apollo/client": "^3.7.2",
Expand Down Expand Up @@ -60,16 +60,16 @@
"@reduxjs/toolkit": "^1.8.5",
"@rnw-community/shared": "^0.48.0",
"@svgr/webpack": "6.4.0",
"@taquito/ledger-signer": "20.0.0",
"@taquito/local-forging": "20.0.0",
"@taquito/michel-codec": "20.0.0",
"@taquito/michelson-encoder": "20.0.0",
"@taquito/rpc": "20.0.0",
"@taquito/signer": "20.0.0",
"@taquito/taquito": "20.0.0",
"@taquito/tzip12": "20.0.0",
"@taquito/tzip16": "20.0.0",
"@taquito/utils": "20.0.0",
"@taquito/ledger-signer": "20.1.0",
"@taquito/local-forging": "20.1.0",
"@taquito/michel-codec": "20.1.0",
"@taquito/michelson-encoder": "20.1.0",
"@taquito/rpc": "20.1.0",
"@taquito/signer": "20.1.0",
"@taquito/taquito": "20.1.0",
"@taquito/tzip12": "20.1.0",
"@taquito/tzip16": "20.1.0",
"@taquito/utils": "20.1.0",
"@temple-wallet/dapp": "5.0.2",
"@temple-wallet/jest-webextension-mock": "^4.1.0",
"@temple-wallet/save-remote-file-webpack-plugin": "^1.1.3",
Expand Down Expand Up @@ -114,7 +114,7 @@
"autoprefixer": "10.4.2",
"axios": "^1.7.4",
"babel-loader": "8.2.5",
"bignumber.js": "9.1.0",
"bignumber.js": "9.1.2",
"bip39": "3.0.4",
"bs58check": "2.1.2",
"buffer": "5.6.0",
Expand Down Expand Up @@ -219,18 +219,19 @@
"resolutions": {
"tslib": "^2.4.0",
"@types/react": "18.0.15",
"@taquito/taquito": "20.0.0",
"@taquito/utils": "20.0.0",
"@taquito/beacon-wallet": "20.0.0",
"@taquito/contracts-library": "20.0.0",
"@taquito/tzip16": "20.0.0",
"bignumber.js": "9.1.0",
"@types/react-dev-utils/@types/webpack-dev-server": "^4",
"@taquito/taquito": "20.1.0",
"@taquito/utils": "20.1.0",
"@taquito/beacon-wallet": "20.1.0",
"@taquito/contracts-library": "20.1.0",
"@taquito/tzip16": "20.1.0",
"bignumber.js": "9.1.2",
"eslint-plugin-import": "^2.29.0",
"graphql-request": "^6.1.0",
"json5": "^2.2.2",
"follow-redirects": "^1.15.4"
},
"optionalDependencies": {
"@temple-wallet/extension-ads": "9.0.0-dev.2"
"@temple-wallet/extension-ads": "9.1.0"
}
}
6 changes: 3 additions & 3 deletions src/app/hooks/use-swap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useCallback } from 'react';
import { BigNumber } from 'bignumber.js';

import { Route3Token } from 'lib/apis/route3/fetch-route3-tokens';
import { Route3LiquidityBakingChains, Route3SwapChains } from 'lib/route3/interfaces';
import { Route3SwapHops, Route3LiquidityBakingHops } from 'lib/route3/interfaces';
import { useAccount, useTezos } from 'lib/temple/front';
import { getSwapTransferParams } from 'lib/utils/swap.utils';

Expand All @@ -17,14 +17,14 @@ export const useSwap = () => {
toRoute3Token: Route3Token,
inputAmountAtomic: BigNumber,
minimumReceivedAtomic: BigNumber,
chains: Route3SwapChains | Route3LiquidityBakingChains
hops: Route3SwapHops | Route3LiquidityBakingHops
) =>
getSwapTransferParams(
fromRoute3Token,
toRoute3Token,
inputAmountAtomic,
minimumReceivedAtomic,
chains,
hops,
tezos,
publicKeyHash
),
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/Staking/MyStake.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,5 +182,5 @@ export const MyStakeTab = memo(() => {
const CYCLES_LOOKUP_URLS: StringRecord = {
[ChainIds.MAINNET]: 'https://tzkt.io/cycles',
[ChainIds.ITHACANET2]: 'https://ghostnet.tzkt.io/cycles',
[ChainIds.PARISNET]: 'https://parisnet.tzkt.io/cycles'
[ChainIds.PARISCNET]: 'https://parisnet.tzkt.io/cycles'
};
2 changes: 1 addition & 1 deletion src/app/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const persistConfigBlacklist: (keyof RootState)[] = SLICES_BLACKLIST;
const persistedReducer = persistReducer<RootState>(
{
key: 'temple-root',
version: 3,
version: 4,
...storageConfig,
stateReconciler: autoMergeLevel2,
blacklist: persistConfigBlacklist,
Expand Down
19 changes: 19 additions & 0 deletions src/app/store/migrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { isCollectible } from 'lib/metadata';

import { collectiblesMetadataInitialState } from './collectibles-metadata/state';
import type { RootState } from './root-state.type';
import { DEFAULT_SWAP_PARAMS } from './swap/state.mock';

import type { SLICES_BLACKLIST } from './index';

Expand Down Expand Up @@ -80,6 +81,24 @@ export const MIGRATIONS: MigrationManifest = {
}
};

return newState;
},

'4': (persistedState: PersistedState) => {
if (!persistedState) return persistedState;

const typedPersistedState = persistedState as TypedPersistedRootState;
const newState: TypedPersistedRootState = {
...typedPersistedState,
swap: {
...typedPersistedState.swap,
swapParams: {
data: DEFAULT_SWAP_PARAMS,
isLoading: false
}
}
};

return newState;
}
};
4 changes: 2 additions & 2 deletions src/app/store/root-state.reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { dAppsReducer } from './d-apps/reducers';
import { newsletterReducers } from './newsletter/newsletter-reducers';
import { partnersPromotionPersistedReducer } from './partners-promotion/reducers';
import { settingsReducer } from './settings/reducers';
import { swapReducer } from './swap/reducers';
import { swapPersistedReducer } from './swap/reducers';
import { tokensMetadataReducer } from './tokens-metadata/reducers';

const rootStateReducersMap = {
Expand All @@ -23,7 +23,7 @@ const rootStateReducersMap = {
currency: currencyReducer,
notifications: notificationsReducer,
dApps: dAppsReducer,
swap: swapReducer,
swap: swapPersistedReducer,
partnersPromotion: partnersPromotionPersistedReducer,
balances: balancesReducer,
assets: assetsPersistedReducer,
Expand Down
16 changes: 13 additions & 3 deletions src/app/store/swap/reducers.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { createReducer } from '@reduxjs/toolkit';
import { persistReducer } from 'redux-persist';

import { createEntity } from 'lib/store';
import { createEntity, storageConfig } from 'lib/store';

import { loadSwapDexesAction, loadSwapParamsAction, loadSwapTokensAction, resetSwapParamsAction } from './actions';
import { swapInitialState } from './state';
import { swapInitialState, SwapState } from './state';
import { DEFAULT_SWAP_PARAMS } from './state.mock';

export const swapReducer = createReducer(swapInitialState, builder => {
const swapReducer = createReducer(swapInitialState, builder => {
builder.addCase(loadSwapTokensAction.submit, state => {
state.tokens = createEntity([...state.tokens.data], true);
});
Expand Down Expand Up @@ -38,3 +39,12 @@ export const swapReducer = createReducer(swapInitialState, builder => {
state.swapParams = createEntity(DEFAULT_SWAP_PARAMS, false, payload);
});
});

export const swapPersistedReducer = persistReducer<SwapState>(
{
key: 'root.swap',
...storageConfig,
blacklist: ['swapParams']
},
swapReducer
);
2 changes: 2 additions & 0 deletions src/app/store/swap/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ export const useSwapParamsSelector = () => useSelector(state => state.swap.swapP
export const useSwapTokensSelector = () => useSelector(state => state.swap.tokens);
export const useSwapTokenSelector = (slug: string) =>
useSelector(state => getRoute3TokenBySlug(state.swap.tokens.data, slug));
// TODO: use this selector to display a route
// ts-prune-ignore-next
export const useSwapDexesSelector = () => useSelector(state => state.swap.dexes);
8 changes: 4 additions & 4 deletions src/app/store/swap/state.mock.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Route3SwapParamsResponse } from 'lib/route3/interfaces';
import { createEntity } from 'lib/store';
import { createEntity, mockPersistedState } from 'lib/store';

import type { SwapState } from './state';

export const DEFAULT_SWAP_PARAMS: Route3SwapParamsResponse = { input: undefined, output: undefined, chains: [] };
export const DEFAULT_SWAP_PARAMS: Route3SwapParamsResponse = { input: undefined, output: undefined, hops: [] };

export const mockSwapState: SwapState = {
export const mockSwapState = mockPersistedState<SwapState>({
swapParams: createEntity(DEFAULT_SWAP_PARAMS),

dexes: createEntity([]),
tokens: createEntity([])
};
});
4 changes: 2 additions & 2 deletions src/app/templates/SwapForm/SwapForm.tippy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { t } from 'lib/i18n';
import { SWAP_CASHBACK_PERCENT } from 'lib/route3/constants';
import { SWAP_CASHBACK_RATIO } from 'lib/route3/constants';

export const feeInfoTippyProps = {
trigger: 'mouseenter',
Expand All @@ -11,6 +11,6 @@ export const feeInfoTippyProps = {
export const cashbackInfoTippyProps = {
trigger: 'mouseenter',
hideOnClick: false,
content: t('swapCashbackDescription', [SWAP_CASHBACK_PERCENT]) as string,
content: t('swapCashbackDescription', String(SWAP_CASHBACK_RATIO * 100)),
animation: 'shift-away-subtle'
};
Loading
Loading