@@ -285,7 +285,13 @@ async fn ct_initialize_and_update_mint() {
285
285
let mut context = TestContext :: new ( ) . await ;
286
286
context
287
287
. init_token_with_mint ( vec ! [
288
- ExtensionInitializationParams :: ConfidentialTransferMint { ct_mint } ,
288
+ ExtensionInitializationParams :: ConfidentialTransferMint {
289
+ authority: Some ( ct_mint. authority) ,
290
+ auto_approve_new_accounts: ct_mint. auto_approve_new_accounts. try_into( ) . unwrap( ) ,
291
+ auditor_encryption_pubkey: ct_mint. auditor_encryption_pubkey,
292
+ withdraw_withheld_authority_encryption_pubkey: ct_mint
293
+ . withdraw_withheld_authority_encryption_pubkey,
294
+ } ,
289
295
] )
290
296
. await
291
297
. unwrap ( ) ;
@@ -306,8 +312,12 @@ async fn ct_initialize_and_update_mint() {
306
312
let err = token
307
313
. confidential_transfer_update_mint (
308
314
& wrong_keypair,
309
- new_ct_mint,
310
315
Some ( & new_ct_mint_authority) ,
316
+ new_ct_mint. auto_approve_new_accounts . into ( ) ,
317
+ & new_ct_mint
318
+ . withdraw_withheld_authority_encryption_pubkey
319
+ . try_into ( )
320
+ . unwrap ( ) ,
311
321
)
312
322
. await
313
323
. unwrap_err ( ) ;
@@ -320,26 +330,64 @@ async fn ct_initialize_and_update_mint() {
320
330
token
321
331
. confidential_transfer_update_mint (
322
332
& ct_mint_authority,
323
- new_ct_mint,
324
333
Some ( & new_ct_mint_authority) ,
334
+ new_ct_mint. auto_approve_new_accounts . into ( ) ,
335
+ & new_ct_mint
336
+ . withdraw_withheld_authority_encryption_pubkey
337
+ . try_into ( )
338
+ . unwrap ( ) ,
325
339
)
326
340
. await
327
341
. unwrap ( ) ;
328
342
329
343
let state = token. get_mint_info ( ) . await . unwrap ( ) ;
330
344
let extension = state. get_extension :: < ConfidentialTransferMint > ( ) . unwrap ( ) ;
331
- assert_eq ! ( * extension, new_ct_mint) ;
345
+ assert_eq ! ( extension. authority, new_ct_mint. authority) ;
346
+ assert_eq ! (
347
+ extension. auto_approve_new_accounts,
348
+ new_ct_mint. auto_approve_new_accounts
349
+ ) ;
350
+ assert_eq ! (
351
+ extension. auditor_encryption_pubkey,
352
+ new_ct_mint. auditor_encryption_pubkey
353
+ ) ;
354
+ assert_eq ! (
355
+ extension. withdraw_withheld_authority_encryption_pubkey,
356
+ ct_mint. withdraw_withheld_authority_encryption_pubkey,
357
+ ) ;
358
+ assert_eq ! ( extension. withheld_amount, ct_mint. withheld_amount) ;
332
359
333
360
// Clear the authority
334
361
let new_ct_mint = ConfidentialTransferMint :: default ( ) ;
335
362
token
336
- . confidential_transfer_update_mint ( & new_ct_mint_authority, new_ct_mint, None )
363
+ . confidential_transfer_update_mint (
364
+ & new_ct_mint_authority,
365
+ None ,
366
+ new_ct_mint. auto_approve_new_accounts . into ( ) ,
367
+ & new_ct_mint
368
+ . withdraw_withheld_authority_encryption_pubkey
369
+ . try_into ( )
370
+ . unwrap ( ) ,
371
+ )
337
372
. await
338
373
. unwrap ( ) ;
339
374
340
375
let state = token. get_mint_info ( ) . await . unwrap ( ) ;
341
376
let extension = state. get_extension :: < ConfidentialTransferMint > ( ) . unwrap ( ) ;
342
- assert_eq ! ( * extension, new_ct_mint) ;
377
+ assert_eq ! ( extension. authority, new_ct_mint. authority) ;
378
+ assert_eq ! (
379
+ extension. auto_approve_new_accounts,
380
+ new_ct_mint. auto_approve_new_accounts
381
+ ) ;
382
+ assert_eq ! (
383
+ extension. auditor_encryption_pubkey,
384
+ new_ct_mint. auditor_encryption_pubkey
385
+ ) ;
386
+ assert_eq ! (
387
+ extension. withdraw_withheld_authority_encryption_pubkey,
388
+ ct_mint. withdraw_withheld_authority_encryption_pubkey,
389
+ ) ;
390
+ assert_eq ! ( extension. withheld_amount, ct_mint. withheld_amount) ;
343
391
}
344
392
345
393
#[ tokio:: test]
@@ -353,7 +401,13 @@ async fn ct_configure_token_account() {
353
401
let mut context = TestContext :: new ( ) . await ;
354
402
context
355
403
. init_token_with_mint ( vec ! [
356
- ExtensionInitializationParams :: ConfidentialTransferMint { ct_mint } ,
404
+ ExtensionInitializationParams :: ConfidentialTransferMint {
405
+ authority: Some ( ct_mint. authority) ,
406
+ auto_approve_new_accounts: ct_mint. auto_approve_new_accounts. try_into( ) . unwrap( ) ,
407
+ auditor_encryption_pubkey: ct_mint. auditor_encryption_pubkey,
408
+ withdraw_withheld_authority_encryption_pubkey: ct_mint
409
+ . withdraw_withheld_authority_encryption_pubkey,
410
+ } ,
357
411
] )
358
412
. await
359
413
. unwrap ( ) ;
@@ -424,7 +478,13 @@ async fn ct_enable_disable_confidential_credits() {
424
478
let mut context = TestContext :: new ( ) . await ;
425
479
context
426
480
. init_token_with_mint ( vec ! [
427
- ExtensionInitializationParams :: ConfidentialTransferMint { ct_mint } ,
481
+ ExtensionInitializationParams :: ConfidentialTransferMint {
482
+ authority: Some ( ct_mint. authority) ,
483
+ auto_approve_new_accounts: ct_mint. auto_approve_new_accounts. try_into( ) . unwrap( ) ,
484
+ auditor_encryption_pubkey: ct_mint. auditor_encryption_pubkey,
485
+ withdraw_withheld_authority_encryption_pubkey: ct_mint
486
+ . withdraw_withheld_authority_encryption_pubkey,
487
+ } ,
428
488
] )
429
489
. await
430
490
. unwrap ( ) ;
@@ -466,7 +526,13 @@ async fn ct_enable_disable_non_confidential_credits() {
466
526
let mut context = TestContext :: new ( ) . await ;
467
527
context
468
528
. init_token_with_mint ( vec ! [
469
- ExtensionInitializationParams :: ConfidentialTransferMint { ct_mint } ,
529
+ ExtensionInitializationParams :: ConfidentialTransferMint {
530
+ authority: Some ( ct_mint. authority) ,
531
+ auto_approve_new_accounts: ct_mint. auto_approve_new_accounts. try_into( ) . unwrap( ) ,
532
+ auditor_encryption_pubkey: ct_mint. auditor_encryption_pubkey,
533
+ withdraw_withheld_authority_encryption_pubkey: ct_mint
534
+ . withdraw_withheld_authority_encryption_pubkey,
535
+ } ,
470
536
] )
471
537
. await
472
538
. unwrap ( ) ;
@@ -557,7 +623,13 @@ async fn ct_new_account_is_empty() {
557
623
let mut context = TestContext :: new ( ) . await ;
558
624
context
559
625
. init_token_with_mint ( vec ! [
560
- ExtensionInitializationParams :: ConfidentialTransferMint { ct_mint } ,
626
+ ExtensionInitializationParams :: ConfidentialTransferMint {
627
+ authority: Some ( ct_mint. authority) ,
628
+ auto_approve_new_accounts: ct_mint. auto_approve_new_accounts. try_into( ) . unwrap( ) ,
629
+ auditor_encryption_pubkey: ct_mint. auditor_encryption_pubkey,
630
+ withdraw_withheld_authority_encryption_pubkey: ct_mint
631
+ . withdraw_withheld_authority_encryption_pubkey,
632
+ } ,
561
633
] )
562
634
. await
563
635
. unwrap ( ) ;
@@ -579,7 +651,13 @@ async fn ct_deposit() {
579
651
let mut context = TestContext :: new ( ) . await ;
580
652
context
581
653
. init_token_with_mint ( vec ! [
582
- ExtensionInitializationParams :: ConfidentialTransferMint { ct_mint } ,
654
+ ExtensionInitializationParams :: ConfidentialTransferMint {
655
+ authority: Some ( ct_mint. authority) ,
656
+ auto_approve_new_accounts: ct_mint. auto_approve_new_accounts. try_into( ) . unwrap( ) ,
657
+ auditor_encryption_pubkey: ct_mint. auditor_encryption_pubkey,
658
+ withdraw_withheld_authority_encryption_pubkey: ct_mint
659
+ . withdraw_withheld_authority_encryption_pubkey,
660
+ } ,
583
661
] )
584
662
. await
585
663
. unwrap ( ) ;
@@ -703,7 +781,13 @@ async fn ct_withdraw() {
703
781
let mut context = TestContext :: new ( ) . await ;
704
782
context
705
783
. init_token_with_mint ( vec ! [
706
- ExtensionInitializationParams :: ConfidentialTransferMint { ct_mint } ,
784
+ ExtensionInitializationParams :: ConfidentialTransferMint {
785
+ authority: Some ( ct_mint. authority) ,
786
+ auto_approve_new_accounts: ct_mint. auto_approve_new_accounts. try_into( ) . unwrap( ) ,
787
+ auditor_encryption_pubkey: ct_mint. auditor_encryption_pubkey,
788
+ withdraw_withheld_authority_encryption_pubkey: ct_mint
789
+ . withdraw_withheld_authority_encryption_pubkey,
790
+ } ,
707
791
] )
708
792
. await
709
793
. unwrap ( ) ;
@@ -806,7 +890,13 @@ async fn ct_transfer() {
806
890
let mut context = TestContext :: new ( ) . await ;
807
891
context
808
892
. init_token_with_mint ( vec ! [
809
- ExtensionInitializationParams :: ConfidentialTransferMint { ct_mint } ,
893
+ ExtensionInitializationParams :: ConfidentialTransferMint {
894
+ authority: Some ( ct_mint. authority) ,
895
+ auto_approve_new_accounts: ct_mint. auto_approve_new_accounts. try_into( ) . unwrap( ) ,
896
+ auditor_encryption_pubkey: ct_mint. auditor_encryption_pubkey,
897
+ withdraw_withheld_authority_encryption_pubkey: ct_mint
898
+ . withdraw_withheld_authority_encryption_pubkey,
899
+ } ,
810
900
] )
811
901
. await
812
902
. unwrap ( ) ;
@@ -1044,7 +1134,13 @@ async fn ct_transfer_with_fee() {
1044
1134
transfer_fee_basis_points: TEST_FEE_BASIS_POINTS ,
1045
1135
maximum_fee: TEST_MAXIMUM_FEE ,
1046
1136
} ,
1047
- ExtensionInitializationParams :: ConfidentialTransferMint { ct_mint } ,
1137
+ ExtensionInitializationParams :: ConfidentialTransferMint {
1138
+ authority: Some ( ct_mint. authority) ,
1139
+ auto_approve_new_accounts: ct_mint. auto_approve_new_accounts. try_into( ) . unwrap( ) ,
1140
+ auditor_encryption_pubkey: ct_mint. auditor_encryption_pubkey,
1141
+ withdraw_withheld_authority_encryption_pubkey: ct_mint
1142
+ . withdraw_withheld_authority_encryption_pubkey,
1143
+ } ,
1048
1144
] )
1049
1145
. await
1050
1146
. unwrap ( ) ;
@@ -1262,7 +1358,13 @@ async fn ct_withdraw_withheld_tokens_from_mint() {
1262
1358
transfer_fee_basis_points: TEST_FEE_BASIS_POINTS ,
1263
1359
maximum_fee: TEST_MAXIMUM_FEE ,
1264
1360
} ,
1265
- ExtensionInitializationParams :: ConfidentialTransferMint { ct_mint } ,
1361
+ ExtensionInitializationParams :: ConfidentialTransferMint {
1362
+ authority: Some ( ct_mint. authority) ,
1363
+ auto_approve_new_accounts: ct_mint. auto_approve_new_accounts. try_into( ) . unwrap( ) ,
1364
+ auditor_encryption_pubkey: ct_mint. auditor_encryption_pubkey,
1365
+ withdraw_withheld_authority_encryption_pubkey: ct_mint
1366
+ . withdraw_withheld_authority_encryption_pubkey,
1367
+ } ,
1266
1368
] )
1267
1369
. await
1268
1370
. unwrap ( ) ;
@@ -1418,7 +1520,13 @@ async fn ct_withdraw_withheld_tokens_from_accounts() {
1418
1520
transfer_fee_basis_points: TEST_FEE_BASIS_POINTS ,
1419
1521
maximum_fee: TEST_MAXIMUM_FEE ,
1420
1522
} ,
1421
- ExtensionInitializationParams :: ConfidentialTransferMint { ct_mint } ,
1523
+ ExtensionInitializationParams :: ConfidentialTransferMint {
1524
+ authority: Some ( ct_mint. authority) ,
1525
+ auto_approve_new_accounts: ct_mint. auto_approve_new_accounts. try_into( ) . unwrap( ) ,
1526
+ auditor_encryption_pubkey: ct_mint. auditor_encryption_pubkey,
1527
+ withdraw_withheld_authority_encryption_pubkey: ct_mint
1528
+ . withdraw_withheld_authority_encryption_pubkey,
1529
+ } ,
1422
1530
] )
1423
1531
. await
1424
1532
. unwrap ( ) ;
@@ -1525,7 +1633,13 @@ async fn ct_transfer_memo() {
1525
1633
let mut context = TestContext :: new ( ) . await ;
1526
1634
context
1527
1635
. init_token_with_mint ( vec ! [
1528
- ExtensionInitializationParams :: ConfidentialTransferMint { ct_mint } ,
1636
+ ExtensionInitializationParams :: ConfidentialTransferMint {
1637
+ authority: Some ( ct_mint. authority) ,
1638
+ auto_approve_new_accounts: ct_mint. auto_approve_new_accounts. try_into( ) . unwrap( ) ,
1639
+ auditor_encryption_pubkey: ct_mint. auditor_encryption_pubkey,
1640
+ withdraw_withheld_authority_encryption_pubkey: ct_mint
1641
+ . withdraw_withheld_authority_encryption_pubkey,
1642
+ } ,
1529
1643
] )
1530
1644
. await
1531
1645
. unwrap ( ) ;
@@ -1633,7 +1747,13 @@ async fn ct_transfer_with_fee_memo() {
1633
1747
transfer_fee_basis_points: TEST_FEE_BASIS_POINTS ,
1634
1748
maximum_fee: TEST_MAXIMUM_FEE ,
1635
1749
} ,
1636
- ExtensionInitializationParams :: ConfidentialTransferMint { ct_mint } ,
1750
+ ExtensionInitializationParams :: ConfidentialTransferMint {
1751
+ authority: Some ( ct_mint. authority) ,
1752
+ auto_approve_new_accounts: ct_mint. auto_approve_new_accounts. try_into( ) . unwrap( ) ,
1753
+ auditor_encryption_pubkey: ct_mint. auditor_encryption_pubkey,
1754
+ withdraw_withheld_authority_encryption_pubkey: ct_mint
1755
+ . withdraw_withheld_authority_encryption_pubkey,
1756
+ } ,
1637
1757
] )
1638
1758
. await
1639
1759
. unwrap ( ) ;
0 commit comments