diff options
author | Sebastian <sebasjm@gmail.com> | 2022-10-25 12:23:08 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-10-25 19:19:09 -0300 |
commit | a286649b0a611d87916a178a795c1acd2917741c (patch) | |
tree | 86d0a8eefb791ffebc877a88d6876d1ff764cf2b /packages/taler-wallet-webextension/src/wallet/ManualWithdrawPage.tsx | |
parent | 5fcd434f662bcef7e9e043763766c8b104ad6b97 (diff) |
cherry-pick: using new wallet typed api missing test
Diffstat (limited to 'packages/taler-wallet-webextension/src/wallet/ManualWithdrawPage.tsx')
-rw-r--r-- | packages/taler-wallet-webextension/src/wallet/ManualWithdrawPage.tsx | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/packages/taler-wallet-webextension/src/wallet/ManualWithdrawPage.tsx b/packages/taler-wallet-webextension/src/wallet/ManualWithdrawPage.tsx index 3714ae538..e2284a466 100644 --- a/packages/taler-wallet-webextension/src/wallet/ManualWithdrawPage.tsx +++ b/packages/taler-wallet-webextension/src/wallet/ManualWithdrawPage.tsx @@ -22,13 +22,14 @@ import { parsePaytoUri, PaytoUri, } from "@gnu-taler/taler-util"; +import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { h, VNode } from "preact"; import { useEffect, useState } from "preact/hooks"; import { Loading } from "../components/Loading.js"; import { LoadingError } from "../components/LoadingError.js"; import { useTranslationContext } from "../context/translation.js"; import { useAsyncAsHook } from "../hooks/useAsyncAsHook.js"; -import * as wxApi from "../wxApi.js"; +import { wxApi } from "../wxApi.js"; import { CreateManualWithdraw } from "./CreateManualWithdraw.js"; import { ReserveCreated } from "./ReserveCreated.js"; @@ -50,11 +51,14 @@ export function ManualWithdrawPage({ amount, onCancel }: Props): VNode { >(undefined); const [error, setError] = useState<string | undefined>(undefined); - const state = useAsyncAsHook(wxApi.listExchanges); + const state = useAsyncAsHook(() => + wxApi.wallet.call(WalletApiOperation.ListExchanges, {}), + ); useEffect(() => { - return wxApi.onUpdateNotification([NotificationType.ExchangeAdded], () => { - state?.retry(); - }); + return wxApi.listener.onUpdateNotification( + [NotificationType.ExchangeAdded], + state?.retry, + ); }); const { i18n } = useTranslationContext(); @@ -63,9 +67,12 @@ export function ManualWithdrawPage({ amount, onCancel }: Props): VNode { amount: AmountJson, ): Promise<void> { try { - const response = await wxApi.acceptManualWithdrawal( - exchangeBaseUrl, - Amounts.stringify(amount), + const response = await wxApi.wallet.call( + WalletApiOperation.AcceptManualWithdrawal, + { + exchangeBaseUrl: exchangeBaseUrl, + amount: Amounts.stringify(amount), + }, ); const payto = response.exchangePaytoUris[0]; const paytoURI = parsePaytoUri(payto); |