• Deserialize a byte array into the corresponding Michelson value. Without a type definition (not recommended) the binary data will be treated as a binary form of a generic Michelson expression and returned as is. Type definition allows some types like timestamp and address and other types usually encoded in optimized binary forms to be transformed back to their string representations like base58 and ISO timestamps.

    const src = [0x05, 0x00, 0xa7, 0xe8, 0xe4, 0xd8, 0x0b];

    const typ: MichelsonType = {
    prim: "timestamp"
    };

    const data = unpackData(src, typ);

    // { string: "2019-09-26T10:59:51Z" }

    Same binary data without a type definition

    const src = [0x05, 0x00, 0xa7, 0xe8, 0xe4, 0xd8, 0x0b];

    const data = unpackData(src);

    // { int: "1569495591" }

    Parameters

    • src: Uint8Array | number[]

      Byte array

    • Optionalt: MichelsonType

      Optional type definition

    Returns MichelsonData

    Deserialized data