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

fix: styles for inscription options #6039

Merged
merged 1 commit into from
Dec 23, 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
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,13 @@ export function Inscription({ inscription }: InscriptionProps) {
<Box position="relative" {...bind}>
<Box opacity={hasInscriptionBeenDiscarded(inscription) ? 0.5 : 1}>{content}</Box>
{isHovered && (
<Box bg="ink.background-primary" right="space.03" top="space.03" zIndex="90">
<Box
bg="ink.background-primary"
position="absolute"
right="space.03"
top="space.03"
zIndex="90"
>
<DropdownMenu.Root>
<DropdownMenu.Trigger>
<IconButton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
useGetTaprootUtxosByAddressQuery,
utxosToBalance,
} from '@leather.io/query';
import { isString } from '@leather.io/utils';

import { useCurrentAccountIndex } from '@app/store/accounts/account';
import {
Expand All @@ -33,6 +34,7 @@ export function useInscriptions({ xpubs }: UseInscriptionArgs) {

export function useNumberOfInscriptionsOnUtxo() {
const xpubs = useCurrentBitcoinAccountXpubs();

const inscriptionQueries = useInscriptions({ xpubs });

// Unsafe as implementation doesn't wait for all results to be successful,
Expand All @@ -47,7 +49,8 @@ export function useCurrentNativeSegwitInscriptions() {
const client = useBitcoinClient();
const nativeSegwitXpub = useCurrentBitcoinAccountNativeSegwitXpub();
return useQuery({
...createInscriptionByXpubQuery(client, nativeSegwitXpub),
...createInscriptionByXpubQuery(client, nativeSegwitXpub ?? ''),
enabled: isString(nativeSegwitXpub),
select(data) {
return data.data.map(createBestInSlotInscription);
},
Expand Down
8 changes: 5 additions & 3 deletions src/app/store/accounts/blockchain/bitcoin/bitcoin.hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
import { extractAddressIndexFromPath } from '@leather.io/crypto';
import { bitcoinNetworkToNetworkMode } from '@leather.io/models';
import { PaymentTypes } from '@leather.io/rpc';
import { isNumber, isUndefined } from '@leather.io/utils';
import { isNumber, isString, isUndefined } from '@leather.io/utils';

import {
BitcoinInputSigningConfig,
Expand Down Expand Up @@ -289,17 +289,19 @@ export function useSignBitcoinTx() {

export function useCurrentBitcoinAccountNativeSegwitXpub() {
const nativeSegwitAccount = useCurrentNativeSegwitAccount();
if (!nativeSegwitAccount) return null;
return `wpkh(${nativeSegwitAccount?.keychain.publicExtendedKey})`;
}

function useCurrentBitcoinAccountTaprootXpub() {
const taprootAccount = useCurrentTaprootAccount();
if (!taprootAccount) return null;
return `tr(${taprootAccount?.keychain.publicExtendedKey})`;
}

export function useCurrentBitcoinAccountXpubs() {
const taprootXpub = useCurrentBitcoinAccountTaprootXpub();
const nativeSegwitXpub = useCurrentBitcoinAccountNativeSegwitXpub();

return [taprootXpub, nativeSegwitXpub];
// Not sure why this type cast is necessary, but thinks its string | null without
return [taprootXpub, nativeSegwitXpub].filter(xpub => isString(xpub)) as string[];
}
5 changes: 4 additions & 1 deletion tests/specs/ledger/ledger.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ test.describe('App with Ledger', () => {

await homePage.page.getByTestId(SettingsSelectors.CurrentAccountDisplayName).click();

test.expect(async () => await test.expect(requestPromise).rejects.toThrowError());
await test
.expect(async () => await test.expect(requestPromise).rejects.toThrowError())
.toPass()
.catch();
});
}

Expand Down
Loading