Skip to content

Commit

Permalink
Merge pull request #788 from secretkeylabs/release/v0.29.1
Browse files Browse the repository at this point in the history
release: v0.29.1 to main
  • Loading branch information
yknl authored Feb 8, 2024
2 parents 6fbad7b + 286ac33 commit a7d723b
Show file tree
Hide file tree
Showing 20 changed files with 139 additions and 94 deletions.
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "xverse-web-extension",
"description": "A Bitcoin wallet for Web3",
"version": "0.29.0",
"version": "0.29.1",
"private": true,
"engines": {
"node": "^18.18.2"
Expand All @@ -11,7 +11,7 @@
"@phosphor-icons/react": "^2.0.10",
"@react-spring/web": "^9.6.1",
"@scure/btc-signer": "1.2.1",
"@secretkeylabs/xverse-core": "9.1.2",
"@secretkeylabs/xverse-core": "10.0.0",
"@stacks/connect": "7.4.1",
"@stacks/stacks-blockchain-api-types": "6.1.1",
"@stacks/transactions": "6.9.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function TransactionSummary({
inputs={inputs}
isPartialTransaction={isPartialTransaction}
onShowInscription={setInscriptionToShow}
netAmount={(netAmount + (feeOutput?.amount ?? 0)) * -1}
netAmount={-netAmount}
/>

<ReceiveSection
Expand Down
1 change: 0 additions & 1 deletion src/app/components/seedPhraseView/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Eye from '@assets/img/createPassword/Eye.svg';
import { useMemo } from 'react';
import styled from 'styled-components';
import SeedPhraseWord from './word';

Expand Down
4 changes: 3 additions & 1 deletion src/app/components/seedPhraseView/word.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ function SeedPhraseWord({ index, word }: Props) {
return (
<Container>
<OrdinalNumber>{index + 1}.</OrdinalNumber>
<SeedWord key={word}>{word}</SeedWord>
<SeedWord key={word} translate="no">
{word}
</SeedWord>
</Container>
);
}
Expand Down
23 changes: 23 additions & 0 deletions src/app/hooks/useChromeLocalStorage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { chromeLocalStorage } from '@utils/chromeStorage';
import { useEffect, useState } from 'react';

export const useChromeLocalStorage = <T extends unknown>(key: string, defaultValue?: T) => {
const [value, setValueState] = useState<T | undefined>(undefined);

useEffect(() => {
setValueState(undefined);
chromeLocalStorage.getItem<T>(key).then((result) => {
const newValue = result === undefined ? defaultValue : result;
setValueState(newValue);
});
}, [key]);

const setValue = (newValue: T) => {
chromeLocalStorage.setItem(key, newValue);
setValueState(newValue);
};

return [value, setValue] as const;
};

export default useChromeLocalStorage;
4 changes: 2 additions & 2 deletions src/app/hooks/useSeedVault.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ const cryptoUtilsAdapter: CryptoUtilsAdapter = {
};

const secureStorageAdapter: StorageAdapter = {
get: async (key: string) => chromeSessionStorage.getItem<string>(key),
get: async (key: string) => chromeSessionStorage.getItem<string, null>(key, null),
set: async (key: string, value: string) => chromeSessionStorage.setItem(key, value),
remove: async (key: string) => chromeSessionStorage.removeItem(key),
};

const commonStorageAdapter: StorageAdapter = {
get: async (key: string) => chromeLocalStorage.getItem<string>(key),
get: async (key: string) => chromeLocalStorage.getItem<string, null>(key, null),
set: async (key: string, value: string) => chromeLocalStorage.setItem(key, value),
remove: async (key: string) => chromeLocalStorage.removeItem(key),
};
Expand Down
2 changes: 1 addition & 1 deletion src/app/screens/backupWalletSteps/verifySeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export default function VerifySeed({
</Heading>
<WordGrid>
{quiz.words.map((word) => (
<WordButton key={word} onClick={handleClickWord} value={word}>
<WordButton key={word} onClick={handleClickWord} value={word} translate="no">
{word}
</WordButton>
))}
Expand Down
48 changes: 0 additions & 48 deletions src/app/screens/connect/btcSelectAddressScreen/helper.ts

This file was deleted.

15 changes: 10 additions & 5 deletions src/app/screens/connect/btcSelectAddressScreen/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import useBtcAddressRequest from '@hooks/useBtcAddressRequest';
import useWalletSelector from '@hooks/useWalletSelector';
import { animated, useTransition } from '@react-spring/web';
import SelectAccount from '@screens/connect/selectAccount';
import { getAppIconFromWebManifest } from '@secretkeylabs/xverse-core';
import { StickyHorizontalSplitButtonContainer } from '@ui-library/common.styled';
import { useCallback, useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
Expand All @@ -15,7 +16,6 @@ import { AddressPurpose } from 'sats-connect';
import styled from 'styled-components';
import AddressPurposeBox from '../addressPurposeBox';
import PermissionsList from '../permissionsList';
import { getAppIconFromWebManifest } from './helper';

const OuterContainer = styled.div((props) => ({
display: 'flex',
Expand Down Expand Up @@ -144,10 +144,15 @@ function BtcSelectAddressScreen() {
(async () => {
if (origin !== '') {
setIsLoadingIcon(true);
getAppIconFromWebManifest(origin).then((appIcons) => {
setAppIcon(appIcons);
setIsLoadingIcon(false);
});
getAppIconFromWebManifest(origin)
.then((appIcons) => {
setAppIcon(appIcons);
setIsLoadingIcon(false);
})
.catch(() => {
setIsLoadingIcon(false);
setAppIcon('');
});
}
})();

Expand Down
8 changes: 4 additions & 4 deletions src/app/screens/nftDashboard/rareSatsTabGridItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ function RareSatsTabGridItem({ bundle, maxItems }: { bundle: Bundle; maxItems: n

return icons.map((sats, index) => (
<Range key={`${bundle.satRanges[index].block}-${bundle.satRanges[index].offset}`}>
{sats.map((sattribute, indexSatributes) => {
if (sattribute === 'ellipsis') {
{sats.map((satribute, indexSatributes) => {
if (satribute === 'ellipsis') {
return (
<DotsThree
key={`${totalTilesDisplayed}-ellipsis`}
Expand All @@ -96,7 +96,7 @@ function RareSatsTabGridItem({ bundle, maxItems }: { bundle: Bundle; maxItems: n
);
}

if (sattribute === '+X') {
if (satribute === '+X') {
return (
<TileText key={`${totalTilesDisplayed}-+X`} typography="body_m">
+{totalTiles - totalTilesDisplayed}
Expand All @@ -105,7 +105,7 @@ function RareSatsTabGridItem({ bundle, maxItems }: { bundle: Bundle; maxItems: n
}
return (
// eslint-disable-next-line react/no-array-index-key
<RareSatIcon key={`${sattribute}-${indexSatributes}`} type={sattribute} size={24} />
<RareSatIcon key={`${satribute}-${indexSatributes}`} type={satribute} size={24} />
);
})}
</Range>
Expand Down
2 changes: 1 addition & 1 deletion src/app/screens/ordinalDetail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ function OrdinalDetailScreen() {
const stributesBadges = showSatributes && (
<SatributesBadgeContainer isGallery={isGalleryOpen}>
<StyledP typography="body_medium_m" color="white_400">
{commonT('SATTRIBUTES')}
{commonT('SATRIBUTES')}
</StyledP>
<SatributesBadges isGallery={isGalleryOpen}>
{ordinalSatributes.map((satribute, index) => {
Expand Down
22 changes: 20 additions & 2 deletions src/app/screens/settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import ArrowIcon from '@assets/img/settings/arrow.svg';
import XverseLogo from '@assets/img/settings/logo.svg';
import PasswordInput from '@components/passwordInput';
import BottomBar from '@components/tabBar';
import useChromeLocalStorage from '@hooks/useChromeLocalStorage';
import useSeedVault from '@hooks/useSeedVault';
import useWalletReducer from '@hooks/useWalletReducer';
import useWalletSelector from '@hooks/useWalletSelector';
Expand All @@ -11,6 +12,7 @@ import {
ChangeActivateRareSatsAction,
ChangeActivateRBFAction,
} from '@stores/wallet/actions/actionCreators';
import { chromeLocalStorageKeys } from '@utils/chromeLocalStorage';
import { PRIVACY_POLICY_LINK, SUPPORT_LINK, TERMS_LINK } from '@utils/constants';
import { isInOptions, isLedgerAccount } from '@utils/helper';
import { useState } from 'react';
Expand Down Expand Up @@ -67,6 +69,10 @@ function Setting() {
hasActivatedRBFKey,
selectedAccount,
} = useWalletSelector();
const [isPriorityWallet, setIsPriorityWallet] = useChromeLocalStorage<boolean>(
chromeLocalStorageKeys.isPriorityWallet,
true,
);
const navigate = useNavigate();
const dispatch = useDispatch();
const { resetWallet } = useWalletReducer();
Expand Down Expand Up @@ -100,6 +106,10 @@ function Setting() {
navigate('/backup-wallet');
};

const switchIsPriorityWallet = () => {
setIsPriorityWallet(!isPriorityWallet);
};

const switchActivateOrdinalState = () => {
dispatch(ChangeActivateOrdinalsAction(!hasActivatedOrdinalsKey));
// disable rare sats if ordinal is disabled
Expand Down Expand Up @@ -202,6 +212,7 @@ function Setting() {
onClick={openChangeNetworkScreen}
textDetail={network.type}
/>

<SettingComponent
title={t('SECURITY')}
text={t('UPDATE_PASSWORD')}
Expand All @@ -226,6 +237,7 @@ function Setting() {
onClick={openResetWalletPrompt}
showWarningTitle
/>

<SettingComponent
title={t('ADVANCED')}
text={t('ACTIVATE_ORDINAL_NFTS')}
Expand All @@ -241,7 +253,6 @@ function Setting() {
showDivider
disabled={!hasActivatedOrdinalsKey}
/>

<SettingComponent
text={t('ENABLE_RARE_SATS')}
description={t('ENABLE_RARE_SATS_DETAIL')}
Expand All @@ -251,7 +262,14 @@ function Setting() {
disabled={!hasActivatedOrdinalsKey}
showDivider
/>

<SettingComponent
text={t('XVERSE_DEFAULT')}
description={t('XVERSE_DEFAULT_DESCRIPTION')}
toggle
toggleFunction={switchIsPriorityWallet}
toggleValue={isPriorityWallet}
showDivider
/>
<SettingComponent
text={t('ENABLE_SPEED_UP_TRANSACTIONS')}
description={t('ENABLE_SPEED_UP_TRANSACTIONS_DETAIL')}
Expand Down
1 change: 1 addition & 0 deletions src/app/screens/signatureRequest/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ function SignatureRequest(): JSX.Element {
const signature = await handleBip322LedgerMessageSigning({
transport,
addressIndex: selectedAccount.deviceAccountIndex,
address: payload.address,
networkType: network.type,
message: payload.message,
});
Expand Down
13 changes: 13 additions & 0 deletions src/app/utils/chromeLocalStorage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { chromeLocalStorage } from './chromeStorage';

export const chromeLocalStorageKeys = {
isPriorityWallet: 'isPriorityWallet',
};

export async function getIsPriorityWallet(): Promise<boolean> {
const isPriorityWallet = await chromeLocalStorage.getItem<boolean>(
chromeLocalStorageKeys.isPriorityWallet,
);

return isPriorityWallet ?? true;
}
Loading

0 comments on commit a7d723b

Please sign in to comment.