66import { Address , Hex } from 'viem' ;
77import { GuardController } from '../../../sdk/typescript/contracts/core/GuardController.tsx' ;
88import { BaseSDKTest , TestWallet } from '../base/BaseSDKTest.ts' ;
9- import { getContractAddressFromArtifacts } from '../base/test-helpers.ts' ;
9+ import { getContractAddressFromArtifacts , getDefinitionAddress } from '../base/test-helpers.ts' ;
1010import { getTestConfig } from '../base/test-config.ts' ;
1111import { MetaTransactionSigner } from '../../../sdk/typescript/utils/metaTx/metaTransaction.tsx' ;
1212import { MetaTransaction , MetaTxParams } from '../../../sdk/typescript/interfaces/lib.index.tsx' ;
1313import { TxAction } from '../../../sdk/typescript/types/lib.index.tsx' ;
1414import { GuardConfigActionType , GuardConfigAction } from '../../../sdk/typescript/types/core.execution.index.tsx' ;
15+ import { guardConfigBatchExecutionParams } from '../../../sdk/typescript/lib/definitions/GuardControllerDefinitions' ;
1516import { keccak256 , encodeAbiParameters , parseAbiParameters } from 'viem' ;
1617
1718export interface GuardControllerRoles {
@@ -22,6 +23,8 @@ export interface GuardControllerRoles {
2223
2324export abstract class BaseGuardControllerTest extends BaseSDKTest {
2425 protected guardController : GuardController | null = null ;
26+ /** Deployed GuardControllerDefinitions library address (for execution params) */
27+ protected guardControllerDefinitionsAddress : Address | null = null ;
2528 protected roles : GuardControllerRoles = {
2629 owner : '0x' as Address ,
2730 broadcaster : '0x' as Address ,
@@ -70,6 +73,8 @@ export abstract class BaseGuardControllerTest extends BaseSDKTest {
7073 throw new Error ( 'Contract address not set' ) ;
7174 }
7275
76+ this . guardControllerDefinitionsAddress = await getDefinitionAddress ( 'GuardControllerDefinitions' ) ;
77+
7378 // Create a wallet client for the owner (default)
7479 const walletClient = this . createWalletClient ( 'wallet1' ) ;
7580
@@ -298,9 +303,12 @@ export abstract class BaseGuardControllerTest extends BaseSDKTest {
298303 } ,
299304 ] ;
300305
301- // Get execution params using the new batch method
306+ // Get execution params using the new batch method (via definition contract)
307+ if ( ! this . guardControllerDefinitionsAddress ) {
308+ throw new Error ( 'GuardControllerDefinitions address not set' ) ;
309+ }
302310 console . log ( ` 📋 Getting execution params for guard config batch...` ) ;
303- const executionParams = await this . guardController . guardConfigBatchExecutionParams ( actions ) ;
311+ const executionParams = await guardConfigBatchExecutionParams ( this . publicClient , this . guardControllerDefinitionsAddress ! , actions ) ;
304312 console . log ( ` ✅ Execution params obtained` ) ;
305313
306314 // Create meta-tx params
@@ -381,9 +389,12 @@ export abstract class BaseGuardControllerTest extends BaseSDKTest {
381389 } ,
382390 ] ;
383391
384- // Get execution params using the new batch method
392+ // Get execution params using the new batch method (via definition contract)
393+ if ( ! this . guardControllerDefinitionsAddress ) {
394+ throw new Error ( 'GuardControllerDefinitions address not set' ) ;
395+ }
385396 console . log ( ` 📋 Getting execution params for guard config batch (function registration)...` ) ;
386- const executionParams = await this . guardController . guardConfigBatchExecutionParams ( actions ) ;
397+ const executionParams = await guardConfigBatchExecutionParams ( this . publicClient , this . guardControllerDefinitionsAddress ! , actions ) ;
387398 console . log ( ` ✅ Execution params obtained` ) ;
388399
389400 // Create meta-tx params
0 commit comments