@@ -378,7 +378,10 @@ describe('Ops.prepareTransfer / Ops.prepareWithdraw', () => {
378378
379379 expect ( planner . plan ) . toHaveBeenCalled ( ) ;
380380 expect ( merkle . getProofByCids ) . toHaveBeenCalledWith ( { chainId, cids : [ 10 ] , totalElements : 5n } ) ;
381- expect ( zkp . proveWithdraw ) . toHaveBeenCalledWith ( expect . anything ( ) , expect . objectContaining ( { recipient, withdraw_amount : burnAmount } ) ) ;
381+ // withdraw_amount in the proof context must be the net recipient amount (requestedAmount),
382+ // NOT burnAmount. The contract computes amountWithFee = inp.amount + protocolFee + relayerFee,
383+ // which equals burnAmount only when inp.amount = requestedAmount (net).
384+ expect ( zkp . proveWithdraw ) . toHaveBeenCalledWith ( expect . anything ( ) , expect . objectContaining ( { recipient, withdraw_amount : plan . requestedAmount } ) ) ;
382385
383386 expect ( res . meta . arrayHashIndex ) . toBe ( 4 ) ;
384387 expect ( res . meta . merkleRootIndex ) . toBe ( 1 ) ;
@@ -388,7 +391,7 @@ describe('Ops.prepareTransfer / Ops.prepareWithdraw', () => {
388391 expect ( res . witness . asset_policy . viewer_pk ) . toMatchObject ( { EncryptionKey : { Key : { X : 1n , Y : 2n } } } ) ;
389392 expect ( res . witness . asset_policy . freezer_pk ) . toMatchObject ( { Point : { X : 3n , Y : 4n } } ) ;
390393 expect ( res . request . path ) . toBe ( '/api/v1/burn' ) ;
391- expect ( ( res . request . body as any ) . burn_amount ) . toBe ( burnAmount . toString ( ) ) ;
394+ expect ( ( res . request . body as any ) . burn_amount ) . toBe ( plan . requestedAmount . toString ( ) ) ;
392395 expect ( ( res . request . body as any ) . gas_drop_value ) . toBe ( gasDropValue . toString ( ) ) ;
393396 expect ( ( res . request . body as any ) . relayer_fee ) . toBe ( relayerFee . toString ( ) ) ;
394397 } ) ;
0 commit comments