From 5feb06502bef15fec8a693783f1d5a6764ad7b90 Mon Sep 17 00:00:00 2001 From: bluecco Date: Thu, 18 Jul 2024 19:29:17 +0200 Subject: [PATCH 1/2] chore: remove console log --- src/services/universalTransactionExecute.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/services/universalTransactionExecute.ts b/src/services/universalTransactionExecute.ts index 16b42d2..6a0efe8 100644 --- a/src/services/universalTransactionExecute.ts +++ b/src/services/universalTransactionExecute.ts @@ -45,12 +45,6 @@ export const universalTransactionExecuteJSONRpcMethod = async ({ throw Error("wallet not connected") } - console.log({ - contract_address, - entry_point, - calldata, - }) - return wallet.request({ type: "wallet_addInvokeTransaction", params: { From 747e0d4b4f95aae28c7244fb2bf0eeecf61bc2f4 Mon Sep 17 00:00:00 2001 From: bluecco Date: Thu, 18 Jul 2024 19:35:14 +0200 Subject: [PATCH 2/2] chore: qol --- src/components/AccountSection.tsx | 20 +++++++++++++++++-- .../Actions/SessionKeysExecuteOutside.tsx | 9 ++++++++- .../Actions/SessionKeysTypedDataOutside.tsx | 9 ++++++++- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/src/components/AccountSection.tsx b/src/components/AccountSection.tsx index 5147699..4d95f07 100644 --- a/src/components/AccountSection.tsx +++ b/src/components/AccountSection.tsx @@ -7,7 +7,7 @@ import { starknetReactVersionAtom, starknetkitVersionAtom, } from "@/state/versionState" -import { Box, Flex, Heading } from "@chakra-ui/react" +import { Box, Flex, Heading, useToast } from "@chakra-ui/react" import { useAtomValue } from "jotai" import { FC } from "react" import { constants, num } from "starknet" @@ -26,6 +26,7 @@ const AccountSection: FC = ({ address, chainId }) => { const lastTxError = useAtomValue(lastTxErrorAtom) const starknetkitVersion = useAtomValue(starknetkitVersionAtom) const starknetReactVersion = useAtomValue(starknetReactVersionAtom) + const toast = useToast() const hexChainId = typeof chainId === "bigint" ? num.toHex(chainId ?? 0) : null @@ -37,7 +38,22 @@ const AccountSection: FC = ({ address, chainId }) => { {starknetReactVersion && {starknetReactVersion}}
- Account: {address} + { + if (address) { + navigator.clipboard.writeText(address || "") + toast({ + title: "Address copied", + duration: 1000, + containerStyle: { minWidth: "50px" }, + status: "success", + }) + } + }} + > + Account: {address} + Chain:{" "} {!hexChainId diff --git a/src/components/Actions/SessionKeysExecuteOutside.tsx b/src/components/Actions/SessionKeysExecuteOutside.tsx index 3b3b4ff..e80b9e7 100644 --- a/src/components/Actions/SessionKeysExecuteOutside.tsx +++ b/src/components/Actions/SessionKeysExecuteOutside.tsx @@ -20,7 +20,7 @@ import { useAtomValue } from "jotai" import { useState } from "react" import { Abi, Calldata, Contract, RawArgs, shortString, stark } from "starknet" import Erc20Abi from "../../abi/ERC20.json" -import { Box, Button, Flex, Heading, Input } from "@chakra-ui/react" +import { Box, Button, Flex, Heading, Input, useToast } from "@chakra-ui/react" type OutsideExecution = { contractAddress: string @@ -33,6 +33,7 @@ const SessionKeysExecuteOutside = ({}) => { const sessionRequest = useAtomValue(sessionRequestAtom) const connectorData = useAtomValue(connectorDataAtom) const transactionStatus = useAtomValue(lastTxStatusAtom) + const toast = useToast() const [amount, setAmount] = useState("") const [outsideExecution, setOutsideExecution] = useState< @@ -117,6 +118,12 @@ const SessionKeysExecuteOutside = ({}) => { const copyData = () => { navigator.clipboard.writeText(JSON.stringify(outsideExecution)) + toast({ + title: "Outside execution payload copied", + duration: 1000, + containerStyle: { minWidth: "50px" }, + status: "success", + }) } return ( diff --git a/src/components/Actions/SessionKeysTypedDataOutside.tsx b/src/components/Actions/SessionKeysTypedDataOutside.tsx index fef2960..deb65b5 100644 --- a/src/components/Actions/SessionKeysTypedDataOutside.tsx +++ b/src/components/Actions/SessionKeysTypedDataOutside.tsx @@ -17,7 +17,7 @@ import { SessionDappService, buildSessionAccount, } from "@argent/x-sessions" -import { Button, Flex, Heading, Input } from "@chakra-ui/react" +import { Button, Flex, Heading, Input, useToast } from "@chakra-ui/react" import { useAtomValue } from "jotai" import { useState } from "react" import { Abi, Contract, stark } from "starknet" @@ -28,6 +28,7 @@ const SessionKeysTypedDataOutside = () => { const sessionRequest = useAtomValue(sessionRequestAtom) const connectorData = useAtomValue(connectorDataAtom) const transactionStatus = useAtomValue(lastTxStatusAtom) + const toast = useToast() const [amount, setAmount] = useState("") const [outsideExecution, setOutsideExecution] = useState< @@ -110,6 +111,12 @@ const SessionKeysTypedDataOutside = () => { const copyData = () => { navigator.clipboard.writeText(JSON.stringify(outsideExecution)) + toast({ + title: "Outside execution typed data copied", + duration: 1000, + containerStyle: { minWidth: "50px" }, + status: "success", + }) } return (