encodeErc1155BatchDeposit
Encodes an ERC-1155 batch deposit payload as the ERC-1155 batch portal does. This is the inverse of decodeErc1155BatchDeposit, useful for testing.
Usage
import { } from "@cartesi/codec";
const = ({
: "0x67742ff5b2b762503ff0a92738c6fc2ea4a4d182",
: "0x92cc14432c1f82622493abd64d99ea8a3000a7c7",
: [1n, 2n, 3n],
: [100n, 200n, 300n],
: "0x",
: "0xdeadbeef",
});Parameters
A Erc1155BatchDeposit object:
token(Address): token contract.sender(Address): token sender.tokenIds(readonly bigint[]): identifiers of the tokens being transferred.values(readonly bigint[]): transfer amounts per token type.baseLayerData(Hex | Uint8Array): additional data to be interpreted by the base layer.execLayerData(Hex | Uint8Array): additional data to be interpreted by the execution layer.
And an optional second parameter:
to("hex" | "bytes", optional): representation of the encoded data. Defaults to"hex".
Return Type
Hex | Uint8Array: packed-encoded deposit payload, with layout token (20 bytes) ‖ sender (20 bytes) ‖ abi.encode(tokenIds, values, baseLayerData, execLayerData).
Returns a Hex string by default, or a Uint8Array when to is "bytes".