Skip to content

invalid arrayify value when providing bytes argument to safeTransferFrom(address,address,uint256,bytes) #239

Open
@kombos

Description

@kombos

I'm trying to call safeTransferFrom(address,address,uint256,bytes) and providing the bytes argument, as the arrayify of my incentiveID (0xec26bf83e88de4eb86c7c98329701993a4692ba8e5410a0eaa5d2ecabe0a8167) like this, using ethers.js:

const { config } = usePrepareContractWrite({
    address: "0xC36442b4a4522E871399CD717aBDD847Ab11FE88",
    abi: nonFungiblePositionManagerABI,
    functionName: "safeTransferFrom(address,address,uint256,bytes)",
    args: [
     "0xae6094170ABC0601b4bbe933D04368cD407C186a",
      "0xe34139463bA50bD61336E0c446Bd8C0867c6fE65",
      444932,
      ethers.utils.arrayify(
        "0xec26bf83e88de4eb86c7c98329701993a4692ba8e5410a0eaa5d2ecabe0a8167"
      ),
    ],
  });

This is throwing the following error:

Error: invalid arrayify value (argument="value", value={"0":236,"1":38,"2":191,"3":131,"4":232,"5":141,"6":228,"7":235,"8":134,"9":199,"10":201,"11":131,"12":41,"13":112,"14":25,"15":147,"16":164,"17":105,"18":43,"19":168,"20":229,"21":65,"22":10,"23":14,"24":170,"25":93,"26":46,"27":202,"28":190,"29":10,"30":129,"31":103}, code=INVALID_ARGUMENT, version=bytes/5.7.0)
    at Logger.makeError (index.js:231:23)
    at Logger.throwError (index.js:240:20)
    at Logger.throwArgumentError (index.js:243:21)
    at arrayify (index.js:111:19)
    at BytesCoder.encode (bytes.js:19:79)
    at eval (array.js:59:19)
    at Array.forEach (<anonymous>)
    at pack (array.js:53:12)
    at TupleCoder.encode (tuple.js:57:60)
    at AbiCoder.encode (abi-coder.js:106:15)
    at Interface._encodeParams (interface.js:273:31)
    at Interface.encodeFunctionData (interface.js:315:18)
    at eval (index.js:141:41)
    at Generator.next (<anonymous>)
    at fulfilled (index.js:21:58)

is this the correct way to populate the bytes argument or something wrong with ethers.js itself ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions