From 5c742afbdf9aaa767c3e4617c48a98439e400fa2 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 8 Nov 2022 13:00:34 -0300 Subject: feature: 7440 add expiration to p2p --- packages/taler-wallet-core/src/wallet.ts | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'packages/taler-wallet-core/src/wallet.ts') diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts index 9339b2f8e..caaf6d410 100644 --- a/packages/taler-wallet-core/src/wallet.ts +++ b/packages/taler-wallet-core/src/wallet.ts @@ -57,6 +57,8 @@ import { codecForListKnownBankAccounts, codecForPrepareDepositRequest, codecForPreparePayRequest, + codecForPreparePeerPullPaymentRequest, + codecForPreparePeerPushPaymentRequest, codecForPrepareRefundRequest, codecForPrepareTipRequest, codecForRetryTransactionRequest, @@ -186,6 +188,8 @@ import { checkPeerPushPayment, initiatePeerPullPayment, initiatePeerToPeerPush, + preparePeerPullPayment, + preparePeerPushPayment, } from "./operations/pay-peer.js"; import { getPendingOperations } from "./operations/pending.js"; import { @@ -659,7 +663,9 @@ async function getExchanges( const opRetryRecord = await tx.operationRetries.get( RetryTags.forExchangeUpdate(r), ); - exchanges.push(makeExchangeListItem(r, exchangeDetails, opRetryRecord?.lastError)); + exchanges.push( + makeExchangeListItem(r, exchangeDetails, opRetryRecord?.lastError), + ); } }); return { exchanges }; @@ -927,9 +933,9 @@ async function dumpCoins(ws: InternalWalletState): Promise { ageCommitmentProof: c.ageCommitmentProof, spend_allocation: c.spendAllocation ? { - amount: c.spendAllocation.amount, - id: c.spendAllocation.id, - } + amount: c.spendAllocation.amount, + id: c.spendAllocation.id, + } : undefined, }); } @@ -1340,6 +1346,10 @@ async function dispatchRequestInternal( await importDb(ws.db.idbHandle(), req.dump); return []; } + case WalletApiOperation.PreparePeerPushPayment: { + const req = codecForPreparePeerPushPaymentRequest().decode(payload); + return await preparePeerPushPayment(ws, req); + } case WalletApiOperation.InitiatePeerPushPayment: { const req = codecForInitiatePeerPushPaymentRequest().decode(payload); return await initiatePeerToPeerPush(ws, req); @@ -1352,6 +1362,10 @@ async function dispatchRequestInternal( const req = codecForAcceptPeerPushPaymentRequest().decode(payload); return await acceptPeerPushPayment(ws, req); } + case WalletApiOperation.PreparePeerPullPayment: { + const req = codecForPreparePeerPullPaymentRequest().decode(payload); + return await preparePeerPullPayment(ws, req); + } case WalletApiOperation.InitiatePeerPullPayment: { const req = codecForInitiatePeerPullPaymentRequest().decode(payload); return await initiatePeerPullPayment(ws, req); -- cgit v1.2.3