Skip to content

PublicKey.from

Instantiates a typed PublicKey.PublicKey object from a PublicKey.PublicKey, Bytes.Bytes, or Hex.Hex.

Imports

Named
import { PublicKey } from 'ox'

Examples

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

From Serialized

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

Definition

function from<publicKey>(
  value: from.Value<publicKey>,
): from.ReturnType<publicKey>

Source: src/PublicKey.ts

Parameters

value

  • Type: from.Value<publicKey>

The public key value to instantiate.

value.prefix

  • Type: number
  • Optional

Return Type

The instantiated PublicKey.PublicKey.

from.ReturnType<publicKey>