transactions list

This commit is contained in:
Florian Dold 2020-07-16 21:03:22 +05:30
parent 041911a15f
commit dd3a31f33d
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
2 changed files with 13 additions and 9 deletions

View File

@ -36,6 +36,8 @@ import {
WithdrawalDetails, WithdrawalDetails,
} from "../types/transactions"; } from "../types/transactions";
import { WithdrawalDetailsResponse } from "../types/walletTypes"; import { WithdrawalDetailsResponse } from "../types/walletTypes";
import { Logger } from "../util/logging";
import { addPaytoQueryParams } from "../util/payto";
/** /**
* Create an event ID from the type and the primary key for the event. * Create an event ID from the type and the primary key for the event.
@ -202,7 +204,6 @@ export async function getTransactions(
} }
withdrawalDetails = { withdrawalDetails = {
type: WithdrawalType.ManualTransfer, type: WithdrawalType.ManualTransfer,
reservePublicKey: r.reservePub,
exchangePaytoUris: exchange.wireInfo?.accounts.map((x) => x.payto_uri) ?? [], exchangePaytoUris: exchange.wireInfo?.accounts.map((x) => x.payto_uri) ?? [],
}; };
} }
@ -261,10 +262,17 @@ export async function getTransactions(
// FIXME: report somehow // FIXME: report somehow
return; return;
} }
const plainPaytoUris = exchange.wireInfo?.accounts.map((x) => x.payto_uri) ?? [];
if (!plainPaytoUris) {
// FIXME: report somehow
return;
}
withdrawalDetails = { withdrawalDetails = {
type: WithdrawalType.ManualTransfer, type: WithdrawalType.ManualTransfer,
reservePublicKey: r.reservePub, exchangePaytoUris: plainPaytoUris.map((x) => addPaytoQueryParams(x, {
exchangePaytoUris: exchange.wireInfo?.accounts.map((x) => x.payto_uri) ?? [], amount: Amounts.stringify(r.instructedAmount),
message: `Taler Withdrawal ${r.reservePub}`,
})),
}; };
} }
transactions.push({ transactions.push({

View File

@ -117,14 +117,10 @@ export type WithdrawalDetails =
interface WithdrawalDetailsForManualTransfer { interface WithdrawalDetailsForManualTransfer {
type: WithdrawalType.ManualTransfer; type: WithdrawalType.ManualTransfer;
/**
* Public key of the reserve that needs to be funded
* manually.
*/
reservePublicKey: string;
/** /**
* Payto URIs that the exchange supports. * Payto URIs that the exchange supports.
*
* Already contains the amount and message.
*/ */
exchangePaytoUris: string[]; exchangePaytoUris: string[];
} }