Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Erc721Standard - Deploy a NFT #97

Open
RegisGraptin opened this issue Mar 17, 2023 · 1 comment
Open

[BUG] Erc721Standard - Deploy a NFT #97

RegisGraptin opened this issue Mar 17, 2023 · 1 comment
Labels
bug Something isn't working needs-bounty needs-fix Bug is valid and needs fixing

Comments

@RegisGraptin
Copy link

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

@RegisGraptin RegisGraptin added the bug Something isn't working label Mar 17, 2023
@RegisGraptin
Copy link
Author

Fix: Missing the default value: "0x0"

receipt = await myNFT.mint('0x39E9617bE6003897a04B6Eb1512e3b40A53E785A', 1, "0x0");

@moshmage moshmage added needs-fix Bug is valid and needs fixing needs-bounty labels Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-bounty needs-fix Bug is valid and needs fixing
Projects
None yet
Development

No branches or pull requests

2 participants