@@ -488,6 +488,15 @@ async fn ct_withdraw() {
488
488
. await
489
489
. unwrap ( ) ;
490
490
assert_eq ! ( state. base. amount, 21 ) ;
491
+ let extension = state
492
+ . get_extension :: < ConfidentialTransferAccount > ( )
493
+ . unwrap ( ) ;
494
+ assert_eq ! (
495
+ alice_meta
496
+ . ae_key
497
+ . decrypt( & extension. decryptable_available_balance. try_into( ) . unwrap( ) ) ,
498
+ Some ( 21 ) ,
499
+ ) ;
491
500
492
501
token
493
502
. confidential_transfer_withdraw (
@@ -508,6 +517,15 @@ async fn ct_withdraw() {
508
517
. await
509
518
. unwrap ( ) ;
510
519
assert_eq ! ( state. base. amount, 42 ) ;
520
+ let extension = state
521
+ . get_extension :: < ConfidentialTransferAccount > ( )
522
+ . unwrap ( ) ;
523
+ assert_eq ! (
524
+ alice_meta
525
+ . ae_key
526
+ . decrypt( & extension. decryptable_available_balance. try_into( ) . unwrap( ) ) ,
527
+ Some ( 0 ) ,
528
+ ) ;
511
529
512
530
token
513
531
. confidential_transfer_empty_account (
@@ -582,6 +600,20 @@ async fn ct_transfer() {
582
600
. await
583
601
. unwrap ( ) ;
584
602
603
+ let state = token
604
+ . get_account_info ( & alice_meta. token_account )
605
+ . await
606
+ . unwrap ( ) ;
607
+ let extension = state
608
+ . get_extension :: < ConfidentialTransferAccount > ( )
609
+ . unwrap ( ) ;
610
+ assert_eq ! (
611
+ alice_meta
612
+ . ae_key
613
+ . decrypt( & extension. decryptable_available_balance. try_into( ) . unwrap( ) ) ,
614
+ Some ( 42 ) ,
615
+ ) ;
616
+
585
617
token
586
618
. confidential_transfer_transfer (
587
619
& alice_meta. token_account ,
@@ -595,6 +627,20 @@ async fn ct_transfer() {
595
627
. await
596
628
. unwrap ( ) ;
597
629
630
+ let state = token
631
+ . get_account_info ( & alice_meta. token_account )
632
+ . await
633
+ . unwrap ( ) ;
634
+ let extension = state
635
+ . get_extension :: < ConfidentialTransferAccount > ( )
636
+ . unwrap ( ) ;
637
+ assert_eq ! (
638
+ alice_meta
639
+ . ae_key
640
+ . decrypt( & extension. decryptable_available_balance. try_into( ) . unwrap( ) ) ,
641
+ Some ( 0 ) ,
642
+ ) ;
643
+
598
644
token
599
645
. confidential_transfer_empty_account (
600
646
& alice_meta. token_account ,
@@ -618,4 +664,42 @@ async fn ct_transfer() {
618
664
TransactionError :: InstructionError ( 1 , InstructionError :: InvalidAccountData )
619
665
) ) )
620
666
) ;
667
+
668
+ let state = token
669
+ . get_account_info ( & bob_meta. token_account )
670
+ . await
671
+ . unwrap ( ) ;
672
+ let extension = state
673
+ . get_extension :: < ConfidentialTransferAccount > ( )
674
+ . unwrap ( ) ;
675
+ assert_eq ! (
676
+ bob_meta
677
+ . ae_key
678
+ . decrypt( & extension. decryptable_available_balance. try_into( ) . unwrap( ) ) ,
679
+ Some ( 0 ) ,
680
+ ) ;
681
+
682
+ token
683
+ . confidential_transfer_apply_pending_balance (
684
+ & bob_meta. token_account ,
685
+ & bob,
686
+ 1 ,
687
+ bob_meta. ae_key . encrypt ( 42_u64 ) ,
688
+ )
689
+ . await
690
+ . unwrap ( ) ;
691
+
692
+ let state = token
693
+ . get_account_info ( & bob_meta. token_account )
694
+ . await
695
+ . unwrap ( ) ;
696
+ let extension = state
697
+ . get_extension :: < ConfidentialTransferAccount > ( )
698
+ . unwrap ( ) ;
699
+ assert_eq ! (
700
+ bob_meta
701
+ . ae_key
702
+ . decrypt( & extension. decryptable_available_balance. try_into( ) . unwrap( ) ) ,
703
+ Some ( 42 ) ,
704
+ ) ;
621
705
}
0 commit comments