Skip to content

Commit

Permalink
Merge pull request #28 from argentlabs/release
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
bluecco authored Jul 18, 2024
2 parents 8573b32 + b8af860 commit e442769
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 10 deletions.
20 changes: 18 additions & 2 deletions src/components/AccountSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -26,6 +26,7 @@ const AccountSection: FC<AccountSectionProps> = ({ 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
Expand All @@ -37,7 +38,22 @@ const AccountSection: FC<AccountSectionProps> = ({ address, chainId }) => {
{starknetReactVersion && <Heading>{starknetReactVersion}</Heading>}
</Flex>
<Section>
<Box>Account: {address}</Box>
<Box
cursor={address ? "pointer" : "default"}
onClick={() => {
if (address) {
navigator.clipboard.writeText(address || "")
toast({
title: "Address copied",
duration: 1000,
containerStyle: { minWidth: "50px" },
status: "success",
})
}
}}
>
Account: {address}
</Box>
<Box>
Chain:{" "}
{!hexChainId
Expand Down
9 changes: 8 additions & 1 deletion src/components/Actions/SessionKeysExecuteOutside.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<
Expand Down Expand Up @@ -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 (
Expand Down
9 changes: 8 additions & 1 deletion src/components/Actions/SessionKeysTypedDataOutside.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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<
Expand Down Expand Up @@ -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 (
Expand Down
6 changes: 0 additions & 6 deletions src/services/universalTransactionExecute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit e442769

Please sign in to comment.