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/cta/Deposit/state.ts | |
| parent | 5fcd434f662bcef7e9e043763766c8b104ad6b97 (diff) | |
cherry-pick: using new wallet typed api missing test
Diffstat (limited to 'packages/taler-wallet-webextension/src/cta/Deposit/state.ts')
| -rw-r--r-- | packages/taler-wallet-webextension/src/cta/Deposit/state.ts | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/packages/taler-wallet-webextension/src/cta/Deposit/state.ts b/packages/taler-wallet-webextension/src/cta/Deposit/state.ts index 5662a24c8..ba7bd147b 100644 --- a/packages/taler-wallet-webextension/src/cta/Deposit/state.ts +++ b/packages/taler-wallet-webextension/src/cta/Deposit/state.ts @@ -14,10 +14,10 @@ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -import { Amounts, CreateDepositGroupResponse } from "@gnu-taler/taler-util"; -import { useState } from "preact/hooks"; +import { Amounts } from "@gnu-taler/taler-util"; +import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { useAsyncAsHook } from "../../hooks/useAsyncAsHook.js"; -import * as wxApi from "../../wxApi.js"; +import { wxApi } from "../../wxApi.js"; import { Props, State } from "./index.js"; export function useComponentState( @@ -29,10 +29,10 @@ export function useComponentState( if (!amountStr) throw Error("ERROR_NO-AMOUNT-FOR-DEPOSIT"); const amount = Amounts.parse(amountStr); if (!amount) throw Error("ERROR_INVALID-AMOUNT-FOR-DEPOSIT"); - const deposit = await api.prepareDeposit( - talerDepositUri, - Amounts.stringify(amount), - ); + const deposit = await api.wallet.call(WalletApiOperation.PrepareDeposit, { + amount: Amounts.stringify(amount), + depositPaytoUri: talerDepositUri, + }); return { deposit, uri: talerDepositUri, amount }; }); @@ -46,7 +46,10 @@ export function useComponentState( const { deposit, uri, amount } = info.response; async function doDeposit(): Promise<void> { - const resp = await api.createDepositGroup(uri, Amounts.stringify(amount)); + const resp = await api.wallet.call(WalletApiOperation.CreateDepositGroup, { + amount: Amounts.stringify(amount), + depositPaytoUri: uri, + }); onSuccess(resp.transactionId); } |
