@coolwallet/sol
Version:
Coolwallet Solana sdk
71 lines (70 loc) • 2.02 kB
TypeScript
import BN from 'bn.js';
import { Buffer } from 'buffer';
/**
* Maximum length of derived pubkey seed
*/
export declare const MAX_SEED_LENGTH = 32;
/**
* Size of public key in bytes
*/
export declare const PUBLIC_KEY_LENGTH = 32;
/**
* Value to be converted into public key
*/
export type PublicKeyInitData = number | string | Uint8Array | Array<number> | PublicKeyData;
/**
* JSON object representation of PublicKey class
*/
export type PublicKeyData = {
/** @internal */
_bn: BN;
};
/**
* A public key
*/
export declare class PublicKey {
/** @internal */
_bn: BN;
/**
* Create a new PublicKey object
* @param value ed25519 public key as buffer or base-58 encoded string
*/
constructor(value: PublicKeyInitData);
/**
* Returns a unique PublicKey for tests and benchmarks using a counter
*/
static unique(): 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
*/
static default: PublicKey;
/**
* Checks if two publicKeys are equal
*/
equals(publicKey: PublicKey): boolean;
/**
* Return the base-58 representation of the public key
*/
toBase58(): string;
toJSON(): string;
/**
* Return the byte array representation of the public key in big endian
*/
toBytes(): Uint8Array;
/**
* Return the Buffer representation of the public key in big endian
*/
toBuffer(): Buffer;
get [Symbol.toStringTag](): string;
/**
* Return the base-58 representation of the public key
*/
toString(): string;
/**
* 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.
*/
static createWithSeed(fromPublicKey: PublicKey, seed: string, programId: PublicKey): Promise<PublicKey>;
}