ERC1155Supply totalSupply weird value

:1234: Code to reproduce

From React + MetaMask calling totalSupply(1) for ERC1151Supply contract:
let contract = new web3.eth.Contract(abi, contractAddress)
let totalSupply = await contract.methods.totalSupply(1).encodeABI()

The value I get is '0xbd85b0390000000000000000000000000000000000000000000000000000000000000001'

Is that a normal return value? I'm expecting to see a number < 100.

:computer: Environment

I also tested in Remix and Truffle and got similar values

The value you're seeing is the calldata that encodes the function call totalSupply(1). The bd85b039 bytes at the beginning are the function selector.

This is not the return value of the function. Instead of encodeABI you need to use call:

let totalSupply = await contract.methods.totalSupply(1).call()

Thanks @frangio! Can you explain the difference, when to use call vs encodeABI ?

encodeABI just gives you a "description" of the function call, the operation is entirely local to your computer. You can submit this description to a node through call in order to get back the result.