Skip to content

Commit

Permalink
Merge pull request #5838 from leather-io/release/chivalrous-pigeon
Browse files Browse the repository at this point in the history
release: chivalrous-pigeon
  • Loading branch information
pete-watters authored Sep 3, 2024
2 parents 91dc5bc + 9d52d9e commit b14acdc
Show file tree
Hide file tree
Showing 18 changed files with 165 additions and 81 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
"@leather.io/query": "2.7.0",
"@leather.io/stacks": "1.0.2",
"@leather.io/tokens": "0.9.0",
"@leather.io/ui": "1.14.3",
"@leather.io/ui": "1.16.0",
"@leather.io/utils": "0.13.2",
"@ledgerhq/hw-transport-webusb": "6.27.19",
"@noble/hashes": "1.4.0",
Expand Down
20 changes: 10 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions src/app/components/layout/card/components/summary-footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,16 @@ interface SummaryFooterProps {
export function SummaryFooter({ onClickLink, onClickCopy }: SummaryFooterProps) {
return (
<HStack gap="space.04" width="100%">
<InfoCardBtn icon={<ExternalLinkIcon />} label="View details" onClick={onClickLink} />
<InfoCardBtn icon={<CopyIcon />} label="Copy ID" onClick={onClickCopy} />
<InfoCardBtn
icon={<ExternalLinkIcon color="ink.background-primary" />}
label="View details"
onClick={onClickLink}
/>
<InfoCardBtn
icon={<CopyIcon color="ink.background-primary" />}
label="Copy ID"
onClick={onClickCopy}
/>
</HStack>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function TransactionItemLayout({
txValue,
}: TransactionItemLayoutProps) {
return (
<Pressable onClick={openTxLink} my="space.02">
<Pressable onClick={openTxLink} p="space.03">
<ItemLayout
flagImg={txIcon && txIcon}
titleLeft={txTitle}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ export function PendingTransactionListLayout({ children }: PendingTransactionLis
<styled.span color="ink.text-subdued" textStyle="body.02">
Pending
</styled.span>
<Stack mt="space.04" pb="space.06">
{children}
</Stack>
<Stack pb="space.06">{children}</Stack>
</>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function SubmittedTransactionListLayout({ children }: SubmittedTransactio
<styled.span textStyle="body.02" color="ink.text-subdued">
Submitted
</styled.span>
<Stack mt="space.04" pb="space.06" gap="space.05">
<Stack pb="space.06" gap="space.05">
{children}
</Stack>
</>
Expand Down
1 change: 1 addition & 0 deletions src/app/features/bitcoin-choose-fee/bitcoin-choose-fee.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export function BitcoinChooseFee({

return (
<Card
border="unset"
footer={
<Box mt="space.05" width="100%">
<AvailableBalance balance={formatMoney(balance.availableBalance)} />
Expand Down
46 changes: 22 additions & 24 deletions src/app/features/container/headers/onboarding.header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,27 @@ export function OnboardingHeader({ hideLogo = false }: OnboardingHeaderProps) {
const navigate = useNavigate();

return (
<>
<Header paddingLeft={{ base: undefined, sm: 0 }}>
<HeaderGrid
leftCol={
<>
<HeaderActionButton
icon={<ArrowLeftIcon />}
onAction={() => navigate(-1)}
dataTestId={SharedComponentsSelectors.HeaderBackBtn}
/>
{!hideLogo && <LogoBox onClick={() => navigate(RouteUrls.Home)} />}
</>
}
rightCol={
<HeaderGridRightCol>
<Settings
triggerButton={<BarsTwoIcon data-testid={SettingsSelectors.SettingsMenuBtn} />}
toggleSwitchAccount={() => setIsShowingSwitchAccount(!isShowingSwitchAccount)}
/>
</HeaderGridRightCol>
}
/>
</Header>
</>
<Header px="space.05">
<HeaderGrid
leftCol={
<>
<HeaderActionButton
icon={<ArrowLeftIcon />}
onAction={() => navigate(-1)}
dataTestId={SharedComponentsSelectors.HeaderBackBtn}
/>
{!hideLogo && <LogoBox onClick={() => navigate(RouteUrls.Home)} />}
</>
}
rightCol={
<HeaderGridRightCol>
<Settings
triggerButton={<BarsTwoIcon data-testid={SettingsSelectors.SettingsMenuBtn} />}
toggleSwitchAccount={() => setIsShowingSwitchAccount(!isShowingSwitchAccount)}
/>
</HeaderGridRightCol>
}
/>
</Header>
);
}
6 changes: 3 additions & 3 deletions src/app/features/container/headers/page.header.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ReactNode } from 'react';
import { useNavigate, useOutletContext } from 'react-router-dom';

import { SettingsSelectors } from '@tests/selectors/settings.selectors';
Expand All @@ -16,7 +17,7 @@ import { LogoBox } from '@app/components/layout/headers/logo-box';
import { Settings } from '@app/features/settings/settings';

interface PageHeaderProps {
title?: string;
title?: ReactNode;
isSummaryPage?: boolean;
isSettingsVisibleOnSm?: boolean;
onBackLocation?: RouteUrls;
Expand All @@ -36,9 +37,8 @@ export function PageHeader({
// pages with nested dialogs specify onBackLocation to prevent navigate(-1) re-opening the dialog
const onGoBack = onBackLocation ? () => navigate(onBackLocation) : () => navigate(-1);
const canGoBack = !isSummaryPage;

return (
<Header>
<Header px={{ base: 'space.04', sm: 'space.00' }}>
<HeaderGrid
leftCol={
<>
Expand Down
12 changes: 10 additions & 2 deletions src/app/pages/rpc-send-transfer/rpc-send-transfer-summary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,16 @@ export function RpcSendTransferSummary() {
</Card>
<InfoCardFooter>
<HStack gap="space.04" width="100%">
<InfoCardBtn icon={<ExternalLinkIcon />} label="View details" onClick={onClickLink} />
<InfoCardBtn icon={<CopyIcon />} label="Copy ID" onClick={onClickCopy} />
<InfoCardBtn
icon={<ExternalLinkIcon color="ink.background-primary" />}
label="View details"
onClick={onClickLink}
/>
<InfoCardBtn
icon={<CopyIcon color="ink.background-primary" />}
label="Copy ID"
onClick={onClickCopy}
/>
</HStack>
</InfoCardFooter>
</>
Expand Down
12 changes: 10 additions & 2 deletions src/app/pages/rpc-sign-psbt/rpc-sign-psbt-summary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,16 @@ export function RpcSignPsbtSummary() {
</Stack>
<InfoCardFooter>
<HStack gap="space.04" width="100%">
<InfoCardBtn icon={<ExternalLinkIcon />} label="View details" onClick={onClickLink} />
<InfoCardBtn icon={<CopyIcon />} label="Copy ID" onClick={onClickCopy} />
<InfoCardBtn
icon={<ExternalLinkIcon color="ink.background-primary" />}
label="View details"
onClick={onClickLink}
/>
<InfoCardBtn
icon={<CopyIcon color="ink.background-primary" />}
label="Copy ID"
onClick={onClickCopy}
/>
</HStack>
</InfoCardFooter>
</Card>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function ChooseCryptoAsset() {

return (
<>
<PageHeader title="Send" isSettingsVisibleOnSm={false} />
<PageHeader isSettingsVisibleOnSm={false} />
<Content>
<Page>
<Card
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,17 @@ export function SendInscriptionReview() {
onClose={() => navigate(RouteUrls.Home)}
>
<Card
border="unset"
contentStyle={{
p: 'space.00',
}}
footer={
<Button
variant="solid"
disabled={isBroadcasting}
aria-busy={isBroadcasting}
onClick={sendInscription}
width="100%"
>
Confirm and send transaction
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,30 @@ export function SendInscriptionSummary() {
return (
<Sheet header={<SheetHeader title="Sent" />} isShowing onClose={() => navigate(RouteUrls.Home)}>
<Card
border="unset"
footer={
<HStack gap="space.04" width="100%">
<InfoCardBtn onClick={onClickLink} icon={<ExternalLinkIcon />} label="View details" />
<InfoCardBtn onClick={onClickCopy} icon={<CopyIcon />} label="Copy ID" />
<InfoCardBtn
onClick={onClickLink}
icon={<ExternalLinkIcon color="ink.background-primary" />}
label="View details"
/>
<InfoCardBtn
onClick={onClickCopy}
icon={<CopyIcon color="ink.background-primary" />}
label="Copy ID"
/>
</HStack>
}
contentStyle={{
p: 'space.00',
}}
>
<Box mt="space.06" px="space.06">
<InscriptionPreviewCard
icon={
<Box mt="space.01">
<CheckmarkIcon height={36} width={36} />
<CheckmarkIcon />
</Box>
}
image={<InscriptionPreview inscription={inscription} />}
Expand Down
27 changes: 9 additions & 18 deletions src/background/messaging/rpc-methods/open.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,21 @@
import { RpcErrorCode } from '@btckit/types';

import { RouteUrls } from '@shared/route-urls';
import { OpenRequest } from '@shared/rpc/methods/open';
import { makeRpcErrorResponse } from '@shared/rpc/rpc-methods';
import { makeRpcSuccessResponse } from '@shared/rpc/rpc-methods';

import {
listenForPopupClose,
makeSearchParamsWithDefaults,
triggerRequestWindowOpen,
} from '../messaging-utils';
import { makeSearchParamsWithDefaults, triggerRequestWindowOpen } from '../messaging-utils';
import { trackRpcRequestSuccess } from '../rpc-message-handler';

export async function rpcOpen(message: OpenRequest, port: chrome.runtime.Port) {
const { urlParams, tabId } = makeSearchParamsWithDefaults(port, [['requestId', message.id]]);
const { id } = await triggerRequestWindowOpen(RouteUrls.Home, urlParams);

await triggerRequestWindowOpen(RouteUrls.Home, urlParams);
void trackRpcRequestSuccess({ endpoint: message.method });

listenForPopupClose({
chrome.tabs.sendMessage(
tabId,
id,
response: makeRpcErrorResponse('open', {
makeRpcSuccessResponse('open', {
id: message.id,
error: {
code: RpcErrorCode.USER_REJECTION,
message: 'User rejected request to open wallet',
},
}),
});
result: { message: 'Success' },
})
);
}
2 changes: 1 addition & 1 deletion src/background/messaging/rpc-methods/supported-methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function rpcSupportedMethods(message: SupportedMethodsRequest, port: chro
methods: [
{
name: 'open',
docsUrl: ['https://leather.gitbook.io/developers/bitcoin/connect-users/open-wallet'],
docsUrl: ['https://leather.gitbook.io/developers/bitcoin/connect-users/open'],
},
{
name: 'getAddresses',
Expand Down
11 changes: 2 additions & 9 deletions src/shared/rpc/methods/open.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
import { DefineRpcMethod, RpcRequest, RpcResponse } from '@btckit/types';
import * as yup from 'yup';

const rpcOpenParamsSchema = yup.object().shape({
url: yup.string(),
});
export type OpenRequest = RpcRequest<'open'>;

type OpenRequestParams = yup.InferType<typeof rpcOpenParamsSchema>;

export type OpenRequest = RpcRequest<'open', OpenRequestParams>;

type OpenResponse = RpcResponse<Response>;
type OpenResponse = RpcResponse<{ message: string }>;

export type Open = DefineRpcMethod<OpenRequest, OpenResponse>;
Loading

0 comments on commit b14acdc

Please sign in to comment.