/ERC721Demo

Primary LanguageTypeScript

ERC721 Demo

Introduction

此项目为一个ERC721 Demo项目,包含合约部分、部署部分以及交互部分,其中交互部分提供了基于hardhat、web3js、alchemySDK三种方式。

测试网采用sepolia

Usage

安装依赖

执行npm install

配置config.json

  • APIKey: 从alchemy中获取dapp的apikey
  • alchemyHTTPURL: 从alchemy中获取dapp的HTTP URL
  • privateKey: MetaMask钱包中的私钥
  • publicKey: MetaMask钱包中的公钥,同时也是钱包的地址
  • contractName: 要部署的合约名称
  • description: 对合约的介绍
  • limit: 铸造NFT的个数限制

命令

  • npm run compile: 编译合约
  • npm run deploy-sepolia: 将合约部署到sepolia测试网
  • npm run deploy-local: 将合约部署到本地测试网
  • npm run testnet: 开启本地测试网
  • npm run console: 启动连接本地测试网的交互命令行
  • npm run test: 运行测试脚本
  • npm run exec-local ./scripts/integrateByHardhat.ts: 在本地使用hardhat执行交互脚本
  • npm run exec-sepolia ./scripts/integrateByHardhat.ts: 在sepolia测试网使用hardhat执行交互脚本
  • npx ts-node ./scripts/<script-name>: 执行交互脚本
    • integrateByAlchemySDK.ts: 使用alchemy-sdk进行交互
    • integrateByWeb3.ts: 使用web3js进行交互