@@ -47,7 +47,7 @@ func testRoundTrip(t *testing.T, s nonce.Store) {
4747 Blockhash : "test_blockhash" ,
4848 Environment : nonce .EnvironmentSolana ,
4949 EnvironmentInstance : nonce .EnvironmentInstanceSolanaMainnet ,
50- Purpose : nonce .PurposeClientTransaction ,
50+ Purpose : nonce .PurposeClientIntent ,
5151 State : nonce .StateClaimed ,
5252 ClaimNodeID : pointer .String ("test_claim_node_id" ),
5353 ClaimExpiresAt : pointer .Time (time .Now ().Add (time .Hour )),
@@ -276,12 +276,12 @@ func testGetCount(t *testing.T, s nonce.Store) {
276276 ctx := context .Background ()
277277
278278 expected := []nonce.Record {
279- {Address : "t1" , Authority : "a1" , Blockhash : "b1" , State : nonce .StateUnknown , Purpose : nonce .PurposeClientTransaction , Signature : "s1" },
280- {Address : "t2" , Authority : "a2" , Blockhash : "b1" , State : nonce .StateInvalid , Purpose : nonce .PurposeClientTransaction , Signature : "s2" },
281- {Address : "t3" , Authority : "a3" , Blockhash : "b1" , State : nonce .StateReserved , Purpose : nonce .PurposeClientTransaction , Signature : "s3" },
282- {Address : "t4" , Authority : "a1" , Blockhash : "b2" , State : nonce .StateReserved , Purpose : nonce .PurposeClientTransaction , Signature : "s4" },
279+ {Address : "t1" , Authority : "a1" , Blockhash : "b1" , State : nonce .StateUnknown , Purpose : nonce .PurposeClientIntent , Signature : "s1" },
280+ {Address : "t2" , Authority : "a2" , Blockhash : "b1" , State : nonce .StateInvalid , Purpose : nonce .PurposeClientIntent , Signature : "s2" },
281+ {Address : "t3" , Authority : "a3" , Blockhash : "b1" , State : nonce .StateReserved , Purpose : nonce .PurposeClientIntent , Signature : "s3" },
282+ {Address : "t4" , Authority : "a1" , Blockhash : "b2" , State : nonce .StateReserved , Purpose : nonce .PurposeClientIntent , Signature : "s4" },
283283 {Address : "t5" , Authority : "a2" , Blockhash : "b2" , State : nonce .StateReserved , Purpose : nonce .PurposeInternalServerProcess , Signature : "s5" },
284- {Address : "t6" , Authority : "a3" , Blockhash : "b2" , State : nonce .StateInvalid , Purpose : nonce .PurposeClientTransaction , Signature : "s6" },
284+ {Address : "t6" , Authority : "a3" , Blockhash : "b2" , State : nonce .StateInvalid , Purpose : nonce .PurposeClientIntent , Signature : "s6" },
285285 }
286286
287287 for index , item := range expected {
@@ -312,15 +312,15 @@ func testGetCount(t *testing.T, s nonce.Store) {
312312 require .NoError (t , err )
313313 assert .EqualValues (t , 3 , count )
314314
315- count , err = s .CountByStateAndPurpose (ctx , nonce .EnvironmentSolana , nonce .EnvironmentInstanceSolanaMainnet , nonce .StateReserved , nonce .PurposeClientTransaction )
315+ count , err = s .CountByStateAndPurpose (ctx , nonce .EnvironmentSolana , nonce .EnvironmentInstanceSolanaMainnet , nonce .StateReserved , nonce .PurposeClientIntent )
316316 require .NoError (t , err )
317317 assert .EqualValues (t , 2 , count )
318318
319319 count , err = s .CountByStateAndPurpose (ctx , nonce .EnvironmentSolana , nonce .EnvironmentInstanceSolanaMainnet , nonce .StateReserved , nonce .PurposeInternalServerProcess )
320320 require .NoError (t , err )
321321 assert .EqualValues (t , 1 , count )
322322
323- count , err = s .CountByStateAndPurpose (ctx , nonce .EnvironmentSolana , nonce .EnvironmentInstanceSolanaMainnet , nonce .StateUnknown , nonce .PurposeClientTransaction )
323+ count , err = s .CountByStateAndPurpose (ctx , nonce .EnvironmentSolana , nonce .EnvironmentInstanceSolanaMainnet , nonce .StateUnknown , nonce .PurposeClientIntent )
324324 require .NoError (t , err )
325325 assert .EqualValues (t , 1 , count )
326326
@@ -337,12 +337,12 @@ func testBatchClaimAvailableByPurpose(t *testing.T, s nonce.Store) {
337337 minExpiry := time .Now ().Add (time .Hour ).Truncate (time .Millisecond )
338338 maxExpiry := time .Now ().Add (2 * time .Hour ).Truncate (time .Millisecond )
339339
340- nonces , err := s .BatchClaimAvailableByPurpose (ctx , nonce .EnvironmentSolana , nonce .EnvironmentInstanceSolanaMainnet , nonce .PurposeClientTransaction , 100 , "my_node_id" , minExpiry , maxExpiry )
340+ nonces , err := s .BatchClaimAvailableByPurpose (ctx , nonce .EnvironmentSolana , nonce .EnvironmentInstanceSolanaMainnet , nonce .PurposeClientIntent , 100 , "my_node_id" , minExpiry , maxExpiry )
341341 require .Equal (t , nonce .ErrNonceNotFound , err )
342342 require .Empty (t , nonces )
343343
344344 for _ , purpose := range []nonce.Purpose {
345- nonce .PurposeClientTransaction ,
345+ nonce .PurposeClientIntent ,
346346 nonce .PurposeInternalServerProcess ,
347347 } {
348348 for _ , state := range []nonce.State {
@@ -396,7 +396,7 @@ func testBatchClaimAvailableByPurpose(t *testing.T, s nonce.Store) {
396396 Blockhash : "bh" ,
397397 Environment : nonce .EnvironmentCvm ,
398398 EnvironmentInstance : "pubkey" ,
399- Purpose : nonce .PurposeClientTransaction ,
399+ Purpose : nonce .PurposeClientIntent ,
400400 State : nonce .StateClaimed ,
401401 Signature : "" ,
402402 ClaimNodeID : pointer .String ("other_node_id" ),
@@ -407,7 +407,7 @@ func testBatchClaimAvailableByPurpose(t *testing.T, s nonce.Store) {
407407
408408 var claimed []* nonce.Record
409409 for remaining := 75 ; remaining > 0 ; {
410- nonces , err = s .BatchClaimAvailableByPurpose (ctx , nonce .EnvironmentSolana , nonce .EnvironmentInstanceSolanaMainnet , nonce .PurposeClientTransaction , 10 , "my_node_d" , minExpiry , maxExpiry )
410+ nonces , err = s .BatchClaimAvailableByPurpose (ctx , nonce .EnvironmentSolana , nonce .EnvironmentInstanceSolanaMainnet , nonce .PurposeClientIntent , 10 , "my_node_d" , minExpiry , maxExpiry )
411411 require .NoError (t , err )
412412 require .Len (t , nonces , min (remaining , 10 ))
413413
@@ -424,14 +424,14 @@ func testBatchClaimAvailableByPurpose(t *testing.T, s nonce.Store) {
424424 require .LessOrEqual (t , * actual .ClaimExpiresAt , maxExpiry )
425425 require .Equal (t , nonce .EnvironmentSolana , actual .Environment )
426426 require .Equal (t , nonce .EnvironmentInstanceSolanaMainnet , actual .EnvironmentInstance )
427- require .Equal (t , nonce .PurposeClientTransaction , actual .Purpose )
427+ require .Equal (t , nonce .PurposeClientIntent , actual .Purpose )
428428 require .EqualValues (t , 2 , actual .Version )
429429
430430 claimed = append (claimed , actual )
431431 }
432432 }
433433
434- nonces , err = s .BatchClaimAvailableByPurpose (ctx , nonce .EnvironmentSolana , nonce .EnvironmentInstanceSolanaMainnet , nonce .PurposeClientTransaction , 10 , "my_node_id" , minExpiry , maxExpiry )
434+ nonces , err = s .BatchClaimAvailableByPurpose (ctx , nonce .EnvironmentSolana , nonce .EnvironmentInstanceSolanaMainnet , nonce .PurposeClientIntent , 10 , "my_node_id" , minExpiry , maxExpiry )
435435 require .Equal (t , nonce .ErrNonceNotFound , err )
436436 require .Empty (t , nonces )
437437
@@ -442,7 +442,7 @@ func testBatchClaimAvailableByPurpose(t *testing.T, s nonce.Store) {
442442 s .Save (ctx , claimed [i ])
443443 }
444444
445- nonces , err = s .BatchClaimAvailableByPurpose (ctx , nonce .EnvironmentSolana , nonce .EnvironmentInstanceSolanaMainnet , nonce .PurposeClientTransaction , 30 , "my_node_id2" , minExpiry , maxExpiry )
445+ nonces , err = s .BatchClaimAvailableByPurpose (ctx , nonce .EnvironmentSolana , nonce .EnvironmentInstanceSolanaMainnet , nonce .PurposeClientIntent , 30 , "my_node_id2" , minExpiry , maxExpiry )
446446 require .NoError (t , err )
447447 require .Len (t , nonces , 20 )
448448
@@ -462,7 +462,7 @@ func testBatchClaimAvailableByPurpose(t *testing.T, s nonce.Store) {
462462 require .LessOrEqual (t , * actual .ClaimExpiresAt , maxExpiry )
463463 require .Equal (t , nonce .EnvironmentSolana , actual .Environment )
464464 require .Equal (t , nonce .EnvironmentInstanceSolanaMainnet , actual .EnvironmentInstance )
465- require .Equal (t , nonce .PurposeClientTransaction , actual .Purpose )
465+ require .Equal (t , nonce .PurposeClientIntent , actual .Purpose )
466466 require .Equal (t , claimed [i ].Address , actual .Address )
467467 require .EqualValues (t , 4 , actual .Version )
468468 }
@@ -478,20 +478,20 @@ func testBatchClaimAvailableByPurposeExpirationRandomness(t *testing.T, s nonce.
478478
479479 for i := 0 ; i < 1000 ; i ++ {
480480 record := & nonce.Record {
481- Address : fmt .Sprintf ("nonce_%s_%s_%d" , nonce .PurposeClientTransaction , nonce .StateAvailable , i ),
481+ Address : fmt .Sprintf ("nonce_%s_%s_%d" , nonce .PurposeClientIntent , nonce .StateAvailable , i ),
482482 Authority : "authority" ,
483483 Blockhash : "bh" ,
484484 Environment : nonce .EnvironmentSolana ,
485485 EnvironmentInstance : nonce .EnvironmentInstanceSolanaMainnet ,
486- Purpose : nonce .PurposeClientTransaction ,
486+ Purpose : nonce .PurposeClientIntent ,
487487 State : nonce .StateAvailable ,
488488 Signature : "" ,
489489 }
490490
491491 require .NoError (t , s .Save (ctx , record ))
492492 }
493493
494- nonces , err := s .BatchClaimAvailableByPurpose (ctx , nonce .EnvironmentSolana , nonce .EnvironmentInstanceSolanaMainnet , nonce .PurposeClientTransaction , 1000 , "my_node_id" , min , max )
494+ nonces , err := s .BatchClaimAvailableByPurpose (ctx , nonce .EnvironmentSolana , nonce .EnvironmentInstanceSolanaMainnet , nonce .PurposeClientIntent , 1000 , "my_node_id" , min , max )
495495 require .NoError (t , err )
496496 require .Len (t , nonces , 1000 )
497497
0 commit comments