aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/withdraw.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2024-04-23 12:49:42 +0200
committerFlorian Dold <florian@dold.me>2024-04-23 12:49:42 +0200
commit666b767766ef299bd58655c55ece6d4a82c3e947 (patch)
treead55f617626d96fb656ff7ab4ccb71b7931ee7b9 /packages/taler-wallet-core/src/withdraw.ts
parent0308290a128d29792225d7b2f4d2e22cb5d42f72 (diff)
downloadwallet-core-666b767766ef299bd58655c55ece6d4a82c3e947.tar.xz
wallet-core: support for withdrawals with forced reserve key
Diffstat (limited to 'packages/taler-wallet-core/src/withdraw.ts')
-rw-r--r--packages/taler-wallet-core/src/withdraw.ts19
1 files changed, 16 insertions, 3 deletions
diff --git a/packages/taler-wallet-core/src/withdraw.ts b/packages/taler-wallet-core/src/withdraw.ts
index 4936135bd..a55ada796 100644
--- a/packages/taler-wallet-core/src/withdraw.ts
+++ b/packages/taler-wallet-core/src/withdraw.ts
@@ -41,6 +41,7 @@ import {
DenomSelItem,
DenomSelectionState,
Duration,
+ EddsaPrivateKeyString,
ExchangeBatchWithdrawRequest,
ExchangeUpdateStatus,
ExchangeWireAccount,
@@ -3050,6 +3051,7 @@ export async function createManualWithdrawal(
amount: AmountLike;
restrictAge?: number;
forcedDenomSel?: ForcedDenomSel;
+ forceReservePriv?: EddsaPrivateKeyString;
},
): Promise<AcceptManualWithdrawalResult> {
const { exchangeBaseUrl } = req;
@@ -3061,9 +3063,20 @@ export async function createManualWithdrawal(
"manual withdrawal with conversion from foreign currency is not yet supported",
);
}
- const reserveKeyPair: EddsaKeypair = await wex.cryptoApi.createEddsaKeypair(
- {},
- );
+
+ let reserveKeyPair: EddsaKeypair;
+ if (req.forceReservePriv) {
+ const pubResp = await wex.cryptoApi.eddsaGetPublic({
+ priv: req.forceReservePriv,
+ });
+
+ reserveKeyPair = {
+ priv: req.forceReservePriv,
+ pub: pubResp.pub,
+ };
+ } else {
+ reserveKeyPair = await wex.cryptoApi.createEddsaKeypair({});
+ }
const withdrawalAccountsList = await fetchWithdrawalAccountInfo(
wex,