diff --git a/src/components/BlockExplorer.tsx b/src/components/BlockExplorer.tsx
index b7fd14d2..2c6263fd 100644
--- a/src/components/BlockExplorer.tsx
+++ b/src/components/BlockExplorer.tsx
@@ -2,7 +2,7 @@ import { chooseUrl, config } from "../config";
import { useGlobalContext } from "../context/Global";
const blockExplorerLink = (asset: string, isTxId: boolean, val: string) => {
- const basePath = chooseUrl(config.assets[asset].blockExplorerUrl);
+ const basePath = chooseUrl(config.assets[asset]?.blockExplorerUrl);
return `${basePath}/${isTxId ? "tx" : "address"}/${val}`;
};
diff --git a/src/components/BlockExplorerLink.tsx b/src/components/BlockExplorerLink.tsx
deleted file mode 100644
index 132e08b4..00000000
--- a/src/components/BlockExplorerLink.tsx
+++ /dev/null
@@ -1,89 +0,0 @@
-import { Accessor, Show, createEffect, createSignal } from "solid-js";
-
-import { SwapType } from "../consts/Enums";
-import {
- ChainSwap,
- ReverseSwap,
- SomeSwap,
- SubmarineSwap,
- getRelevantAssetForSwap,
-} from "../utils/swapCreator";
-import BlockExplorer from "./BlockExplorer";
-
-enum TransactionType {
- Lockup = "lockupTx",
- Claim = "claimTx",
-}
-
-const BlockExplorerLink = ({
- swap,
- swapStatus,
- contractTransaction,
- contractTransactionType,
-}: {
- swap: Accessor;
- swapStatus: Accessor;
- contractTransaction: Accessor;
- contractTransactionType: Accessor;
-}) => {
- // Refund transactions are handled in SwapRefunded
-
- if (swap().type !== SwapType.Chain) {
- return (
- <>
-
-
-
-
-
-
- >
- );
- }
-
- // TODO: RSK
-
- const [hasBeenClaimed, setHasBeenClaimed] = createSignal(false);
-
- createEffect(() => {
- setHasBeenClaimed(swap().claimTx !== undefined);
- });
-
- return (
-
- );
-};
-
-export default BlockExplorerLink;
-export { TransactionType };
diff --git a/src/consts/Types.ts b/src/consts/Types.ts
index bcbd86dd..5e9a02d4 100644
--- a/src/consts/Types.ts
+++ b/src/consts/Types.ts
@@ -1,4 +1,4 @@
export type ButtonLabelParams = {
key: string;
- params?: Record;
+ params?: Record;
};
diff --git a/src/context/Global.tsx b/src/context/Global.tsx
index c30308f9..e520b194 100644
--- a/src/context/Global.tsx
+++ b/src/context/Global.tsx
@@ -37,8 +37,6 @@ export type GlobalContextType = {
setWasmSupported: Setter;
refundAddress: Accessor;
setRefundAddress: Setter;
- transactionToRefund: Accessor;
- setTransactionToRefund: Setter;
i18n: Accessor;
setI18n: Setter;
notification: Accessor;
@@ -107,10 +105,6 @@ const GlobalProvider = (props: { children: any }) => {
const [wasmSupported, setWasmSupported] = createSignal(true);
const [refundAddress, setRefundAddress] = createSignal(null);
- const [transactionToRefund, setTransactionToRefund] = createSignal<
- string | null
- >(null);
-
const [i18n, setI18n] = createSignal(null);
const [notification, setNotification] = createSignal("");
@@ -326,8 +320,6 @@ const GlobalProvider = (props: { children: any }) => {
setWasmSupported,
refundAddress,
setRefundAddress,
- transactionToRefund,
- setTransactionToRefund,
i18n,
setI18n,
notification,
diff --git a/src/context/Pay.tsx b/src/context/Pay.tsx
index 662506d5..0f695d82 100644
--- a/src/context/Pay.tsx
+++ b/src/context/Pay.tsx
@@ -6,26 +6,22 @@ import {
useContext,
} from "solid-js";
+import { SwapStatusTransaction } from "../utils/boltzClient";
import { SomeSwap } from "../utils/swapCreator";
export type PayContextType = {
- failureReason: Accessor;
- setFailureReason: Setter;
- swap: Accessor;
- setSwap: Setter;
- swapStatus: Accessor;
- setSwapStatus: Setter;
- swapStatusTransaction: Accessor;
- setSwapStatusTransaction: Setter;
+ failureReason: Accessor;
+ setFailureReason: Setter;
+ swap: Accessor;
+ setSwap: Setter;
+ swapStatus: Accessor;
+ setSwapStatus: Setter;
+ swapStatusTransaction: Accessor;
+ setSwapStatusTransaction: Setter;
};
const PayContext = createContext();
-type SwapStatusTransaction = {
- hex?: string;
- id?: string;
-};
-
const PayProvider = (props: { children: any }) => {
const [failureReason, setFailureReason] = createSignal("");
const [swap, setSwap] = createSignal(null, {
@@ -34,7 +30,7 @@ const PayProvider = (props: { children: any }) => {
});
const [swapStatus, setSwapStatus] = createSignal("");
const [swapStatusTransaction, setSwapStatusTransaction] =
- createSignal({});
+ createSignal(null);
return (
{
const params = useParams();
- const [contractTransaction, setContractTransaction] =
- createSignal(undefined);
- const [contractTransactionType, setContractTransactionType] = createSignal(
- TransactionType.Lockup,
- );
const { getSwap, t } = useGlobalContext();
const {
@@ -68,24 +52,6 @@ const Pay = () => {
setSwapStatus(res.status);
setSwapStatusTransaction(res.transaction);
setFailureReason(res.failureReason);
-
- // RSK
- if (
- asset === RBTC &&
- res.transaction &&
- currentSwap.claimTx === undefined
- ) {
- setContractTransaction(res.transaction.id);
- }
-
- if (asset === RBTC && currentSwap["lockupTx"]) {
- setContractTransaction(currentSwap["lockupTx"]);
- }
-
- if (asset === RBTC && currentSwap.claimTx) {
- setContractTransaction(currentSwap.claimTx);
- setContractTransactionType(TransactionType.Claim);
- }
}
});
@@ -208,12 +174,6 @@ const Pay = () => {
-
diff --git a/src/status/InvoiceFailedToPay.tsx b/src/status/InvoiceFailedToPay.tsx
index 4a2e46b9..e885912b 100644
--- a/src/status/InvoiceFailedToPay.tsx
+++ b/src/status/InvoiceFailedToPay.tsx
@@ -1,11 +1,13 @@
import { OutputType } from "boltz-core";
import { Accessor, Show } from "solid-js";
+import BlockExplorer from "../components/BlockExplorer";
import DownloadRefund from "../components/DownloadRefund";
import RefundButton from "../components/RefundButton";
import { RBTC } from "../consts/Assets";
import { useGlobalContext } from "../context/Global";
import { usePayContext } from "../context/Pay";
+import { getLockupAddress } from "../utils/helper";
import { ChainSwap, SubmarineSwap } from "../utils/swapCreator";
const InvoiceFailedToPay = () => {
@@ -20,11 +22,15 @@ const InvoiceFailedToPay = () => {
{t("failure_reason")}: {failureReason()}
- } />
+
+
);
};
diff --git a/src/status/InvoicePending.tsx b/src/status/InvoicePending.tsx
index 378ddd4b..e4db2f57 100644
--- a/src/status/InvoicePending.tsx
+++ b/src/status/InvoicePending.tsx
@@ -1,12 +1,24 @@
+import { Show } from "solid-js";
+
+import BlockExplorer from "../components/BlockExplorer";
import LoadingSpinner from "../components/LoadingSpinner";
import { useGlobalContext } from "../context/Global";
+import { usePayContext } from "../context/Pay";
const InvoicePending = () => {
const { t } = useGlobalContext();
+ const { swap, swapStatusTransaction } = usePayContext();
return (
{t("invoice_pending")}
+
+
+
);
};
diff --git a/src/status/SwapExpired.tsx b/src/status/SwapExpired.tsx
index c1448e3d..9ab113e3 100644
--- a/src/status/SwapExpired.tsx
+++ b/src/status/SwapExpired.tsx
@@ -1,18 +1,21 @@
import { useNavigate } from "@solidjs/router";
import log from "loglevel";
-import { Accessor, Show, createEffect } from "solid-js";
+import { Accessor, Show, createEffect, createSignal } from "solid-js";
+import BlockExplorer from "../components/BlockExplorer";
import RefundButton from "../components/RefundButton";
import { useGlobalContext } from "../context/Global";
import { usePayContext } from "../context/Pay";
-import { getLockupTransaction } from "../utils/boltzClient";
+import { LockupTransaction, getLockupTransaction } from "../utils/boltzClient";
import { ChainSwap, SubmarineSwap } from "../utils/swapCreator";
const SwapExpired = () => {
const navigate = useNavigate();
const { failureReason, swap } = usePayContext();
- const { t, setTransactionToRefund, transactionToRefund } =
- useGlobalContext();
+ const { t } = useGlobalContext();
+
+ const [transactionToRefund, setTransactionToRefund] =
+ createSignal(null);
createEffect(async () => {
setTransactionToRefund(null);
@@ -22,10 +25,10 @@ const SwapExpired = () => {
swap().id,
swap().type,
);
- log.debug(`got swap transaction for ${swap().id}`);
- setTransactionToRefund(res.hex);
+ log.debug(`got swap transaction for ${swap()?.id}`);
+ setTransactionToRefund(res);
} catch (error: any) {
- log.warn(`no swap transaction for: ${swap().id}`, error);
+ log.warn(`no swap transaction for: ${swap()?.id}`, error);
}
});
@@ -36,10 +39,13 @@ const SwapExpired = () => {
- }
- />
+
+