45 lines
961 B
TypeScript
45 lines
961 B
TypeScript
/**
|
|
* ShareCreated Event
|
|
*
|
|
* Emitted when a new party share is created (after keygen).
|
|
*/
|
|
|
|
import { DomainEvent } from './domain-event.base';
|
|
import { PartyShareType } from '../enums';
|
|
|
|
export class ShareCreatedEvent extends DomainEvent {
|
|
constructor(
|
|
public readonly shareId: string,
|
|
public readonly partyId: string,
|
|
public readonly sessionId: string,
|
|
public readonly shareType: PartyShareType,
|
|
public readonly publicKey: string,
|
|
public readonly threshold: string,
|
|
) {
|
|
super();
|
|
}
|
|
|
|
get eventType(): string {
|
|
return 'ShareCreated';
|
|
}
|
|
|
|
get aggregateId(): string {
|
|
return this.shareId;
|
|
}
|
|
|
|
get aggregateType(): string {
|
|
return 'PartyShare';
|
|
}
|
|
|
|
get payload(): Record<string, unknown> {
|
|
return {
|
|
shareId: this.shareId,
|
|
partyId: this.partyId,
|
|
sessionId: this.sessionId,
|
|
shareType: this.shareType,
|
|
publicKey: this.publicKey,
|
|
threshold: this.threshold,
|
|
};
|
|
}
|
|
}
|