Home Reference Source
import {PublicKey} from '@solana/web3'
public class | source

PublicKey

A public key

Static Method Summary

Static Public Methods
public static

async createProgramAddress(seeds: Array<Buffer|Uint8Array>, programId: PublicKey): Promise<PublicKey>

Derive a program address from seeds and a program ID.

public static

async createWithSeed(fromPublicKey: PublicKey, seed: string, programId: PublicKey): Promise<PublicKey>

Derive a public key from another key, a seed, and a program ID.

public static

Checks if the provided object is a PublicKey

Constructor Summary

Public Constructor
public

constructor(value: number | string | Buffer | Uint8Array | Array<number>)

Create a new PublicKey object

Method Summary

Public Methods
public

equals(publicKey: PublicKey): boolean

Checks if two publicKeys are equal

public

Return the base-58 representation of the public key

public

toBuffer(): Buffer

Return the Buffer representation of the public key

public

Returns a string representation of the public key

Static Public Methods

public static async createProgramAddress(seeds: Array<Buffer|Uint8Array>, programId: PublicKey): Promise<PublicKey> source

Derive a program address from seeds and a program ID.

Params:

NameTypeAttributeDescription
seeds Array<Buffer|Uint8Array>
programId PublicKey

Return:

Promise<PublicKey>

public static async createWithSeed(fromPublicKey: PublicKey, seed: string, programId: PublicKey): Promise<PublicKey> source

Derive a public key from another key, a seed, and a program ID.

Params:

NameTypeAttributeDescription
fromPublicKey PublicKey
seed string
programId PublicKey

Return:

Promise<PublicKey>

public static isPublicKey(o: Object): boolean source

Checks if the provided object is a PublicKey

Params:

NameTypeAttributeDescription
o Object

Return:

boolean

Public Constructors

public constructor(value: number | string | Buffer | Uint8Array | Array<number>) source

Create a new PublicKey object

Params:

NameTypeAttributeDescription
value number | string | Buffer | Uint8Array | Array<number>

Public Methods

public equals(publicKey: PublicKey): boolean source

Checks if two publicKeys are equal

Params:

NameTypeAttributeDescription
publicKey PublicKey

Return:

boolean

public toBase58(): string source

Return the base-58 representation of the public key

Return:

string

public toBuffer(): Buffer source

Return the Buffer representation of the public key

Return:

Buffer

public toString(): string source

Returns a string representation of the public key

Return:

string