[BUG] Erc721Standard - Deploy a NFT
RegisGraptin opened this issue · 1 comments
Describe the bug
I try to implement the Erc721Standard documented in https://docs.dappkit.dev/start-building/how-to-guides/create-an-erc721
And I have an error occuring in the mint
function part. I think it something from the framework. Maybe something that I didn't defined or is missing.
Reproduction
Take the code example provided from the documentation.
I used the code below for testing different approaches and I have the same result from the code of the documentation.
Context: I try to create an NFT and send it to one user address. I test this on localy (with ganache) and on Goerli, and have the same result.
async function createEventTickets() {
let userAddress = "0x0xxx";
let privateKey = process.env.PRIVATE_KEY;
/* Deploying your NFT */
const deployer = new Erc721Standard({
web3Host: "http://127.0.0.1:7545",
privateKey: privateKey
});
await deployer.connection.start();
// await deployer.connection.connect();
await deployer.loadAbi();
let receipt;
receipt = await deployer.deployJsonAbi('My NFT Name', '$MyNftSymbol');
console.log('deployed!', receipt);
/* Using your NFT after deployment */
const myNFT = new Erc721Standard({
web3Host: "http://127.0.0.1:7545",
privateKey: privateKey
}, receipt.contractAddress);
await myNFT.connection.start();
await myNFT.loadAbi();
await myNFT.loadContract();
console.log("Before mint !")
receipt = await myNFT.mint('0x0xxx', 1);
console.log('Minted!', receipt);
}
Expected behavior
Create and mint a NFT.
Logs, screenshots
/home/rere/Documents/Project/ETHPorto/contract/node_modules/web3-eth-abi/lib/index.js:254
if (param.length % 2 === 1) {
^
TypeError: Cannot read property 'length' of undefined
at ABICoder.formatParam (/home/rere/Documents/Project/ETHPorto/contract/node_modules/web3-eth-abi/lib/index.js:254:19)
at /home/rere/Documents/Project/ETHPorto/contract/node_modules/web3-eth-abi/lib/index.js:99:22
at Array.map (<anonymous>)
at ABICoder.encodeParameters (/home/rere/Documents/Project/ETHPorto/contract/node_modules/web3-eth-abi/lib/index.js:93:21)
at /home/rere/Documents/Project/ETHPorto/contract/node_modules/web3-eth-contract/lib/index.js:463:20
at Array.map (<anonymous>)
at Object._encodeMethodABI (/home/rere/Documents/Project/ETHPorto/contract/node_modules/web3-eth-contract/lib/index.js:462:8)
at Erc721Standard.<anonymous> (/home/rere/Documents/Project/ETHPorto/contract/node_modules/@taikai/dappkit/dist/src/base/model.js:97:72)
at Generator.next (<anonymous>)
at /home/rere/Documents/Project/ETHPorto/contract/node_modules/@taikai/dappkit/dist/src/base/model.js:8:71
at new Promise (<anonymous>)
at __awaiter (/home/rere/Documents/Project/ETHPorto/contract/node_modules/@taikai/dappkit/dist/src/base/model.js:4:12)
at Erc721Standard.sendTx (/home/rere/Documents/Project/ETHPorto/contract/node_modules/@taikai/dappkit/dist/src/base/model.js:95:16)
at Erc721Standard.<anonymous> (/home/rere/Documents/Project/ETHPorto/contract/node_modules/@taikai/dappkit/dist/src/models/erc721-standard.js:39:25)
at Generator.next (<anonymous>)
at /home/rere/Documents/Project/ETHPorto/contract/node_modules/@taikai/dappkit/dist/src/models/erc721-standard.js:8:71
versions, packages, etc
node version: v16.0.0
Additional context
Fix: Missing the default value: "0x0"
receipt = await myNFT.mint('0x39E9617bE6003897a04B6Eb1512e3b40A53E785A', 1, "0x0");