Skip to content

Commit

Permalink
fix: add network solana to specific error, fix changelly additionalna…
Browse files Browse the repository at this point in the history
…tivefees
  • Loading branch information
gamalielhere committed Nov 21, 2024
1 parent 4db7a02 commit c17d75c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
6 changes: 3 additions & 3 deletions packages/extension/src/ui/action/views/swap/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ const pickBestQuote = (fromAmountBN: BN, quotes: ProviderQuoteResponse[]) => {
* minumum amount for the swap and returns changelly
* but rango's actual minimum is a lot lower than changelly's
*/
if (quotes.length === 1) {
if (quotes.length === 1 && props.network.name === NetworkNames.Solana) {
errors.value.inputAmount = `Minimum amount may be lower than: ~${fromT.toReadable(
lowestMinimum,
)} ${nativeSwapToken.value!.token.symbol}`;
Expand All @@ -562,8 +562,8 @@ const pickBestQuote = (fromAmountBN: BN, quotes: ProviderQuoteResponse[]) => {
)} ${nativeSwapToken.value!.token.symbol}`;
} else if (smallestNativeFees.gt(remainingBalance)) {
// Can't afford the fees
errors.value.inputAmount = `Insufficient Bridging fees: ~${nativeSwapToken
.value!.toReadable(smallestNativeFees)
errors.value.inputAmount = `Insufficient Bridging fees: ~${fromT
.toReadable(smallestNativeFees)
.substring(0, 10)} ${nativeSwapToken.value!.token.symbol} required`;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,6 @@ const selectFee = (option: GasPriceTypes) => {
};
const selectTrade = (trade: ProviderSwapResponse) => {
console.log(trade.provider);
pickedTrade.value = trade;
setTransactionFees();
};
Expand Down
5 changes: 2 additions & 3 deletions packages/swap/src/providers/changelly/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ class Changelly extends ProviderClass {
try {
networkFeeBase = toBase(
firstChangellyFixRateQuote.networkFee,
options.toToken.decimals,
options.fromToken.decimals,
);
} catch (err) {
console.warn(
Expand Down Expand Up @@ -628,10 +628,9 @@ class Changelly extends ProviderClass {
` options.toToken.address=${options.toToken.address}`,
);
}

const providerQuoteResponse: ProviderQuoteResponse = {
fromTokenAmount: quoteRequestAmount,
additionalNativeFees: toBN(firstChangellyFixRateQuote.networkFee),
additionalNativeFees: toBN(networkFeeBase),
toTokenAmount: toBN(toTokenAmountBase).sub(toBN(networkFeeBase)),
provider: this.name,
quote: {
Expand Down

0 comments on commit c17d75c

Please sign in to comment.