Skip to content

PublicKey.compress

Compresses a PublicKey.PublicKey.

Imports

Named
import { PublicKey } from 'ox'

Examples

import { PublicKey } from 'ox'
 
const publicKey = PublicKey.from({
  prefix: 4,
  x: 59295962801117472859457908919941473389380284132224861839820747729565200149877n,
  y: 24099691209996290925259367678540227198235484593389470330605641003500238088869n,
})
 
const compressed = PublicKey.compress(publicKey)
{
prefix: 3,
x: 59295962801117472859457908919941473389380284132224861839820747729565200149877n,
}

Definition

function compress(
  publicKey: PublicKey<false>,
): PublicKey<true>

Source: src/core/PublicKey.ts

Parameters

publicKey

  • Type: PublicKey<false>

The public key to compress.

publicKey.prefix

  • Type: numberType

publicKey.x

  • Type: bigintType

publicKey.y

  • Type: bigintType

Return Type

The compressed public key.

PublicKey<true>