10
10
signer:: keypair:: Keypair , transaction:: TransactionError , transport:: TransportError ,
11
11
} ,
12
12
spl_token_2022:: {
13
- error:: TokenError ,
14
13
extension:: {
15
14
confidential_transfer:: {
16
15
ConfidentialTransferAccount , ConfidentialTransferMint , EncryptedWithheldAmount ,
@@ -869,9 +868,7 @@ async fn ct_transfer_with_fee() {
869
868
)
870
869
. await ;
871
870
872
- // Fee is 2.5%, so what is left is 97 in Alice account
873
- //
874
- // TODO: make self transfers not not take fees
871
+ // Self-transfers does not incur a fee
875
872
token
876
873
. confidential_transfer_transfer_with_fee (
877
874
& alice_meta. token_account ,
@@ -890,7 +887,7 @@ async fn ct_transfer_with_fee() {
890
887
. check_balances (
891
888
& token,
892
889
ConfidentialTokenAccountBalances {
893
- pending_balance : 97 ,
890
+ pending_balance : 100 ,
894
891
available_balance : 0 ,
895
892
decryptable_available_balance : 0 ,
896
893
} ,
@@ -902,7 +899,7 @@ async fn ct_transfer_with_fee() {
902
899
& alice_meta. token_account ,
903
900
& alice,
904
901
2 ,
905
- alice_meta. ae_key . encrypt ( 97_u64 ) ,
902
+ alice_meta. ae_key . encrypt ( 100_u64 ) ,
906
903
)
907
904
. await
908
905
. unwrap ( ) ;
@@ -912,8 +909,8 @@ async fn ct_transfer_with_fee() {
912
909
& token,
913
910
ConfidentialTokenAccountBalances {
914
911
pending_balance : 0 ,
915
- available_balance : 97 ,
916
- decryptable_available_balance : 97 ,
912
+ available_balance : 100 ,
913
+ decryptable_available_balance : 100 ,
917
914
} ,
918
915
)
919
916
. await ;
@@ -923,8 +920,8 @@ async fn ct_transfer_with_fee() {
923
920
& alice_meta. token_account ,
924
921
& bob_meta. token_account ,
925
922
& alice,
926
- 97 , // amount
927
- 97 , // available balance
923
+ 100 , // amount
924
+ 100 , // available balance
928
925
& alice_meta. elgamal_keypair ,
929
926
alice_meta. ae_key . encrypt ( 0_u64 ) ,
930
927
& epoch_info,
@@ -958,23 +955,14 @@ async fn ct_transfer_with_fee() {
958
955
) ;
959
956
960
957
// Alice account cannot be closed since there are withheld fees from self-transfer
961
- let error = token
958
+ token
962
959
. confidential_transfer_empty_account (
963
960
& alice_meta. token_account ,
964
961
& alice,
965
962
& alice_meta. elgamal_keypair ,
966
963
)
967
964
. await
968
- . unwrap_err ( ) ;
969
- assert_eq ! (
970
- error,
971
- TokenClientError :: Client ( Box :: new( TransportError :: TransactionError (
972
- TransactionError :: InstructionError (
973
- 1 ,
974
- InstructionError :: Custom ( TokenError :: ConfidentialTransferAccountHasBalance as u32 )
975
- )
976
- ) ) )
977
- ) ;
965
+ . unwrap ( ) ;
978
966
979
967
let err = token
980
968
. confidential_transfer_empty_account (
0 commit comments