Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PublicKey

A public key

Hierarchy

Index

Constructors

Properties

default: PublicKey = ...

Default public key value. (All zeros)

Methods

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

    Returns string

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

    Returns Uint8Array

  • toJSON(): string
  • toString(): string
  • createProgramAddress(seeds: (Buffer | Uint8Array)[], programId: PublicKey): Promise<PublicKey>
  • 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>

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

    Parameters

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

    Returns Promise<[PublicKey, number]>

  • findProgramAddressSync(seeds: (Buffer | Uint8Array)[], 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: (Buffer | Uint8Array)[]
    • programId: PublicKey

    Returns [PublicKey, number]

Generated using TypeDoc