diff options
Diffstat (limited to 'packages/taler-util')
-rw-r--r-- | packages/taler-util/src/time.ts | 22 | ||||
-rw-r--r-- | packages/taler-util/src/wallet-types.ts | 34 |
2 files changed, 41 insertions, 15 deletions
diff --git a/packages/taler-util/src/time.ts b/packages/taler-util/src/time.ts index 75b3c7e94..55cda08a5 100644 --- a/packages/taler-util/src/time.ts +++ b/packages/taler-util/src/time.ts @@ -312,6 +312,14 @@ export namespace Duration { } export namespace AbsoluteTime { + export function getStampMsNow(): number { + return new Date().getTime(); + } + + export function getStampMsNever(): number { + return Number.MAX_SAFE_INTEGER; + } + export function now(): AbsoluteTime { return { t_ms: new Date().getTime() + timeshift, @@ -398,6 +406,13 @@ export namespace AbsoluteTime { }; } + export function fromStampMs(stampMs: number): AbsoluteTime { + return { + t_ms: stampMs, + [opaque_AbsoluteTime]: true, + }; + } + export function fromPreciseTimestamp(t: TalerPreciseTimestamp): AbsoluteTime { if (t.t_s === "never") { return { t_ms: "never", [opaque_AbsoluteTime]: true }; @@ -409,6 +424,13 @@ export namespace AbsoluteTime { }; } + export function toStampMs(at: AbsoluteTime): number { + if (at.t_ms === "never") { + return Number.MAX_SAFE_INTEGER; + } + return at.t_ms; + } + export function toPreciseTimestamp(at: AbsoluteTime): TalerPreciseTimestamp { if (at.t_ms == "never") { return { diff --git a/packages/taler-util/src/wallet-types.ts b/packages/taler-util/src/wallet-types.ts index 04fb43ec6..01c1838d5 100644 --- a/packages/taler-util/src/wallet-types.ts +++ b/packages/taler-util/src/wallet-types.ts @@ -1262,17 +1262,25 @@ export interface ExchangeFullDetails { } export enum ExchangeTosStatus { - New = "new", + Pending = "pending", + Proposed = "proposed", Accepted = "accepted", - Changed = "changed", - NotFound = "not-found", - Unknown = "unknown", } export enum ExchangeEntryStatus { - Unknown = "unknown", - Outdated = "outdated", - Ok = "ok", + Preset = "preset", + Ephemeral = "ephemeral", + Used = "used", +} + +export enum ExchangeUpdateStatus { + Initial = "initial", + InitialUpdate = "initial(update)", + Suspended = "suspended", + Failed = "failed", + OutdatedUpdate = "outdated(update)", + Ready = "ready", + ReadyUpdate = "ready(update)", } export interface OperationErrorInfo { @@ -1285,13 +1293,9 @@ export interface ExchangeListItem { currency: string | undefined; paytoUris: string[]; tosStatus: ExchangeTosStatus; - exchangeStatus: ExchangeEntryStatus; + exchangeEntryStatus: ExchangeEntryStatus; + exchangeUpdateStatus: ExchangeUpdateStatus; ageRestrictionOptions: number[]; - /** - * Permanently added to the wallet, as opposed to just - * temporarily queried. - */ - permanent: boolean; /** * Information about the last error that occurred when trying @@ -1370,8 +1374,8 @@ export const codecForExchangeListItem = (): Codec<ExchangeListItem> => .property("exchangeBaseUrl", codecForString()) .property("paytoUris", codecForList(codecForString())) .property("tosStatus", codecForAny()) - .property("exchangeStatus", codecForAny()) - .property("permanent", codecForBoolean()) + .property("exchangeEntryStatus", codecForAny()) + .property("exchangeUpdateStatus", codecForAny()) .property("ageRestrictionOptions", codecForList(codecForNumber())) .build("ExchangeListItem"); |