@@ -68,29 +68,31 @@ export async function addAddressesToAlchemyWebhook(evm?: string, svm?: string):
6868 if ( ! record ) {
6969 throw new Error ( `EVM address does not exist in the database: ${ evm } ` ) ;
7070 }
71- // Iterate over all EVM networks and register the address with each webhook
72- for ( const [ chainId , webhookId ] of Object . entries ( evmChainIdToAlchemyWebhookId ) ) {
73- try {
74- await registerAddressWithAlchemyWebhookWithRetry ( evm , webhookId ) ;
75- logger . info ( {
76- at : 'TurnkeyController#addAddressesToAlchemyWebhook' ,
77- message : `Successfully registered EVM address with webhook for chain ${ chainId } ` ,
78- address : evm ,
79- chainId,
80- webhookId,
81- } ) ;
82- } catch ( error ) {
83- logger . error ( {
84- at : 'TurnkeyController#addAddressesToAlchemyWebhook' ,
85- message : `Failed to register EVM address with webhook for chain ${ chainId } after retries` ,
86- error,
87- address : evm ,
88- chainId,
89- webhookId,
90- } ) ;
91- errors . push ( `Failed to register EVM address with webhook for chain ${ chainId } after retries` ) ;
92- }
93- }
71+ // Register the address with all EVM webhooks in parallel
72+ await Promise . allSettled (
73+ Object . entries ( evmChainIdToAlchemyWebhookId ) . map ( async ( [ chainId , webhookId ] ) => {
74+ try {
75+ await registerAddressWithAlchemyWebhookWithRetry ( evm , webhookId ) ;
76+ logger . info ( {
77+ at : 'TurnkeyController#addAddressesToAlchemyWebhook' ,
78+ message : `Successfully registered EVM address with webhook for chain ${ chainId } ` ,
79+ address : evm ,
80+ chainId,
81+ webhookId,
82+ } ) ;
83+ } catch ( error ) {
84+ logger . error ( {
85+ at : 'TurnkeyController#addAddressesToAlchemyWebhook' ,
86+ message : `Failed to register EVM address with webhook for chain ${ chainId } after retries` ,
87+ error,
88+ address : evm ,
89+ chainId,
90+ webhookId,
91+ } ) ;
92+ errors . push ( `Failed to register EVM address with webhook for chain ${ chainId } after retries` ) ;
93+ }
94+ } ) ,
95+ ) ;
9496 }
9597
9698 // Add SVM address to webhook for monitoring
0 commit comments