Skip to content

Commit

Permalink
Merge pull request #320 from aura-nw/fix/remove-unused-package
Browse files Browse the repository at this point in the history
Fix/remove unused package
  • Loading branch information
hoangndm3139 authored Sep 15, 2023
2 parents 2ad87de + 91544f2 commit 842c24b
Show file tree
Hide file tree
Showing 100 changed files with 380 additions and 10,458 deletions.
15 changes: 3 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -188,34 +188,26 @@
"@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",
"base64-js": "^1.5.1",
"bech32": "^2.0.0",
"bignumber.js": "9.0.1",
"bnc-onboard": "~1.35.3",
"classnames": "^2.2.6",
"currency-flags": "3.2.1",
"date-fns": "^2.20.2",
"detect-port": "^1.3.0",
"electron-log": "^4.4.3",
"electron-settings": "^4.0.2",
"electron-updater": "4.6.1",
"eth-sig-util": "^2.5.3",
"ethereumjs-abi": "0.6.8",
"ethereumjs-util": "^7.0.10",
"exponential-backoff": "^3.1.0",
"express": "^4.17.2",
"final-form": "^4.20.2",
"final-form-calculate": "^1.3.2",
"framer-motion": "^4.1.17",
"fuse.js": "^6.4.6",
"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",
"object-hash": "^2.1.1",
"qrcode.react": "1.0.1",
Expand All @@ -226,8 +218,8 @@
"react-final-form": "^6.5.3",
"react-final-form-listeners": "^1.0.2",
"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 All @@ -240,7 +232,6 @@
"styled-components": "^5.3.0",
"web3": "1.6.0",
"web3-core": "^1.6.0",
"web3-eth-contract": "^1.6.0",
"web3-utils": "^1.6.0"
},
"devDependencies": {
Expand Down Expand Up @@ -289,7 +280,7 @@
"husky": "^7.0.0",
"jest": "26.6.0",
"lint-staged": "^11.1.1",
"patch-package": "^6.4.7",
"patch-package": "^8.0.0",
"postinstall-postinstall": "^2.1.0",
"prettier": "^2.4.0",
"redux-mock-store": "^1.5.4",
Expand All @@ -298,4 +289,4 @@
"typescript": "^4.3.5",
"wait-on": "^6.0.0"
}
}
}
41 changes: 0 additions & 41 deletions src/components/ConnectButton/index.tsx
Original file line number Diff line number Diff line change
@@ -1,46 +1,5 @@
import { ReactElement } from 'react'
import { _getChainId } from 'src/config'
import { getWeb3 } from 'src/logic/wallets/getWeb3'
import onboard from 'src/logic/wallets/onboard'
import { shouldSwitchNetwork, switchNetwork } from 'src/logic/wallets/utils/network'
import { StyledConnectButton } from './styles'
const checkWallet = async (): Promise<boolean> => {
if (shouldSwitchNetwork()) {
switchNetwork(onboard().getState().wallet, _getChainId()).catch((e) => e.log())
}

return await onboard().walletCheck()
}

export const onboardUser = async (): Promise<boolean> => {
// before calling walletSelect you want to check if web3 has been instantiated
// which indicates that a wallet has already been selected
// and web3 has been instantiated with that provider
const web3 = getWeb3()
const walletSelected = web3 ? true : await onboard().walletSelect()
return walletSelected && checkWallet()
}

// export const onConnectButtonClick = async (): Promise<void> => {
// const chainId = _getChainId()
// await connectKeplr()
// .then(async (status) => {
// if (status === KeplrErrors.NoChainInfo) {
// await suggestChain(chainId)
// return true
// }

// return null
// })
// .then((e) => {
// if (e) {
// connectKeplr()
// }
// })
// .catch(() => {
// store.dispatch(enqueueSnackbar(enhanceSnackbarForAction(NOTIFICATIONS.CONNECT_WALLET_ERROR_MSG)))
// })
// }

