@@ -940,6 +940,7 @@ func TestCreateIntentConfigurationWithMalleableSapient_ZeroAddressSkipsLeaf(t *t
940940}
941941
942942func TestGetIntentConfigurationSignature (t * testing.T ) {
943+ ctx := context .Background ()
943944 // Create test wallets
944945 eoa1 , err := ethwallet .NewWalletFromRandomEntropy ()
945946 require .NoError (t , err )
@@ -967,7 +968,7 @@ func TestGetIntentConfigurationSignature(t *testing.T) {
967968 require .NoError (t , err )
968969
969970 // Create the signature
970- signature , err := sequence .GetIntentConfigurationSignature (eoa1 . Address (), [] * v3. CallsPayload { & payload } )
971+ signature , err := sequence .GetIntentConfigurationSignature (ctx , config , nil )
971972 require .NoError (t , err )
972973
973974 // fmt.Println("==> signature", common.Bytes2Hex(signature))
@@ -1042,10 +1043,14 @@ func TestGetIntentConfigurationSignature(t *testing.T) {
10421043 }, big .NewInt (0 ), big .NewInt (0 ))
10431044
10441045 // Create signatures for each payload as separate batches
1045- sig1 , err := sequence .GetIntentConfigurationSignature (eoa1 .Address (), []* v3.CallsPayload {& payload1 })
1046+ config1 , err := sequence .CreateIntentConfiguration (eoa1 .Address (), []* v3.CallsPayload {& payload1 }, nil )
1047+ require .NoError (t , err )
1048+ sig1 , err := sequence .GetIntentConfigurationSignature (ctx , config1 , nil )
10461049 require .NoError (t , err )
10471050
1048- sig2 , err := sequence .GetIntentConfigurationSignature (eoa1 .Address (), []* v3.CallsPayload {& payload2 })
1051+ config2 , err := sequence .CreateIntentConfiguration (eoa1 .Address (), []* v3.CallsPayload {& payload2 }, nil )
1052+ require .NoError (t , err )
1053+ sig2 , err := sequence .GetIntentConfigurationSignature (ctx , config2 , nil )
10491054 require .NoError (t , err )
10501055
10511056 // Verify signatures are different
@@ -1054,18 +1059,24 @@ func TestGetIntentConfigurationSignature(t *testing.T) {
10541059
10551060 t .Run ("same transactions produce same signatures" , func (t * testing.T ) {
10561061 // Use the payload directly
1057- sig1 , err := sequence .GetIntentConfigurationSignature (eoa1 .Address (), []* v3.CallsPayload {& payload })
1062+ config1 , err := sequence .CreateIntentConfiguration (eoa1 .Address (), []* v3.CallsPayload {& payload }, nil )
1063+ require .NoError (t , err )
1064+ sig1 , err := sequence .GetIntentConfigurationSignature (ctx , config1 , nil )
10581065 require .NoError (t , err )
10591066
1060- sig2 , err := sequence .GetIntentConfigurationSignature (eoa1 .Address (), []* v3.CallsPayload {& payload })
1067+ config2 , err := sequence .CreateIntentConfiguration (eoa1 .Address (), []* v3.CallsPayload {& payload }, nil )
1068+ require .NoError (t , err )
1069+ sig2 , err := sequence .GetIntentConfigurationSignature (ctx , config2 , nil )
10611070 require .NoError (t , err )
10621071
1063- // Verify signatures are the same
1072+ // Verify configs and signatures are the same
1073+ require .Equal (t , config1 .Tree , config2 .Tree , "same transactions should produce same configuration" )
10641074 require .Equal (t , sig1 , sig2 , "same transactions should produce same signatures" )
10651075 })
10661076}
10671077
10681078func TestGetIntentConfigurationSignature_MultipleTransactions (t * testing.T ) {
1079+ ctx := context .Background ()
10691080 // Create test wallets
10701081 eoa1 , err := ethwallet .NewWalletFromRandomEntropy ()
10711082 require .NoError (t , err )
@@ -1093,7 +1104,9 @@ func TestGetIntentConfigurationSignature_MultipleTransactions(t *testing.T) {
10931104 }, big .NewInt (0 ), big .NewInt (0 ))
10941105
10951106 // Create a signature
1096- sig , err := sequence .GetIntentConfigurationSignature (eoa1 .Address (), []* v3.CallsPayload {& payload1 })
1107+ config , err := sequence .CreateIntentConfiguration (eoa1 .Address (), []* v3.CallsPayload {& payload1 }, nil )
1108+ require .NoError (t , err )
1109+ sig , err := sequence .GetIntentConfigurationSignature (ctx , config , nil )
10971110 require .NoError (t , err )
10981111
10991112 // Convert the full signature into a hex string.
@@ -1104,6 +1117,7 @@ func TestGetIntentConfigurationSignature_MultipleTransactions(t *testing.T) {
11041117}
11051118
11061119func TestIntentTransactionToGuestModuleDeployAndCall (t * testing.T ) {
1120+ ctx := context .Background ()
11071121 // Create normal txn of: callmockContract.testCall(55, 0x112255)
11081122 callmockContract := testChain .UniDeploy (t , "WALLET_CALL_RECV_MOCK" , 0 )
11091123 calldata1 , err := callmockContract .Encode ("setRevertFlag" , false )
@@ -1164,7 +1178,9 @@ func TestIntentTransactionToGuestModuleDeployAndCall(t *testing.T) {
11641178 require .NotZero (t , mainSigner )
11651179
11661180 // Generate a configuration signature for the batch.
1167- intentConfigSig , err := sequence .GetIntentConfigurationSignature (mainSigner , []* v3.CallsPayload {& payload })
1181+ config , err := sequence .CreateIntentConfiguration (mainSigner , []* v3.CallsPayload {& payload }, nil )
1182+ require .NoError (t , err )
1183+ intentConfigSig , err := sequence .GetIntentConfigurationSignature (ctx , config , nil )
11681184 require .NoError (t , err )
11691185
11701186 // fmt.Println("==> bundle.Digest", bundle.Digest().Hash)
@@ -1238,6 +1254,7 @@ func TestIntentTransactionToGuestModuleDeployAndCall(t *testing.T) {
12381254}
12391255
12401256func TestIntentTransactionToGuestModuleDeployAndCallMultiplePayloads (t * testing.T ) {
1257+ ctx := context .Background ()
12411258 // Create normal txn of: callmockContract.testCall(55, 0x112255) for first chain
12421259 callmockContract := testChain .UniDeploy (t , "WALLET_CALL_RECV_MOCK" , 0 )
12431260 calldata1 , err := callmockContract .Encode ("setRevertFlag" , false )
@@ -1322,7 +1339,9 @@ func TestIntentTransactionToGuestModuleDeployAndCallMultiplePayloads(t *testing.
13221339 require .NotZero (t , mainSigner )
13231340
13241341 // Generate a configuration signature for both batches
1325- intentConfigSig , err := sequence .GetIntentConfigurationSignature (mainSigner , payloads )
1342+ config , err := sequence .CreateIntentConfiguration (mainSigner , payloads , nil )
1343+ require .NoError (t , err )
1344+ intentConfigSig , err := sequence .GetIntentConfigurationSignature (ctx , config , nil )
13261345 require .NoError (t , err )
13271346 fmt .Printf ("--- Intent Config Signature (for all payloads) ---\n %s\n " , common .Bytes2Hex (intentConfigSig ))
13281347
0 commit comments