diff options
author | Sebastian <sebasjm@gmail.com> | 2023-11-21 17:10:07 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-11-21 17:10:31 -0300 |
commit | 32182fb1b912e1136ba933c4a4f204e6e2f33de2 (patch) | |
tree | 9de9caf82632994c233fbbd4366b086818217c7d /packages/taler-wallet-webextension | |
parent | 6000a55d583832a71335310514688f1f6faed722 (diff) | |
download | wallet-core-32182fb1b912e1136ba933c4a4f204e6e2f33de2.tar.xz |
cashout creation
Diffstat (limited to 'packages/taler-wallet-webextension')
3 files changed, 10 insertions, 11 deletions
diff --git a/packages/taler-wallet-webextension/src/wallet/AddExchange/index.ts b/packages/taler-wallet-webextension/src/wallet/AddExchange/index.ts index cece582e9..f16d3929d 100644 --- a/packages/taler-wallet-webextension/src/wallet/AddExchange/index.ts +++ b/packages/taler-wallet-webextension/src/wallet/AddExchange/index.ts @@ -14,15 +14,14 @@ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -import { TalerConfigResponse } from "@gnu-taler/taler-util"; +import { HttpResponse } from "@gnu-taler/web-util/browser"; import { ErrorAlertView } from "../../components/CurrentAlerts.js"; import { Loading } from "../../components/Loading.js"; import { ErrorAlert } from "../../context/alert.js"; +import { TextFieldHandler } from "../../mui/handlers.js"; import { compose, StateViewMap } from "../../utils/index.js"; import { useComponentState } from "./state.js"; import { ConfirmView, VerifyView } from "./views.js"; -import { HttpResponse, InputFieldHandler } from "@gnu-taler/web-util/browser"; -import { TextFieldHandler } from "../../mui/handlers.js"; export interface Props { currency?: string; @@ -65,7 +64,7 @@ export namespace State { url: TextFieldHandler, knownExchanges: URL[], - result: HttpResponse<TalerConfigResponse, unknown> | undefined, + result: HttpResponse<{ currency_specification: {currency: string}, version: string}, unknown> | undefined, expectedCurrency: string | undefined, } } diff --git a/packages/taler-wallet-webextension/src/wallet/AddExchange/state.ts b/packages/taler-wallet-webextension/src/wallet/AddExchange/state.ts index fc1762331..61f4308f4 100644 --- a/packages/taler-wallet-webextension/src/wallet/AddExchange/state.ts +++ b/packages/taler-wallet-webextension/src/wallet/AddExchange/state.ts @@ -16,7 +16,7 @@ import { useState, useEffect, useCallback } from "preact/hooks"; import { Props, State } from "./index.js"; -import { ExchangeEntryStatus, TalerConfigResponse, TranslatedString, canonicalizeBaseUrl } from "@gnu-taler/taler-util"; +import { ExchangeEntryStatus, TalerCorebankApi, TalerExchangeApi, canonicalizeBaseUrl } from "@gnu-taler/taler-util"; import { useBackendContext } from "../../context/backend.js"; import { useAsyncAsHook } from "../../hooks/useAsyncAsHook.js"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; @@ -27,7 +27,7 @@ import { withSafe } from "../../mui/handlers.js"; export function useComponentState({ onBack, currency, noDebounce }: Props): RecursiveState<State> { const [verified, setVerified] = useState< - { url: string; config: TalerConfigResponse } | undefined + { url: string; config: { currency_specification: {currency: string}, version: string} } | undefined >(undefined); const api = useBackendContext(); @@ -48,10 +48,10 @@ export function useComponentState({ onBack, currency, noDebounce }: Props): Recu if (found !== -1) { throw Error("This exchange is already active") } - const result = await request<TalerConfigResponse>(c, "/keys") + const result = await request<{ currency_specification: {currency: string}, version: string}>(c, "/keys") return result }, [used]) - const { result, value: url, update, error: requestError } = useDebounce<HttpResponse<TalerConfigResponse, unknown>>(ccc, noDebounce ?? false) + const { result, value: url, update, error: requestError } = useDebounce<HttpResponse<{ currency_specification: {currency: string}, version: string}, unknown>>(ccc, noDebounce ?? false) const [inputError, setInputError] = useState<string>() return { diff --git a/packages/taler-wallet-webextension/src/wallet/AddExchange/views.tsx b/packages/taler-wallet-webextension/src/wallet/AddExchange/views.tsx index e1bc7f0f6..87ea5eae3 100644 --- a/packages/taler-wallet-webextension/src/wallet/AddExchange/views.tsx +++ b/packages/taler-wallet-webextension/src/wallet/AddExchange/views.tsx @@ -60,7 +60,7 @@ export function VerifyView({ </i18n.Translate> </LightText> )} - {result && result.ok && expectedCurrency && expectedCurrency !== result.data.currency && ( + {result && result.ok && expectedCurrency && expectedCurrency !== result.data.currency_specification.currency && ( <WarningBox> <i18n.Translate> This exchange doesn't match the expected currency @@ -105,7 +105,7 @@ export function VerifyView({ <label> <i18n.Translate>Currency</i18n.Translate> </label> - <input type="text" disabled value={result.data.currency} /> + <input type="text" disabled value={result.data.currency_specification.currency} /> </Input> </Fragment> )} @@ -127,7 +127,7 @@ export function VerifyView({ !result || result.loading || !result.ok || - (!!expectedCurrency && expectedCurrency !== result.data.currency) + (!!expectedCurrency && expectedCurrency !== result.data.currency_specification.currency) } onClick={onAccept} > |