@@ -2,7 +2,6 @@ import { isHex } from 'viem';
22import { generatePrivateKey , privateKeyToAccount } from 'viem/accounts' ;
33import { describe , expect , it } from 'vitest' ;
44
5- import { createCaveatBuilder } from '../../../src/caveatBuilder' ;
65import { createDelegation } from '../../../src/delegation' ;
76import * as DelegationManager from '../../../src/DelegationFramework/DelegationManager' ;
87import { ExecutionMode , createExecution } from '../../../src/executions' ;
@@ -86,17 +85,21 @@ describe('DelegationManager - Delegation Management', () => {
8685 const delegation = createDelegation ( {
8786 to : bob . address ,
8887 from : alice . address ,
89- caveats : createCaveatBuilder ( environment ) . addCaveat ( 'allowedTargets' , {
88+ environment,
89+ scope : {
90+ type : 'functionCall' ,
9091 targets : [ alice . address ] ,
91- } ) ,
92+ selectors : [ '0x00000000' ] ,
93+ } ,
94+ caveats : [ ] ,
9295 } ) ;
9396
9497 const encodedData = DelegationManager . encode . disableDelegation ( {
9598 delegation,
9699 } ) ;
97100
98101 expect ( isHex ( encodedData , { strict : true } ) ) . toBe ( true ) ;
99- expect ( encodedData . length ) . toBe ( 1034 ) ;
102+ expect ( encodedData . length ) . toBe ( 1482 ) ;
100103 } ) ;
101104 } ) ;
102105
@@ -108,17 +111,21 @@ describe('DelegationManager - Delegation Management', () => {
108111 const delegation = createDelegation ( {
109112 to : bob . address ,
110113 from : alice . address ,
111- caveats : createCaveatBuilder ( environment ) . addCaveat ( 'allowedTargets' , {
114+ environment,
115+ scope : {
116+ type : 'functionCall' ,
112117 targets : [ alice . address ] ,
113- } ) ,
118+ selectors : [ '0x00000000' ] ,
119+ } ,
120+ caveats : [ ] ,
114121 } ) ;
115122
116123 const encodedData = DelegationManager . encode . enableDelegation ( {
117124 delegation,
118125 } ) ;
119126
120127 expect ( isHex ( encodedData , { strict : true } ) ) . toBe ( true ) ;
121- expect ( encodedData . length ) . toBe ( 1034 ) ;
128+ expect ( encodedData . length ) . toBe ( 1482 ) ;
122129 } ) ;
123130 } ) ;
124131
@@ -130,9 +137,13 @@ describe('DelegationManager - Delegation Management', () => {
130137 const delegation = createDelegation ( {
131138 to : bob . address ,
132139 from : alice . address ,
133- caveats : createCaveatBuilder ( environment ) . addCaveat ( 'allowedTargets' , {
140+ environment,
141+ scope : {
142+ type : 'functionCall' ,
134143 targets : [ alice . address ] ,
135- } ) ,
144+ selectors : [ '0x00000000' ] ,
145+ } ,
146+ caveats : [ ] ,
136147 } ) ;
137148
138149 const execution = createExecution ( {
@@ -146,7 +157,7 @@ describe('DelegationManager - Delegation Management', () => {
146157 } ) ;
147158
148159 expect ( isHex ( encodedData , { strict : true } ) ) . toBe ( true ) ;
149- expect ( encodedData . length ) . toBe ( 1994 ) ;
160+ expect ( encodedData . length ) . toBe ( 2442 ) ;
150161 } ) ;
151162 } ) ;
152163} ) ;
0 commit comments