encodeErc1155SingleDeposit
Encodes an ERC-1155 single deposit payload as the ERC-1155 single portal does. This is the inverse of decodeErc1155SingleDeposit, useful for testing.
Usage
import { } from "@cartesi/codec";
const = ({
: "0x67742ff5b2b762503ff0a92738c6fc2ea4a4d182",
: "0x92cc14432c1f82622493abd64d99ea8a3000a7c7",
: 42n,
: 7n,
: "0x",
: "0xdeadbeef",
});Parameters
A Erc1155SingleDeposit object:
token(Address): token contract.sender(Address): token sender.tokenId(bigint): identifier of the token being transferred.value(bigint): transfer amount.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) ‖ tokenId (32 bytes) ‖ value (32 bytes) ‖ abi.encode(baseLayerData, execLayerData).
Returns a Hex string by default, or a Uint8Array when to is "bytes".