fix deep copy crash on quote adjustment (#102)

This commit is contained in:
meep 2023-05-15 10:44:55 +10:00 committed by GitHub
parent 04abca9ef0
commit c4213bb62d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -265,7 +265,7 @@ function adjustQuoteForSlippage(quote: SubTradeRoute, slippage: Percentage): Sub
};
if (amountSpecifiedIsInput) {
updatedQuote.hopQuotes[1] = {
updatedQuote.hopQuotes = [updatedQuote.hopQuotes[0], {
...swapQuoteTwo,
quote: {
...swapQuoteTwo.quote,
@ -275,9 +275,9 @@ function adjustQuoteForSlippage(quote: SubTradeRoute, slippage: Percentage): Sub
false
),
},
};
}];
} else {
updatedQuote.hopQuotes[0] = {
updatedQuote.hopQuotes = [{
...swapQuoteOne,
quote: {
...swapQuoteOne.quote,
@ -287,7 +287,7 @@ function adjustQuoteForSlippage(quote: SubTradeRoute, slippage: Percentage): Sub
true
),
},
};
}, updatedQuote.hopQuotes[1]];
}
return updatedQuote;
}