Merge branch 'develop' of github.com:secretkeylabs/xverse-web-extension-private into release/v0.48.0

This commit is contained in:
Denys Hriaznov
2025-01-17 09:21:42 +01:00
8 changed files with 62 additions and 29 deletions

View File

@@ -1,4 +1,4 @@
Copyright Secret Key Labs Limited 2024. All rights reserved.
Copyright Secret Key Labs Limited 2025. All rights reserved.
You acknowledge and agree that Secret Key Labs Limited own all legal right, title and interest in and to the work, software, application, source code, documentation and any other documents in this repository (collectively, the “Program”), including any intellectual property rights which subsist in the Program (whether those rights happen to be registered or not, and wherever in the world those rights may exist), whether in source code or any other form.

View File

@@ -1,6 +1,6 @@
{
"name": "xverse-web-extension",
"description": "A Bitcoin wallet for Web3",
"description": "The Bitcoin Wallet for everyone",
"version": "0.48.0",
"private": true,
"engines": {
@@ -32,6 +32,7 @@
"tsc-files --noEmit src/styled.d.ts src/react-app-env.d.ts"
],
"*.json": [
"node scripts/pin_all_deps.js",
"prettier --write"
]
},

View File

@@ -8,21 +8,46 @@
*/
const fs = require('fs');
const packageLock = require('../package-lock.json');
const packageJson = require('../package.json');
const path = require('path');
const { execSync } = require('child_process');
for (const packageName in packageJson.dependencies) {
const installedPathKey = `node_modules/${packageName}`;
if (packageJson.dependencies.hasOwnProperty(packageName) && packageLock.packages[installedPathKey]) {
packageJson.dependencies[packageName] = packageLock.packages[installedPathKey].version;
const packageJsonPath = path.resolve(__dirname, '../package.json');
const packageJson = require(packageJsonPath);
const allDependenciesVersions = Object.values(packageJson.dependencies).concat(
Object.values(packageJson.devDependencies),
);
// if any version has a ^ or ~, we need to pin it, otherwise we can skip
const hasUnpinnedVersions = allDependenciesVersions.some(
(version) => version.startsWith('^') || version.startsWith('~'),
);
if (hasUnpinnedVersions) {
const packages = require('../package-lock.json').packages;
for (const packageName in packageJson.dependencies) {
const installedVersion = packages[`node_modules/${packageName}`].version;
if (packageJson.dependencies.hasOwnProperty(packageName) && installedVersion) {
packageJson.dependencies[packageName] = installedVersion;
}
}
}
for (const packageName in packageJson.devDependencies) {
const installedPathKey = `node_modules/${packageName}`;
if (packageJson.devDependencies.hasOwnProperty(packageName) && packageLock.packages[installedPathKey]) {
packageJson.devDependencies[packageName] = packageLock.packages[installedPathKey].version;
for (const packageName in packageJson.devDependencies) {
const installedVersion = packages[`node_modules/${packageName}`].version;
if (packageJson.devDependencies.hasOwnProperty(packageName) && installedVersion) {
packageJson.devDependencies[packageName] = installedVersion;
}
}
}
fs.writeFileSync('../package.json', JSON.stringify(packageJson, null, 2));
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2), 'utf8');
// Run npm install to update package-lock.json
console.log('Running npm install to update package-lock.json...');
execSync('npm install', { stdio: 'inherit' });
// execSync('git add package.json package-lock.json', { stdio: 'inherit' });
console.log('Successfully pinned all dependency versions');
} else {
console.log('All dependencies are already pinned to exact versions');
}

View File

@@ -221,6 +221,7 @@ function ManageTokens() {
disabled={false}
toggled={toggled}
enabled={coin.isEnabled}
protocol={selectedProtocol}
/>
))}
{!coins.length && <ErrorsText>{t('NO_COINS')}</ErrorsText>}

View File

