```Error: invalid arrayify value``` passing an array of hashes as an argument in my constructor

I think am passing bytes32 array in the constructor, so I don’t understand why the error is there?

Am creating an NFT contract using the functionality in this repo https://github.com/austintgriffith/scaffold-eth/tree/buyer-mints-nft.
I have a script that uploads a json file with all the nft metadata to IPFS and returning the IPFS hashes for each NFT’s metadata in an uploaded.json file which has key value pair of IPFS hash to nft json file.
Then, in the deploy.js file am populating an array with the hashes from the uploaded.json file and passing that array as one of the arguments for my NFT contract’s constructor. And that is where am getting an error Error: invalid arrayify value .

:computer: Environment
Hardhat
Solidity 0.8.0
Node 14.16.1

:memo:Details
Here is my deploy js file

const main = async () => {
  console.log("\n\n 📡 Deploying...\n");
  // read in all the assets to get their IPFS hash...
  let uploadedAssets = JSON.parse(fs.readFileSync("./uploaded.json"))
  let bytes32Array = []
  for(let a in uploadedAssets){
    console.log(" 🏷 IPFS:",a)
    let bytes32 = utils.id(a)
    console.log(" #️⃣ hashed:",bytes32)
    bytes32Array.push(bytes32)
  }
  console.log(" \n")
  console.log(
    " 💾  Artifacts (address, abi, and args) saved to: ",
    chalk.blue("artifacts"),
    "\n\n"
  );
  const [deployer] = await ethers.getSigners();
  console.log(`Deploying contracts with the account: ${deployer.address}`);
  const balance = await deployer.getBalance();
  console.log(`Account balance: ${balance.toString()}`);
  const AdventureNFT = await ethers.getContractFactory('adventureNFT');
  const adventureNFT = await AdventureNFT.deploy([ bytes32Array ], CATNIP_ADDRESS);
  console.log(`AdventureNFT address: ${adventureNFT.address}`);
};
main()
  .then(() => process.exit(0))
  .catch((error) => {
    console.error(error);
    process.exit(1);
  });

