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

Asset select fallback to account address #238

Merged
merged 1 commit into from
Dec 10, 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
2 changes: 1 addition & 1 deletion packages/ui-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@unstoppabledomains/ui-components",
"version": "0.0.52-browser-extension.4",
"version": "0.0.52-browser-extension.5",
"private": true,
"description": "An open and reusable suite of Unstoppable Domains management components",
"keywords": [
Expand Down
15 changes: 10 additions & 5 deletions packages/ui-components/src/lib/wallet/asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import config from '@unstoppabledomains/config';
import {notifyEvent} from '../error';
import {TokenType} from '../types';
import type {AccountAsset} from '../types/fireBlocks';
import type { TokenEntry} from '../types/wallet';
import type {TokenEntry} from '../types/wallet';
import {SUPPORTED_SIGNING_SYMBOLS} from '../types/wallet';

export const getAsset = (
Expand Down Expand Up @@ -43,14 +43,19 @@ export const getAsset = (
);
}

// use default blockchain symbol
return (
// find by address on default signing asset
const defaultAsset =
a.blockchainAsset.blockchain.id.toLowerCase() ===
config.WALLETS.SIGNATURE_SYMBOL.split('/')[0].toLowerCase() &&
a.blockchainAsset.symbol.toLowerCase() ===
config.WALLETS.SIGNATURE_SYMBOL.split('/')[1].toLowerCase() &&
a.address.toLowerCase() === opts?.address?.toLowerCase()
);
a.address.toLowerCase() === opts?.address?.toLowerCase();
if (defaultAsset) {
return defaultAsset;
}

// find by address on any asset
return a.address.toLowerCase() === opts?.address?.toLowerCase();
});

// fallback to first element if asset is not found, and no options have
Expand Down
Loading