41
41
account_info:: {
42
42
ApplyPendingBalanceAccountInfo , TransferAccountInfo , WithdrawAccountInfo ,
43
43
} ,
44
- instruction:: TransferSplitContextStateAccounts ,
45
44
ConfidentialTransferAccount , ConfidentialTransferMint ,
46
45
} ,
47
46
confidential_transfer_fee:: ConfidentialTransferFeeConfig ,
@@ -1575,6 +1574,7 @@ async fn command_transfer(
1575
1574
} ) ;
1576
1575
1577
1576
let context_state_authority = config. fee_payer ( ) ?;
1577
+ let context_state_authority_pubkey = context_state_authority. pubkey ( ) ;
1578
1578
let equality_proof_context_state_account = Keypair :: new ( ) ;
1579
1579
let equality_proof_pubkey = equality_proof_context_state_account. pubkey ( ) ;
1580
1580
let ciphertext_validity_proof_context_state_account = Keypair :: new ( ) ;
@@ -1583,91 +1583,90 @@ async fn command_transfer(
1583
1583
let range_proof_context_state_account = Keypair :: new ( ) ;
1584
1584
let range_proof_pubkey = range_proof_context_state_account. pubkey ( ) ;
1585
1585
1586
- let transfer_context_state_accounts = TransferSplitContextStateAccounts {
1587
- equality_proof : & equality_proof_pubkey,
1588
- ciphertext_validity_proof : & ciphertext_validity_proof_pubkey,
1589
- range_proof : & range_proof_pubkey,
1590
- authority : & context_state_authority. pubkey ( ) ,
1591
- no_op_on_uninitialized_split_context_state : false ,
1592
- close_split_context_state_accounts : None ,
1593
- } ;
1594
-
1595
1586
let state = token. get_account_info ( & sender) . await . unwrap ( ) ;
1596
1587
let extension = state
1597
1588
. get_extension :: < ConfidentialTransferAccount > ( )
1598
1589
. unwrap ( ) ;
1599
1590
let transfer_account_info = TransferAccountInfo :: new ( extension) ;
1600
1591
1601
- let (
1602
- equality_proof_data,
1603
- ciphertext_validity_proof_data,
1604
- range_proof_data,
1605
- source_decrypt_handles,
1606
- ) = transfer_account_info
1607
- . generate_split_transfer_proof_data (
1608
- transfer_balance,
1609
- & args. sender_elgamal_keypair ,
1610
- & args. sender_aes_key ,
1611
- & recipient_elgamal_pubkey,
1612
- auditor_elgamal_pubkey. as_ref ( ) ,
1613
- )
1614
- . unwrap ( ) ;
1592
+ let ( equality_proof_data, ciphertext_validity_proof_data, range_proof_data) =
1593
+ transfer_account_info
1594
+ . generate_split_transfer_proof_data (
1595
+ transfer_balance,
1596
+ & args. sender_elgamal_keypair ,
1597
+ & args. sender_aes_key ,
1598
+ & recipient_elgamal_pubkey,
1599
+ auditor_elgamal_pubkey. as_ref ( ) ,
1600
+ )
1601
+ . unwrap ( ) ;
1615
1602
1616
1603
// setup proofs
1617
1604
let _ = try_join ! (
1618
1605
token. create_range_proof_context_state_for_transfer(
1619
- transfer_context_state_accounts,
1606
+ & range_proof_pubkey,
1607
+ & context_state_authority_pubkey,
1620
1608
& range_proof_data,
1621
1609
& range_proof_context_state_account,
1622
1610
) ,
1623
1611
token. create_equality_proof_context_state_for_transfer(
1624
- transfer_context_state_accounts,
1612
+ & equality_proof_pubkey,
1613
+ & context_state_authority_pubkey,
1625
1614
& equality_proof_data,
1626
1615
& equality_proof_context_state_account,
1627
1616
) ,
1628
1617
token. create_ciphertext_validity_proof_context_state_for_transfer(
1629
- transfer_context_state_accounts,
1618
+ & ciphertext_validity_proof_pubkey,
1619
+ & context_state_authority_pubkey,
1630
1620
& ciphertext_validity_proof_data,
1631
1621
& ciphertext_validity_proof_context_state_account,
1632
1622
)
1633
1623
) ?;
1634
1624
1635
1625
// do the transfer
1626
+ let equality_proof_context_proof_account =
1627
+ ProofAccount :: ContextAccount ( equality_proof_pubkey) ;
1628
+ let ciphertext_validity_proof_context_proof_account =
1629
+ ProofAccount :: ContextAccount ( ciphertext_validity_proof_pubkey) ;
1630
+ let range_proof_context_proof_account =
1631
+ ProofAccount :: ContextAccount ( range_proof_pubkey) ;
1632
+
1636
1633
let transfer_result = token
1637
- . confidential_transfer_transfer_with_split_proofs (
1634
+ . confidential_transfer_transfer (
1638
1635
& sender,
1639
1636
& recipient_token_account,
1640
1637
& sender_owner,
1641
- transfer_context_state_accounts,
1638
+ Some ( & equality_proof_context_proof_account) ,
1639
+ Some ( & ciphertext_validity_proof_context_proof_account) ,
1640
+ Some ( & range_proof_context_proof_account) ,
1642
1641
transfer_balance,
1643
1642
Some ( transfer_account_info) ,
1643
+ & args. sender_elgamal_keypair ,
1644
1644
& args. sender_aes_key ,
1645
- & source_decrypt_handles,
1645
+ & recipient_elgamal_pubkey,
1646
+ auditor_elgamal_pubkey. as_ref ( ) ,
1646
1647
& bulk_signers,
1647
1648
)
1648
1649
. await ?;
1649
1650
1650
1651
// close context state accounts
1651
- let context_state_authority_pubkey = context_state_authority. pubkey ( ) ;
1652
- let close_context_state_signers = & [ context_state_authority] ;
1653
1652
let _ = try_join ! (
1654
1653
token. confidential_transfer_close_context_state(
1655
1654
& equality_proof_pubkey,
1656
1655
& sender,
1657
1656
& context_state_authority_pubkey,
1658
- close_context_state_signers ,
1657
+ & context_state_authority ,
1659
1658
) ,
1660
1659
token. confidential_transfer_close_context_state(
1661
1660
& ciphertext_validity_proof_pubkey,
1662
1661
& sender,
1663
1662
& context_state_authority_pubkey,
1664
- close_context_state_signers ,
1663
+ & context_state_authority ,
1665
1664
) ,
1666
1665
token. confidential_transfer_close_context_state(
1667
1666
& range_proof_pubkey,
1668
1667
& sender,
1669
1668
& context_state_authority_pubkey,
1670
- close_context_state_signers ,
1669
+ & context_state_authority ,
1671
1670
) ,
1672
1671
) ?;
1673
1672
@@ -3369,13 +3368,12 @@ async fn command_deposit_withdraw_confidential_tokens(
3369
3368
3370
3369
// close context state account
3371
3370
let context_state_authority_pubkey = context_state_authority. pubkey ( ) ;
3372
- let close_context_state_signers = & [ context_state_authority] ;
3373
3371
token
3374
3372
. confidential_transfer_close_context_state (
3375
3373
& context_state_pubkey,
3376
3374
& token_account_address,
3377
3375
& context_state_authority_pubkey,
3378
- close_context_state_signers ,
3376
+ & context_state_authority ,
3379
3377
)
3380
3378
. await ?
3381
3379
}
0 commit comments