aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src/popup
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2022-10-25 12:23:08 -0300
committerSebastian <sebasjm@gmail.com>2022-10-25 12:23:52 -0300
commit3f2db7707fdf4eb4c1dfdb527d5726dd1694e126 (patch)
tree4366d443db56eb200ba29760bf1f4a0b9def6c97 /packages/taler-wallet-webextension/src/popup
parent587674dd10bd714b68ff5a6e836eb21113c0337a (diff)
downloadwallet-core-3f2db7707fdf4eb4c1dfdb527d5726dd1694e126.tar.xz
using new wallet api (typed interface)
Diffstat (limited to 'packages/taler-wallet-webextension/src/popup')
-rw-r--r--packages/taler-wallet-webextension/src/popup/BalancePage.tsx19
1 files changed, 10 insertions, 9 deletions
diff --git a/packages/taler-wallet-webextension/src/popup/BalancePage.tsx b/packages/taler-wallet-webextension/src/popup/BalancePage.tsx
index 94d5d1e16..98c6d166c 100644
--- a/packages/taler-wallet-webextension/src/popup/BalancePage.tsx
+++ b/packages/taler-wallet-webextension/src/popup/BalancePage.tsx
@@ -15,6 +15,7 @@
*/
import { Amounts, Balance, NotificationType } from "@gnu-taler/taler-util";
+import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { Fragment, h, VNode } from "preact";
import { useEffect, useState } from "preact/hooks";
import { BalanceTable } from "../components/BalanceTable.js";
@@ -27,7 +28,7 @@ import { Button } from "../mui/Button.js";
import { ButtonHandler } from "../mui/handlers.js";
import { compose, StateViewMap } from "../utils/index.js";
import { AddNewActionView } from "../wallet/AddNewActionView.js";
-import * as wxApi from "../wxApi.js";
+import { wxApi } from "../wxApi.js";
import { NoBalanceHelp } from "./NoBalanceHelp.js";
export interface Props {
@@ -71,16 +72,16 @@ function useComponentState(
api: typeof wxApi,
): State {
const [addingAction, setAddingAction] = useState(false);
- const state = useAsyncAsHook(api.getBalance);
+ const state = useAsyncAsHook(() =>
+ api.wallet.call(WalletApiOperation.GetBalances, {}),
+ );
- useEffect(() => {
- return api.onUpdateNotification(
+ useEffect(() =>
+ api.listener.onUpdateNotification(
[NotificationType.WithdrawGroupFinished],
- () => {
- state?.retry();
- },
- );
- });
+ state?.retry,
+ ),
+ );
if (!state) {
return {