and here is the console feedback when I run the script

 📡 Deploying...
 🏷 IPFS: Qme9T6kxqGE13fFLMN7o1gPXnojgktmDPENDphkHf5gMsn
 #️⃣ hashed: 0xd684e2e08b1f363176cb14405d8c1eefb7788c002ba583f1a838130956635ac8
 🏷 IPFS: QmToMnfPdtTDqjtJ2FjqPuPQtYQh7Ughq2ZCaJ8yj5B9qh
 #️⃣ hashed: 0xb46d21f480f9a029c3f0043b96b48b6352b52dfc282b8f7101aa684590ad9c52
 🏷 IPFS: QmTEQGEPggM5CXKnhqSwEyig2C2r4NtbTk6BqBthfDqn11
 #️⃣ hashed: 0x873000b60b392df07c7ac4cc870a98e616bb98a462288e8f00cf090f0ff81538
 🏷 IPFS: QmVJbUM3nftSWTvmwmqpNCswHsnqJ7oXwAm9erSHLLMwA9
 #️⃣ hashed: 0x8ad03ad905ab0cfc4f9443428f06fdab1f88beb1289a44b06ab9d20e0e272e14
 🏷 IPFS: QmZwLCzYR9aN4Urq9k7UtcEi7C4o22fhcFEyhGxxpPbe9C
 #️⃣ hashed: 0xd66e3f61a039ae45d14a09e9bec0a9cf135d3abaf56841f919fd0ecf0174ade1
 🏷 IPFS: QmNssM24YWndkbXdNQbFGnbyoK5DyWrpoRXdAZ1joGv3xT
 #️⃣ hashed: 0xfdb2d74c395c0d194bbf0833aad11db4f5ad57297435e0cc67ca6b5dd5c69272
 🏷 IPFS: QmRt3Se2vWwvhsEXdV8KKwpC5U2FuX5Zd4htBCTd7EpWrN
 #️⃣ hashed: 0x54be0683eef72e8de0727aa39dc705dc3d79a17e33ddf7f1c5fbba2f51d9cf30
 🏷 IPFS: QmfBe45wDzgA4G33U5ggz3X5fMPXgVuYSKtLr7BTE7N1E7
 #️⃣ hashed: 0xf86b5e05c97bbdaf6dfa8d263d14a89a43dde6cacdce3dc1fde91d2a965c05e8
 🏷 IPFS: QmWSBgXskKJuMuUCz9KtvUFvV1jVc97UKSFUX9XJfBoijS
 #️⃣ hashed: 0x996078a99a6cb246d022fc1431a4097d19eed7d35c3021eb0a6977f0f8ff9fb9
 🏷 IPFS: QmVYpLtUbSnXLtT7eSFjaPnifjPUVr9QaQNNbLYaYtYwrT
 #️⃣ hashed: 0x49fb56becbe9b75b5c814c73b24069faa8f249f0ee3bffd7556a4ad098da292a
 🏷 IPFS: QmeF1727dJwNKE66Y4baGtyk9dA6SdDXCc2SJCus2EVsAQ
 #️⃣ hashed: 0x68c31705f8079f8f452ae3330bf1d83ed511798387016c6150495a5dfbc7b428
 🏷 IPFS: QmSQ31Cn4nS2FwEDPMMs2pM682wZLosEkDTyWgjhYRcdgS
 #️⃣ hashed: 0x21a16f2de96aceaa51c3a08033cd6bca03049a97d0505c658cd4683b88dd36f1
 🏷 IPFS: QmTpuhVJKJWjaRbwUmhPhPj2i38y12MfgoQZ1yHtFJiq6p
 #️⃣ hashed: 0x82a20069f9e152645a8f42ff7d3d1e836746e2b09a8ceebac45e97ad31721f5b
 🏷 IPFS: QmUFExYWG6KkkgN7zvGoBWr97d1RRQeQGHG5Nx83mymCWS
 #️⃣ hashed: 0x0ec88a9a84cb83e6c0982198a336e18476a6bf38c33285a29f76aa5816621334
 🏷 IPFS: QmebbAqgcvM58jBPVdEsTqZjoMn7Njz8cJwPArgjbr9ghf
 #️⃣ hashed: 0x0ed4703ef08c57867cbfd8c44132214364b3efb6380c458ad47df5da193c6732
 🏷 IPFS: QmUjc4oorKhK3dRKQJQ7Rb3TQriLKA8rFJoURBf5N7NWk2
 #️⃣ hashed: 0x73806d087a4322f5f106028a9abe90d8da46af14c011232c59dbbc47578b5577
 🏷 IPFS: QmeMmdSgg5psqCfTxQmEtXkYKMqhTivxMNevFyfBbqY3Fp
 #️⃣ hashed: 0x4063329ebea8a15b235ecb4bc35f3a9ede08818cedf2c9aead7860c3c76f51db


 💾  Artifacts (address, abi, and args) saved to:  artifacts 


Deploying contracts with the account: 0x8C9ad9Ff0655Db057317FDd37B4aabcC5411E87D
Account balance: 1381184968600000000
Error: invalid arrayify value (argument="value", value=["0xd684e2e08b1f363176cb14405d8c1eefb7788c002ba583f1a838130956635ac8","0xb46d21f480f9a029c3f0043b96b48b6352b52dfc282b8f7101aa684590ad9c52","0x873000b60b392df07c7ac4cc870a98e616bb98a462288e8f00cf090f0ff81538","0x8ad03ad905ab0cfc4f9443428f06fdab1f88beb1289a44b06ab9d20e0e272e14","0xd66e3f61a039ae45d14a09e9bec0a9cf135d3abaf56841f919fd0ecf0174ade1","

:1234: Code to reproduce

2 Likes

Solved. By updating this line
const adventureNFT = await AdventureNFT.deploy(bytes32Array , CATNIP_ADDRESS);

2 Likes