Skip to content

Commit

Permalink
Merge pull request #383 from aura-nw/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
hoangndm3139 authored Apr 1, 2024
2 parents e86b1ed + 06725e4 commit f1826a9
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 14 deletions.
4 changes: 2 additions & 2 deletions public/config.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"api-gateway": "https://safe-api.dev.aura.network",
"chain_id": "aura-testnet-2",
"chain_id": "auradev_1235-3",
"chain_info": [
{
"features": [
"ibc-transfer"
],
"chainId": "aura-testnet-2",
"chainId": "auradev_1235-3",
"chainName": "aura testnet",
"rpc": "https://rpc.dev.aura.network",
"rest": "https://lcd.dev.aura.network",
Expand Down
2 changes: 1 addition & 1 deletion src/config/cache/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const loadChains = async () => {
environment: 'serenity',
}
}
if (chain.chainId.includes('aura-testnet')) {
if (chain.chainId.includes('auradev')) {
return {
...chain,
environment: 'auratestnet',
Expand Down
3 changes: 1 addition & 2 deletions src/logic/safe/store/selectors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ export const safesAsMap = (state: AppReduxState): SafesMap => safesState(state).

export const safesAsList = createSelector(safesAsMap, (safes): List<SafeRecord> => safes.toList())

export const currentSafe = createSelector([safesAsMap], (safes: SafesMap) => {
const address = extractSafeAddress()
export const currentSafe = createSelector([safesAsMap, extractSafeAddress], (safes: SafesMap, address: string) => {
return safes.get(address, baseSafe(address))
})
export const safeByAddressSelector = createSelector(
Expand Down
35 changes: 26 additions & 9 deletions src/pages/Transactions/TxActionModal/Send/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,47 @@ import AddressInfo from 'src/components/AddressInfo'
import { FilledButton, OutlinedNeutralButton } from 'src/components/Button'
import Divider from 'src/components/Divider'
import Gap from 'src/components/Gap'
import TxMemo from 'src/components/Input/TxMemo'
import { Popup } from 'src/components/Popup'
import Footer from 'src/components/Popup/Footer'
import Header from 'src/components/Popup/Header'
import Amount from 'src/components/TxComponents/Amount'
import { getCoinMinimalDenom } from 'src/config'
import { getChainDefaultGasPrice, getCoinDecimal, getCoinMinimalDenom } from 'src/config'
import { currentSafeWithNames } from 'src/logic/safe/store/selectors'
import { formatNativeCurrency, formatNativeToken } from 'src/utils'
import { convertAmount, formatNativeCurrency, formatNativeToken, formatWithComma } from 'src/utils'
import { signAndChangeTransactionSequence, signAndConfirmTransaction } from 'src/utils/signer'
import { getNotice, getTitle } from '..'
import { TxSignModalContext } from '../../Queue'
import { ReviewTxPopupWrapper } from '../../styled'
import EditSequence from '../EditSequence'
import TxMemo from 'src/components/Input/TxMemo'
import { DeleteButton, TxContent } from '../styles'
import calculateGasFee from '../../../../logic/providers/utils/fee'

export default function Execute({ open, onClose, data, sendTx, rejectTx, disabled, setDisabled, deleteTx }) {
const { action } = useContext(TxSignModalContext)
const { nativeBalance: balance, sequence: currentSequence } = useSelector(currentSafeWithNames)
const { nativeBalance: balance, sequence: currentSequence, coinConfig } = useSelector(currentSafeWithNames)
const chainDefaultGasPrice = getChainDefaultGasPrice()
const decimal = getCoinDecimal()
const gasFee = chainDefaultGasPrice ? calculateGasFee(400000, +chainDefaultGasPrice, decimal) : chainDefaultGasPrice
const dispatch = useDispatch()
const [sequence, setSequence] = useState(data?.txSequence)
const [txMemo, setTxMemo] = useState(data?.txDetails?.txMemo)

const totalAllocationAmount = formatNativeToken(
new BigNumber(+data?.txDetails?.txMessage[0]?.amount || 0).plus(+data.txDetails?.fee || 0).toString(),
)
const isNativeToken = data?.txDetails?.txMessage[0]?.denom === coinConfig?.find((e) => e?.type === 'native')?.denom
const otherToken = coinConfig?.find((e) => e?.denom ?? e?.cosmosDenom === data?.txDetails?.txMessage[0]?.denom)

const amount = isNativeToken
? formatNativeToken(data?.txDetails?.txMessage[0]?.amount)
: `${convertAmount(data?.txDetails?.txMessage[0]?.amount, false, otherToken?.decimals)} ${otherToken?.coinDenom}`

const totalAllocationAmount = isNativeToken
? formatNativeToken(
new BigNumber(+data?.txDetails?.txMessage[0]?.amount || 0).plus(+data.txDetails?.fee || 0).toString(),
)
: `${convertAmount(data?.txDetails?.txMessage[0]?.amount, false, otherToken?.decimals)} ${
otherToken?.coinDenom
} + ${formatNativeCurrency(new BigNumber(+gasFee).toString())}`

const txHandler = async (type) => {
if (type == 'confirm') {
dispatch(
Expand Down Expand Up @@ -80,6 +96,7 @@ export default function Execute({ open, onClose, data, sendTx, rejectTx, disable
)
}
}

return (
<>
<Popup open={open} handleClose={onClose} title="">
Expand All @@ -97,7 +114,7 @@ export default function Execute({ open, onClose, data, sendTx, rejectTx, disable
<TxContent>
<div>
<div className="label">Amount</div>
<div className="value">{formatNativeToken(data?.txDetails?.txMessage[0]?.amount)}</div>
<div className="value">{amount}</div>
</div>
<div>
<div className="label">Transaction fee</div>
Expand All @@ -115,7 +132,7 @@ export default function Execute({ open, onClose, data, sendTx, rejectTx, disable
</TxContent>
) : (
<>
<Amount amount={formatNativeToken(data?.txDetails?.txMessage[0]?.amount)} />
<Amount amount={amount} />
{action == 'change-sequence' && (
<>
<Gap height={16} />
Expand Down

0 comments on commit f1826a9

Please sign in to comment.