fix: Issues with 1.1.0-rc (#328)

* bump(rust): Toolchain to 1.82

* bump(tauri): Bump some Tauri peer-dependencies

* fix(gui): Prefer maker with known version, bump MIN_ASB_VERSION to 1.1.0-rc.3

* amend: CHANGELOG.md
This commit is contained in:
Mohan 2025-05-19 12:43:27 +02:00 committed by GitHub
parent 0c4de7e4cd
commit e66881d6eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 411 additions and 538 deletions

View file

@ -24,7 +24,7 @@
"@tauri-apps/api": "^2.0.0",
"@tauri-apps/plugin-cli": "^2.0.0",
"@tauri-apps/plugin-clipboard-manager": "^2.0.0",
"@tauri-apps/plugin-opener": "^2.2.5",
"@tauri-apps/plugin-opener": "^2.0.0",
"@tauri-apps/plugin-process": "^2.0.0",
"@tauri-apps/plugin-shell": "^2.0.0",
"@tauri-apps/plugin-store": "^2.0.0",

View file

@ -7,9 +7,9 @@ import {
SatsAmount,
} from "renderer/components/other/Units";
import { getMarkup, satsToBtc, secondsToDays } from "utils/conversionUtils";
import { isMakerOutdated } from 'utils/multiAddrUtils';
import { isMakerOutdated, isMakerVersionOutdated } from 'utils/multiAddrUtils';
import WarningIcon from '@material-ui/icons/Warning';
import { useAppSelector } from "store/hooks";
import { useAppSelector, useMakerVersion } from "store/hooks";
import IdentIcon from "renderer/components/icons/IdentIcon";
const useStyles = makeStyles((theme) => ({

View file

@ -3,7 +3,8 @@ import { Multiaddr } from "multiaddr";
import semver from "semver";
import { isTestnet } from "store/config";
const MIN_ASB_VERSION = "1.0.0-alpha.1"
// const MIN_ASB_VERSION = "1.0.0-alpha.1" // First version to support new libp2p protocol
const MIN_ASB_VERSION = "1.1.0-rc.3" // First version with support for bdk > 1.0
export function providerToConcatenatedMultiAddr(provider: Maker) {
return new Multiaddr(provider.multiAddr)
@ -17,13 +18,19 @@ export function isMakerOnCorrectNetwork(
return provider.testnet === isTestnet();
}
export function isMakerOutdated(provider: ExtendedMakerStatus): boolean {
if (provider.version != null) {
if (semver.satisfies(provider.version, `>=${MIN_ASB_VERSION}`))
return false;
} else {
return false;
export function isMakerOutdated(maker: ExtendedMakerStatus): boolean {
if (maker.version != null) {
if (isMakerVersionOutdated(maker.version))
return true;
}
return true;
// Do not mark a maker as outdated if it doesn't have a version
return false;
}
export function isMakerVersionOutdated(version: string): boolean {
// This checks if the version is less than the minimum version
// we use .compare(...) instead of .satisfies(...) because satisfies(...)
// does not work with pre-release versions
return semver.compare(version, MIN_ASB_VERSION) === -1;
}

View file

@ -1,31 +1,29 @@
import { ExtendedMakerStatus } from "models/apiModel";
import { isMakerOnCorrectNetwork, isMakerOutdated } from "./multiAddrUtils";
import _ from 'lodash';
export function sortMakerList(list: ExtendedMakerStatus[]) {
return list
return _(list)
// Filter out makers that are on the wrong network (testnet / mainnet)
.filter(isMakerOnCorrectNetwork)
.concat()
// Sort by criteria
.sort((firstEl, secondEl) => {
// If either provider is outdated, prioritize the one that isn't
if (isMakerOutdated(firstEl) && !isMakerOutdated(secondEl)) return 1;
if (!isMakerOutdated(firstEl) && isMakerOutdated(secondEl)) return -1;
// If neither of them have a relevancy score or they are the same, sort by price
if (firstEl.relevancy == secondEl.relevancy) {
return firstEl.price - secondEl.price;
}
// If only one of the two doesn't have a relevancy score, prioritize the one that does
if (firstEl.relevancy == null) return 1;
if (secondEl.relevancy == null) return -1;
// Otherwise, sort by relevancy score
return secondEl.relevancy - firstEl.relevancy;
})
// Remove duplicate makers
.filter((provider, index, self) =>
index === self.findIndex((p) => p.peerId === provider.peerId)
.orderBy(
[
// Prefer makers that have a 'version' attribute
// If we don't have a version, we cannot clarify if it's outdated or not
m => (m.version ? 0 : 1),
// Prefer makers that are not outdated
m => (isMakerOutdated(m) ? 1 : 0),
// Prefer makers that have a relevancy score
m => (m.relevancy == null ? 1 : 0),
// Prefer makers with a higher relevancy score
m => -(m.relevancy ?? 0),
// Prefer makers with a lower price
m => m.price
],
['asc', 'asc', 'asc', 'asc', 'asc']
)
// Remove duplicate makers
.uniqBy(m => m.peerId)
.value();
}

View file

@ -850,10 +850,10 @@
dependencies:
"@tauri-apps/api" "^2.0.0"
"@tauri-apps/plugin-opener@^2.2.5":
version "2.2.5"
resolved "https://registry.yarnpkg.com/@tauri-apps/plugin-opener/-/plugin-opener-2.2.5.tgz#928b917d28d3e8b5bafb90f5f91fb0ed20c27fd4"
integrity sha512-hHsJ9RPWpZvZEPVFaL+d25gABMUMOf/A6ESXnvf/ii9guTukj58WXsAE/SOysXRIhej7kseRCxnOnIMpSCdUsQ==
"@tauri-apps/plugin-opener@^2.0.0":
version "2.2.6"
resolved "https://registry.yarnpkg.com/@tauri-apps/plugin-opener/-/plugin-opener-2.2.6.tgz#a4dc328541708d40e3bb969231974353a4ad6983"
integrity sha512-bSdkuP71ZQRepPOn8BOEdBKYJQvl6+jb160QtJX/i2H9BF6ZySY/kYljh76N2Ne5fJMQRge7rlKoStYQY5Jq1w==
dependencies:
"@tauri-apps/api" "^2.0.0"