@aalu1418/sponsored-erc721 中文文档教程

发布于 4年前 浏览 22 项目主页 更新于 3年前

Sponsored ERC-721

与 Conflux 网络上赞助的 NFT 交互的包 要

Setup Instructions

npm install @aalu1418/sponsored-erc721

获得完整功能,请确保还部署此处描述的相应合约:https://github.com/Conflux-Network-Global/sponsored-erc721

Functionality

需要 .env工作目录中的文件。

PRIVATE_KEY=<conflux private key>

Commands

//initialize connection
//input: conflux network endpoint, NFT address
//output: nft object
const nft = new NFT("http://test.confluxrpc.org", "0x8aa092e0660c59eab456efdbd39ae8d158e9a95b");

//mint NFT to user address
//input: user address, NFT id
//output: conflux network transaction hash
const tx = await nft.mint("0x18e33e342b0f3fFE0b0193950FE9F2e0378a81Ee", 1);
console.log("Mint TX hash:", tx.transactionHash);

//get NFT assets for specific user address
//input: address
//output: array of NFT ids
const list = await nft.getAssets("0x18e33e342b0f3fFE0b0193950FE9F2e0378a81Ee")
console.log("Assets:", list);

Sponsored ERC-721

Package for interacting with sponsored NFTs on Conflux network

Setup Instructions

npm install @aalu1418/sponsored-erc721

For full functionality make sure to also deploy corresponding contracts described here: https://github.com/Conflux-Network-Global/sponsored-erc721

Functionality

Requires a .env file in the working directory.

PRIVATE_KEY=<conflux private key>

Commands

//initialize connection
//input: conflux network endpoint, NFT address
//output: nft object
const nft = new NFT("http://test.confluxrpc.org", "0x8aa092e0660c59eab456efdbd39ae8d158e9a95b");

//mint NFT to user address
//input: user address, NFT id
//output: conflux network transaction hash
const tx = await nft.mint("0x18e33e342b0f3fFE0b0193950FE9F2e0378a81Ee", 1);
console.log("Mint TX hash:", tx.transactionHash);

//get NFT assets for specific user address
//input: address
//output: array of NFT ids
const list = await nft.getAssets("0x18e33e342b0f3fFE0b0193950FE9F2e0378a81Ee")
console.log("Assets:", list);
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文