@@ -712,10 +712,199 @@ async fn test_metadata_comprehensive_workflow() -> Result<(), light_client::rpc:
712
712
. await
713
713
. unwrap ( ) ;
714
714
715
- // Continue with remaining steps - combined operations, field updates, etc.
716
- // (Implementation details match the original test but with proper assertions)
715
+ // === STEP 2: Combined operations - Remove key, update field, change authority ===
716
+ let combined_step2_actions = vec ! [
717
+ MintActionType :: RemoveMetadataKey {
718
+ extension_index: 0 ,
719
+ key: b"license" . to_vec( ) ,
720
+ idempotent: 0 ,
721
+ } ,
722
+ MintActionType :: UpdateMetadataField {
723
+ extension_index: 0 ,
724
+ field_type: 0 , // Name
725
+ key: vec![ ] ,
726
+ value: b"Workflow Token" . to_vec( ) ,
727
+ } ,
728
+ MintActionType :: UpdateMetadataAuthority {
729
+ extension_index: 0 ,
730
+ new_authority: second_authority. pubkey( ) ,
731
+ } ,
732
+ ] ;
733
+
734
+ mint_action (
735
+ & mut rpc,
736
+ MintActionParams {
737
+ compressed_mint_address : context. compressed_mint_address ,
738
+ mint_seed : context. mint_seed . pubkey ( ) ,
739
+ authority : context. mint_authority . pubkey ( ) ,
740
+ payer : context. payer . pubkey ( ) ,
741
+ actions : combined_step2_actions,
742
+ new_mint : None ,
743
+ } ,
744
+ & context. mint_authority ,
745
+ & context. payer ,
746
+ None ,
747
+ )
748
+ . await ?;
749
+
750
+ // Assert: authority changed, name updated, "license" removed
751
+ let expected_after_step2 = create_expected_metadata_state (
752
+ Some ( second_authority. pubkey ( ) ) ,
753
+ "Workflow Token" ,
754
+ "TEST" ,
755
+ "https://example.com/token.json" ,
756
+ vec ! [
757
+ create_additional_metadata( "website" , "https://mytoken.com" ) ,
758
+ create_additional_metadata( "category" , "DeFi" ) ,
759
+ create_additional_metadata( "creator" , "TokenMaker Inc." ) ,
760
+ ] ,
761
+ 0 ,
762
+ ) ;
763
+ assert_metadata_state ( & mut rpc, context. compressed_mint_address , & expected_after_step2) . await ;
764
+
765
+ // === STEP 3: Update symbol field with second authority ===
766
+ mint_action (
767
+ & mut rpc,
768
+ MintActionParams {
769
+ compressed_mint_address : context. compressed_mint_address ,
770
+ mint_seed : context. mint_seed . pubkey ( ) ,
771
+ authority : second_authority. pubkey ( ) ,
772
+ payer : context. payer . pubkey ( ) ,
773
+ actions : vec ! [ MintActionType :: UpdateMetadataField {
774
+ extension_index: 0 ,
775
+ field_type: 1 , // Symbol
776
+ key: vec![ ] ,
777
+ value: b"WF" . to_vec( ) ,
778
+ } ] ,
779
+ new_mint : None ,
780
+ } ,
781
+ & second_authority,
782
+ & context. payer ,
783
+ None ,
784
+ )
785
+ . await ?;
786
+
787
+ // === STEP 4: Transfer authority to third authority ===
788
+ mint_action (
789
+ & mut rpc,
790
+ MintActionParams {
791
+ compressed_mint_address : context. compressed_mint_address ,
792
+ mint_seed : context. mint_seed . pubkey ( ) ,
793
+ authority : second_authority. pubkey ( ) ,
794
+ payer : context. payer . pubkey ( ) ,
795
+ actions : vec ! [ MintActionType :: UpdateMetadataAuthority {
796
+ extension_index: 0 ,
797
+ new_authority: third_authority. pubkey( ) ,
798
+ } ] ,
799
+ new_mint : None ,
800
+ } ,
801
+ & second_authority,
802
+ & context. payer ,
803
+ None ,
804
+ )
805
+ . await ?;
806
+
807
+ // === STEP 5: Update URI field with third authority ===
808
+ mint_action (
809
+ & mut rpc,
810
+ MintActionParams {
811
+ compressed_mint_address : context. compressed_mint_address ,
812
+ mint_seed : context. mint_seed . pubkey ( ) ,
813
+ authority : third_authority. pubkey ( ) ,
814
+ payer : context. payer . pubkey ( ) ,
815
+ actions : vec ! [ MintActionType :: UpdateMetadataField {
816
+ extension_index: 0 ,
817
+ field_type: 2 , // URI
818
+ key: vec![ ] ,
819
+ value: b"https://workflow.example.com/token.json" . to_vec( ) ,
820
+ } ] ,
821
+ new_mint : None ,
822
+ } ,
823
+ & third_authority,
824
+ & context. payer ,
825
+ None ,
826
+ )
827
+ . await ?;
828
+
829
+ // === STEP 6: Remove another metadata key ===
830
+ mint_action (
831
+ & mut rpc,
832
+ MintActionParams {
833
+ compressed_mint_address : context. compressed_mint_address ,
834
+ mint_seed : context. mint_seed . pubkey ( ) ,
835
+ authority : third_authority. pubkey ( ) ,
836
+ payer : context. payer . pubkey ( ) ,
837
+ actions : vec ! [ MintActionType :: RemoveMetadataKey {
838
+ extension_index: 0 ,
839
+ key: b"website" . to_vec( ) ,
840
+ idempotent: 0 ,
841
+ } ] ,
842
+ new_mint : None ,
843
+ } ,
844
+ & third_authority,
845
+ & context. payer ,
846
+ None ,
847
+ )
848
+ . await ?;
849
+
850
+ // === STEP 7: Transfer to fourth authority, then immediately revoke ===
851
+ let combined_step7_actions = vec ! [
852
+ MintActionType :: UpdateMetadataAuthority {
853
+ extension_index: 0 ,
854
+ new_authority: fourth_authority. pubkey( ) ,
855
+ } ,
856
+ ] ;
857
+
858
+ mint_action (
859
+ & mut rpc,
860
+ MintActionParams {
861
+ compressed_mint_address : context. compressed_mint_address ,
862
+ mint_seed : context. mint_seed . pubkey ( ) ,
863
+ authority : third_authority. pubkey ( ) ,
864
+ payer : context. payer . pubkey ( ) ,
865
+ actions : combined_step7_actions,
866
+ new_mint : None ,
867
+ } ,
868
+ & third_authority,
869
+ & context. payer ,
870
+ None ,
871
+ )
872
+ . await ?;
873
+
874
+ // === STEP 8: Revoke authority entirely ===
875
+ mint_action (
876
+ & mut rpc,
877
+ MintActionParams {
878
+ compressed_mint_address : context. compressed_mint_address ,
879
+ mint_seed : context. mint_seed . pubkey ( ) ,
880
+ authority : fourth_authority. pubkey ( ) ,
881
+ payer : context. payer . pubkey ( ) ,
882
+ actions : vec ! [ MintActionType :: UpdateMetadataAuthority {
883
+ extension_index: 0 ,
884
+ new_authority: Pubkey :: default ( ) , // Revoke authority
885
+ } ] ,
886
+ new_mint : None ,
887
+ } ,
888
+ & fourth_authority,
889
+ & context. payer ,
890
+ None ,
891
+ )
892
+ . await ?;
717
893
718
894
// Verify final state where authority is None and metadata exists
895
+ let expected_final = create_expected_metadata_state (
896
+ None , // Authority revoked
897
+ "Workflow Token" ,
898
+ "WF" ,
899
+ "https://workflow.example.com/token.json" ,
900
+ vec ! [
901
+ create_additional_metadata( "category" , "DeFi" ) ,
902
+ create_additional_metadata( "creator" , "TokenMaker Inc." ) ,
903
+ ] ,
904
+ 0 ,
905
+ ) ;
906
+ assert_metadata_state ( & mut rpc, context. compressed_mint_address , & expected_final) . await ;
907
+
719
908
// This validates the complete end-to-end workflow
720
909
Ok ( ( ) )
721
910
}
0 commit comments