[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] 01/03: wallet-core: return versions in init response
From: |
gnunet |
Subject: |
[taler-wallet-core] 01/03: wallet-core: return versions in init response |
Date: |
Wed, 19 Oct 2022 15:45:07 +0200 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository wallet-core.
commit f697b20a91362c9b7978107973cfe9aaf376baf8
Author: Florian Dold <florian@dold.me>
AuthorDate: Wed Oct 19 15:36:57 2022 +0200
wallet-core: return versions in init response
---
packages/taler-util/src/wallet-types.ts | 4 ++++
packages/taler-wallet-core/src/wallet-api-types.ts | 6 +++--
packages/taler-wallet-core/src/wallet.ts | 26 +++++++++++++---------
3 files changed, 24 insertions(+), 12 deletions(-)
diff --git a/packages/taler-util/src/wallet-types.ts
b/packages/taler-util/src/wallet-types.ts
index 1a6808d66..77ba42caf 100644
--- a/packages/taler-util/src/wallet-types.ts
+++ b/packages/taler-util/src/wallet-types.ts
@@ -115,6 +115,10 @@ export interface Balance {
requiresUserInput: boolean;
}
+export interface InitResponse {
+ versionInfo: WalletCoreVersion;
+}
+
export interface BalancesResponse {
balances: Balance[];
}
diff --git a/packages/taler-wallet-core/src/wallet-api-types.ts
b/packages/taler-wallet-core/src/wallet-api-types.ts
index 2eac18249..097518263 100644
--- a/packages/taler-wallet-core/src/wallet-api-types.ts
+++ b/packages/taler-wallet-core/src/wallet-api-types.ts
@@ -65,6 +65,7 @@ import {
InitiatePeerPullPaymentResponse,
InitiatePeerPushPaymentRequest,
InitiatePeerPushPaymentResponse,
+ InitResponse,
IntegrationTestArgs,
KnownBankAccounts,
ListKnownBankAccountsRequest,
@@ -91,6 +92,7 @@ import {
TransactionsRequest,
TransactionsResponse,
WalletBackupContentV1,
+ WalletCoreVersion,
WalletCurrencyInfo,
WithdrawFakebankRequest,
WithdrawTestBalanceRequest,
@@ -183,13 +185,13 @@ export enum WalletApiOperation {
export type InitWalletOp = {
op: WalletApiOperation.InitWallet;
request: {};
- response: {};
+ response: InitResponse;
};
export type GetVersionOp = {
op: WalletApiOperation.GetVersion;
request: {};
- response: {};
+ response: WalletCoreVersion;
};
// group: Basic Wallet Information
diff --git a/packages/taler-wallet-core/src/wallet.ts
b/packages/taler-wallet-core/src/wallet.ts
index 1b338b383..584129c9c 100644
--- a/packages/taler-wallet-core/src/wallet.ts
+++ b/packages/taler-wallet-core/src/wallet.ts
@@ -996,7 +996,9 @@ async function dispatchRequestInternal<Op extends
WalletApiOperation>(
bankAccessApiBaseUrl: "https://bank.test.taler.net/",
exchangeBaseUrl: "https://exchange.test.taler.net/",
});
- return {};
+ return {
+ versionInfo: getVersion(ws),
+ };
}
case WalletApiOperation.WithdrawTestBalance: {
const req = codecForWithdrawTestBalance().decode(payload);
@@ -1367,15 +1369,7 @@ async function dispatchRequestInternal<Op extends
WalletApiOperation>(
return {};
}
case WalletApiOperation.GetVersion: {
- const version: WalletCoreVersion = {
- hash: GIT_HASH,
- version: VERSION,
- exchange: WALLET_EXCHANGE_PROTOCOL_VERSION,
- merchant: WALLET_MERCHANT_PROTOCOL_VERSION,
- bank: WALLET_BANK_INTEGRATION_PROTOCOL_VERSION,
- devMode: ws.devModeActive,
- };
- return version;
+ return getVersion(ws);
}
}
throw TalerError.fromDetail(
@@ -1387,6 +1381,18 @@ async function dispatchRequestInternal<Op extends
WalletApiOperation>(
);
}
+export function getVersion(ws: InternalWalletState): WalletCoreVersion {
+ const version: WalletCoreVersion = {
+ hash: GIT_HASH,
+ version: VERSION,
+ exchange: WALLET_EXCHANGE_PROTOCOL_VERSION,
+ merchant: WALLET_MERCHANT_PROTOCOL_VERSION,
+ bank: WALLET_BANK_INTEGRATION_PROTOCOL_VERSION,
+ devMode: ws.devModeActive,
+ };
+ return version;
+}
+
/**
* Handle a request to the wallet-core API.
*/
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.