Skip to content

Commit

Permalink
Merge pull request #270 from aura-nw/euphoria
Browse files Browse the repository at this point in the history
Add contract interaction and custom transaction feature
  • Loading branch information
harisato authored May 29, 2023
2 parents 867a26e + 4dd9769 commit c48ba51
Show file tree
Hide file tree
Showing 152 changed files with 3,928 additions and 3,051 deletions.
12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"prettier:fix": "yarn prettier --write",
"prettier": "prettier './src/**/*.{js,jsx,ts,tsx}'",
"release": "electron-builder --mac --linux --windows -p always",
"start": "rescripts --openssl-legacy-provider start",
"start": "rescripts start",
"start:docker": "docker-compose build && docker-compose up",
"test": "REACT_APP_ENV=test rescripts test --env=jsdom",
"test:coverage": "REACT_APP_ENV=test yarn test --coverage --watchAll=false",
Expand Down Expand Up @@ -166,6 +166,9 @@
},
"dependencies": {
"@aura/safe-react-components": "https://github.com/aura-nw/safe-react-components.git",
"@codemirror/lang-javascript": "^6.1.6",
"@codemirror/lang-json": "^6.0.1",
"@codemirror/language": "^6.6.0",
"@cosmjs/cosmwasm-stargate": "^0.28.11",
"@cosmjs/stargate": "^0.28.11",
"@gnosis.pm/safe-apps-sdk": "6.1.0",
Expand All @@ -181,6 +184,8 @@
"@reduxjs/toolkit": "^1.8.6",
"@sentry/react": "^6.10.0",
"@sentry/tracing": "^6.10.0",
"@uiw/codemirror-theme-github": "^4.19.16",
"@uiw/react-codemirror": "^4.19.16",
"@unstoppabledomains/resolution": "^1.17.0",
"abi-decoder": "^2.4.0",
"axios": "0.21.4",
Expand All @@ -207,6 +212,7 @@
"history": "4.10.1",
"immutable": "4.0.0-rc.12",
"js-cookie": "^3.0.0",
"jsonschema": "^1.4.1",
"lodash": "^4.17.21",
"marked-react": "^1.3.0",
"notistack": "https://github.com/gnosis/notistack.git#v0.9.5",
Expand All @@ -221,7 +227,6 @@
"react-ga": "3.3.0",
"react-intersection-observer": "^8.32.0",
"react-papaparse": "^3.16.1",
"react-qr-reader": "^2.2.1",
"react-redux": "7.2.4",
"react-router-dom": "5.2.0",
"react-scripts": "^4.0.1",
Expand Down Expand Up @@ -290,7 +295,6 @@
"sass": "^1.32.0",
"typechain": "^5.1.2",
"typescript": "^4.3.5",
"usb-detection": "^4.10.0",
"wait-on": "^6.0.0"
}
}
}
6 changes: 3 additions & 3 deletions public/resources/Logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/App/TermModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { fontColor, lg, md, screenSm, secondaryText } from 'src/theme/variables'
import { borderLinear } from 'src/theme/variables'
import Logo from 'src/assets/icons/Logo.svg'
import session from 'src/utils/storage/session'
import { store } from 'src/store'
import { store } from 'src/logic/safe/store'
import { setTerm } from 'src/logic/checkTerm/store/actions/setTerm'
import { handleConnectWallet } from 'src/logic/providers'

Expand Down
2 changes: 1 addition & 1 deletion src/App/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import useConnectWallet from 'src/logic/hooks/useConnectWallet'
import { useSafeScheduledUpdates } from 'src/logic/safe/hooks/useSafeScheduledUpdates'
import useSafeActions from 'src/logic/safe/hooks/useSafeActions'
import { formatAmountInUsFormat } from 'src/logic/tokens/utils/formatAmount'
import { grantedSelector } from 'src/routes/safe/container/selector'
import { grantedSelector } from 'src/utils/safeUtils/selector'

import ReceiveModal from './ReceiveModal'
import TermModal from './TermModal'
Expand Down
6 changes: 6 additions & 0 deletions src/assets/icons/FileText.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion src/components/AddressInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type EthHashInfoRestProps = Omit<

