@@ -100,7 +100,7 @@ export class VotingPowerTriggerHandler extends BaseTriggerHandler {
100100 ) : Promise < void > {
101101 const { daoId, accountId, sourceAccountId, delta, transactionHash, chainId, votingPower, logIndex } = votingPowerEvent ;
102102
103- const subscribers = await this . getNotificationSubscribers (
103+ const { subscribers, eventId } = await this . getNotificationSubscribers (
104104 accountId , // who receives the delegation
105105 daoId ,
106106 transactionHash ,
@@ -137,7 +137,7 @@ export class VotingPowerTriggerHandler extends BaseTriggerHandler {
137137 chainId
138138 } ) ;
139139
140- await this . sendNotificationsToSubscribers ( subscribers , notificationMessage , transactionHash , daoId , metadata , buttons ) ;
140+ await this . sendNotificationsToSubscribers ( subscribers , notificationMessage , eventId , daoId , metadata , buttons ) ;
141141 }
142142
143143 /**
@@ -160,7 +160,7 @@ export class VotingPowerTriggerHandler extends BaseTriggerHandler {
160160 return ;
161161 }
162162
163- const subscribers = await this . getNotificationSubscribers (
163+ const { subscribers, eventId } = await this . getNotificationSubscribers (
164164 sourceAccountId , // who MADE the delegation
165165 daoId ,
166166 transactionHash ,
@@ -219,7 +219,7 @@ export class VotingPowerTriggerHandler extends BaseTriggerHandler {
219219 chainId
220220 } ) ;
221221
222- await this . sendNotificationsToSubscribers ( subscribers , notificationMessage , transactionHash , daoId , metadata , buttons ) ;
222+ await this . sendNotificationsToSubscribers ( subscribers , notificationMessage , eventId , daoId , metadata , buttons ) ;
223223 }
224224
225225 /**
@@ -232,7 +232,7 @@ export class VotingPowerTriggerHandler extends BaseTriggerHandler {
232232 ) : Promise < void > {
233233 const { daoId, accountId, changeType, transactionHash, chainId, transfer, logIndex } = votingPowerEvent ;
234234
235- const subscribers = await this . getNotificationSubscribers (
235+ const { subscribers, eventId } = await this . getNotificationSubscribers (
236236 accountId , daoId , transactionHash , logIndex , walletOwnersMap , daoSubscribersMap
237237 ) ;
238238 if ( subscribers . length === 0 ) return ;
@@ -242,7 +242,7 @@ export class VotingPowerTriggerHandler extends BaseTriggerHandler {
242242 : this . buildGenericNotification ( votingPowerEvent ) ;
243243
244244 const buttons = buildButtons ( { triggerType : 'votingPowerChange' , txHash : transactionHash , chainId } ) ;
245- await this . sendNotificationsToSubscribers ( subscribers , message , transactionHash , daoId , metadata , buttons ) ;
245+ await this . sendNotificationsToSubscribers ( subscribers , message , eventId , daoId , metadata , buttons ) ;
246246 }
247247
248248 /**
@@ -293,7 +293,6 @@ export class VotingPowerTriggerHandler extends BaseTriggerHandler {
293293
294294 /**
295295 * Shared method to get notification subscribers with deduplication
296- *
297296 * eventId format: ${transactionHash}-${logIndex}-${accountId}-voting-power
298297 */
299298 private async getNotificationSubscribers (
@@ -303,10 +302,12 @@ export class VotingPowerTriggerHandler extends BaseTriggerHandler {
303302 logIndex : number ,
304303 walletOwnersMap : Record < string , User [ ] > ,
305304 daoSubscribersMap : Record < string , User [ ] >
306- ) : Promise < User [ ] > {
305+ ) : Promise < { subscribers : User [ ] ; eventId : string } > {
306+ const eventId = `${ transactionHash } -${ logIndex } -${ accountId } -voting-power` ;
307+
307308 // Get wallet owners from cache
308309 const walletOwners = walletOwnersMap [ accountId ] || [ ] ;
309- if ( walletOwners . length === 0 ) return [ ] ;
310+ if ( walletOwners . length === 0 ) return { subscribers : [ ] , eventId } ;
310311
311312 // Get DAO subscribers from cache
312313 const daoSubscribers = daoSubscribersMap [ daoId ] || [ ] ;
@@ -316,8 +317,8 @@ export class VotingPowerTriggerHandler extends BaseTriggerHandler {
316317 daoSubscribers . some ( sub => sub . id === owner . id )
317318 ) ;
318319
319- if ( subscribedOwners . length === 0 ) return [ ] ;
320- const eventId = ` ${ transactionHash } - ${ logIndex } - ${ accountId } -voting-power` ;
320+ if ( subscribedOwners . length === 0 ) return { subscribers : [ ] , eventId } ;
321+
321322 // Check deduplication for all subscribed owners at once
322323 const shouldSendNotifications = await this . subscriptionClient . shouldSend (
323324 subscribedOwners ,
@@ -326,10 +327,10 @@ export class VotingPowerTriggerHandler extends BaseTriggerHandler {
326327 ) ;
327328
328329 // Final filtered list of subscribers
329- const finalSubscribers = subscribedOwners . filter ( owner =>
330+ const subscribers = subscribedOwners . filter ( owner =>
330331 shouldSendNotifications . some ( notification => notification . user_id === owner . id )
331332 ) ;
332- return finalSubscribers ;
333+ return { subscribers , eventId } ;
333334 }
334335
335336 /**
0 commit comments