@@ -512,6 +512,20 @@ export function getChainExecutionType(
512512 return chainConfig ?. executionType ?? ExecutionType . MovableCollateral ;
513513}
514514
515+ /**
516+ * Extract the executionType from an override config object.
517+ * Returns undefined if the override config doesn't have an executionType field.
518+ */
519+ export function getOverrideExecutionType (
520+ overrideConfig : unknown ,
521+ ) : ExecutionType | undefined {
522+ return typeof overrideConfig === 'object' &&
523+ overrideConfig !== null &&
524+ 'executionType' in overrideConfig
525+ ? ( overrideConfig as { executionType ?: ExecutionType } ) . executionType
526+ : undefined ;
527+ }
528+
515529/**
516530 * Get the names of all chains that use inventory execution type.
517531 * Includes both top-level inventory chains and override destination chains
@@ -540,15 +554,7 @@ export function getInventoryChainNames(strategies: StrategyConfig[]): string[] {
540554 return overrideEntries
541555 . filter ( ( [ , overrideConfig ] ) => {
542556 const overrideExecutionType =
543- typeof overrideConfig === 'object' &&
544- overrideConfig !== null &&
545- 'executionType' in overrideConfig
546- ? (
547- overrideConfig as {
548- executionType ?: ExecutionType ;
549- }
550- ) . executionType
551- : undefined ;
557+ getOverrideExecutionType ( overrideConfig ) ;
552558
553559 return (
554560 ( overrideExecutionType ??
@@ -582,15 +588,7 @@ export function getInventoryOriginChainNames(
582588 chainConfig . override ,
583589 ) . some ( ( overrideConfig ) => {
584590 const overrideExecutionType =
585- typeof overrideConfig === 'object' &&
586- overrideConfig !== null &&
587- 'executionType' in overrideConfig
588- ? (
589- overrideConfig as {
590- executionType ?: ExecutionType ;
591- }
592- ) . executionType
593- : undefined ;
591+ getOverrideExecutionType ( overrideConfig ) ;
594592
595593 return (
596594 ( overrideExecutionType ??
0 commit comments