@@ -68,17 +68,6 @@ describe("IPAccount Functions", () => {
6868 } ) ;
6969 expect ( response . txHash ) . to . be . a ( "string" ) ;
7070 } ) ;
71-
72- it ( "should fail with invalid ipId" , async ( ) => {
73- await expect (
74- client . ipAccount . execute ( {
75- to : permissionAddress ,
76- value : 0 ,
77- data : data ,
78- ipId : "0x0000000000000000000000000000000000000000" ,
79- } ) ,
80- ) . to . be . rejected ;
81- } ) ;
8271 } ) ;
8372
8473 describe ( "executeWithSig" , ( ) => {
@@ -127,19 +116,6 @@ describe("IPAccount Functions", () => {
127116 ) . to . be . rejectedWith ( "IPAccount__ExpiredSignature" ) ;
128117 } ) ;
129118
130- it ( "should fail with invalid signature format" , async ( ) => {
131- await expect (
132- client . ipAccount . executeWithSig ( {
133- to : permissionAddress ,
134- data : data ,
135- ipId : ipId ,
136- signer : TEST_WALLET_ADDRESS ,
137- deadline : VALID_DEADLINE ,
138- signature : "0x1234567890abcdef" as Hex , // Invalid signature format
139- } ) ,
140- ) . to . be . rejectedWith ( "IPAccount__InvalidSignature" ) ;
141- } ) ;
142-
143119 it ( "should fail with signature from wrong signer" , async ( ) => {
144120 // Generate signature with wrong signer
145121 const wrongSigner = "0x1234567890123456789012345678901234567890" as Address ;
@@ -167,158 +143,6 @@ describe("IPAccount Functions", () => {
167143 ) . to . be . rejectedWith ( "IPAccount__InvalidSignature" ) ;
168144 } ) ;
169145
170- it ( "should fail with invalid ipId format" , async ( ) => {
171- const nonceResult = await client . ipAccount . getIpAccountNonce ( ipId ) ;
172-
173- const { signature } = await getSignature ( {
174- state : nonceResult ,
175- to : permissionAddress ,
176- encodeData : data ,
177- wallet : walletClient ,
178- verifyingContract : ipId ,
179- deadline : VALID_DEADLINE ,
180- chainId : aeneid ,
181- } ) ;
182-
183- await expect (
184- client . ipAccount . executeWithSig ( {
185- to : permissionAddress ,
186- data : data ,
187- ipId : "0x123" as Address , // Invalid address format
188- signer : TEST_WALLET_ADDRESS ,
189- deadline : VALID_DEADLINE ,
190- signature : signature ,
191- } ) ,
192- ) . to . be . rejectedWith ( "Invalid address: 0x123." ) ;
193- } ) ;
194-
195- it ( "should fail when IP account does not exist" , async ( ) => {
196- // Create a real non-existent IP address (but with correct format)
197- const nonExistentIpId = "0x1111111111111111111111111111111111111111" as Address ;
198-
199- // Generate signature for this non-existent IP
200- // Note: We need to try to get nonce first, if IP doesn't exist, this step should fail
201- try {
202- const nonceResult = await client . ipAccount . getIpAccountNonce ( nonExistentIpId ) ;
203-
204- const { signature } = await getSignature ( {
205- state : nonceResult ,
206- to : permissionAddress ,
207- encodeData : data ,
208- wallet : walletClient ,
209- verifyingContract : nonExistentIpId , // Use non-existent IP as verifying contract
210- deadline : VALID_DEADLINE ,
211- chainId : aeneid ,
212- } ) ;
213-
214- await expect (
215- client . ipAccount . executeWithSig ( {
216- to : permissionAddress ,
217- data : data ,
218- ipId : nonExistentIpId ,
219- signer : TEST_WALLET_ADDRESS ,
220- deadline : VALID_DEADLINE ,
221- signature : signature ,
222- } ) ,
223- ) . to . be . rejectedWith ( "IPAccount__InvalidSignature" ) ; // Should fail because IP doesn't exist
224- } catch ( error ) {
225- // If getting nonce fails, it means IP indeed doesn't exist, which is also our expected result
226- expect ( ( error as Error ) . message ) . to . include ( "Failed to get the IP Account nonce" ) ;
227- }
228- } ) ;
229-
230- it ( "should fail with unauthorized signer" , async ( ) => {
231- // Test various unauthorized signer scenarios
232- const unauthorizedSigner = "0x2222222222222222222222222222222222222222" as Address ;
233-
234- const nonceResult = await client . ipAccount . getIpAccountNonce ( ipId ) ;
235- const { signature } = await getSignature ( {
236- state : nonceResult ,
237- to : permissionAddress ,
238- encodeData : data ,
239- wallet : walletClient ,
240- verifyingContract : ipId ,
241- deadline : VALID_DEADLINE ,
242- chainId : aeneid ,
243- } ) ;
244-
245- await expect (
246- client . ipAccount . executeWithSig ( {
247- to : permissionAddress ,
248- data : data ,
249- ipId : ipId ,
250- signer : unauthorizedSigner , // Unauthorized signer
251- deadline : VALID_DEADLINE ,
252- signature : signature ,
253- } ) ,
254- ) . to . be . rejectedWith ( "IPAccount__InvalidSignature" ) ; // Contract returns InvalidSignature for permission issues
255- } ) ;
256-
257- it ( "should fail with signature for wrong data" , async ( ) => {
258- // Generate signature for different data than what we execute
259- const wrongData = encodeFunctionData ( {
260- abi : accessControllerAbi ,
261- functionName : "setTransientPermission" ,
262- args : [
263- getAddress ( "0x1234567890123456789012345678901234567890" ) ,
264- getAddress ( TEST_WALLET_ADDRESS ) ,
265- getAddress ( coreMetadataModule ) ,
266- toFunctionSelector ( "function setAll(address,string,bytes32,bytes32)" ) ,
267- AccessPermission . DENY ,
268- ] ,
269- } ) ;
270-
271- const nonceResult = await client . ipAccount . getIpAccountNonce ( ipId ) ;
272-
273- const { signature } = await getSignature ( {
274- state : nonceResult ,
275- to : permissionAddress ,
276- encodeData : wrongData , // Sign wrong data
277- wallet : walletClient ,
278- verifyingContract : ipId ,
279- deadline : VALID_DEADLINE ,
280- chainId : aeneid ,
281- } ) ;
282-
283- await expect (
284- client . ipAccount . executeWithSig ( {
285- to : permissionAddress ,
286- data : data , // Execute with original data, not the signed data
287- ipId : ipId ,
288- signer : TEST_WALLET_ADDRESS ,
289- deadline : VALID_DEADLINE ,
290- signature : signature ,
291- } ) ,
292- ) . to . be . rejectedWith ( "IPAccount__InvalidSignature" ) ; // Should fail because data doesn't match signature
293- } ) ;
294-
295- it ( "should fail with signature for wrong target address" , async ( ) => {
296- // Generate signature for different target address than what we execute
297- const wrongTarget = "0x1234567890123456789012345678901234567890" as Address ;
298- const nonceResult = await client . ipAccount . getIpAccountNonce ( ipId ) ;
299-
300- const { signature } = await getSignature ( {
301- state : nonceResult ,
302- to : wrongTarget , // Sign for wrong target
303- encodeData : data ,
304- wallet : walletClient ,
305- verifyingContract : ipId ,
306- deadline : VALID_DEADLINE ,
307- chainId : aeneid ,
308- } ) ;
309-
310- await expect (
311- client . ipAccount . executeWithSig ( {
312- to : permissionAddress , // Execute with original target, not the signed target
313- data : data ,
314- ipId : ipId ,
315- signer : TEST_WALLET_ADDRESS ,
316- deadline : VALID_DEADLINE ,
317- signature : signature ,
318- } ) ,
319- ) . to . be . rejectedWith ( "IPAccount__InvalidSignature" ) ; // Should fail because target doesn't match signature
320- } ) ;
321-
322146 it ( "should execute with zero value transaction" , async ( ) => {
323147 // Test successful execution with zero value
324148 const nonceResult = await client . ipAccount . getIpAccountNonce ( ipId ) ;
@@ -347,32 +171,18 @@ describe("IPAccount Functions", () => {
347171 } ) ;
348172 } ) ;
349173
350- describe ( "getIpAccountNonce" , ( ) => {
351- it ( "should successfully return account nonce" , async ( ) => {
352- const response = await client . ipAccount . getIpAccountNonce ( ipId ) ;
353- expect ( response ) . to . be . a ( "string" ) ;
354- } ) ;
355-
356- it ( "should fail with invalid ipId" , async ( ) => {
357- await expect ( client . ipAccount . getIpAccountNonce ( "0x0000000000000000000000000000000000000000" ) )
358- . to . be . rejected ;
359- } ) ;
174+ it ( "should successfully return account nonce" , async ( ) => {
175+ const response = await client . ipAccount . getIpAccountNonce ( ipId ) ;
176+ expect ( response ) . to . be . a ( "string" ) ;
360177 } ) ;
361178
362- describe ( "getToken" , ( ) => {
363- it ( "should successfully return token information" , async ( ) => {
364- const response = await client . ipAccount . getToken ( ipId ) ;
179+ it ( "should successfully return token information" , async ( ) => {
180+ const response = await client . ipAccount . getToken ( ipId ) ;
365181
366- expect ( response . chainId ) . to . be . a ( "bigint" ) ;
367- expect ( response . tokenContract ) . to . be . a ( "string" ) ;
368- expect ( response . tokenId ) . to . be . a ( "bigint" ) ;
369- expect ( response . tokenContract ) . to . equal ( mockERC721 ) ;
370- } ) ;
371-
372- it ( "should fail with invalid ipId" , async ( ) => {
373- await expect ( client . ipAccount . getToken ( "0x0000000000000000000000000000000000000000" ) ) . to . be
374- . rejected ;
375- } ) ;
182+ expect ( response . chainId ) . to . be . a ( "bigint" ) ;
183+ expect ( response . tokenContract ) . to . be . a ( "string" ) ;
184+ expect ( response . tokenId ) . to . be . a ( "bigint" ) ;
185+ expect ( response . tokenContract ) . to . equal ( mockERC721 ) ;
376186 } ) ;
377187
378188 it ( "should successfully set ip metadata" , async ( ) => {
0 commit comments