Skip to content

Commit

Permalink
fix: styles for inscription options
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranjamie committed Dec 23, 2024
1 parent 0f55fc9 commit d3955fe
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
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

0 comments on commit d3955fe

Please sign in to comment.