const sender = Ethers.send("eth_requestAccounts", [])[0]; if (!sender) return "You need to login first"; const nftCollectionAddress = "0xE652f7eF26D4Ed34de2d83d4EEBf291BD60ed2AF"; const nftCollectionABI = [ { inputs: [ { internalType: "address", name: "_withdrawTarget", type: "address" }, { internalType: "address", name: "_royaltyReceiver", type: "address" }, { internalType: "uint96", name: "_royaltyNumerator", type: "uint96" }, ], stateMutability: "nonpayable", type: "constructor", }, { inputs: [], name: "ApprovalCallerNotOwnerNorApproved", type: "error" }, { inputs: [], name: "ApprovalQueryForNonexistentToken", type: "error" }, { inputs: [], name: "BalanceQueryForZeroAddress", type: "error" }, { inputs: [], name: "InvalidQueryRange", type: "error" }, { inputs: [], name: "MintERC2309QuantityExceedsLimit", type: "error" }, { inputs: [], name: "MintToZeroAddress", type: "error" }, { inputs: [], name: "MintZeroQuantity", type: "error" }, { inputs: [], name: "OwnerQueryForNonexistentToken", type: "error" }, { inputs: [], name: "OwnershipNotInitializedForExtraData", type: "error" }, { inputs: [], name: "TransferCallerNotOwnerNorApproved", type: "error" }, { inputs: [], name: "TransferFromIncorrectOwner", type: "error" }, { inputs: [], name: "TransferToNonERC721ReceiverImplementer", type: "error" }, { inputs: [], name: "TransferToZeroAddress", type: "error" }, { inputs: [], name: "URIQueryForNonexistentToken", type: "error" }, { anonymous: false, inputs: [ { indexed: true, internalType: "address", name: "owner", type: "address", }, { indexed: true, internalType: "address", name: "approved", type: "address", }, { indexed: true, internalType: "uint256", name: "tokenId", type: "uint256", }, ], name: "Approval", type: "event", }, { anonymous: false, inputs: [ { indexed: true, internalType: "address", name: "owner", type: "address", }, { indexed: true, internalType: "address", name: "operator", type: "address", }, { indexed: false, internalType: "bool", name: "approved", type: "bool" }, ], name: "ApprovalForAll", type: "event", }, { anonymous: false, inputs: [ { indexed: true, internalType: "uint256", name: "fromTokenId", type: "uint256", }, { indexed: false, internalType: "uint256", name: "toTokenId", type: "uint256", }, { indexed: true, internalType: "address", name: "from", type: "address" }, { indexed: true, internalType: "address", name: "to", type: "address" }, ], name: "ConsecutiveTransfer", type: "event", }, { anonymous: false, inputs: [ { indexed: true, internalType: "address", name: "previousOwner", type: "address", }, { indexed: true, internalType: "address", name: "newOwner", type: "address", }, ], name: "OwnershipTransferred", type: "event", }, { anonymous: false, inputs: [ { indexed: false, internalType: "address", name: "account", type: "address", }, ], name: "Paused", type: "event", }, { anonymous: false, inputs: [ { indexed: true, internalType: "address", name: "from", type: "address" }, { indexed: true, internalType: "address", name: "to", type: "address" }, { indexed: true, internalType: "uint256", name: "tokenId", type: "uint256", }, ], name: "Transfer", type: "event", }, { anonymous: false, inputs: [ { indexed: false, internalType: "address", name: "account", type: "address", }, ], name: "Unpaused", type: "event", }, { inputs: [], name: "MAX_NFTS", outputs: [{ internalType: "uint256", name: "", type: "uint256" }], stateMutability: "view", type: "function", }, { inputs: [ { internalType: "address", name: "to", type: "address" }, { internalType: "uint256", name: "tokenId", type: "uint256" }, ], name: "approve", outputs: [], stateMutability: "payable", type: "function", }, { inputs: [{ internalType: "address", name: "owner", type: "address" }], name: "balanceOf", outputs: [{ internalType: "uint256", name: "", type: "uint256" }], stateMutability: "view", type: "function", }, { inputs: [], name: "claimNative", outputs: [], stateMutability: "nonpayable", type: "function", }, { inputs: [{ internalType: "address", name: "_token", type: "address" }], name: "claimToken", outputs: [], stateMutability: "nonpayable", type: "function", }, { inputs: [{ internalType: "uint256", name: "tokenId", type: "uint256" }], name: "exists", outputs: [{ internalType: "bool", name: "", type: "bool" }], stateMutability: "view", type: "function", }, { inputs: [{ internalType: "uint256", name: "tokenId", type: "uint256" }], name: "explicitOwnershipOf", outputs: [ { components: [ { internalType: "address", name: "addr", type: "address" }, { internalType: "uint64", name: "startTimestamp", type: "uint64" }, { internalType: "bool", name: "burned", type: "bool" }, { internalType: "uint24", name: "extraData", type: "uint24" }, ], internalType: "struct IERC721A.TokenOwnership", name: "", type: "tuple", }, ], stateMutability: "view", type: "function", }, { inputs: [ { internalType: "uint256[]", name: "tokenIds", type: "uint256[]" }, ], name: "explicitOwnershipsOf", outputs: [ { components: [ { internalType: "address", name: "addr", type: "address" }, { internalType: "uint64", name: "startTimestamp", type: "uint64" }, { internalType: "bool", name: "burned", type: "bool" }, { internalType: "uint24", name: "extraData", type: "uint24" }, ], internalType: "struct IERC721A.TokenOwnership[]", name: "", type: "tuple[]", }, ], stateMutability: "view", type: "function", }, { inputs: [{ internalType: "uint256", name: "tokenId", type: "uint256" }], name: "getApproved", outputs: [{ internalType: "address", name: "", type: "address" }], stateMutability: "view", type: "function", }, { inputs: [], name: "isAllowlistSaleOpen", outputs: [{ internalType: "bool", name: "", type: "bool" }], stateMutability: "view", type: "function", }, { inputs: [ { internalType: "address", name: "owner", type: "address" }, { internalType: "address", name: "operator", type: "address" }, ], name: "isApprovedForAll", outputs: [{ internalType: "bool", name: "", type: "bool" }], stateMutability: "view", type: "function", }, { inputs: [], name: "isPublicSaleOpen", outputs: [{ internalType: "bool", name: "", type: "bool" }], stateMutability: "view", type: "function", }, { inputs: [ { internalType: "address", name: "target", type: "address" }, { internalType: "uint256", name: "quantity", type: "uint256" }, { internalType: "bytes32[]", name: "proof", type: "bytes32[]" }, ], name: "mintAllowlist", outputs: [], stateMutability: "payable", type: "function", }, { inputs: [], name: "mintLimitAllowlist", outputs: [{ internalType: "uint256", name: "", type: "uint256" }], stateMutability: "view", type: "function", }, { inputs: [], name: "mintLimitPublic", outputs: [{ internalType: "uint256", name: "", type: "uint256" }], stateMutability: "view", type: "function", }, { inputs: [ { internalType: "address", name: "target", type: "address" }, { internalType: "uint256", name: "quantity", type: "uint256" }, ], name: "mintOwner", outputs: [], stateMutability: "nonpayable", type: "function", }, { inputs: [], name: "mintPriceAllowlist", outputs: [{ internalType: "uint256", name: "", type: "uint256" }], stateMutability: "view", type: "function", }, { inputs: [], name: "mintPricePublic", outputs: [{ internalType: "uint256", name: "", type: "uint256" }], stateMutability: "view", type: "function", }, { inputs: [ { internalType: "address", name: "target", type: "address" }, { internalType: "uint256", name: "quantity", type: "uint256" }, ], name: "mintPublic", outputs: [], stateMutability: "payable", type: "function", }, { inputs: [], name: "mintTimestampAllowlist", outputs: [{ internalType: "uint256", name: "", type: "uint256" }], stateMutability: "view", type: "function", }, { inputs: [], name: "mintTimestampPublic", outputs: [{ internalType: "uint256", name: "", type: "uint256" }], stateMutability: "view", type: "function", }, { inputs: [{ internalType: "address", name: "", type: "address" }], name: "mintedDuringAllowlistSale", outputs: [{ internalType: "uint256", name: "", type: "uint256" }], stateMutability: "view", type: "function", }, { inputs: [{ internalType: "address", name: "", type: "address" }], name: "mintedDuringPublicSale", outputs: [{ internalType: "uint256", name: "", type: "uint256" }], stateMutability: "view", type: "function", }, { inputs: [], name: "name", outputs: [{ internalType: "string", name: "", type: "string" }], stateMutability: "view", type: "function", }, { inputs: [], name: "owner", outputs: [{ internalType: "address", name: "", type: "address" }], stateMutability: "view", type: "function", }, { inputs: [{ internalType: "uint256", name: "tokenId", type: "uint256" }], name: "ownerOf", outputs: [{ internalType: "address", name: "", type: "address" }], stateMutability: "view", type: "function", }, { inputs: [], name: "paused", outputs: [{ internalType: "bool", name: "", type: "bool" }], stateMutability: "view", type: "function", }, { inputs: [], name: "renounceOwnership", outputs: [], stateMutability: "nonpayable", type: "function", }, { inputs: [ { internalType: "uint256", name: "_tokenId", type: "uint256" }, { internalType: "uint256", name: "_salePrice", type: "uint256" }, ], name: "royaltyInfo", outputs: [ { internalType: "address", name: "", type: "address" }, { internalType: "uint256", name: "", type: "uint256" }, ], stateMutability: "view", type: "function", }, { inputs: [ { internalType: "address", name: "from", type: "address" }, { internalType: "address", name: "to", type: "address" }, { internalType: "uint256", name: "tokenId", type: "uint256" }, ], name: "safeTransferFrom", outputs: [], stateMutability: "payable", type: "function", }, { inputs: [ { internalType: "address", name: "from", type: "address" }, { internalType: "address", name: "to", type: "address" }, { internalType: "uint256", name: "tokenId", type: "uint256" }, { internalType: "bytes", name: "_data", type: "bytes" }, ], name: "safeTransferFrom", outputs: [], stateMutability: "payable", type: "function", }, { inputs: [ { internalType: "address", name: "operator", type: "address" }, { internalType: "bool", name: "approved", type: "bool" }, ], name: "setApprovalForAll", outputs: [], stateMutability: "nonpayable", type: "function", }, { inputs: [{ internalType: "string", name: "_newBaseURI", type: "string" }], name: "setBaseURI", outputs: [], stateMutability: "nonpayable", type: "function", }, { inputs: [ { internalType: "address", name: "_receiver", type: "address" }, { internalType: "uint96", name: "_feeNumerator", type: "uint96" }, ], name: "setDefaultRoyalty", outputs: [], stateMutability: "nonpayable", type: "function", }, { inputs: [ { internalType: "bytes32", name: "_newMerkleRoot", type: "bytes32" }, ], name: "setMerkleRoot", outputs: [], stateMutability: "nonpayable", type: "function", }, { inputs: [ { internalType: "uint256", name: "_public", type: "uint256" }, { internalType: "uint256", name: "_allowlist", type: "uint256" }, ], name: "setMintingLimits", outputs: [], stateMutability: "nonpayable", type: "function", }, { inputs: [ { internalType: "uint256", name: "_public", type: "uint256" }, { internalType: "uint256", name: "_allowlist", type: "uint256" }, ], name: "setMintingPrice", outputs: [], stateMutability: "nonpayable", type: "function", }, { inputs: [ { internalType: "uint256", name: "_public", type: "uint256" }, { internalType: "uint256", name: "_allowlist", type: "uint256" }, ], name: "setMintingTime", outputs: [], stateMutability: "nonpayable", type: "function", }, { inputs: [{ internalType: "bool", name: "pause", type: "bool" }], name: "setPaused", outputs: [], stateMutability: "nonpayable", type: "function", }, { inputs: [ { internalType: "address", name: "_newWithdrawTarget", type: "address" }, ], name: "setWithdrawTarget", outputs: [], stateMutability: "nonpayable", type: "function", }, { inputs: [{ internalType: "bytes4", name: "interfaceId", type: "bytes4" }], name: "supportsInterface", outputs: [{ internalType: "bool", name: "", type: "bool" }], stateMutability: "view", type: "function", }, { inputs: [], name: "symbol", outputs: [{ internalType: "string", name: "", type: "string" }], stateMutability: "view", type: "function", }, { inputs: [{ internalType: "uint256", name: "tokenId", type: "uint256" }], name: "tokenURI", outputs: [{ internalType: "string", name: "", type: "string" }], stateMutability: "view", type: "function", }, { inputs: [{ internalType: "address", name: "owner", type: "address" }], name: "tokensOfOwner", outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], stateMutability: "view", type: "function", }, { inputs: [ { internalType: "address", name: "owner", type: "address" }, { internalType: "uint256", name: "start", type: "uint256" }, { internalType: "uint256", name: "stop", type: "uint256" }, ], name: "tokensOfOwnerIn", outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], stateMutability: "view", type: "function", }, { inputs: [], name: "totalSupply", outputs: [{ internalType: "uint256", name: "", type: "uint256" }], stateMutability: "view", type: "function", }, { inputs: [ { internalType: "address", name: "from", type: "address" }, { internalType: "address", name: "to", type: "address" }, { internalType: "uint256", name: "tokenId", type: "uint256" }, ], name: "transferFrom", outputs: [], stateMutability: "payable", type: "function", }, { inputs: [{ internalType: "address", name: "newOwner", type: "address" }], name: "transferOwnership", outputs: [], stateMutability: "nonpayable", type: "function", }, ]; const getNftContract = async () => { const signer = Ethers.provider().getSigner(); const nftContract = new ethers.Contract(address, contractAbi.abi, signer); console.log(nftContract); }; return ( <div> <h1>NFT Gateway</h1> <p>You are logged in as : {sender}</p> <button onClick={getNftContract}>Get Contract</button> </div> );