DESCRIPTION
Several critical actions in Velar do not emit any event to the audit_events table, creating gaps in the audit trail that undermine the platform's core promise of full traceability. This task adds the missing event emissions in the appropriate NestJS services using the existing AuditService.emit() pattern.
GOAL
Every critical lifecycle action on a bond or actor emits a corresponding audit event, making the on-chain and off-chain audit trail complete and gap-free.
REQUIREMENTS
party_created → PartiesService.create()
wallet_provisioned → WalletService.provisionWallet()
bond_published → BondsService.publish()
offer_rejected → TransfersService.reject()
counter_offer_sent → TransfersService.counterOffer()
- Each event must include:
type, bondTokenId (if applicable), actorId, payload (JSON), txHash (if applicable)
- Use the existing
AuditService.emit() pattern — do not create new emission methods
- Add new event type constants to the
AuditEventType enum in @velar/types
ACCEPTANCE CRITERIA
NOTES
Relevant files: apps/api/src/parties/parties.service.ts, apps/api/src/wallets/wallet.service.ts, apps/api/src/bonds/bonds.service.ts, apps/api/src/transfers/transfers.service.ts, apps/api/src/audit/audit.service.ts, packages/types/. txHash may be null for non-blockchain actions (e.g. party_created). Confirm the audit_events table schema in supabase/migrations/ before inserting.
Difficulty: Intermediate
Priority: High
DESCRIPTION
Several critical actions in Velar do not emit any event to the
audit_eventstable, creating gaps in the audit trail that undermine the platform's core promise of full traceability. This task adds the missing event emissions in the appropriate NestJS services using the existingAuditService.emit()pattern.GOAL
Every critical lifecycle action on a bond or actor emits a corresponding audit event, making the on-chain and off-chain audit trail complete and gap-free.
REQUIREMENTS
party_created→PartiesService.create()wallet_provisioned→WalletService.provisionWallet()bond_published→BondsService.publish()offer_rejected→TransfersService.reject()counter_offer_sent→TransfersService.counterOffer()type,bondTokenId(if applicable),actorId,payload(JSON),txHash(if applicable)AuditService.emit()pattern — do not create new emission methodsAuditEventTypeenum in@velar/typesACCEPTANCE CRITERIA
audit_eventsafter their corresponding actions are triggeredtype,actorId,payload,created_atpackages/typesdocs/audit-events.mdor equivalentNOTES
Relevant files:
apps/api/src/parties/parties.service.ts,apps/api/src/wallets/wallet.service.ts,apps/api/src/bonds/bonds.service.ts,apps/api/src/transfers/transfers.service.ts,apps/api/src/audit/audit.service.ts,packages/types/.txHashmay be null for non-blockchain actions (e.g.party_created). Confirm theaudit_eventstable schema insupabase/migrations/before inserting.Difficulty: Intermediate
Priority: High