pubkey to check
true if compressed, otherwise false
import {isKeyCompressed} from "@caravan/bitcoin"
const uncompressed = "0487cb4929c287665fbda011b1afbebb0e691a5ee11ee9a561fcd6adba266afe03f7c55f784242305cfd8252076d038b0f3c92836754308d06b097d11e37bc0907"
const compressed = "0387cb4929c287665fbda011b1afbebb0e691a5ee11ee9a561fcd6adba266afe03"
console.log(isKeyCompressed(uncompressed)) // false
console.log(isKeyCompressed(compressed)) // true
Check if a given pubkey is compressed or not by checking its length and the possible prefixes