taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit 7e1468a1a07d3c5f5a441fb12ee16b7487c9b840
parent 57a6a98cacdd9c9864ee4029069c51c0b27381fd
Author: Sebastian <sebasjm@gmail.com>
Date:   Mon, 29 Jul 2024 14:15:51 -0300

fix: validating if the tx was on this wallet

Diffstat:
Mpackages/taler-wallet-webextension/src/cta/Withdraw/state.ts | 5++++-
Mpackages/taler-wallet-webextension/src/cta/Withdraw/views.tsx | 2+-
2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/packages/taler-wallet-webextension/src/cta/Withdraw/state.ts b/packages/taler-wallet-webextension/src/cta/Withdraw/state.ts @@ -22,6 +22,7 @@ import { ExchangeListItem, NotificationType, TransactionMajorState, + TransactionMinorState, parseWithdrawExchangeUri, } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; @@ -207,6 +208,7 @@ export function useComponentStateFromURI({ const api = useBackendContext(); const { i18n } = useTranslationContext(); + // eslint-disable-next-line @typescript-eslint/no-unused-vars const [updatedExchangeByUser, setUpdatedExchangeByUser] = useState<string>(); /** * Ask the wallet about the withdraw URI @@ -315,11 +317,12 @@ export function useComponentStateFromURI({ uriInfoHook.response.status !== "pending" ) { const info = uriInfoHook.response.txInfo; + const anotherWallet = info.txState.major === TransactionMajorState.Aborted && info.txState.minor === TransactionMinorState.CompletedByOtherWallet; return { status: "already-completed", operationState: uriInfoHook.response.status, confirmTransferUrl: bwi.confirmTransferUrl, - thisWallet: info.txState.major === TransactionMajorState.Pending, + thisWallet: !anotherWallet, redirectToTx: () => onSuccess(info.transactionId), error: undefined, }; diff --git a/packages/taler-wallet-webextension/src/cta/Withdraw/views.tsx b/packages/taler-wallet-webextension/src/cta/Withdraw/views.tsx @@ -39,10 +39,10 @@ import { getAmountWithFee, } from "../../wallet/Transaction.js"; import { State } from "./index.js"; -import { Amounts } from "@gnu-taler/taler-util"; export function FinalStateOperation(state: State.AlreadyCompleted): VNode { const { i18n } = useTranslationContext(); + // document.location.href = res.confirmTransferUrl if (state.thisWallet) { switch (state.operationState) {