• Serializes any value of packable type to its optimized binary representation identical to the one used by PACK and UNPACK Michelson instructions. Without a type definition (not recommended) the data will be encoded as a binary form of a generic Michelson expression. Type definition allows some types like timestamp and address and other base58 representable types to be encoded to corresponding optimized binary forms borrowed from the Tezos protocol

    const data: MichelsonData = {
    string: "KT1RvkwF4F7pz1gCoxkyZrG1RkrxQy3gmFTv%foo"
    };

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

    const packed = packData(data, typ);

    // 050a0000001901be41ee922ddd2cf33201e49d32da0afec571dce300666f6f

    Without a type definition the base58 encoded address will be treated as a string

    const data: MichelsonData = {
    string: "KT1RvkwF4F7pz1gCoxkyZrG1RkrxQy3gmFTv%foo"
    };

    const packed = packData(data);

    // 0501000000284b543152766b7746344637707a3167436f786b795a724731526b7278517933676d46547625666f6f

    Parameters

    Returns number[]

    Binary representation as numeric array