new exchange-added notifiaction and including tos information in the wxApi.listExchange api
This commit is contained in:
parent
b3b3c21acb
commit
f07436aa49
@ -45,6 +45,7 @@ export enum NotificationType {
|
|||||||
RefundQueried = "refund-queried",
|
RefundQueried = "refund-queried",
|
||||||
RefundFinished = "refund-finished",
|
RefundFinished = "refund-finished",
|
||||||
ExchangeOperationError = "exchange-operation-error",
|
ExchangeOperationError = "exchange-operation-error",
|
||||||
|
ExchangeAdded = "exchange-added",
|
||||||
RefreshOperationError = "refresh-operation-error",
|
RefreshOperationError = "refresh-operation-error",
|
||||||
RecoupOperationError = "recoup-operation-error",
|
RecoupOperationError = "recoup-operation-error",
|
||||||
RefundApplyOperationError = "refund-apply-error",
|
RefundApplyOperationError = "refund-apply-error",
|
||||||
@ -150,6 +151,10 @@ export interface RefundFinishedNotification {
|
|||||||
type: NotificationType.RefundFinished;
|
type: NotificationType.RefundFinished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ExchangeAddedNotification {
|
||||||
|
type: NotificationType.ExchangeAdded;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ExchangeOperationErrorNotification {
|
export interface ExchangeOperationErrorNotification {
|
||||||
type: NotificationType.ExchangeOperationError;
|
type: NotificationType.ExchangeOperationError;
|
||||||
error: TalerErrorDetails;
|
error: TalerErrorDetails;
|
||||||
@ -243,6 +248,7 @@ export type WalletNotification =
|
|||||||
| BackupOperationErrorNotification
|
| BackupOperationErrorNotification
|
||||||
| WithdrawOperationErrorNotification
|
| WithdrawOperationErrorNotification
|
||||||
| ReserveOperationErrorNotification
|
| ReserveOperationErrorNotification
|
||||||
|
| ExchangeAddedNotification
|
||||||
| ExchangeOperationErrorNotification
|
| ExchangeOperationErrorNotification
|
||||||
| RefreshOperationErrorNotification
|
| RefreshOperationErrorNotification
|
||||||
| RefundStatusOperationErrorNotification
|
| RefundStatusOperationErrorNotification
|
||||||
|
@ -523,17 +523,32 @@ export interface ExchangesListRespose {
|
|||||||
exchanges: ExchangeListItem[];
|
exchanges: ExchangeListItem[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ExchangeTos {
|
||||||
|
acceptedVersion?: string;
|
||||||
|
currentVersion?: string;
|
||||||
|
contentType?: string;
|
||||||
|
content?: string;
|
||||||
|
}
|
||||||
export interface ExchangeListItem {
|
export interface ExchangeListItem {
|
||||||
exchangeBaseUrl: string;
|
exchangeBaseUrl: string;
|
||||||
currency: string;
|
currency: string;
|
||||||
paytoUris: string[];
|
paytoUris: string[];
|
||||||
|
tos: ExchangeTos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const codecForExchangeTos = (): Codec<ExchangeTos> => buildCodecForObject<ExchangeTos>()
|
||||||
|
.property("acceptedVersion", codecOptional(codecForString()))
|
||||||
|
.property("currentVersion", codecOptional(codecForString()))
|
||||||
|
.property("contentType", codecOptional(codecForString()))
|
||||||
|
.property("content", codecOptional(codecForString()))
|
||||||
|
.build("ExchangeTos")
|
||||||
|
|
||||||
export const codecForExchangeListItem = (): Codec<ExchangeListItem> =>
|
export const codecForExchangeListItem = (): Codec<ExchangeListItem> =>
|
||||||
buildCodecForObject<ExchangeListItem>()
|
buildCodecForObject<ExchangeListItem>()
|
||||||
.property("currency", codecForString())
|
.property("currency", codecForString())
|
||||||
.property("exchangeBaseUrl", codecForString())
|
.property("exchangeBaseUrl", codecForString())
|
||||||
.property("paytoUris", codecForList(codecForString()))
|
.property("paytoUris", codecForList(codecForString()))
|
||||||
|
.property("tos", codecForExchangeTos())
|
||||||
.build("ExchangeListItem");
|
.build("ExchangeListItem");
|
||||||
|
|
||||||
export const codecForExchangesListResponse = (): Codec<ExchangesListRespose> =>
|
export const codecForExchangesListResponse = (): Codec<ExchangesListRespose> =>
|
||||||
|
@ -657,6 +657,9 @@ async function updateExchangeFromUrlImpl(
|
|||||||
|
|
||||||
logger.trace("done updating exchange info in database");
|
logger.trace("done updating exchange info in database");
|
||||||
|
|
||||||
|
ws.notify({
|
||||||
|
type: NotificationType.ExchangeAdded,
|
||||||
|
});
|
||||||
return {
|
return {
|
||||||
exchange: updated.exchange,
|
exchange: updated.exchange,
|
||||||
exchangeDetails: updated.exchangeDetails,
|
exchangeDetails: updated.exchangeDetails,
|
||||||
|
@ -746,8 +746,7 @@ export async function updateWithdrawalDenoms(
|
|||||||
denom.verificationStatus === DenominationVerificationStatus.Unverified
|
denom.verificationStatus === DenominationVerificationStatus.Unverified
|
||||||
) {
|
) {
|
||||||
logger.trace(
|
logger.trace(
|
||||||
`Validating denomination (${current + 1}/${
|
`Validating denomination (${current + 1}/${denominations.length
|
||||||
denominations.length
|
|
||||||
}) signature of ${denom.denomPubHash}`,
|
}) signature of ${denom.denomPubHash}`,
|
||||||
);
|
);
|
||||||
const valid = await ws.cryptoApi.isValidDenom(
|
const valid = await ws.cryptoApi.isValidDenom(
|
||||||
@ -1075,6 +1074,12 @@ export async function getWithdrawalDetailsForUri(
|
|||||||
exchanges.push({
|
exchanges.push({
|
||||||
exchangeBaseUrl: details.exchangeBaseUrl,
|
exchangeBaseUrl: details.exchangeBaseUrl,
|
||||||
currency: details.currency,
|
currency: details.currency,
|
||||||
|
tos: {
|
||||||
|
acceptedVersion: details.termsOfServiceAcceptedEtag,
|
||||||
|
currentVersion: details.termsOfServiceLastEtag,
|
||||||
|
contentType: details.termsOfServiceContentType,
|
||||||
|
content: details.termsOfServiceText,
|
||||||
|
},
|
||||||
paytoUris: details.wireInfo.accounts.map((x) => x.payto_uri),
|
paytoUris: details.wireInfo.accounts.map((x) => x.payto_uri),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -513,9 +513,16 @@ async function getExchanges(
|
|||||||
if (!exchangeDetails) {
|
if (!exchangeDetails) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
exchanges.push({
|
exchanges.push({
|
||||||
exchangeBaseUrl: r.baseUrl,
|
exchangeBaseUrl: r.baseUrl,
|
||||||
currency,
|
currency,
|
||||||
|
tos: {
|
||||||
|
acceptedVersion: exchangeDetails.termsOfServiceAcceptedEtag,
|
||||||
|
currentVersion: exchangeDetails.termsOfServiceLastEtag,
|
||||||
|
contentType: exchangeDetails.termsOfServiceContentType,
|
||||||
|
content: exchangeDetails.termsOfServiceText,
|
||||||
|
},
|
||||||
paytoUris: exchangeDetails.wireInfo.accounts.map((x) => x.payto_uri),
|
paytoUris: exchangeDetails.wireInfo.accounts.map((x) => x.payto_uri),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user