sortMapByKeyXdr

Sorts ScMap entries by lexicographic comparison of their keys' XDR byte representation.

Soroban mandates that ScMap keys are sorted lexicographically by their XDR-encoded bytes. This function takes a LinkedHashMap of ScVal entries and returns a new LinkedHashMap with entries sorted by their key's XDR encoding.

Return

A new LinkedHashMap with entries sorted by XDR-encoded key bytes

Parameters

map

The unsorted map of ScVal key-value pairs