summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src/wallet/AddExchange/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-wallet-webextension/src/wallet/AddExchange/index.ts')
-rw-r--r--packages/taler-wallet-webextension/src/wallet/AddExchange/index.ts20
1 files changed, 14 insertions, 6 deletions
diff --git a/packages/taler-wallet-webextension/src/wallet/AddExchange/index.ts b/packages/taler-wallet-webextension/src/wallet/AddExchange/index.ts
index 69f2a6028..94b32c157 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 { HttpResponse } from "@gnu-taler/web-util/browser";
+import { OperationFailWithBody, OperationOk, TalerExchangeApi } from "@gnu-taler/taler-util";
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 { StateViewMap, compose } from "../../utils/index.js";
import { useComponentState } from "./state.js";
-import { ConfirmView, VerifyView } from "./views.js";
-import { ExchangeListItem } from "@gnu-taler/taler-util";
+import { ConfirmAddExchangeView, VerifyView } from "./views.js";
export interface Props {
currency?: string;
@@ -35,6 +34,14 @@ export type State = State.Loading
| State.Confirm
| State.Verify;
+export type CheckExchangeErrors = {
+ "invalid-version": string;
+ "invalid-currency": string;
+ "not-found": void;
+ "already-active": void;
+ "invalid-protocol": void;
+}
+
export namespace State {
export interface Loading {
status: "loading";
@@ -64,8 +71,9 @@ export namespace State {
onAccept: () => Promise<void>;
url: TextFieldHandler,
+ loading: boolean;
knownExchanges: URL[],
- result: HttpResponse<{ currency_specification: { currency: string }, version: string }, unknown> | undefined,
+ result: OperationOk<TalerExchangeApi.ExchangeKeysResponse> | OperationFailWithBody<CheckExchangeErrors> | undefined,
expectedCurrency: string | undefined,
}
}
@@ -73,7 +81,7 @@ export namespace State {
const viewMapping: StateViewMap<State> = {
loading: Loading,
error: ErrorAlertView,
- confirm: ConfirmView,
+ confirm: ConfirmAddExchangeView,
verify: VerifyView,
};