diff options
Diffstat (limited to 'packages/taler-wallet-core/src/operations/common.ts')
-rw-r--r-- | packages/taler-wallet-core/src/operations/common.ts | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/packages/taler-wallet-core/src/operations/common.ts b/packages/taler-wallet-core/src/operations/common.ts index 95551010c..d75869043 100644 --- a/packages/taler-wallet-core/src/operations/common.ts +++ b/packages/taler-wallet-core/src/operations/common.ts @@ -362,9 +362,10 @@ export enum TombstoneTag { DeletePeerPushCredit = "delete-peer-push-credit", } - /** * Create an event ID from the type and the primary key for the event. + * + * @deprecated use constructTombstone instead */ export function makeTombstoneId(type: TombstoneTag, ...args: string[]): string { return `tmb:${type}:${args.map((x) => encodeURIComponent(x)).join(":")}`; @@ -458,3 +459,19 @@ export function runLongpollAsync( }; asyncFn(); } + +export type ParsedTombstone = + | { + tag: TombstoneTag.DeleteWithdrawalGroup; + withdrawalGroupId: string; + } + | { tag: TombstoneTag.DeleteRefund; refundGroupId: string }; + +export function constructTombstone(p: ParsedTombstone): string { + switch (p.tag) { + case TombstoneTag.DeleteWithdrawalGroup: + return `tmb:${p.tag}:${p.withdrawalGroupId}`; + case TombstoneTag.DeleteRefund: + return `tmb:${p.tag}:${p.refundGroupId}`; + } +} |