({})
- const [currentTokenId, setCurrentTokenId] = useState(123)
-
- const { gasLimit, gasFee } = useGasFee()
-
- const { data: contractList } = useSWR(nftTokenListUrl(branchName), url => {
- return scrollRequest(url)
- .then((data: any) => {
- setContract(data.tokens[0])
-
- return data.tokens
- })
- .catch(() => {
- // setFetchTokenListError("Fail to fetch token list")
- // setTokenSymbol(ETH_SYMBOL)
- return []
- })
- })
-
- const tokenInstance = useMemo(() => {
- const signer = provider?.getSigner(0)
- if (contract?.type === TOEKN_TYPE[721] && checkConnectedChainId(ChainId.SCROLL_LAYER_1)) {
- return new ethers.Contract(L1_721, L1_ERC721, signer)
- } else if (contract?.type === TOEKN_TYPE[721] && checkConnectedChainId(ChainId.SCROLL_LAYER_2)) {
- return new ethers.Contract(L2_721, L2_ERC721, signer)
- } else if (contract?.type === TOEKN_TYPE[1155] && checkConnectedChainId(ChainId.SCROLL_LAYER_1)) {
- return new ethers.Contract(L1_1155, L1_ERC1155, signer)
- } else if (contract?.type === TOEKN_TYPE[1155] && checkConnectedChainId(ChainId.SCROLL_LAYER_2)) {
- return new ethers.Contract(L2_1155, L2_ERC1155, signer)
- }
- return {}
- }, [provider, checkConnectedChainId, contract?.type])
-
- const getOwnedL1_721Nfts = async () => {
- console.log("getOwnedNfts", walletCurrentAddress)
- const count = await tokenInstance["balanceOf(address)"](walletCurrentAddress)
- console.log(count.toNumber(), "count")
- for (let i = 0; i < count.toNumber(); i++) {
- const tokenId = await tokenInstance["tokenOfOwnerByIndex(address,uint256)"](walletCurrentAddress, i)
- const tokenURI = await tokenInstance["tokenURI(uint256)"](tokenId)
- console.log(tokenId, tokenURI)
- }
- }
-
- const getOwnedL2_721Nfts = async () => {
- console.log("getOwnedNfts")
- const count = await tokenInstance["balanceOf(address)"](walletCurrentAddress)
- console.log(count.toNumber(), "count")
- for (let i = 0; i < count.toNumber(); i++) {
- const tokenId = await tokenInstance["tokenOfOwnerByIndex(address,uint256)"](walletCurrentAddress, i)
- const tokenURI = await tokenInstance["tokenURI(uint256)"](tokenId)
- console.log(tokenId.toNumber(), tokenURI)
- }
- }
-
- const getTokenURI = async () => {
- const uri = await tokenInstance["tokenURI(uint256)"](currentTokenId)
- console.log(uri, "isOwner")
-
- // const isOwner = await tokenInstance["ownerOf(uint256)"](currentTokenId)
- // console.log(isOwner, "isOwner")
- }
-
- const get1155TokenURI = async () => {
- const uri = await tokenInstance["uri(uint256)"](currentTokenId)
- console.log(uri, "uri")
- }
-
- const get1155Balance = async () => {
- const amount = await tokenInstance["balanceOf(address,uint256)"](walletCurrentAddress, currentTokenId)
- console.log(amount.toNumber(), "amount")
- }
- const setTokenURI = async () => {
- await tokenInstance["setTokenURI(uint256,string)"](
- currentTokenId,
- // "https://ipfs.io/ipfs/bafybeiezeds576kygarlq672cnjtimbsrspx5b3tr3gct2lhqud6abjgiu",
- "Dummy ERC1155",
- )
- }
-
- const approveDeposit = async () => {
- const gateway = contract.type === "ERC721" ? GATEWAY_721_L1 : GATEWAY_1155_L1
- const result = await setApproval(tokenInstance, gateway)
- console.log("approve success", result)
- }
-
- const deposite = () => {
- if (contract.type === "ERC721") {
- deposite721()
- } else if (contract.type === "ERC1155") {
- deposite1155()
- }
- }
-
- const deposite721 = async () => {
- const tx = await networksAndSigners[ChainId.SCROLL_LAYER_1].gateway_721["batchDepositERC721(address,address,uint256[],uint256)"](
- L1_721,
- walletCurrentAddress,
- [currentTokenId],
- 0,
- )
- const txResult = await tx.wait()
- console.log(txResult)
- }
-
- const deposite1155 = async () => {
- const tx = await networksAndSigners[ChainId.SCROLL_LAYER_1].gateway_1155["batchDepositERC1155(address,address,uint256[],uint256[],uint256)"](
- L1_1155,
- walletCurrentAddress,
- [123],
- [1],
- 0,
- )
- const txResult = await tx.wait()
- console.log(txResult)
- }
-
- const approveWithdraw = async () => {
- const gateway = contract.type === "ERC721" ? GATEWAY_721_L2 : GATEWAY_1155_L2
- const result = await setApproval(tokenInstance, gateway)
- console.log("approve withdraw success", result)
- }
-
- const withdraw = () => {
- if (contract.type === "ERC721") {
- withdraw721()
- } else if (contract.type === "ERC1155") {
- withdraw1155()
- }
- }
-
- const withdraw721 = async () => {
- const tx = await networksAndSigners[ChainId.SCROLL_LAYER_2].gateway_721["batchWithdrawERC721(address,address,uint256[],uint256)"](
- L2_721,
- walletCurrentAddress,
- [currentTokenId],
- gasLimit,
- { value: gasFee },
- )
- const txResult = await tx.wait()
- console.log(txResult)
- }
-
- const withdraw1155 = async () => {
- const tx = await networksAndSigners[ChainId.SCROLL_LAYER_2].gateway_1155["batchWithdrawERC1155(address,address,uint256[],uint256[],uint256)"](
- L2_1155,
- walletCurrentAddress,
- [currentTokenId],
- [1],
- gasLimit,
- { value: gasFee },
- )
- const txResult = await tx.wait()
- console.log(txResult)
- }
-
- const handleEnsureToken = async () => {
- let uri
- if (contract?.type === 721) {
- uri = await tokenInstance["tokenURI(uint256)"](currentTokenId)
- } else {
- uri = await tokenInstance["uri(uint256)"](currentTokenId)
- }
- console.log(uri, "uri")
- // scrollRequest(uri).then(data => {
- // addViewingList({ id: currentTokenId, ...data })
- // })
- }
-
- const handleChangeContract = value => {
- console.log(value, "value")
- setContract(value)
- }
-
- // const checkContrantType = async () => {
- // const signer = provider?.getSigner(0)
- // const instance = new ethers.Contract(contract.address, L1_ERC721, signer)
- // const isERC721 = await instance["supportsInterface(bytes4)"]("0x80ac58cd")
- // const isERC1155 = await instance["supportsInterface(bytes4)"]("0xd9b67a26")
- // if (isERC721) {
- // console.log("721")
- // } else if (isERC1155) {
- // console.log("1155")
- // } else {
- // console.log("no")
- // }
- // }
-
- const handleCheckApproval = async () => {
- if (tokenInstance) {
- const gateway = contract.type === TOEKN_TYPE[721] ? GATEWAY_721_L2 : GATEWAY_1155_L2
- const isApproved = await checkApproval(tokenInstance, gateway)
- console.log(isApproved, "isApproved")
- }
- }
-
- return (
-
-
-
- {checkConnectedChainId(ChainId.SCROLL_LAYER_1) ? (
-
-
-
-
-
-
- ) : (
-
-
-
-
-
-
-
- )}
-
-
- {/* */}
-
-
-
- )
-}
-
-export default SelectPanel
diff --git a/src/pages/nftBridge/RencentTx/index.tsx b/src/pages/nftBridge/RencentTx/index.tsx
deleted file mode 100644
index ffc0af364..000000000
--- a/src/pages/nftBridge/RencentTx/index.tsx
+++ /dev/null
@@ -1,48 +0,0 @@
-import { makeStyles } from "tss-react/mui"
-
-import { Button } from "@mui/material"
-
-import useBridgeStore from "@/stores/bridgeStore"
-import useTxStore from "@/stores/txStore"
-
-import TxTable from "../components/TxTable"
-
-const useStyles = makeStyles()(theme => ({
- wrapper: {
- width: "max-content",
- margin: "6.4rem auto 0",
- textAlign: "center",
- [theme.breakpoints.down("sm")]: {
- padding: "0 1.6rem",
- width: "100%",
- },
- },
- button: {
- width: "28.2rem",
- marginTop: "4rem",
- [theme.breakpoints.down("sm")]: {
- width: "100%",
- },
- },
-}))
-
-const RencentTx = (props: any) => {
- const { transactions } = useTxStore()
- const { changeRecentTxVisible } = useBridgeStore()
-
- const { classes } = useStyles()
-
- const handleGoBridge = () => {
- changeRecentTxVisible(false)
- }
- return (
-
-
-
-
- )
-}
-
-export default RencentTx
diff --git a/src/pages/nftBridge/components/LargeTextField/index.tsx b/src/pages/nftBridge/components/LargeTextField/index.tsx
index da429cdde..7cb03a0a2 100644
--- a/src/pages/nftBridge/components/LargeTextField/index.tsx
+++ b/src/pages/nftBridge/components/LargeTextField/index.tsx
@@ -1,7 +1,7 @@
import { FC, ReactNode } from "react"
import { makeStyles } from "tss-react/mui"
-import MuiTextField, { TextFieldProps } from "@mui/material/TextField"
+import MuiTextField, { StandardTextFieldProps } from "@mui/material/TextField"
type LargeTextFieldProps = {
units?: string | ReactNode
@@ -9,7 +9,7 @@ type LargeTextFieldProps = {
leftAlign?: boolean | undefined
defaultShadow?: boolean | undefined
smallFontSize?: boolean
-} & TextFieldProps
+} & StandardTextFieldProps
const useStyles = makeStyles()(theme => {
return {