From 4f77fe6eaae8a94bb8d843ba753d3b396187cba4 Mon Sep 17 00:00:00 2001 From: Jacob Homanics Date: Sat, 18 May 2024 03:07:23 -0500 Subject: [PATCH] latest --- .../collections/[network]/[address]/page.tsx | 2 +- .../components/scaffold-nft/nft/Nft.tsx | 16 +- .../nextjs/hooks/scaffold-nft/erc1155Abi.json | 772 ++++++++++++------ .../nextjs/hooks/scaffold-nft/useTokens.ts | 16 +- .../types/scaffold-nft/ScaffoldToken.ts | 2 + packages/nextjs/types/scaffold-nft/Types.ts | 3 +- 6 files changed, 553 insertions(+), 258 deletions(-) diff --git a/packages/nextjs/app/collections/[network]/[address]/page.tsx b/packages/nextjs/app/collections/[network]/[address]/page.tsx index 05e76b4..50e5611 100644 --- a/packages/nextjs/app/collections/[network]/[address]/page.tsx +++ b/packages/nextjs/app/collections/[network]/[address]/page.tsx @@ -49,7 +49,7 @@ export default function CollectionPage({ params }: { params: { network: string; collection={collection} isLoading={isLoading} isError={isError} - renderOrder={["balanceOf", "Image", "Token Id", "Name", "Description", "Attributes"]} + renderOrder={["Balance", "Image", "Token Id", "Name", "Description", "Type", "Attributes"]} /> ); diff --git a/packages/nextjs/components/scaffold-nft/nft/Nft.tsx b/packages/nextjs/components/scaffold-nft/nft/Nft.tsx index 8234e82..d100279 100644 --- a/packages/nextjs/components/scaffold-nft/nft/Nft.tsx +++ b/packages/nextjs/components/scaffold-nft/nft/Nft.tsx @@ -61,9 +61,21 @@ export const Nft = ({ ); } - console.log(token); + if (renderOrder[i] === "Type") { + let i = ""; + + if (token?.tokenType === 0) { + i += "Transferable"; + } else if (token?.tokenType === 1) { + i += "Soulbound"; + } else if (token?.tokenType === 2) { + i += "Redeemable"; + } + + selectedElement = ; + } - if (renderOrder[i] === "balanceOf") { + if (renderOrder[i] === "Balance") { selectedElement = ( ); diff --git a/packages/nextjs/hooks/scaffold-nft/erc1155Abi.json b/packages/nextjs/hooks/scaffold-nft/erc1155Abi.json index a4d8e9c..1503f17 100644 --- a/packages/nextjs/hooks/scaffold-nft/erc1155Abi.json +++ b/packages/nextjs/hooks/scaffold-nft/erc1155Abi.json @@ -1,314 +1,584 @@ [ { - "anonymous": false, + "type": "constructor", "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "approved", - "type": "bool" - } + { "name": "newOwner", "type": "address", "internalType": "address" }, + { "name": "admins", "type": "address[]", "internalType": "address[]" } ], - "name": "ApprovalForAll", - "type": "event" + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "DEFAULT_ADMIN_ROLE", + "inputs": [], + "outputs": [{ "name": "", "type": "bytes32", "internalType": "bytes32" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "MINTER_ROLE", + "inputs": [], + "outputs": [{ "name": "", "type": "bytes32", "internalType": "bytes32" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "TOKEN_MIGRATOR_ROLE", + "inputs": [], + "outputs": [{ "name": "", "type": "bytes32", "internalType": "bytes32" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "TOKEN_UPDATER_ROLE", + "inputs": [], + "outputs": [{ "name": "", "type": "bytes32", "internalType": "bytes32" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "TOKEN_URI_SETTER_ROLE", + "inputs": [], + "outputs": [{ "name": "", "type": "bytes32", "internalType": "bytes32" }], + "stateMutability": "view" }, { - "anonymous": false, + "type": "function", + "name": "balanceOf", "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256[]", - "name": "ids", - "type": "uint256[]" - }, - { - "indexed": false, - "internalType": "uint256[]", - "name": "values", - "type": "uint256[]" - } + { "name": "account", "type": "address", "internalType": "address" }, + { "name": "id", "type": "uint256", "internalType": "uint256" } ], - "name": "TransferBatch", - "type": "event" + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" }, { - "anonymous": false, + "type": "function", + "name": "balanceOfBatch", "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "id", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } + { "name": "accounts", "type": "address[]", "internalType": "address[]" }, + { "name": "ids", "type": "uint256[]", "internalType": "uint256[]" } ], - "name": "TransferSingle", - "type": "event" + "outputs": [{ "name": "", "type": "uint256[]", "internalType": "uint256[]" }], + "stateMutability": "view" }, { - "anonymous": false, + "type": "function", + "name": "burnedBalanceOf", "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "value", - "type": "string" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "id", - "type": "uint256" - } + { "name": "addr", "type": "address", "internalType": "address" }, + { "name": "tokenId", "type": "uint256", "internalType": "uint256" } ], - "name": "URI", - "type": "event" + "outputs": [{ "name": "burnedBalance", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" }, { + "type": "function", + "name": "distributableBalanceOf", "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "id", - "type": "uint256" - } + { "name": "addr", "type": "address", "internalType": "address" }, + { "name": "tokenId", "type": "uint256", "internalType": "uint256" } ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } + "outputs": [{ "name": "distributableBalance", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "distribute", + "inputs": [ + { "name": "from", "type": "address", "internalType": "address" }, + { "name": "to", "type": "address", "internalType": "address" }, + { "name": "id", "type": "uint256", "internalType": "uint256" }, + { "name": "value", "type": "uint256", "internalType": "uint256" }, + { "name": "data", "type": "bytes", "internalType": "bytes" } ], - "stateMutability": "view", - "type": "function" + "outputs": [], + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "distributeBatch", "inputs": [ - { - "internalType": "address[]", - "name": "accounts", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "ids", - "type": "uint256[]" - } + { "name": "from", "type": "address", "internalType": "address" }, + { "name": "to", "type": "address", "internalType": "address" }, + { "name": "ids", "type": "uint256[]", "internalType": "uint256[]" }, + { "name": "values", "type": "uint256[]", "internalType": "uint256[]" }, + { "name": "data", "type": "bytes", "internalType": "bytes" } ], - "name": "balanceOfBatch", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "getRoleAdmin", + "inputs": [{ "name": "role", "type": "bytes32", "internalType": "bytes32" }], + "outputs": [{ "name": "", "type": "bytes32", "internalType": "bytes32" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getTokenType", + "inputs": [{ "name": "id", "type": "uint256", "internalType": "uint256" }], + "outputs": [{ "name": "", "type": "uint8", "internalType": "enum IReputationTokensTypes.TokenType" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "grantRole", + "inputs": [ + { "name": "role", "type": "bytes32", "internalType": "bytes32" }, + { "name": "account", "type": "address", "internalType": "address" } ], - "stateMutability": "view", - "type": "function" + "outputs": [], + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "hasRole", "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "operator", - "type": "address" - } + { "name": "role", "type": "bytes32", "internalType": "bytes32" }, + { "name": "account", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "honestBalanceOf", + "inputs": [ + { "name": "addr", "type": "address", "internalType": "address" }, + { "name": "tokenId", "type": "uint256", "internalType": "uint256" } ], + "outputs": [{ "name": "transferrableBalance", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", "name": "isApprovedForAll", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } + "inputs": [ + { "name": "account", "type": "address", "internalType": "address" }, + { "name": "operator", "type": "address", "internalType": "address" } ], - "stateMutability": "view", - "type": "function" + "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], + "stateMutability": "view" }, { + "type": "function", + "name": "migrate", "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256[]", - "name": "ids", - "type": "uint256[]" - }, - { - "internalType": "uint256[]", - "name": "amounts", - "type": "uint256[]" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } + { "name": "from", "type": "address", "internalType": "address" }, + { "name": "to", "type": "address", "internalType": "address" }, + { "name": "id", "type": "uint256", "internalType": "uint256" }, + { "name": "value", "type": "uint256", "internalType": "uint256" }, + { "name": "data", "type": "bytes", "internalType": "bytes" } ], - "name": "safeBatchTransferFrom", "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "migrateBatch", "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "id", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } + { "name": "from", "type": "address", "internalType": "address" }, + { "name": "to", "type": "address", "internalType": "address" }, + { "name": "ids", "type": "uint256[]", "internalType": "uint256[]" }, + { "name": "values", "type": "uint256[]", "internalType": "uint256[]" }, + { "name": "data", "type": "bytes", "internalType": "bytes" } ], - "name": "safeTransferFrom", "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "mint", "inputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "internalType": "bool", - "name": "approved", - "type": "bool" - } + { "name": "to", "type": "address", "internalType": "address" }, + { "name": "id", "type": "uint256", "internalType": "uint256" }, + { "name": "value", "type": "uint256", "internalType": "uint256" }, + { "name": "data", "type": "bytes", "internalType": "bytes" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "mintBatch", + "inputs": [ + { "name": "to", "type": "address", "internalType": "address" }, + { "name": "ids", "type": "uint256[]", "internalType": "uint256[]" }, + { "name": "values", "type": "uint256[]", "internalType": "uint256[]" }, + { "name": "data", "type": "bytes", "internalType": "bytes" } ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "owner", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { "type": "function", "name": "renounceOwnership", "inputs": [], "outputs": [], "stateMutability": "nonpayable" }, + { + "type": "function", + "name": "renounceRole", + "inputs": [ + { "name": "role", "type": "bytes32", "internalType": "bytes32" }, + { "name": "callerConfirmation", "type": "address", "internalType": "address" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "revokeRole", + "inputs": [ + { "name": "role", "type": "bytes32", "internalType": "bytes32" }, + { "name": "account", "type": "address", "internalType": "address" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "safeBatchTransferFrom", + "inputs": [ + { "name": "from", "type": "address", "internalType": "address" }, + { "name": "to", "type": "address", "internalType": "address" }, + { "name": "ids", "type": "uint256[]", "internalType": "uint256[]" }, + { "name": "values", "type": "uint256[]", "internalType": "uint256[]" }, + { "name": "data", "type": "bytes", "internalType": "bytes" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "safeTransferFrom", + "inputs": [ + { "name": "from", "type": "address", "internalType": "address" }, + { "name": "to", "type": "address", "internalType": "address" }, + { "name": "id", "type": "uint256", "internalType": "uint256" }, + { "name": "value", "type": "uint256", "internalType": "uint256" }, + { "name": "data", "type": "bytes", "internalType": "bytes" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", "name": "setApprovalForAll", + "inputs": [ + { "name": "operator", "type": "address", "internalType": "address" }, + { "name": "approved", "type": "bool", "internalType": "bool" } + ], "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "setBatchTokenURI", "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } + { "name": "tokenIds", "type": "uint256[]", "internalType": "uint256[]" }, + { "name": "tokenURIs", "type": "string[]", "internalType": "string[]" } ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setTokenURI", + "inputs": [ + { "name": "tokenId", "type": "uint256", "internalType": "uint256" }, + { "name": "tokenURI", "type": "string", "internalType": "string" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } + "inputs": [{ "name": "interfaceId", "type": "bytes4", "internalType": "bytes4" }], + "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "transferOwnership", + "inputs": [{ "name": "newOwner", "type": "address", "internalType": "address" }], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "updateToken", + "inputs": [ + { "name": "id", "type": "uint256", "internalType": "uint256" }, + { "name": "tokenType", "type": "uint8", "internalType": "enum IReputationTokensTypes.TokenType" } ], - "stateMutability": "view", - "type": "function" + "outputs": [], + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "updateTokenBatch", "inputs": [ - { - "internalType": "uint256", - "name": "id", - "type": "uint256" - } + { "name": "ids", "type": "uint256[]", "internalType": "uint256[]" }, + { "name": "tokenTypes", "type": "uint8[]", "internalType": "enum IReputationTokensTypes.TokenType[]" } ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", "name": "uri", - "outputs": [ + "inputs": [{ "name": "tokenId", "type": "uint256", "internalType": "uint256" }], + "outputs": [{ "name": "", "type": "string", "internalType": "string" }], + "stateMutability": "view" + }, + { + "type": "event", + "name": "ApprovalForAll", + "inputs": [ + { "name": "account", "type": "address", "indexed": true, "internalType": "address" }, + { "name": "operator", "type": "address", "indexed": true, "internalType": "address" }, + { "name": "approved", "type": "bool", "indexed": false, "internalType": "bool" } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Create", + "inputs": [{ "name": "tokenId", "type": "uint256", "indexed": true, "internalType": "uint256" }], + "anonymous": false + }, + { + "type": "event", + "name": "Distribute", + "inputs": [ + { "name": "from", "type": "address", "indexed": true, "internalType": "address" }, + { "name": "to", "type": "address", "indexed": true, "internalType": "address" }, + { "name": "tokenId", "type": "uint256", "indexed": false, "internalType": "uint256" }, + { "name": "value", "type": "uint256", "indexed": false, "internalType": "uint256" } + ], + "anonymous": false + }, + { + "type": "event", + "name": "DistributeBatch", + "inputs": [ + { "name": "from", "type": "address", "indexed": true, "internalType": "address" }, + { "name": "to", "type": "address", "indexed": true, "internalType": "address" }, + { "name": "tokenId", "type": "uint256[]", "indexed": false, "internalType": "uint256[]" }, + { "name": "value", "type": "uint256[]", "indexed": false, "internalType": "uint256[]" } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Migrate", + "inputs": [ + { "name": "from", "type": "address", "indexed": true, "internalType": "address" }, + { "name": "to", "type": "address", "indexed": true, "internalType": "address" }, + { "name": "id", "type": "uint256", "indexed": false, "internalType": "uint256" }, + { "name": "value", "type": "uint256", "indexed": false, "internalType": "uint256" } + ], + "anonymous": false + }, + { + "type": "event", + "name": "MigrateBatch", + "inputs": [ + { "name": "from", "type": "address", "indexed": true, "internalType": "address" }, + { "name": "to", "type": "address", "indexed": true, "internalType": "address" }, + { "name": "ids", "type": "uint256[]", "indexed": false, "internalType": "uint256[]" }, + { "name": "values", "type": "uint256[]", "indexed": false, "internalType": "uint256[]" } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Mint", + "inputs": [ + { "name": "from", "type": "address", "indexed": true, "internalType": "address" }, + { "name": "to", "type": "address", "indexed": true, "internalType": "address" }, + { "name": "tokenId", "type": "uint256", "indexed": false, "internalType": "uint256" }, + { "name": "value", "type": "uint256", "indexed": false, "internalType": "uint256" } + ], + "anonymous": false + }, + { + "type": "event", + "name": "MintBatch", + "inputs": [ + { "name": "from", "type": "address", "indexed": true, "internalType": "address" }, + { "name": "to", "type": "address", "indexed": true, "internalType": "address" }, + { "name": "tokenIds", "type": "uint256[]", "indexed": false, "internalType": "uint256[]" }, + { "name": "values", "type": "uint256[]", "indexed": false, "internalType": "uint256[]" } + ], + "anonymous": false + }, + { + "type": "event", + "name": "OwnershipTransferred", + "inputs": [ + { "name": "previousOwner", "type": "address", "indexed": true, "internalType": "address" }, + { "name": "newOwner", "type": "address", "indexed": true, "internalType": "address" } + ], + "anonymous": false + }, + { + "type": "event", + "name": "RoleAdminChanged", + "inputs": [ + { "name": "role", "type": "bytes32", "indexed": true, "internalType": "bytes32" }, + { "name": "previousAdminRole", "type": "bytes32", "indexed": true, "internalType": "bytes32" }, + { "name": "newAdminRole", "type": "bytes32", "indexed": true, "internalType": "bytes32" } + ], + "anonymous": false + }, + { + "type": "event", + "name": "RoleGranted", + "inputs": [ + { "name": "role", "type": "bytes32", "indexed": true, "internalType": "bytes32" }, + { "name": "account", "type": "address", "indexed": true, "internalType": "address" }, + { "name": "sender", "type": "address", "indexed": true, "internalType": "address" } + ], + "anonymous": false + }, + { + "type": "event", + "name": "RoleRevoked", + "inputs": [ + { "name": "role", "type": "bytes32", "indexed": true, "internalType": "bytes32" }, + { "name": "account", "type": "address", "indexed": true, "internalType": "address" }, + { "name": "sender", "type": "address", "indexed": true, "internalType": "address" } + ], + "anonymous": false + }, + { + "type": "event", + "name": "TransferBatch", + "inputs": [ + { "name": "operator", "type": "address", "indexed": true, "internalType": "address" }, + { "name": "from", "type": "address", "indexed": true, "internalType": "address" }, + { "name": "to", "type": "address", "indexed": true, "internalType": "address" }, + { "name": "ids", "type": "uint256[]", "indexed": false, "internalType": "uint256[]" }, + { "name": "values", "type": "uint256[]", "indexed": false, "internalType": "uint256[]" } + ], + "anonymous": false + }, + { + "type": "event", + "name": "TransferSingle", + "inputs": [ + { "name": "operator", "type": "address", "indexed": true, "internalType": "address" }, + { "name": "from", "type": "address", "indexed": true, "internalType": "address" }, + { "name": "to", "type": "address", "indexed": true, "internalType": "address" }, + { "name": "id", "type": "uint256", "indexed": false, "internalType": "uint256" }, + { "name": "value", "type": "uint256", "indexed": false, "internalType": "uint256" } + ], + "anonymous": false + }, + { + "type": "event", + "name": "URI", + "inputs": [ + { "name": "value", "type": "string", "indexed": false, "internalType": "string" }, + { "name": "id", "type": "uint256", "indexed": true, "internalType": "uint256" } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Update", + "inputs": [ + { "name": "tokenId", "type": "uint256", "indexed": true, "internalType": "uint256" }, + { "name": "tokenType", "type": "uint8", "indexed": true, "internalType": "enum IReputationTokensTypes.TokenType" } + ], + "anonymous": false + }, + { + "type": "event", + "name": "UpdateBatch", + "inputs": [ + { "name": "tokenId", "type": "uint256[]", "indexed": true, "internalType": "uint256[]" }, { - "internalType": "string", - "name": "", - "type": "string" + "name": "tokenType", + "type": "uint8[]", + "indexed": true, + "internalType": "enum IReputationTokensTypes.TokenType[]" } ], - "stateMutability": "view", - "type": "function" - } + "anonymous": false + }, + { "type": "error", "name": "AccessControlBadConfirmation", "inputs": [] }, + { + "type": "error", + "name": "AccessControlUnauthorizedAccount", + "inputs": [ + { "name": "account", "type": "address", "internalType": "address" }, + { "name": "neededRole", "type": "bytes32", "internalType": "bytes32" } + ] + }, + { + "type": "error", + "name": "ERC1155InsufficientBalance", + "inputs": [ + { "name": "sender", "type": "address", "internalType": "address" }, + { "name": "balance", "type": "uint256", "internalType": "uint256" }, + { "name": "needed", "type": "uint256", "internalType": "uint256" }, + { "name": "tokenId", "type": "uint256", "internalType": "uint256" } + ] + }, + { + "type": "error", + "name": "ERC1155InvalidApprover", + "inputs": [{ "name": "approver", "type": "address", "internalType": "address" }] + }, + { + "type": "error", + "name": "ERC1155InvalidArrayLength", + "inputs": [ + { "name": "idsLength", "type": "uint256", "internalType": "uint256" }, + { "name": "valuesLength", "type": "uint256", "internalType": "uint256" } + ] + }, + { + "type": "error", + "name": "ERC1155InvalidOperator", + "inputs": [{ "name": "operator", "type": "address", "internalType": "address" }] + }, + { + "type": "error", + "name": "ERC1155InvalidReceiver", + "inputs": [{ "name": "receiver", "type": "address", "internalType": "address" }] + }, + { + "type": "error", + "name": "ERC1155InvalidSender", + "inputs": [{ "name": "sender", "type": "address", "internalType": "address" }] + }, + { + "type": "error", + "name": "ERC1155MissingApprovalForAll", + "inputs": [ + { "name": "operator", "type": "address", "internalType": "address" }, + { "name": "owner", "type": "address", "internalType": "address" } + ] + }, + { + "type": "error", + "name": "OwnableInvalidOwner", + "inputs": [{ "name": "owner", "type": "address", "internalType": "address" }] + }, + { + "type": "error", + "name": "OwnableUnauthorizedAccount", + "inputs": [{ "name": "account", "type": "address", "internalType": "address" }] + }, + { "type": "error", "name": "ReputationTokens__CannotTransferSoulboundToken", "inputs": [] }, + { "type": "error", "name": "ReputationTokens__InsufficientBalance", "inputs": [] } ] diff --git a/packages/nextjs/hooks/scaffold-nft/useTokens.ts b/packages/nextjs/hooks/scaffold-nft/useTokens.ts index 5d5e883..8cfe4fa 100644 --- a/packages/nextjs/hooks/scaffold-nft/useTokens.ts +++ b/packages/nextjs/hooks/scaffold-nft/useTokens.ts @@ -131,11 +131,20 @@ export const useTokens = ( args: [userAddress, tokenIds[i]], }); } catch (e) { - console.log("NYEUH22222"); - console.log(userAddress); + console.log(e); + } + + let tokenType; + try { + tokenType = await publicClient?.readContract({ + address, + abi: erc1155Abi, + functionName: "getTokenType", + args: [tokenIds[i]], + }); + } catch (e) { console.log(e); - console.log("NYEUH"); } const token = {} as any; @@ -144,6 +153,7 @@ export const useTokens = ( token.id = tokenIds[i]; token.balanceOf = balanceOf; token.uri = tokenURIFormatted; + token.tokenType = tokenType; // token.collectionName = collectionName; // token.collectionSymbol = collectionSymbol; arr.push(token); diff --git a/packages/nextjs/types/scaffold-nft/ScaffoldToken.ts b/packages/nextjs/types/scaffold-nft/ScaffoldToken.ts index f51eada..ea95ceb 100644 --- a/packages/nextjs/types/scaffold-nft/ScaffoldToken.ts +++ b/packages/nextjs/types/scaffold-nft/ScaffoldToken.ts @@ -5,6 +5,8 @@ export type ScaffoldToken = { id?: bigint; uri?: string; balanceOf?: bigint; + tokenType?: any; + metadata?: { name?: string; description?: string; diff --git a/packages/nextjs/types/scaffold-nft/Types.ts b/packages/nextjs/types/scaffold-nft/Types.ts index 07ea1ac..ab190f6 100644 --- a/packages/nextjs/types/scaffold-nft/Types.ts +++ b/packages/nextjs/types/scaffold-nft/Types.ts @@ -8,7 +8,8 @@ export type Style = "rounded" | "straight"; export type Size = "base"; export type RenderableTypes = - | "balanceOf" + | "Type" + | "Balance" | "Image" | "Token Id" | "Name"