diff --git a/packages/nextjs/app/enterpreneur/create/page.tsx b/packages/nextjs/app/enterpreneur/create/page.tsx index 957227f..4092d18 100644 --- a/packages/nextjs/app/enterpreneur/create/page.tsx +++ b/packages/nextjs/app/enterpreneur/create/page.tsx @@ -9,6 +9,9 @@ import { Typography } from "@mui/material"; import { Card } from "~~/components/Card"; import { CardList } from "~~/components/CardList"; import DividerWithText from "~~/components/DividerWithText"; +import { useAccount } from "wagmi"; +import { useERC721List } from "~~/hooks/scaffold-eth/useERC721List"; +import Button from "@mui/material/Button"; // タブの種類を表すユニオン型を定義 type TabType = "割引券" | "引換券" | "会員券"; @@ -24,41 +27,24 @@ const content = { export default function TicketTabs() { const [value, setValue] = useState("割引券"); + const { address } = useAccount(); + const { vouchers } = useERC721List(address || ''); + const handleChange = (event: React.SyntheticEvent, newValue: number) => { const tabLabels: TabType[] = ["割引券", "引換券", "会員券"]; setValue(tabLabels[newValue]); }; - const cards = [ - { - title: "引換券", - issueDate: "2024.12.05", - amount: 7000, - expiryDate: "2025.06.30", - usageScope: "店舗全体", - }, - { - title: "引換券", - issueDate: "2024.12.05", - amount: 7000, - expiryDate: "2025.06.30", - usageScope: "店舗全体", - }, - { - title: "引換券", - issueDate: "2024.12.05", - amount: 7000, - expiryDate: "2025.06.30", - usageScope: "店舗全体", - }, - { - title: "引換券", - issueDate: "2024.12.05", - amount: 7000, - expiryDate: "2025.06.30", - usageScope: "店舗全体", - }, - ]; + const cards = vouchers?.map((voucher) => { + const amount = voucher.amount; + return { + title: voucher.title, + issueDate: voucher.issueDate.toString(), + amount: Number(amount), + expiryDate: voucher.expiryDate.toString(), + usageScope: voucher.usageScope, + }; + }) || []; return (
@@ -72,6 +58,17 @@ export default function TicketTabs() { +
); } diff --git a/packages/nextjs/app/user/list/page.tsx b/packages/nextjs/app/user/list/page.tsx index effee4a..b2e260b 100644 --- a/packages/nextjs/app/user/list/page.tsx +++ b/packages/nextjs/app/user/list/page.tsx @@ -1,5 +1,6 @@ 'use client'; +import { Button, Typography } from '@mui/material'; import type { NextPage } from 'next'; import { useAccount } from 'wagmi'; import { CardList } from '~~/components/CardList'; @@ -21,7 +22,24 @@ const UserListPage: NextPage = () => { }) || []; - return ; + return ( +
+ + 取得クーポン一覧 + + + +
) ; }; export default UserListPage; diff --git a/packages/nextjs/components/ScaffoldEthAppWithProviders.tsx b/packages/nextjs/components/ScaffoldEthAppWithProviders.tsx index 22da3c6..0e88f73 100644 --- a/packages/nextjs/components/ScaffoldEthAppWithProviders.tsx +++ b/packages/nextjs/components/ScaffoldEthAppWithProviders.tsx @@ -21,7 +21,7 @@ const ScaffoldEthApp = ({ children }: { children: React.ReactNode }) => {
{children}
-
+ {/*
*/}
diff --git a/packages/nextjs/contracts/deployedContracts.ts b/packages/nextjs/contracts/deployedContracts.ts index bdeec41..d03b864 100644 --- a/packages/nextjs/contracts/deployedContracts.ts +++ b/packages/nextjs/contracts/deployedContracts.ts @@ -7,7 +7,7 @@ import { GenericContractsDeclaration } from "~~/utils/scaffold-eth/contract"; const deployedContracts = { 31337: { ExpirableERC721: { - address: "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707", + address: "0x5FbDB2315678afecb367f032d93F642f64180aa3", abi: [ { inputs: [ @@ -826,642 +826,6 @@ const deployedContracts = { transferOwnership: "@openzeppelin/contracts/access/Ownable.sol", }, }, - YourContract: { - address: "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0", - abi: [ - { - inputs: [ - { - internalType: "string", - name: "name", - type: "string", - }, - { - internalType: "string", - name: "symbol", - type: "string", - }, - { - internalType: "address", - name: "initialOwner", - type: "address", - }, - ], - stateMutability: "nonpayable", - type: "constructor", - }, - { - inputs: [ - { - internalType: "address", - name: "sender", - type: "address", - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - { - internalType: "address", - name: "owner", - type: "address", - }, - ], - name: "ERC721IncorrectOwner", - type: "error", - }, - { - inputs: [ - { - internalType: "address", - name: "operator", - type: "address", - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "ERC721InsufficientApproval", - type: "error", - }, - { - inputs: [ - { - internalType: "address", - name: "approver", - type: "address", - }, - ], - name: "ERC721InvalidApprover", - type: "error", - }, - { - inputs: [ - { - internalType: "address", - name: "operator", - type: "address", - }, - ], - name: "ERC721InvalidOperator", - type: "error", - }, - { - inputs: [ - { - internalType: "address", - name: "owner", - type: "address", - }, - ], - name: "ERC721InvalidOwner", - type: "error", - }, - { - inputs: [ - { - internalType: "address", - name: "receiver", - type: "address", - }, - ], - name: "ERC721InvalidReceiver", - type: "error", - }, - { - inputs: [ - { - internalType: "address", - name: "sender", - type: "address", - }, - ], - name: "ERC721InvalidSender", - type: "error", - }, - { - inputs: [ - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "ERC721NonexistentToken", - type: "error", - }, - { - inputs: [ - { - internalType: "address", - name: "owner", - type: "address", - }, - ], - name: "OwnableInvalidOwner", - type: "error", - }, - { - inputs: [ - { - internalType: "address", - name: "account", - type: "address", - }, - ], - name: "OwnableUnauthorizedAccount", - 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: "address", - name: "previousOwner", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "newOwner", - type: "address", - }, - ], - name: "OwnershipTransferred", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "to", - type: "address", - }, - { - indexed: true, - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - { - indexed: false, - internalType: "uint256", - name: "expirationTime", - type: "uint256", - }, - ], - name: "TokenMinted", - 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", - }, - { - inputs: [ - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "approve", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "owner", - type: "address", - }, - ], - name: "balanceOf", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "getApproved", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - 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: [ - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "isTokenExpired", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "numberOfTokens", - type: "uint256", - }, - { - internalType: "uint256[]", - name: "expirationTimes", - type: "uint256[]", - }, - ], - name: "mintBatch", - outputs: [], - stateMutability: "nonpayable", - 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: "renounceOwnership", - outputs: [], - stateMutability: "nonpayable", - 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: "nonpayable", - 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: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "operator", - type: "address", - }, - { - internalType: "bool", - name: "approved", - type: "bool", - }, - ], - name: "setApprovalForAll", - 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: "tokenExpiration", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - 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: "from", - type: "address", - }, - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "transferFrom", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "newOwner", - type: "address", - }, - ], - name: "transferOwnership", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - ], - inheritedFunctions: { - approve: "@openzeppelin/contracts/token/ERC721/ERC721.sol", - balanceOf: "@openzeppelin/contracts/token/ERC721/ERC721.sol", - getApproved: "@openzeppelin/contracts/token/ERC721/ERC721.sol", - isApprovedForAll: "@openzeppelin/contracts/token/ERC721/ERC721.sol", - name: "@openzeppelin/contracts/token/ERC721/ERC721.sol", - ownerOf: "@openzeppelin/contracts/token/ERC721/ERC721.sol", - safeTransferFrom: "@openzeppelin/contracts/token/ERC721/ERC721.sol", - setApprovalForAll: "@openzeppelin/contracts/token/ERC721/ERC721.sol", - supportsInterface: "@openzeppelin/contracts/token/ERC721/ERC721.sol", - symbol: "@openzeppelin/contracts/token/ERC721/ERC721.sol", - tokenURI: "@openzeppelin/contracts/token/ERC721/ERC721.sol", - transferFrom: "@openzeppelin/contracts/token/ERC721/ERC721.sol", - owner: "@openzeppelin/contracts/access/Ownable.sol", - renounceOwnership: "@openzeppelin/contracts/access/Ownable.sol", - transferOwnership: "@openzeppelin/contracts/access/Ownable.sol", - }, - }, }, } as const;