@@ -565,43 +565,49 @@ export class UniswapHandler implements SwapBaseInterface {
565
565
recipient : receiverAddress
566
566
} ) ;
567
567
568
- // // todo: wait until this ready to get destination fee. the real receiveAmount is deduce by this fee
569
- // const acrossQuote = await getAcrossQuote({
570
- // destinationChain: toChainInfo,
571
- // destinationTokenInfo: toTokenInfo,
572
- // originChain: fromChainInfo,
573
- // originTokenInfo: fromTokenInfo,
574
- // recipient: receiverAddress,
575
- // sender: senderAddress,
576
- // sendingValue,
577
- // feeInfo
578
- // });
568
+ const acrossQuote = await getAcrossQuote ( {
569
+ destinationChain : toChainInfo ,
570
+ destinationTokenInfo : toTokenInfo ,
571
+ originChain : fromChainInfo ,
572
+ originTokenInfo : fromTokenInfo ,
573
+ recipient : receiverAddress ,
574
+ sender : senderAddress ,
575
+ sendingValue : mockSendingValue ,
576
+ feeInfo
577
+ } ) ;
579
578
579
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument,@typescript-eslint/no-unsafe-member-access
580
+ const destinationFee = BigNumber ( mockSendingValue ) . minus ( acrossQuote . metadata . outputAmount ) . toFixed ( 0 , 1 ) ;
580
581
const estimatedBridgeFee = await estimateTxFee ( tx , evmApi , feeInfo ) ;
581
582
582
583
let sendingValue ;
583
584
let expectedReceive ;
584
585
585
586
if ( isBridgeFirst ) {
586
587
expectedReceive = selectedQuote . fromAmount ;
588
+ sendingValue = BigNumber ( destinationFee ) . multipliedBy ( 1.02 ) . plus ( expectedReceive ) . toFixed ( 0 , 1 ) ;
587
589
588
- if ( isBridgeNativeToken ) {
589
- sendingValue = BigNumber ( expectedReceive ) . plus ( estimatedBridgeFee ) . toFixed ( 0 , 1 ) ;
590
- } else {
591
- sendingValue = BigNumber ( expectedReceive ) . toFixed ( 0 , 1 ) ;
592
- }
590
+ // if (isBridgeNativeToken) {
591
+ // sendingValue = BigNumber(expectedReceive).plus(estimatedBridgeFee).toFixed(0, 1);
592
+ // } else {
593
+ // sendingValue = BigNumber(expectedReceive).toFixed(0, 1);
594
+ // }
593
595
} else if ( isBridgeSecond ) {
594
596
sendingValue = BigNumber ( selectedQuote . toAmount ) . div ( 1.02 ) . toFixed ( 0 , 1 ) ;
597
+ expectedReceive = BigNumber ( sendingValue ) . minus ( destinationFee ) . toFixed ( 0 , 1 ) ;
595
598
596
- if ( isBridgeNativeToken ) {
597
- expectedReceive = BigNumber ( sendingValue ) . minus ( estimatedBridgeFee ) . toFixed ( 0 , 1 ) ;
598
- } else {
599
- expectedReceive = sendingValue ;
600
- }
599
+ // if (isBridgeNativeToken) {
600
+ // expectedReceive = BigNumber(sendingValue).minus(estimatedBridgeFee).toFixed(0, 1);
601
+ // } else {
602
+ // expectedReceive = sendingValue;
603
+ // }
601
604
} else {
602
605
return undefined ;
603
606
}
604
607
608
+ console . log ( 'send bridge amount' , sendingValue ) ;
609
+ console . log ( 'receive bridge amount' , expectedReceive ) ;
610
+
605
611
const fee : CommonStepFeeInfo = {
606
612
feeComponent : [ {
607
613
feeType : SwapFeeType . NETWORK_FEE ,
0 commit comments