Skip to content

Commit

Permalink
issue #27: fix bug 36, default tab = long, remove text 'Gas'
Browse files Browse the repository at this point in the history
  • Loading branch information
blackskin18 committed Jun 23, 2023
1 parent f59b251 commit 89c3b28
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
6 changes: 1 addition & 5 deletions src/Components/App/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,8 @@ export const App = () => {
switch (true) {
case isMatchWithPath('/:tab(long|short|liquidity|swap)/:pool?'):
return <Trade tab={detectTradeTab(location.pathname)} pool={detectPool(location.pathname)} />
// case isMatchWithPath('/pools'):
// return <Pools />
// case isMatchWithPath('/:tab(add-liquidity|remove-liquidity)'):
// return <Liquidity tab={detectLiquidityTab(location.pathname)} />
default:
return <Trade tab={TRADE_TYPE.SWAP} />
return <Trade tab={TRADE_TYPE.LONG} />
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/Components/BuyPositionBox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ const Component = ({
})

const { value: valueOut } = useTokenValue({
amount: amountOut,
tokenAddress: outputTokenAddress
amount: amountIn,
tokenAddress: inputTokenAddress
})

const { value: valueOutBefore } = useTokenValue({
Expand Down
2 changes: 1 addition & 1 deletion src/Components/SwapBox/components/TxFee.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const TxFee = ({ gasUsed, txFee } : {gasUsed: BigNumber, txFee: BigNumber
<InfoRow>
<TextGrey>Gas Used</TextGrey>
<span>
<Text>{formatWeiToDisplayNumber(gasUsed, 0, 0)} Gas</Text>
<Text>{formatWeiToDisplayNumber(gasUsed, 0, 0)}</Text>
</span>
</InfoRow>
<InfoRow>
Expand Down
7 changes: 4 additions & 3 deletions src/state/config/useInitConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { setConfigs, setEngine } from './reducer'
import configs from './configs'
import { addTokensReduce } from '../token/reducer'
import { Engine } from 'derivable-tools/dist/engine'
import { DEFAULT_CHAIN } from '../../utils/constant'
import { DEFAULT_CHAIN, ZERO_ADDRESS } from '../../utils/constant'

export const useInitConfig = ({
library,
Expand Down Expand Up @@ -49,12 +49,13 @@ export const useInitConfig = ({
}, [location, useHistory, chainId, useSubPage, language, env])

useEffect(() => {
console.log('khanh', chainId)
if (!chainId) return
if (!account) {
return console.log('=======await sync account========')
console.log('=======await sync account========')
}
const engine = new Engine(
account,
account || ZERO_ADDRESS,
{
storage: {
// @ts-ignore
Expand Down
1 change: 1 addition & 0 deletions src/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ export const isErc1155Address = (address: string) => {
}

export const decodeErc1155Address = (address: string) => {
if (!address) return { address: '', id: '' }
return {
address: address.split('-')[0],
id: address.split('-')[1]
Expand Down

0 comments on commit 89c3b28

Please sign in to comment.