ERC1155 safeTransferFrom bytes argument

Hello,

I am trying to do an ERC1155 contract, when I try and use safeTransferFrom I get an error because I have no idea how to pass in the bytes argument. any ideas?

Also, is there a way to create a function that returns an array of tokens that a wallet holds?

:computer: Environment

:memo:Details

:1234: Code to reproduce

1 Like

Hi @mattarad,

Welcome to the community :wave:

You could try using the Create an ERC1155.
Using Truffle developer console I created a GameItems contract and did a safeTransferFrom and set the data value to 0x0.

truffle(develop)> item = await GameItems.new()
undefined
truffle(develop)> await item.safeTransferFrom(accounts[0], accounts[1], 2, 1, 0x0)

You could use balanceOf or balanceOfBatch, though rather than do this onchain, you could use a service like The Graph to get the tokens held by an address.