fix(wallet)_: fix crash on cbridge fee calculation #5178
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #19610
cbridge does not handle such small values, though we pass them correctly:
"{\n \"err\": {\n \"code\": 500,\n \"msg\": \"amount should \\u003e 0\"\n },\n \"eq_value_token_amt\": \"\",\n \"bridge_rate\": 0,\n \"perc_fee\": \"\",\n \"base_fee\": \"\",\n \"slippage_tolerance\": 0,\n \"max_slippage\": 0,\n \"estimated_receive_amt\": \"\",\n \"drop_gas_amt\": \"\",\n \"op_fee_rebate\": 0,\n \"op_fee_rebate_portion\": 0,\n \"op_fee_rebate_end_time\": \"0\"\n}" url="https://cbridge-prod2.celer.app/v2/estimateAmt?src_chain_id=1&dst_chain_id=10&token_symbol=WETH&amt=10000&usr_addr=0xaa47c83316edc05cf9ff7136296b026c5de7eccd&slippage_tolerance=500" amountIn=10000
It returns err, that
amount should be > 0
and base_fee and perc_fee are empty, so we can't parse them into a bigInt anf get nil.