From 35c517a7b8fba344fd6e178a3ac0a6d340c6de1a Mon Sep 17 00:00:00 2001 From: zhen <770226915@qq.com> Date: Thu, 12 Sep 2024 23:02:15 +0800 Subject: [PATCH] chore --- .../components/{ => scaffold-eth}/Address.vue | 0 .../components/{ => scaffold-eth}/Balance.vue | 0 .../{ => scaffold-eth}/BlockieAvatar.vue | 0 .../{ => scaffold-eth}/FaucetButton.vue | 0 .../{ => scaffold-eth}/WalletConnect.vue | 0 .../scaffold-eth/debug/DebugContracts.vue | 19 + nuxt/contracts/deployedContracts.ts | 706 ++++++++++++++++++ nuxt/contracts/externalContracts.ts | 16 + nuxt/nuxt.config.ts | 9 +- nuxt/pages/debug/index.vue | 1 + nuxt/utils/scaffold-eth/contract.ts | 309 +++++++- nuxt/utils/scaffold-eth/contractsData.ts | 7 + package.json | 3 + .../hardhat/contracts/YourCollectible.sol | 67 ++ .../hardhat/deploy/01_deploy_your_contract.ts | 43 ++ packages/hardhat/deploy/99_generateTsAbis.ts | 3 +- .../nextjs/contracts/deployedContracts.ts | 553 +++++++++++++- pnpm-lock.yaml | 456 +++++------ 18 files changed, 1935 insertions(+), 257 deletions(-) rename nuxt/components/{ => scaffold-eth}/Address.vue (100%) rename nuxt/components/{ => scaffold-eth}/Balance.vue (100%) rename nuxt/components/{ => scaffold-eth}/BlockieAvatar.vue (100%) rename nuxt/components/{ => scaffold-eth}/FaucetButton.vue (100%) rename nuxt/components/{ => scaffold-eth}/WalletConnect.vue (100%) create mode 100644 nuxt/components/scaffold-eth/debug/DebugContracts.vue create mode 100644 nuxt/contracts/deployedContracts.ts create mode 100644 nuxt/contracts/externalContracts.ts create mode 100644 nuxt/utils/scaffold-eth/contractsData.ts create mode 100644 packages/hardhat/contracts/YourCollectible.sol create mode 100644 packages/hardhat/deploy/01_deploy_your_contract.ts diff --git a/nuxt/components/Address.vue b/nuxt/components/scaffold-eth/Address.vue similarity index 100% rename from nuxt/components/Address.vue rename to nuxt/components/scaffold-eth/Address.vue diff --git a/nuxt/components/Balance.vue b/nuxt/components/scaffold-eth/Balance.vue similarity index 100% rename from nuxt/components/Balance.vue rename to nuxt/components/scaffold-eth/Balance.vue diff --git a/nuxt/components/BlockieAvatar.vue b/nuxt/components/scaffold-eth/BlockieAvatar.vue similarity index 100% rename from nuxt/components/BlockieAvatar.vue rename to nuxt/components/scaffold-eth/BlockieAvatar.vue diff --git a/nuxt/components/FaucetButton.vue b/nuxt/components/scaffold-eth/FaucetButton.vue similarity index 100% rename from nuxt/components/FaucetButton.vue rename to nuxt/components/scaffold-eth/FaucetButton.vue diff --git a/nuxt/components/WalletConnect.vue b/nuxt/components/scaffold-eth/WalletConnect.vue similarity index 100% rename from nuxt/components/WalletConnect.vue rename to nuxt/components/scaffold-eth/WalletConnect.vue diff --git a/nuxt/components/scaffold-eth/debug/DebugContracts.vue b/nuxt/components/scaffold-eth/debug/DebugContracts.vue new file mode 100644 index 0000000..9510d66 --- /dev/null +++ b/nuxt/components/scaffold-eth/debug/DebugContracts.vue @@ -0,0 +1,19 @@ + + + diff --git a/nuxt/contracts/deployedContracts.ts b/nuxt/contracts/deployedContracts.ts new file mode 100644 index 0000000..6fd43b0 --- /dev/null +++ b/nuxt/contracts/deployedContracts.ts @@ -0,0 +1,706 @@ +/** + * This file is autogenerated by Scaffold-ETH. + * You should not edit it manually or your changes might be overwritten. + */ +import type { GenericContractsDeclaration } from '~~/utils/scaffold-eth/contract' + +const deployedContracts = { + 31337: { + YourCollectible: { + address: '0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0', + abi: [ + { + inputs: [], + stateMutability: 'nonpayable', + type: 'constructor', + }, + { + 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: false, + internalType: 'uint256', + name: '_fromTokenId', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: '_toTokenId', + type: 'uint256', + }, + ], + name: 'BatchMetadataUpdate', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint256', + name: '_tokenId', + type: 'uint256', + }, + ], + name: 'MetadataUpdate', + 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: '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: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'string', + name: 'uri', + type: 'string', + }, + ], + name: 'mintItem', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + 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: 'index', + type: 'uint256', + }, + ], + name: 'tokenByIndex', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'tokenIdCounter', + outputs: [ + { + internalType: 'uint256', + name: '_value', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + internalType: 'uint256', + name: 'index', + type: 'uint256', + }, + ], + name: 'tokenOfOwnerByIndex', + 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: [], + 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: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'newOwner', + type: 'address', + }, + ], + name: 'transferOwnership', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + ], + inheritedFunctions: { + approve: + '@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol', + balanceOf: + '@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol', + getApproved: + '@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol', + isApprovedForAll: + '@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol', + name: '@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol', + ownerOf: + '@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol', + safeTransferFrom: + '@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol', + setApprovalForAll: + '@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol', + supportsInterface: + '@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol', + symbol: + '@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol', + tokenURI: + '@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol', + transferFrom: + '@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol', + tokenByIndex: + '@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol', + tokenOfOwnerByIndex: + '@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol', + totalSupply: + '@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol', + owner: '@openzeppelin/contracts/access/Ownable.sol', + renounceOwnership: '@openzeppelin/contracts/access/Ownable.sol', + transferOwnership: '@openzeppelin/contracts/access/Ownable.sol', + }, + }, + YourContract: { + address: '0x5FbDB2315678afecb367f032d93F642f64180aa3', + abi: [ + { + inputs: [ + { + internalType: 'address', + name: '_owner', + type: 'address', + }, + ], + stateMutability: 'nonpayable', + type: 'constructor', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'greetingSetter', + type: 'address', + }, + { + indexed: false, + internalType: 'string', + name: 'newGreeting', + type: 'string', + }, + { + indexed: false, + internalType: 'bool', + name: 'premium', + type: 'bool', + }, + { + indexed: false, + internalType: 'uint256', + name: 'value', + type: 'uint256', + }, + ], + name: 'GreetingChange', + type: 'event', + }, + { + inputs: [], + name: 'greeting', + outputs: [ + { + internalType: 'string', + name: '', + type: 'string', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'owner', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'premium', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'string', + name: '_newGreeting', + type: 'string', + }, + ], + name: 'setGreeting', + outputs: [], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [], + name: 'totalCounter', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + name: 'userGreetingCounter', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'withdraw', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + stateMutability: 'payable', + type: 'receive', + }, + ], + inheritedFunctions: {}, + }, + }, +} as const + +export default deployedContracts satisfies GenericContractsDeclaration diff --git a/nuxt/contracts/externalContracts.ts b/nuxt/contracts/externalContracts.ts new file mode 100644 index 0000000..48dc23e --- /dev/null +++ b/nuxt/contracts/externalContracts.ts @@ -0,0 +1,16 @@ +import type { GenericContractsDeclaration } from '~/utils/scaffold-eth/contract' + +/** + * @example + * const externalContracts = { + * 1: { + * DAI: { + * address: "0x...", + * abi: [...], + * }, + * }, + * } as const; + */ +const externalContracts = {} as const + +export default externalContracts satisfies GenericContractsDeclaration diff --git a/nuxt/nuxt.config.ts b/nuxt/nuxt.config.ts index 86979b0..83037cc 100644 --- a/nuxt/nuxt.config.ts +++ b/nuxt/nuxt.config.ts @@ -2,11 +2,9 @@ export default defineNuxtConfig({ compatibilityDate: '2024-04-03', devtools: { enabled: true }, - devServer: { port: 3001, }, - modules: [ '@wagmi/vue/nuxt', '@pinia/nuxt', @@ -41,4 +39,11 @@ export default defineNuxtConfig({ mode: 'svg', size: '1.5em', }, + components: [ + { + path: '~/components/scaffold-eth', + pathPrefix: false, + }, + '~/components', + ], }) diff --git a/nuxt/pages/debug/index.vue b/nuxt/pages/debug/index.vue index db29a85..f0c032a 100644 --- a/nuxt/pages/debug/index.vue +++ b/nuxt/pages/debug/index.vue @@ -6,6 +6,7 @@ useSeoMeta({