aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/wallet.ts
diff options
context:
space:
mode:
authorÖzgür Kesim <oec-taler@kesim.org>2023-08-03 19:35:52 +0200
committerÖzgür Kesim <oec-taler@kesim.org>2023-08-03 19:35:52 +0200
commit77ea209ddb6d457db0ce113f91247207cc29fbd8 (patch)
tree93eec60ae611ffa38d81ba60fa3e5f76ceca5c04 /packages/taler-wallet-core/src/wallet.ts
parent2b9faf3d4ee00833c3431f1e8fc26bb102594e0f (diff)
parentee47aa4837fedcaa8257b57138ea34fda220d2b7 (diff)
Merge branch 'master' into age-withdraw
Diffstat (limited to 'packages/taler-wallet-core/src/wallet.ts')
-rw-r--r--packages/taler-wallet-core/src/wallet.ts39
1 files changed, 17 insertions, 22 deletions
diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts
index 628a55e92..aab414e94 100644
--- a/packages/taler-wallet-core/src/wallet.ts
+++ b/packages/taler-wallet-core/src/wallet.ts
@@ -93,7 +93,7 @@ import {
codecForPreparePeerPullPaymentRequest,
codecForPreparePeerPushCreditRequest,
codecForPrepareRefundRequest,
- codecForPrepareTipRequest,
+ codecForPrepareRewardRequest,
codecForResumeTransaction,
codecForRetryTransactionRequest,
codecForSetCoinSuspendedRequest,
@@ -249,10 +249,10 @@ import {
} from "./operations/testing.js";
import {
acceptTip,
- computeTipTransactionStatus,
+ computeRewardTransactionStatus,
prepareTip,
processTip,
-} from "./operations/tip.js";
+} from "./operations/reward.js";
import {
abortTransaction,
deleteTransaction,
@@ -300,6 +300,7 @@ import {
import { TimerAPI, TimerGroup } from "./util/timer.js";
import {
WALLET_BANK_INTEGRATION_PROTOCOL_VERSION,
+ WALLET_CORE_IMPLEMENTATION_VERSION,
WALLET_EXCHANGE_PROTOCOL_VERSION,
WALLET_MERCHANT_PROTOCOL_VERSION,
} from "./versions.js";
@@ -328,7 +329,7 @@ async function callOperationHandler(
return await processRefreshGroup(ws, pending.refreshGroupId);
case PendingTaskType.Withdraw:
return await processWithdrawalGroup(ws, pending.withdrawalGroupId);
- case PendingTaskType.TipPickup:
+ case PendingTaskType.RewardPickup:
return await processTip(ws, pending.tipId);
case PendingTaskType.Purchase:
return await processPurchase(ws, pending.proposalId);
@@ -1016,12 +1017,6 @@ export async function getClientFromWalletState(
return client;
}
-declare const __VERSION__: string;
-declare const __GIT_HASH__: string;
-
-const VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "dev";
-const GIT_HASH = typeof __GIT_HASH__ !== "undefined" ? __GIT_HASH__ : undefined;
-
/**
* Implementation of the "wallet-core" API.
*/
@@ -1355,9 +1350,9 @@ async function dispatchRequestInternal<Op extends WalletApiOperation>(
refreshGroupId,
};
}
- case WalletApiOperation.PrepareTip: {
- const req = codecForPrepareTipRequest().decode(payload);
- return await prepareTip(ws, req.talerTipUri);
+ case WalletApiOperation.PrepareReward: {
+ const req = codecForPrepareRewardRequest().decode(payload);
+ return await prepareTip(ws, req.talerRewardUri);
}
case WalletApiOperation.StartRefundQueryForUri: {
const req = codecForPrepareRefundRequest().decode(payload);
@@ -1375,9 +1370,9 @@ async function dispatchRequestInternal<Op extends WalletApiOperation>(
await startQueryRefund(ws, txIdParsed.proposalId);
return {};
}
- case WalletApiOperation.AcceptTip: {
+ case WalletApiOperation.AcceptReward: {
const req = codecForAcceptTipRequest().decode(payload);
- return await acceptTip(ws, req.walletTipId);
+ return await acceptTip(ws, req.walletRewardId);
}
case WalletApiOperation.ExportBackupPlain: {
return exportBackup(ws);
@@ -1590,15 +1585,15 @@ async function dispatchRequestInternal<Op extends WalletApiOperation>(
}
export function getVersion(ws: InternalWalletState): WalletCoreVersion {
- const version: WalletCoreVersion = {
- hash: GIT_HASH,
- version: VERSION,
+ const result: WalletCoreVersion = {
+ hash: undefined,
+ version: WALLET_CORE_IMPLEMENTATION_VERSION,
exchange: WALLET_EXCHANGE_PROTOCOL_VERSION,
merchant: WALLET_MERCHANT_PROTOCOL_VERSION,
bank: WALLET_BANK_INTEGRATION_PROTOCOL_VERSION,
devMode: false,
};
- return version;
+ return result;
}
/**
@@ -1889,12 +1884,12 @@ class InternalWalletStateImpl implements InternalWalletState {
}
return computeRefreshTransactionState(rec);
}
- case TransactionType.Tip: {
- const rec = await tx.tips.get(parsedTxId.walletTipId);
+ case TransactionType.Reward: {
+ const rec = await tx.rewards.get(parsedTxId.walletRewardId);
if (!rec) {
return undefined;
}
- return computeTipTransactionStatus(rec);
+ return computeRewardTransactionStatus(rec);
}
default:
assertUnreachable(parsedTxId);