const ConnectButton = (props: { 'data-testid': string; onConnect: () => void }): ReactElement => (
<StyledConnectButton
Expand Down
31 changes: 0 additions & 31 deletions src/logic/contracts/safeContractErrors.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import abi from 'ethereumjs-abi'

import { CONTRACT_ERRORS, CONTRACT_ERROR_CODES } from 'src/logic/contracts/contracts.d'
import { getWeb3 } from 'src/logic/wallets/getWeb3'
import { GnosisSafe } from 'src/types/contracts/gnosis_safe.d'

export const decodeMessage = (message: string): string => {
const code = CONTRACT_ERROR_CODES.find((code) => {
Expand All @@ -11,31 +8,3 @@ export const decodeMessage = (message: string): string => {

return code ? `${code}: ${CONTRACT_ERRORS[code]}` : message
}

export const getContractErrorMessage = async ({
safeInstance,
from,
data,
}: {
safeInstance: GnosisSafe
from: string
data: string
}): Promise<string | null> => {
const web3 = getWeb3()

try {
const returnData = await web3.eth.call({
to: safeInstance.options.address,
from,
value: 0,
data,
})

const returnBuffer = Buffer.from(returnData.slice(2), 'hex')

const contractOutput = abi.rawDecode(['string'], returnBuffer.slice(4))[0]
return decodeMessage(contractOutput)
} catch (e) {
return decodeMessage(e.message)
}
}
17 changes: 7 additions & 10 deletions src/logic/keplr/keplr.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
import { ChainInfo } from '@gnosis.pm/safe-react-gateway-sdk'
import { Keplr, Key } from '@keplr-wallet/types'
import { Keplr } from '@keplr-wallet/types'
import * as _ from 'lodash'
import { Dispatch } from 'redux'

import { store } from 'src/logic/safe/store'
import { JWT_TOKEN_KEY } from 'src/services/constant/common'
import { getGatewayUrl } from 'src/services/data/environment'
import { auth } from 'src/services/index'
import { store } from 'src/logic/safe/store'
import { parseToAddress } from 'src/utils/parseByteAdress'
import { saveToStorage } from 'src/utils/storage'
import session from 'src/utils/storage/session'
import { getChainInfo, getInternalChainId, _getChainId } from '../../config'
import { trackAnalyticsEvent, WALLET_EVENTS } from '../../utils/googleAnalytics'
import { enhanceSnackbarForAction, NOTIFICATIONS } from '../notifications'
import { _getChainId, getChainInfo, getInternalChainId } from '../../config'
import { WALLET_EVENTS, trackAnalyticsEvent } from '../../utils/googleAnalytics'
import { NOTIFICATIONS, enhanceSnackbarForAction } from '../notifications'
import enqueueSnackbar from '../notifications/store/actions/enqueueSnackbar'
import { handleConnectWallet } from '../providers/index'
import { WALLETS_NAME } from '../wallets/constant/wallets'
import { addProvider } from '../wallets/store/actions'
import { LAST_USED_PROVIDER_KEY } from '../wallets/store/middlewares/providerWatcher'
import { makeProvider, ProviderProps } from '../wallets/store/model/provider'
import { handleConnectWallet } from '../providers/index'
import { ProviderProps, makeProvider } from '../wallets/store/model/provider'
export type WalletKey = {
myAddress: string
myPubkey: string
Expand Down
3 changes: 2 additions & 1 deletion src/logic/safe/safeTxSigner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { List } from 'immutable'
import { Confirmation } from 'src/logic/safe/store/models/types/confirmation'
import { EMPTY_DATA } from 'src/logic/wallets/ethTransactions'
import semverSatisfies from 'semver/functions/satisfies'
import { SAFE_VERSION_FOR_OFF_CHAIN_SIGNATURES } from './transactions/offchainSigner'

const SAFE_VERSION_FOR_OFF_CHAIN_SIGNATURES = '>=1.0.0'

// Here we're checking that safe contract version is greater or equal 1.1.1, but
// theoretically EIP712 should also work for 1.0.0 contracts
Expand Down
Loading

0 comments on commit 842c24b

Please sign in to comment.