Options
All
  • Public
  • Public/Protected
  • All
Menu

A public key

Hierarchy

Index

Constructors

  • Create a new PublicKey object

    Parameters

    Returns PublicKey

Properties

default: PublicKey

Default public key value. The base58-encoded string representation is all ones (as seen below) The underlying BN number is 32 bytes that are all zeros

Methods

  • encode(): Buffer
  • Returns Buffer

  • Checks if two publicKeys are equal

    Parameters

    Returns boolean

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

    Returns string

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

    Returns Buffer

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

    Returns Uint8Array

  • toJSON(): string
  • Returns string

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

    Returns string

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

    deprecated

    Use createProgramAddressSync instead

    Parameters

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

    Returns Promise<PublicKey>

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

    Parameters

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

    Returns 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
  • Parameters

    • data: Buffer

    Returns any

  • decodeUnchecked(data: Buffer): any
  • Parameters

    • data: Buffer

    Returns any

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

    deprecated

    Use findProgramAddressSync instead

    Parameters

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

    Returns Promise<[PublicKey, number]>

  • 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]

  • Check that a pubkey is on the ed25519 curve.

    Parameters

    Returns boolean

  • Returns a unique PublicKey for tests and benchmarks using a counter

    Returns PublicKey

Generated using TypeDoc