-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ui): prevent the error of an already connected wallet
- Loading branch information
Showing
6 changed files
with
44 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { PersonalizedWalletInfo } from 'src/app/models/personalized-wallet-info'; | ||
import { isWalletInfoRemote } from '@tonconnect/sdk'; | ||
|
||
export function getUniqueBridges(walletsList: PersonalizedWalletInfo[]): { bridgeUrl: string }[] { | ||
const uniqueBridges = new Set( | ||
walletsList.filter(isWalletInfoRemote).map(item => item.bridgeUrl) | ||
); | ||
return Array.from(uniqueBridges).map(bridgeUrl => ({ bridgeUrl })); | ||
} | ||
|
||
export function bridgesIsEqual( | ||
left: { bridgeUrl: string }[] | null, | ||
right: { bridgeUrl: string }[] | null | ||
): boolean { | ||
const leftSet = new Set(left?.map(i => i.bridgeUrl)); | ||
const rightSet = new Set(right?.map(i => i.bridgeUrl)); | ||
return leftSet.size === rightSet.size && [...leftSet].every(value => rightSet.has(value)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters