Skip to content

Commit

Permalink
Merge pull request #389 from aura-nw/euphoria
Browse files Browse the repository at this point in the history
Euphoria
  • Loading branch information
harisato authored Apr 3, 2024
2 parents 46320c1 + b4bec64 commit cfe6bc9
Show file tree
Hide file tree
Showing 5 changed files with 36 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
3 changes: 2 additions & 1 deletion src/pages/Assets/Tokens/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ function Tokens(props): ReactElement {
const safeTokens: any = useSelector(extendedSafeTokensSelector)
const { name: safeName, address, isHideZeroBalance, coinConfig: coinConfigState } = useSelector(currentSafeWithNames)
const [hideZeroBalance, setHideZeroBalance] = useState(isHideZeroBalance)
const coinConfig = loadFromLocalStorage(LS_TOKEN_CONFIG) as any[]
const coinConfigStorage = loadFromLocalStorage(LS_TOKEN_CONFIG) as any[]
const coinConfig = coinConfigStorage ?? coinConfigState
const { onShow, onHide, safeActionsState } = useSafeActions()
const safeAddress = extractSafeAddress()

Expand Down
38 changes: 30 additions & 8 deletions src/pages/Transactions/TxActionModal/Send/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,52 @@ 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 === data?.txDetails?.txMessage[0]?.denom ||
e?.symbol === data?.txDetails?.txMessage[0]?.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 +101,7 @@ export default function Execute({ open, onClose, data, sendTx, rejectTx, disable
)
}
}

return (
<>
<Popup open={open} handleClose={onClose} title="">
Expand All @@ -97,7 +119,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 +137,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 cfe6bc9

Please sign in to comment.