@@ -18,7 +18,10 @@ const useFromTokens = (toToken?: FungibleToken) => {
const filteredTokens = toToken
? sortedTokens.filter(
(token) => token.principal !== toToken.ticker && toToken.protocol === token.protocol,
(token) =>
token.principal !== toToken.ticker &&
token.principal !== toToken.principal &&
toToken.protocol === token.protocol,
)
: sortedTokens;

View File

@@ -113,7 +113,7 @@ export default function QuoteSummary({
} = usePlaceUtxoOrder();
useEffect(() => {
if (true) {
if (placeOrderError || placeUtxoOrderError) {
onError(placeOrderError ?? placeUtxoOrderError ?? '');
}
}, [placeOrderError, placeUtxoOrderError]);
@@ -299,11 +299,9 @@ export default function QuoteSummary({
.toFixed(2);
})();
const showBadQuoteWarning =
quote.slippageSupported &&
new BigNumber(toTokenFiatValue).isLessThan(
new BigNumber(fromTokenFiatValue).multipliedBy(BAD_QUOTE_PERCENTAGE),
);
const showBadQuoteWarning = new BigNumber(toTokenFiatValue).isLessThan(
new BigNumber(fromTokenFiatValue).multipliedBy(BAD_QUOTE_PERCENTAGE),
);
const valueLossPercentage = new BigNumber(fromTokenFiatValue)
.minus(new BigNumber(toTokenFiatValue))
.dividedBy(new BigNumber(fromTokenFiatValue))
@@ -330,9 +328,13 @@ export default function QuoteSummary({
<CalloutContainer>
<Callout
titleText={t('SWAP_SCREEN.BAD_QUOTE_WARNING_TITLE')}
bodyText={t('SWAP_SCREEN.BAD_QUOTE_WARNING_DESC', {
percentage: valueLossPercentage,
})}
bodyText={
quote.slippageSupported && BigNumber(toTokenFiatValue).isGreaterThan(0)
? t('SWAP_SCREEN.BAD_QUOTE_WARNING_DESC', {
percentage: valueLossPercentage,
})
: t('SWAP_SCREEN.UNKNOWN_QUOTE_VALUE_WARNING_DESC')
}
variant="warning"
/>
</CalloutContainer>

View File

@@ -1528,7 +1528,8 @@
"LIST_YOUR_RUNES": "List your Runes on a marketplace",
"SLIPPAGE_WARNING": "Your transaction may be frontrun and result in an unfavorable trade",
"BAD_QUOTE_WARNING_TITLE": "The quote you are receiving may result in significant value loss.",
"BAD_QUOTE_WARNING_DESC": "The minimum amount you will receive will result in a loss of over {{percentage}}% of your trades value. This is due to low liquidity in the pool, causing discrepancies in pricing. Please review the details carefully before proceeding with the swap."
"BAD_QUOTE_WARNING_DESC": "The minimum amount you will receive will result in a loss of over {{percentage}}% of your trades value. This is due to low liquidity in the pool, causing discrepancies in pricing. Please review the details carefully before proceeding with the swap.",
"UNKNOWN_QUOTE_VALUE_WARNING_DESC": "The market value of the token you will receive is unknown. Review details carefully before proceeding with the swap."
},
"SWAP_CONFIRM_SCREEN": {
"TOKEN_SWAP": "Token swap",

View File

@@ -1,12 +1,12 @@
{
"name": "Xverse Wallet",
"description": "A Bitcoin Wallet for Web3",
"name": "Xverse Wallet: Buy Bitcoin",
"description": "Ordinals, Runes, NFTs & DeFi",
"manifest_version": 3,
"options_page": "options.html",
"action": {
"default_popup": "popup.html",
"default_icon": "xverse_icon.png",
"default_title": "Xverse Wallet"
"default_title": "Xverse Wallet: Buy Bitcoin"
},
"chrome_url_overrides": {},
"background": {