Skip to content

Commit

Permalink
Merge branch 'main' into fix/reintroduce-tezos-cosmos
Browse files Browse the repository at this point in the history
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
  • Loading branch information
Gancho Radkov committed Feb 1, 2024
2 parents e816e6a + 68c95a9 commit b0bbffc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
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
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

0 comments on commit b0bbffc

Please sign in to comment.