Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PublicKey

A public key

Hierarchy

  • PublicKey

Index

Constructors

constructor

  • new PublicKey(value: string | number | Buffer | Uint8Array | number[]): PublicKey
  • Create a new PublicKey object

    Parameters

    • value: string | number | Buffer | Uint8Array | number[]

      ed25519 public key as buffer or base-58 encoded string

    Returns PublicKey

Methods

equals

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

toString

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

    Returns string

Static createProgramAddress

  • createProgramAddress(seeds: (Buffer | Uint8Array)[], programId: PublicKey): Promise<PublicKey>
  • Derive a program address from seeds and a program ID.

    Parameters

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

    Returns Promise<PublicKey>

Static createWithSeed

Static findProgramAddress

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

Generated using TypeDoc