Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Rithvik-padma committed Dec 23, 2023
2 parents 0e3f962 + 4555ba5 commit ab9deaf
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 35 deletions.
8 changes: 4 additions & 4 deletions src/app/components/TipCard/index.test.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { render, screen } from "@testing-library/react";
import { MemoryRouter } from "react-router-dom";
import BuyBitcoinTipCardIcon from "~/app/icons/BuyBitcoinTipCardIcon";

import MnemonicTipCardIcon from "~/app/icons/MnemonicTipCardIcon";
import type { Props } from "./index";
import TipCard from "./index";

const props: Props = {
title: "Card Title",
description: "Card description",
handleClose: () => ({}),
arrowClassName: "text-orange-500",
backgroundIcon: <BuyBitcoinTipCardIcon />,
className: "border-orange-500",
arrowClassName: "text-purple-500",
backgroundIcon: <MnemonicTipCardIcon />,
className: "border-purple-500",
};

describe("CloseableCard", () => {
Expand Down
27 changes: 0 additions & 27 deletions src/app/icons/BuyBitcoinTipCardIcon.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/app/router/Welcome/Welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function Layout() {
return (
<div className="flex justify-center items-center min-h-screen">
<div className="w-full">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 mb-4">
<div className="text-center font-serif font-medium text-2xl mt-8 dark:text-white">
<p>
{t("welcome.title")}
Expand Down
2 changes: 1 addition & 1 deletion src/app/screens/Discover/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function Discover() {
<p className="mb-6 text-gray-500 dark:text-neutral-500">
{t("discover.tips.description")}
</p>
<div className="mb-6 flex gap-4">
<div className="mb-6 flex sm:flex-row flex-col gap-4">
<Tips />
</div>
</>
Expand Down
1 change: 0 additions & 1 deletion src/app/screens/connectors/ConnectAlby/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ export default function ConnectAlby() {
disabled={loading}
primary
flex
className="w-64"
onClick={connectAlby}
/>
);
Expand Down
36 changes: 35 additions & 1 deletion src/extension/background-script/connectors/galoy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,21 @@ class Galoy implements Connector {
errors {
message
}
transaction {
settlementVia {
... on SettlementViaLn {
${
this.config.apiCompatibilityMode
? "paymentSecret"
: "preImage"
}
}
... on SettlementViaIntraLedger {
counterPartyUsername
counterPartyWalletId
}
}
}
}
}
`,
Expand All @@ -295,6 +310,25 @@ class Galoy implements Connector {
throw new Error(errs[0].message || JSON.stringify(errs));
}

const transaction = data.lnInvoicePaymentSend.transaction;
let preimageMessage = "No preimage received";

if (transaction && transaction.settlementVia) {
if (
"preImage" in transaction.settlementVia ||
"paymentSecret" in transaction.settlementVia
) {
preimageMessage =
transaction.settlementVia.preImage ||
transaction.settlementVia.paymentSecret;
} else if (
"counterPartyUsername" in transaction.settlementVia ||
"counterPartyWalletId" in transaction.settlementVia
) {
preimageMessage = "No preimage, the payment was settled intraledger";
}
}

switch (data.lnInvoicePaymentSend.status) {
case "ALREADY_PAID":
throw new Error("Invoice was already paid.");
Expand All @@ -311,7 +345,7 @@ class Galoy implements Connector {
default:
return {
data: {
preimage: "No preimage received",
preimage: preimageMessage,
paymentHash,
route: { total_amt: amountInSats, total_fees: 0 },
},
Expand Down

0 comments on commit ab9deaf

Please sign in to comment.