Options
All
  • Public
  • Public/Protected
  • All
Menu

A public key

Hierarchy

  • Struct
    • PublicKey

Index

Constructors

constructor

  • new PublicKey(value: PublicKeyInitData): PublicKey
  • Create a new PublicKey object

    Parameters

    • value: PublicKeyInitData

      ed25519 public key as buffer or base-58 encoded string

    Returns PublicKey

Properties

Static default

default: PublicKey

Default public key value. (All zeros)

Methods

encode

  • encode(): Buffer
  • Returns Buffer

equals

  • Checks if two publicKeys are equal

    Parameters

    Returns boolean

toBase58

  • toBase58(): string
  • Return the base-58 representation of the public key

    Returns string

toBuffer

  • toBuffer(): Buffer
  • Return the Buffer representation of the public key

    Returns Buffer

toBytes

  • toBytes(): Uint8Array
  • Return the byte array representation of the public key

    Returns Uint8Array

toJSON

  • toJSON(): string
  • Returns string

toString

  • toString(): string
  • Return the base-58 representation of the public key

    Returns string

Static createProgramAddress

  • createProgramAddress(seeds: (Uint8Array | Buffer)[], programId: PublicKey): Promise<PublicKey>
  • Async version of createProgramAddressSync For backwards compatibility

    Parameters

    • seeds: (Uint8Array | Buffer)[]
    • programId: PublicKey

    Returns Promise<PublicKey>

Static createProgramAddressSync

  • Derive a program address from seeds and a program ID.

    Parameters

    • seeds: (Uint8Array | Buffer)[]
    • programId: PublicKey

    Returns PublicKey

Static createWithSeed

  • Derive a public key from another key, a seed, and a program ID. The program ID will also serve as the owner of the public key, giving it permission to write data to the account.

    Parameters

    Returns Promise<PublicKey>

Static decode

  • decode(data: Buffer): any
  • Parameters

    • data: Buffer

    Returns any

Static decodeUnchecked

  • decodeUnchecked(data: Buffer): any
  • Parameters

    • data: Buffer

    Returns any

Static findProgramAddress

  • findProgramAddress(seeds: (Uint8Array | Buffer)[], programId: PublicKey): Promise<[PublicKey, number]>
  • Async version of findProgramAddressSync For backwards compatibility

    Parameters

    • seeds: (Uint8Array | Buffer)[]
    • programId: PublicKey

    Returns Promise<[PublicKey, number]>

Static findProgramAddressSync

  • findProgramAddressSync(seeds: (Uint8Array | Buffer)[], programId: PublicKey): [PublicKey, number]
  • Find a valid program address

    Valid program addresses must fall off the ed25519 curve. This function iterates a nonce until it finds one that when combined with the seeds results in a valid program address.

    Parameters

    • seeds: (Uint8Array | Buffer)[]
    • programId: PublicKey

    Returns [PublicKey, number]

Static isOnCurve

  • isOnCurve(pubkeyData: PublicKeyInitData): boolean
  • Check that a pubkey is on the ed25519 curve.

    Parameters

    • pubkeyData: PublicKeyInitData

    Returns boolean

Generated using TypeDoc