1+ #[ cfg( not( target_arch = "wasm32" ) ) ]
2+ use solana_zk_sdk:: encryption:: grouped_elgamal:: GroupedElGamal ;
3+ #[ cfg( target_arch = "wasm32" ) ]
4+ use solana_zk_sdk:: encryption:: grouped_elgamal:: {
5+ GroupedElGamalCiphertext2Handles , GroupedElGamalCiphertext3Handles ,
6+ } ;
17use {
28 crate :: {
39 encryption:: { FeeCiphertext , TransferAmountCiphertext } ,
1117 encryption:: {
1218 auth_encryption:: { AeCiphertext , AeKey } ,
1319 elgamal:: { ElGamalCiphertext , ElGamalKeypair , ElGamalPubkey } ,
14- grouped_elgamal:: GroupedElGamal ,
1520 pedersen:: { Pedersen , PedersenCommitment , PedersenOpening } ,
1621 } ,
1722 zk_elgamal_proof_program:: proof_data:: {
@@ -71,6 +76,16 @@ pub fn transfer_with_fee_split_proof_data(
7176 destination_elgamal_pubkey,
7277 auditor_elgamal_pubkey,
7378 ) ;
79+ #[ cfg( not( target_arch = "wasm32" ) ) ]
80+ let grouped_ciphertext_lo = transfer_amount_grouped_ciphertext_lo. 0 ;
81+ #[ cfg( target_arch = "wasm32" ) ]
82+ let grouped_ciphertext_lo = GroupedElGamalCiphertext3Handles :: encryption_with_u64 (
83+ source_elgamal_keypair. pubkey ( ) ,
84+ destination_elgamal_pubkey,
85+ auditor_elgamal_pubkey,
86+ transfer_amount_lo,
87+ & transfer_amount_opening_lo,
88+ ) ;
7489
7590 let ( transfer_amount_grouped_ciphertext_hi, transfer_amount_opening_hi) =
7691 TransferAmountCiphertext :: new (
@@ -79,6 +94,16 @@ pub fn transfer_with_fee_split_proof_data(
7994 destination_elgamal_pubkey,
8095 auditor_elgamal_pubkey,
8196 ) ;
97+ #[ cfg( not( target_arch = "wasm32" ) ) ]
98+ let grouped_ciphertext_hi = transfer_amount_grouped_ciphertext_hi. 0 ;
99+ #[ cfg( target_arch = "wasm32" ) ]
100+ let grouped_ciphertext_hi = GroupedElGamalCiphertext3Handles :: encryption_with_u64 (
101+ source_elgamal_keypair. pubkey ( ) ,
102+ destination_elgamal_pubkey,
103+ auditor_elgamal_pubkey,
104+ transfer_amount_hi,
105+ & transfer_amount_opening_hi,
106+ ) ;
82107
83108 // Decrypt the current available balance at the source
84109 let current_decrypted_available_balance = current_decryptable_available_balance
@@ -130,8 +155,8 @@ pub fn transfer_with_fee_split_proof_data(
130155 source_elgamal_keypair. pubkey ( ) ,
131156 destination_elgamal_pubkey,
132157 auditor_elgamal_pubkey,
133- & transfer_amount_grouped_ciphertext_lo . 0 ,
134- & transfer_amount_grouped_ciphertext_hi . 0 ,
158+ & grouped_ciphertext_lo ,
159+ & grouped_ciphertext_hi ,
135160 transfer_amount_lo,
136161 transfer_amount_hi,
137162 & transfer_amount_opening_lo,
@@ -233,6 +258,7 @@ pub fn transfer_with_fee_split_proof_data(
233258
234259 // encrypt the fee amount under the destination and withdraw withheld authority
235260 // ElGamal public key
261+ #[ cfg( not( target_arch = "wasm32" ) ) ]
236262 let fee_destination_withdraw_withheld_authority_ciphertext_lo = GroupedElGamal :: encrypt_with (
237263 [
238264 destination_elgamal_pubkey,
@@ -241,6 +267,16 @@ pub fn transfer_with_fee_split_proof_data(
241267 fee_amount_lo,
242268 & fee_opening_lo,
243269 ) ;
270+ #[ cfg( target_arch = "wasm32" ) ]
271+ let fee_destination_withdraw_withheld_authority_ciphertext_lo =
272+ GroupedElGamalCiphertext2Handles :: encryption_with_u64 (
273+ destination_elgamal_pubkey,
274+ withdraw_withheld_authority_elgamal_pubkey,
275+ fee_amount_lo,
276+ & fee_opening_lo,
277+ ) ;
278+
279+ #[ cfg( not( target_arch = "wasm32" ) ) ]
244280 let fee_destination_withdraw_withheld_authority_ciphertext_hi = GroupedElGamal :: encrypt_with (
245281 [
246282 destination_elgamal_pubkey,
@@ -249,6 +285,14 @@ pub fn transfer_with_fee_split_proof_data(
249285 fee_amount_hi,
250286 & fee_opening_hi,
251287 ) ;
288+ #[ cfg( target_arch = "wasm32" ) ]
289+ let fee_destination_withdraw_withheld_authority_ciphertext_hi =
290+ GroupedElGamalCiphertext2Handles :: encryption_with_u64 (
291+ destination_elgamal_pubkey,
292+ withdraw_withheld_authority_elgamal_pubkey,
293+ fee_amount_hi,
294+ & fee_opening_hi,
295+ ) ;
252296
253297 // generate fee ciphertext validity data
254298 let fee_ciphertext_validity_proof_data =
0 commit comments