encodeVoucher
Encodes a voucher as a Voucher call of the rollups contracts Outputs interface.
Usage
import { } from "@cartesi/codec";
const = ({
: "0x0000000000000000000000000000000000000001",
: 2n,
: "0xdeadbeef",
});
// "0x237a816f..."Parameters
destination(Address): address of the contract to be called.value(bigint): amount of Wei to be passed along the call.payload(Hex | Uint8Array): calldata of the call.
And an optional second parameter:
to("hex" | "bytes", optional): representation of the encoded data. Defaults to"hex".
Return Type
Hex | Uint8Array: ABI-encoded output data, starting with the Voucher function selector (0x237a816f).
Returns a Hex string by default, or a Uint8Array when to is "bytes".