diff --git a/package.json b/package.json index 9b218a7..29c0575 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "starknet-react-chains-next": "npm:@starknet-react/chains@3.0.0-beta.2", "starknet-react-core-next": "npm:@starknet-react/core@3.0.0-beta.2", "starknetkit-latest": "npm:starknetkit@^1.1.9", - "starknetkit-next": "npm:starknetkit@^2.2.23" + "starknetkit-next": "npm:starknetkit@^2.2.24" }, "devDependencies": { "@types/lodash-es": "^4.17.12", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bf12a81..ad72710 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -72,8 +72,8 @@ importers: specifier: npm:starknetkit@^1.1.9 version: starknetkit@1.1.9(starknet@6.11.0) starknetkit-next: - specifier: npm:starknetkit@^2.2.23 - version: starknetkit@2.2.23(starknet@6.11.0) + specifier: npm:starknetkit@^2.2.24 + version: starknetkit@2.2.24(starknet@6.11.0) devDependencies: '@types/lodash-es': specifier: ^4.17.12 @@ -2980,8 +2980,8 @@ packages: peerDependencies: starknet: ^6.7.0 - starknetkit@2.2.23: - resolution: {integrity: sha512-cAf8Hf2Q3HTIy0g+PeRihXO2EVKFeJsVYwWd7XSt1xF4xHJcG5mb86mdfoV7Z9POILuy38CPNvUAc48BmFPfHA==} + starknetkit@2.2.24: + resolution: {integrity: sha512-4L80RCdq6AUnwUVeMA7x2XdOdZsmRFL2rgnmRPM6Thn5wFKhO+5M7O4vUwfUPJmAvGqY1ix59Lb94xub0Oc7bQ==} peerDependencies: starknet: ^6.9.0 @@ -7040,7 +7040,7 @@ snapshots: - uWebSockets.js - utf-8-validate - starknetkit@2.2.23(starknet@6.11.0): + starknetkit@2.2.24(starknet@6.11.0): dependencies: '@starknet-io/get-starknet': 4.0.0 '@starknet-io/get-starknet-core': 4.0.0 diff --git a/src/app/withStarknetReactNext/page.tsx b/src/app/withStarknetReactNext/page.tsx index e1c24e4..1580b04 100644 --- a/src/app/withStarknetReactNext/page.tsx +++ b/src/app/withStarknetReactNext/page.tsx @@ -3,6 +3,7 @@ import { AccountSection } from "@/components/AccountSection" import { SignMessageWithStarknetReactNext } from "@/components/Actions/SignMessageWithStarknetReactNext" import { TransferWithStarknetReactNext } from "@/components/Actions/TransferWithStarknetReactNext" +import { WalletRpcMsgContainerWithStarknetReactNext } from "@/components/Actions/WalletRpcMsgContainer" import { DisconnectButton } from "@/components/DisconnectButton" import { Section } from "@/components/Section" import { ConnectStarknetReactNext } from "@/components/connect/ConnectStarknetReactNext" @@ -72,6 +73,9 @@ const StarknetReactDappContent = () => { */} +
+ +
)} diff --git a/src/components/Actions/WalletRpcMessageReactNext.tsx b/src/components/Actions/WalletRpcMessageReactNext.tsx new file mode 100644 index 0000000..14ae2ed --- /dev/null +++ b/src/components/Actions/WalletRpcMessageReactNext.tsx @@ -0,0 +1,86 @@ +import { + Button, + Flex, + Modal, + ModalBody, + ModalCloseButton, + ModalContent, + ModalFooter, + ModalHeader, + ModalOverlay, + Tooltip, + useDisclosure, +} from "@chakra-ui/react" +import { RpcMessage } from "@starknet-io/types-js" +import { useState } from "react" +import { useWalletRequest } from "starknet-react-core-next" + +type Props = { + type: RpcMessage["type"] + symbol?: string + params?: RpcMessage["params"] + tip?: string +} + +export function WalletRpcMessageReactNext({ + type, + symbol, + params, + tip, +}: Props) { + const { isOpen, onOpen, onClose } = useDisclosure() + const [response, setResponse] = useState("N/A") + + const walletRequest = useWalletRequest({ + type, + params, + }) + + return ( + <> + + + + + + + + + + + Message sent to Wallet. + + + + Message : {type}
+ Param : {params ? JSON.stringify(params) : "N/A"}
+ Response : {response} +
+ + + + +
+
+
+ + ) +} diff --git a/src/components/Actions/WalletRpcMsgContainer.tsx b/src/components/Actions/WalletRpcMsgContainer.tsx index 61c4e70..2e7704b 100644 --- a/src/components/Actions/WalletRpcMsgContainer.tsx +++ b/src/components/Actions/WalletRpcMsgContainer.tsx @@ -3,6 +3,33 @@ import { WalletRpcMessage } from "./WalletRpcMessage" import { constants } from "starknet" import { RpcMessage } from "@/types/RpcMessage" import { StarknetWindowObject } from "starknetkit-next" +import { useWalletRequest } from "starknet-react-core-next" +import { WalletRpcMessageReactNext } from "./WalletRpcMessageReactNext" + +export const WalletRpcMsgContainerWithStarknetReactNext = () => { + return ( + <> + Wallet RPC + + + + + + + ) +} export function WalletRpcMsgContainer({ wallet,