type Props = EthHashInfoRestProps & {
address: string
type?: string
name?: string | undefined
avatarUrl?: string | undefined
}
Expand All @@ -32,6 +33,7 @@ export default function AddressInfo({
showAvatar = true,
showName = true,
avatarUrl,
type,
...rest
}: Props): ReactElement | null {
const toInfo = useKnownAddress({ value: address, name: name || null, logoUri: avatarUrl || null })
Expand All @@ -49,7 +51,7 @@ export default function AddressInfo({
showAvatar={showAvatar}
customAvatar={addressDetail?.picture || toInfo.logoUri || undefined}
showCopyBtn={!addressDetail}
explorerUrl={getExplorerInfo(addressDetail?.operatorAddress || address)}
explorerUrl={getExplorerInfo(addressDetail?.operatorAddress || address, type)}
{...rest}
/>
)
Expand Down
2 changes: 1 addition & 1 deletion src/components/Breadcrumb/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const Wrap = styled.div<{ icon: any }>`
font-size: 32px;
line-height: 40px;
color: #ffffff;
margin: 0;
margin: 0px 0px 8px;
}
.breadcrumb-subtitle {
margin: 0;
Expand Down
34 changes: 28 additions & 6 deletions src/components/ConnectWalletModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { connectProvider } from 'src/logic/providers'
import { WALLETS_NAME } from 'src/logic/wallets/constant/wallets'
import { enhanceSnackbarForAction, NOTIFICATIONS } from '../../logic/notifications'
import enqueueSnackbar from '../../logic/notifications/store/actions/enqueueSnackbar'
import { store } from '../../store'
import { store } from '../../logic/safe/store'
import Img from '../layout/Img'
import { ImageContainer, ImageItem, ImageTitle, WalletList } from './styles'

Expand Down Expand Up @@ -37,12 +37,34 @@ export const ConnectWalletModal = ({ isOpen, onClose }: Props): React.ReactEleme
.then((res) => {
onClose()
})
.catch(() => {
store.dispatch(enqueueSnackbar(enhanceSnackbarForAction(NOTIFICATIONS.CONNECT_WALLET_ERROR_MSG)))
.catch((error) => {
console.error('error 3', error)
store.dispatch(
enqueueSnackbar(
enhanceSnackbarForAction(
error?.message
? {
message: error?.message,
options: { variant: 'error', persist: false, autoHideDuration: 5000, preventDuplicate: true },
}
: NOTIFICATIONS.CONNECT_WALLET_ERROR_MSG,
),
),
)
})
} catch (e) {
store.dispatch(enqueueSnackbar(enhanceSnackbarForAction(NOTIFICATIONS.CONNECT_WALLET_ERROR_MSG)))
console.log(e)
} catch (error) {
store.dispatch(
enqueueSnackbar(
enhanceSnackbarForAction(
error?.message
? {
message: error?.message,
options: { variant: 'error', persist: false, autoHideDuration: 5000, preventDuplicate: true },
}
: NOTIFICATIONS.CONNECT_WALLET_ERROR_MSG,
),
),
)
}
},
[onClose],
Expand Down
63 changes: 63 additions & 0 deletions src/components/CustomTransactionMessage/BigMsg.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { Accordion, AccordionSummary, AccordionDetails } from '@aura/safe-react-components'
import { beutifyJson } from 'src/utils'
import styled from 'styled-components'

export const NoPaddingAccordion = styled(Accordion)`
margin-bottom: 16px !important;
border-radius: 8px !important;
&.MuiAccordion-root {
border: none !important;
.MuiAccordionDetails-root {
padding: 0;
}
}
`

export const StyledAccordionSummary = styled(AccordionSummary)`
background-color: #363843 !important;
border: none !important;
height: 52px;
&.Mui-expanded {
background-color: #363843 !important;
}
.tx-nonce {
margin: 0 16px 0 8px;
min-width: 80px;
}
`
export const StyledAccordionDetails = styled(AccordionDetails)`
padding: 16px !important;
background: #34353a !important; ;
`

export const Message = ({ msgData, index }) => {
if (!msgData.typeUrl || !msgData.value) return <></>
const Wrap = styled.div`
white-space: pre-wrap;
.string {
color: #ce9178;
}
.number {
color: #aac19e;
}
.boolean {
color: #266781;
}
.null {
color: #d33a3a;
}
.key {
color: #569cd6;
}
`
return (
<NoPaddingAccordion>
<StyledAccordionSummary>
{index + 1}. {msgData?.typeUrl?.split('Msg')?.at(-1)}
</StyledAccordionSummary>
<StyledAccordionDetails>
<Wrap dangerouslySetInnerHTML={{ __html: beutifyJson(msgData?.value) }} />
</StyledAccordionDetails>
</NoPaddingAccordion>
)
}
69 changes: 69 additions & 0 deletions src/components/CustomTransactionMessage/SmallMsg.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { Accordion, AccordionDetails, AccordionSummary } from '@aura/safe-react-components'
import { beutifyJson } from 'src/utils'
import styled from 'styled-components'

export const NoPaddingAccordion = styled(Accordion)`
margin-bottom: 8px !important;
border-radius: 4px !important;
&.MuiAccordion-root {
border: none !important;
.MuiAccordionDetails-root {
padding: 0;
}
}
`

export const StyledAccordionSummary = styled(AccordionSummary)`
background-color: #363843 !important;
border: none !important;
min-height: 24px !important;
font-size: 12px;
&.Mui-expanded {
background-color: #363843 !important;
}
.tx-nonce {
margin: 0 16px 0 8px;
min-width: 80px;
}
> div {
padding: 0px !important;
margin: 0px !important;
}
`
export const StyledAccordionDetails = styled(AccordionDetails)`
padding: 8px !important;
background: #34353a !important;
font-size: 12px !important;
`

export const Message = ({ msgData, index }) => {
const Wrap = styled.div`
white-space: pre-wrap;
.string {
color: #ce9178;
}
.number {
color: #aac19e;
}
.boolean {
color: #266781;
}
.null {
color: #d33a3a;
}
.key {
color: #569cd6;
}
`

return (
<NoPaddingAccordion>
<StyledAccordionSummary>
{index + 1}. {msgData?.typeUrl.split('Msg').at(-1)}
</StyledAccordionSummary>
<StyledAccordionDetails>
<Wrap dangerouslySetInnerHTML={{ __html: beutifyJson(msgData?.value) }} />
</StyledAccordionDetails>
</NoPaddingAccordion>
)
}
50 changes: 3 additions & 47 deletions src/components/Input/Address/index.tsx
Original file line number Diff line number Diff line change
@@ -1,55 +1,11 @@
import { Autocomplete, AutocompleteCloseReason } from '@material-ui/lab'
import { useState } from 'react'
import { useSelector } from 'react-redux'
import AddressInfo from 'src/components/AddressInfo'
import { AddressBookEntry } from 'src/logic/addressBook/model/addressBook'
import { currentNetworkAddressBook } from 'src/logic/addressBook/store/selectors'
import MuiTextField from '@material-ui/core/TextField'
import { Wrapper } from './style'
import { useState, useEffect } from 'react'
import AddressInfo from 'src/components/AddressInfo'
import styled from 'styled-components'
import { colorLinear } from 'src/theme/variables'
import { extractSafeAddress } from 'src/routes/routes'

const StyledTextField = styled(MuiTextField)`
width: 100%;
label {
z-index: 1;
font-size: 14px;
transform: translate(12px, 18px) scale(1);
}
.MuiInputLabel-shrink {
transform: translate(12px, 8px) scale(0.85);
height: 16px;
}
.MuiInputLabel-shrink.Mui-focused {
color: #5ee6d0;
}
> div {
background: #24262e;
border: 1px solid #494c58;
color: #fff;
border-radius: 8px;
padding: 0px !important ;
&:hover {
background: #24262e;
}
}
> div.Mui-focused {
background: linear-gradient(#24262e, #24262e) padding-box, ${colorLinear} border-box;
border: 1px solid transparent;
border-radius: 8px;
}
input {
color: #fff;
padding: 22px 12px 8px !important;
font-size: 14px;
height: 18px;
}
> div::after,
> div::before {
display: none;
}
`
import { StyledTextField } from '../StyledTextField'

export default function AddressInput({
label = 'Address',
Expand Down
Loading

0 comments on commit c48ba51

Please sign in to comment.