Skip to content

Commit

Permalink
Update query for send screen
Browse files Browse the repository at this point in the history
  • Loading branch information
cypt4 committed Oct 30, 2024
1 parent 4089537 commit b91a414
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion components/brave_wallet/common/brave_wallet.mojom
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,7 @@ struct BlockchainToken {
string coingecko_id = "";
string chain_id;
CoinType coin;
bool is_shielded = false; // Zcash only, markes whether asset belongs to the shielded pool.
bool is_shielded = false; // Zcash only, marks whether asset belongs to the shielded pool.
};

struct AllowanceInfo {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,18 +159,22 @@ export const SendScreen = React.memo((props: Props) => {

const tokenId = query.get('tokenId')

const isShielded = query.get('isShielded') === 'true'

return userVisibleTokensInfo.find((token) =>
tokenId
? token.chainId === networkFromParams.chainId &&
token.contractAddress.toLowerCase() ===
contractOrSymbol.toLowerCase() &&
token.tokenId === tokenId
token.tokenId === tokenId &&
token.isShielded === isShielded
: (token.chainId === networkFromParams.chainId &&
token.contractAddress.toLowerCase() ===
contractOrSymbol.toLowerCase()) ||
(token.chainId === networkFromParams.chainId &&
token.contractAddress === '' &&
token.symbol.toLowerCase() === contractOrSymbol.toLowerCase())
token.symbol.toLowerCase() === contractOrSymbol.toLowerCase()) &&
token.isShielded === isShielded
)
}, [userVisibleTokensInfo, query, networkFromParams])

Expand Down
11 changes: 8 additions & 3 deletions components/brave_wallet_ui/utils/routes-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,15 @@ export const makeSendRoute = (
token: asset.contractAddress || asset.symbol.toUpperCase(),
account: account.accountId.uniqueKey
}

const tokenIdQueryParams = asset.tokenId
? { ...baseQueryParams, tokenId: asset.tokenId }
: baseQueryParams

const params = new URLSearchParams(
asset.tokenId
? { ...baseQueryParams, tokenId: asset.tokenId }
: baseQueryParams
asset.isShielded
? {...tokenIdQueryParams, isShielded: 'true'}
: tokenIdQueryParams
)

if (isNftTab) {
Expand Down

0 comments on commit b91a414

Please sign in to comment.