Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -236,16 +236,7 @@ export const GasSetting1559 = memo(() => {
value?.formatterTransaction?.type === TransactionDescriptorType.TRANSFER ||
value?.formatterTransaction?.type === TransactionDescriptorType.INTERACTION
) {
if (
value?.formatterTransaction?.type === TransactionDescriptorType.INTERACTION &&
value?.transactionContext?.name &&
!['transfer', 'transferFrom', 'approve'].includes(value?.transactionContext?.name)
) {
setOption(1)
} else if (
value?.formatterTransaction._tx.maxFeePerGas &&
value?.formatterTransaction._tx.maxPriorityFeePerGas
) {
if (value?.formatterTransaction._tx.maxFeePerGas && value?.formatterTransaction._tx.maxPriorityFeePerGas) {
setValue(
'maxPriorityFeePerGas',
fromWei(toFixed(value.formatterTransaction._tx.maxPriorityFeePerGas as string), 'gwei'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function useUpdateBalance(chainId: ChainId) {
type: AllProviderTradeActionType.UPDATE_INPUT_TOKEN_BALANCE,
balance: value || '0',
})
}, [currentAccount, inputToken?.type, balance.value])
}, [currentAccount, inputToken?.schema, balance.value])

useEffect(() => {
if (!currentAccount) return
Expand All @@ -48,5 +48,5 @@ export function useUpdateBalance(chainId: ChainId) {
type: AllProviderTradeActionType.UPDATE_OUTPUT_TOKEN_BALANCE,
balance: value || '0',
})
}, [currentAccount, outputToken?.type, outputToken?.address, balance.value])
}, [currentAccount, outputToken?.schema, outputToken?.address, balance.value])
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function useTradeCallback(tradeComputed: TradeComputed<SwapQuoteResponse>
...pick(tradeComputed.trade_, ['to', 'data', 'value']),
...gasConfig,
} as TransactionConfig
}, [account, tradeComputed])
}, [account, tradeComputed, gasConfig])

return useAsyncFn(async () => {
// validate config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,20 @@ function computeRealizedLPFeeAmount(trade?: Trade | null): CurrencyAmount<Curren

export function useTradeBreakdown(trade: Trade | null) {
return useMemo(() => {
if (!trade) return null
const realizedLPFeePercent = computeRealizedLPFeePercent(trade)
const realizedLPFeeAmount = computeRealizedLPFeeAmount(trade)
return {
realizedLPFeePercent,
realizedLPFeeAmount,
try {
if (!trade) return null
const realizedLPFeePercent = computeRealizedLPFeePercent(trade)
const realizedLPFeeAmount = computeRealizedLPFeeAmount(trade)
return {
realizedLPFeePercent,
realizedLPFeeAmount,

// different ver of @uniswap/sdk-core were used by @uniswap/v2-sdk and @uniswap/v3-sdk
realizedLPFee: trade.inputAmount.multiply(realizedLPFeePercent) as CurrencyAmount<Currency>,
priceImpact: trade.priceImpact.subtract(realizedLPFeePercent) as Percent,
// different ver of @uniswap/sdk-core were used by @uniswap/v2-sdk and @uniswap/v3-sdk
realizedLPFee: trade.inputAmount.multiply(realizedLPFeePercent) as CurrencyAmount<Currency>,
priceImpact: trade.priceImpact.subtract(realizedLPFeePercent) as Percent,
}
} catch {
return null
}
}, [trade])
}
18 changes: 11 additions & 7 deletions packages/plugins/EVM/src/state/NameService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,18 @@ export class NameService extends NameServiceState<ChainId> {
}

override async reverse(chainId: ChainId, address: string) {
if (chainId !== ChainId.Mainnet) return
try {
if (chainId !== ChainId.Mainnet) return

const cachedDomain = await super.reverse(chainId, address)
if (cachedDomain) return cachedDomain
const cachedDomain = await super.reverse(chainId, address)
if (cachedDomain) return cachedDomain

const ens = await this.createENS()
const name = await ens.reverse(address)
await super.addName(chainId, address, name)
return super.reverse(chainId, address)
const ens = await this.createENS()
const name = await ens.reverse(address)
await super.addName(chainId, address, name)
return super.reverse(chainId, address)
} catch {
return
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class SwapDescriptor implements TransactionDescriptor {
}`,
}
case 'swapExactTokensForETH':
const inToken = await connection?.getFungibleToken(last(context.parameters!.path) ?? '')
const inToken = await connection?.getFungibleToken(first(context.parameters!.path) ?? '')
const inAmount = formatBalance(context.parameters!.amountIn, inToken?.decimals, 2)
const outAmount = formatBalance(context.parameters!.amountOutMin, nativeToken?.decimals, 2)

Expand All @@ -49,6 +49,12 @@ export class SwapDescriptor implements TransactionDescriptor {
title: 'SwapToken',
description: `Swap ${amountIn} ${tokenIn?.symbol ?? ''} for ${amountOut} ${tokenOut?.symbol ?? ''}`,
}
case 'multicall':
return {
chainId: context.chainId,
title: 'SwapToken',
description: 'Swap with UniSwap V3',
}
default:
return
}
Expand Down