Skip to content

Commit

Permalink
Main build fix and error message (#439)
Browse files Browse the repository at this point in the history
* fix(quota): api showing outdated results

* removed missing module imports

* better error messaging on smart account creation (#438)

* feat: removes tezos & cosmos

---------

Co-authored-by: Derek <alexanderderekrein@gmail.com>
Co-authored-by: Gancho Radkov <ganchoradkov@gmail.com>
  • Loading branch information
3 people authored Feb 1, 2024
1 parent 6db5826 commit 68c95a9
Show file tree
Hide file tree
Showing 17 changed files with 36 additions and 232 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { cosmosAddresses } from '@/utils/CosmosWalletUtil'
import { eip155Addresses } from '@/utils/EIP155WalletUtil'
import { polkadotAddresses } from '@/utils/PolkadotWalletUtil'
import { multiversxAddresses } from '@/utils/MultiversxWalletUtil'
import { tronAddresses } from '@/utils/TronWalletUtil'
import { tezosAddresses } from '@/utils/TezosWalletUtil'
import { solanaAddresses } from '@/utils/SolanaWalletUtil'
import { nearAddresses } from '@/utils/NearWalletUtil'
import { kadenaAddresses } from '@/utils/KadenaWalletUtil'
Expand Down
13 changes: 2 additions & 11 deletions advanced/wallets/react-wallet-v2/src/components/ChainDataMini.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
import { COSMOS_MAINNET_CHAINS } from '@/data/COSMOSData'
import { EIP155_CHAINS } from '@/data/EIP155Data'
import { KADENA_CHAINS } from '@/data/KadenaData'
import { MULTIVERSX_CHAINS } from '@/data/MultiversxData'
import { NEAR_CHAINS } from '@/data/NEARData'
import { POLKADOT_CHAINS } from '@/data/PolkadotData'
import { SOLANA_CHAINS } from '@/data/SolanaData'
import { TEZOS_CHAINS } from '@/data/TezosData'
import { TRON_CHAINS } from '@/data/TronData'
import { getChainData } from '@/data/chainsUtil'
import { Card, Row, styled, Image, Avatar } from '@nextui-org/react'
import { ReactNode, useMemo } from 'react'
import { Row, Avatar } from '@nextui-org/react'
import { useMemo } from 'react'

interface Props {
chainId?: string // namespace + ":" + reference
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { COSMOS_MAINNET_CHAINS, TCosmosChain } from '@/data/COSMOSData'
import { EIP155_CHAINS, TEIP155Chain } from '@/data/EIP155Data'
import { KADENA_CHAINS, TKadenaChain } from '@/data/KadenaData'
import { NEAR_TEST_CHAINS, TNearChain } from '@/data/NEARData'
Expand Down Expand Up @@ -30,7 +29,6 @@ export default function RequestDetailsCard({ chains, protocol }: IProps) {
.map(
chain =>
EIP155_CHAINS[chain as TEIP155Chain]?.name ??
COSMOS_MAINNET_CHAINS[chain as TCosmosChain]?.name ??
SOLANA_CHAINS[chain as TSolanaChain]?.name ??
NEAR_TEST_CHAINS[chain as TNearChain]?.name ??
MULTIVERSX_CHAINS[chain as TMultiversxChain]?.name ??
Expand All @@ -48,7 +46,9 @@ export default function RequestDetailsCard({ chains, protocol }: IProps) {
<Row>
<Col>
<Text h5>Relay Protocol</Text>
<Text color="$gray400" data-testid="request-detauls-realy-protocol">{protocol}</Text>
<Text color="$gray400" data-testid="request-detauls-realy-protocol">
{protocol}
</Text>
</Col>
</Row>
</Fragment>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import ChainCard from '@/components/ChainCard'
import { COSMOS_MAINNET_CHAINS } from '@/data/COSMOSData'
import { EIP155_MAINNET_CHAINS, EIP155_TEST_CHAINS } from '@/data/EIP155Data'
import { NEAR_TEST_CHAINS } from '@/data/NEARData'
import { SOLANA_MAINNET_CHAINS, SOLANA_TEST_CHAINS } from '@/data/SolanaData'
Expand All @@ -14,7 +13,6 @@ import { Fragment } from 'react'
* Utilities
*/
const CHAIN_METADATA = {
...COSMOS_MAINNET_CHAINS,
...SOLANA_MAINNET_CHAINS,
...MULTIVERSX_MAINNET_CHAINS,
...TRON_MAINNET_CHAINS,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import ChainCard from '@/components/ChainCard'
import { COSMOS_MAINNET_CHAINS } from '@/data/COSMOSData'
import { EIP155_MAINNET_CHAINS, EIP155_TEST_CHAINS } from '@/data/EIP155Data'
import { NEAR_TEST_CHAINS } from '@/data/NEARData'
import { SOLANA_MAINNET_CHAINS, SOLANA_TEST_CHAINS } from '@/data/SolanaData'
Expand All @@ -14,7 +13,6 @@ import { Fragment } from 'react'
* Utilities
*/
const CHAIN_METADATA = {
...COSMOS_MAINNET_CHAINS,
...SOLANA_MAINNET_CHAINS,
...MULTIVERSX_MAINNET_CHAINS,
...TRON_MAINNET_CHAINS,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import ChainCard from '@/components/ChainCard'
import SettingsStore from '@/store/SettingsStore'
import { truncate } from '@/utils/HelperUtil'
import { styledToast, truncate } from '@/utils/HelperUtil'
import { updateSignClientChainId } from '@/utils/WalletConnectUtil'
import { Avatar, Button, Text, Tooltip, Loading } from '@nextui-org/react'
import { eip155Wallets } from '@/utils/EIP155WalletUtil'
Expand Down Expand Up @@ -134,7 +134,7 @@ export default function SmartAccountCard({
css={{ marginTop: 10, width: '100%' }}
onClick={onCreateSmartAccount}
>
{loading ? <Loading size="sm" /> : 'Create Smart Account'}
{loading ? <Loading size="sm" css={{ paddingTop: 10 }} /> : 'Create Smart Account'}
</Button>
</>
)}
Expand Down
26 changes: 0 additions & 26 deletions advanced/wallets/react-wallet-v2/src/data/COSMOSData.ts

This file was deleted.

49 changes: 0 additions & 49 deletions advanced/wallets/react-wallet-v2/src/data/TezosData.ts

This file was deleted.

4 changes: 0 additions & 4 deletions advanced/wallets/react-wallet-v2/src/data/chainsUtil.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
import { COSMOS_MAINNET_CHAINS } from './COSMOSData'
import { EIP155_CHAINS } from './EIP155Data'
import { KADENA_CHAINS } from './KadenaData'
import { MULTIVERSX_CHAINS } from './MultiversxData'
import { NEAR_CHAINS } from './NEARData'
import { POLKADOT_CHAINS } from './PolkadotData'
import { SOLANA_CHAINS } from './SolanaData'
import { TEZOS_CHAINS } from './TezosData'
import { TRON_CHAINS } from './TronData'

export const ALL_CHAINS = {
...EIP155_CHAINS,
...COSMOS_MAINNET_CHAINS,
...KADENA_CHAINS,
...MULTIVERSX_CHAINS,
...NEAR_CHAINS,
...POLKADOT_CHAINS,
...SOLANA_CHAINS,
...TEZOS_CHAINS,
...TRON_CHAINS
}

Expand Down
8 changes: 8 additions & 0 deletions advanced/wallets/react-wallet-v2/src/hooks/useSmartAccount.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { SmartAccountLib } from "@/lib/SmartAccountLib";
import { styledToast } from "@/utils/HelperUtil";
import { useCallback, useEffect, useState } from "react";
import { TransactionExecutionError } from "viem";

export default function useSmartAccount(signerPrivateKey: `0x${string}`) {
const [loading, setLoading] = useState(false)
Expand All @@ -14,6 +16,12 @@ export default function useSmartAccount(signerPrivateKey: `0x${string}`) {
setLoading(false)
}
catch (e) {
if (e instanceof TransactionExecutionError) {
// shorten the error message
styledToast(e.cause.message, 'error')
} else if (e instanceof Error) {
styledToast(e.message, 'error')
}
console.error(e)
setLoading(false)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Web3WalletTypes } from '@walletconnect/web3wallet'
import { COSMOS_SIGNING_METHODS } from '@/data/COSMOSData'
import { EIP155_SIGNING_METHODS } from '@/data/EIP155Data'
import { SOLANA_SIGNING_METHODS } from '@/data/SolanaData'
import { POLKADOT_SIGNING_METHODS } from '@/data/PolkadotData'
Expand All @@ -12,7 +11,6 @@ import { SignClientTypes } from '@walletconnect/types'
import { useCallback, useEffect } from 'react'
import { NEAR_SIGNING_METHODS } from '@/data/NEARData'
import { approveNearRequest } from '@/utils/NearRequestHandlerUtil'
import { TEZOS_SIGNING_METHODS } from '@/data/TezosData'
import { KADENA_SIGNING_METHODS } from '@/data/KadenaData'

export default function useWalletConnectEventsManager(initialized: boolean) {
Expand Down Expand Up @@ -60,10 +58,6 @@ export default function useWalletConnectEventsManager(initialized: boolean) {
case EIP155_SIGNING_METHODS.ETH_SIGN_TRANSACTION:
return ModalStore.open('SessionSendTransactionModal', { requestEvent, requestSession })

case COSMOS_SIGNING_METHODS.COSMOS_SIGN_DIRECT:
case COSMOS_SIGNING_METHODS.COSMOS_SIGN_AMINO:
return ModalStore.open('SessionSignCosmosModal', { requestEvent, requestSession })

case SOLANA_SIGNING_METHODS.SOLANA_SIGN_MESSAGE:
case SOLANA_SIGNING_METHODS.SOLANA_SIGN_TRANSACTION:
return ModalStore.open('SessionSignSolanaModal', { requestEvent, requestSession })
Expand Down Expand Up @@ -98,10 +92,6 @@ export default function useWalletConnectEventsManager(initialized: boolean) {
case TRON_SIGNING_METHODS.TRON_SIGN_MESSAGE:
case TRON_SIGNING_METHODS.TRON_SIGN_TRANSACTION:
return ModalStore.open('SessionSignTronModal', { requestEvent, requestSession })
case TEZOS_SIGNING_METHODS.TEZOS_GET_ACCOUNTS:
case TEZOS_SIGNING_METHODS.TEZOS_SEND:
case TEZOS_SIGNING_METHODS.TEZOS_SIGN:
return ModalStore.open('SessionSignTezosModal', { requestEvent, requestSession })
case KADENA_SIGNING_METHODS.KADENA_GET_ACCOUNTS:
case KADENA_SIGNING_METHODS.KADENA_SIGN:
case KADENA_SIGNING_METHODS.KADENA_QUICKSIGN:
Expand Down
73 changes: 19 additions & 54 deletions advanced/wallets/react-wallet-v2/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import AccountCard from '@/components/AccountCard'
import AccountPicker from '@/components/AccountPicker'
import PageHeader from '@/components/PageHeader'
import { COSMOS_MAINNET_CHAINS } from '@/data/COSMOSData'
import { EIP155_MAINNET_CHAINS, EIP155_TEST_CHAINS } from '@/data/EIP155Data'
import { SOLANA_MAINNET_CHAINS, SOLANA_TEST_CHAINS } from '@/data/SolanaData'
import { POLKADOT_MAINNET_CHAINS, POLKADOT_TEST_CHAINS } from '@/data/PolkadotData'
import { MULTIVERSX_MAINNET_CHAINS, MULTIVERSX_TEST_CHAINS } from '@/data/MultiversxData'
import { TRON_MAINNET_CHAINS, TRON_TEST_CHAINS } from '@/data/TronData'
import { NEAR_TEST_CHAINS } from '@/data/NEARData'
import { TEZOS_MAINNET_CHAINS, TEZOS_TEST_CHAINS } from '@/data/TezosData'
import { KADENA_MAINNET_CHAINS, KADENA_TEST_CHAINS } from '@/data/KadenaData'
import SettingsStore from '@/store/SettingsStore'
import { Text } from '@nextui-org/react'
Expand All @@ -21,13 +19,11 @@ export default function HomePage() {
testNets,
eip155Address,
activeChainId,
cosmosAddress,
solanaAddress,
polkadotAddress,
nearAddress,
multiversxAddress,
tronAddress,
tezosAddress,
kadenaAddress
} = useSnapshot(SettingsStore.state)

Expand All @@ -50,17 +46,6 @@ export default function HomePage() {
data-testid={'chain-card-' + caip10.toString()}
/>
))}
{Object.entries(COSMOS_MAINNET_CHAINS).map(([caip10, { name, logo, rgb }]) => (
<AccountCard
key={name}
name={name}
logo={logo}
rgb={rgb}
address={cosmosAddress}
chainId={caip10}
data-testid={'chain-card-' + caip10.toString()}
/>
))}
{Object.entries(SOLANA_MAINNET_CHAINS).map(([caip10, { name, logo, rgb }]) => (
<AccountCard
key={name}
Expand Down Expand Up @@ -105,17 +90,6 @@ export default function HomePage() {
data-testid={'chain-card-' + caip10.toString()}
/>
))}
{Object.entries(TEZOS_MAINNET_CHAINS).map(([caip10, { name, logo, rgb }]) => (
<AccountCard
key={name}
name={name}
logo={logo}
rgb={rgb}
address={tezosAddress}
chainId={caip10}
data-testid={'chain-card-' + caip10.toString()}
/>
))}
{Object.entries(KADENA_MAINNET_CHAINS).map(([caip10, { name, logo, rgb }]) => (
<AccountCard
key={name}
Expand All @@ -133,34 +107,36 @@ export default function HomePage() {
<Text h4 css={{ marginBottom: '$5' }}>
Testnets
</Text>
{Object.entries(EIP155_TEST_CHAINS).map(([caip10, { name, logo, rgb, chainId, smartAccountEnabled }]) => {
if (smartAccountEnabled) {
{Object.entries(EIP155_TEST_CHAINS).map(
([caip10, { name, logo, rgb, chainId, smartAccountEnabled }]) => {
if (smartAccountEnabled) {
return (
<SmartAccountCard
key={name}
name={name}
logo={logo}
rgb={rgb}
address={eip155Address}
chainId={caip10.toString()}
data-testid={'chain-card-' + caip10.toString()}
isActiveChain={activeChainId === `eip155:${chainId}`}
/>
)
}

return (
<SmartAccountCard
<AccountCard
key={name}
name={name}
logo={logo}
rgb={rgb}
address={eip155Address}
chainId={caip10.toString()}
data-testid={'chain-card-' + caip10.toString()}
isActiveChain={activeChainId === `eip155:${chainId}`}
/>
)
}

return (
<AccountCard
key={name}
name={name}
logo={logo}
rgb={rgb}
address={eip155Address}
chainId={caip10.toString()}
data-testid={'chain-card-' + caip10.toString()}
/>
)
})}
)}
{Object.entries(SOLANA_TEST_CHAINS).map(([caip10, { name, logo, rgb }]) => (
<AccountCard
key={name}
Expand Down Expand Up @@ -216,17 +192,6 @@ export default function HomePage() {
data-testid={'chain-card-' + caip10.toString()}
/>
))}
{Object.entries(TEZOS_TEST_CHAINS).map(([caip10, { name, logo, rgb }]) => (
<AccountCard
key={name}
name={name}
logo={logo}
rgb={rgb}
address={tezosAddress}
chainId={caip10}
data-testid={'chain-card-' + caip10.toString()}
/>
))}
{Object.entries(KADENA_TEST_CHAINS).map(([caip10, { name, logo, rgb }]) => (
<AccountCard
key={name}
Expand Down
Loading

0 comments on commit 68c95a9

Please sign in to comment.