Skip to content
Get startedGetting started →

getSolanaAddress

Derives the Solana address for an Ed25519 public key: the public key itself, base58-encoded.

import {
function getSolanaAddress(publicKey: Uint8Array): SolanaAddress

Derives the base58-encoded Solana address for an Ed25519 public key.

@parampublicKey - A 32-byte Ed25519 public key.

@returnsThe base58-encoded Solana address.

@throwsMeraError with code INPUT_INVALID when publicKey is not 32 bytes.

getSolanaAddress
} from "@category-labs/mera";
import {
function createEd25519SigningSession({ privateKey, }: CreateSigningSessionOptions): Ed25519SigningSession

Creates a signing session from an Ed25519 private key.

@paramoptions - Signing session inputs.

@returnsA live Ed25519 signing session.

@throwsMeraError with code INPUT_INVALID when privateKey is not 32 bytes.

createEd25519SigningSession
,
function getSolanaAddress(publicKey: Uint8Array): SolanaAddress

Derives the base58-encoded Solana address for an Ed25519 public key.

@parampublicKey - A 32-byte Ed25519 public key.

@returnsThe base58-encoded Solana address.

@throwsMeraError with code INPUT_INVALID when publicKey is not 32 bytes.

getSolanaAddress
,
} from "@category-labs/mera";
const
const session: Ed25519SigningSession
session
=
function createEd25519SigningSession({ privateKey, }: CreateSigningSessionOptions): Ed25519SigningSession

Creates a signing session from an Ed25519 private key.

@paramoptions - Signing session inputs.

@returnsA live Ed25519 signing session.

@throwsMeraError with code INPUT_INVALID when privateKey is not 32 bytes.

createEd25519SigningSession
({
privateKey: Uint8Array<ArrayBufferLike>

Curve private key. Must be exactly 32 bytes and, for secp256k1, a valid scalar.

privateKey
:
var crypto: Crypto
crypto
.
Crypto.getRandomValues<Uint8Array<ArrayBuffer>>(array: Uint8Array<ArrayBuffer>): Uint8Array<ArrayBuffer>

The Crypto.getRandomValues() method lets you get cryptographically strong random values.

MDN Reference

getRandomValues
(new
var Uint8Array: Uint8ArrayConstructor
new (length: number) => Uint8Array<ArrayBuffer> (+6 overloads)
Uint8Array
(32)),
});
const
const address: SolanaAddress
address
=
function getSolanaAddress(publicKey: Uint8Array): SolanaAddress

Derives the base58-encoded Solana address for an Ed25519 public key.

@parampublicKey - A 32-byte Ed25519 public key.

@returnsThe base58-encoded Solana address.

@throwsMeraError with code INPUT_INVALID when publicKey is not 32 bytes.

getSolanaAddress
(
const session: Ed25519SigningSession
session
.
publicKey: Uint8Array<ArrayBuffer>

32-byte Ed25519 public key for the session.

publicKey
);
// base58, like "7EcDhSYGxXyscszYEp35KHN8vvw3svAuLKTzXwCFLtV"
  • Type: Uint8Array
  • Required

A 32-byte Ed25519 public key.

import type {
type SolanaAddress = string & {
readonly [brand]: "SolanaAddress";
}

A base58-encoded 32-byte Solana address.

Branded nominal type minted by getSolanaAddress; at runtime the value is a plain string.

SolanaAddress
} from "@category-labs/mera";
type
type ReturnType = string & {
readonly [brand]: "SolanaAddress";
}
ReturnType
=
type SolanaAddress = string & {
readonly [brand]: "SolanaAddress";
}

A base58-encoded 32-byte Solana address.

Branded nominal type minted by getSolanaAddress; at runtime the value is a plain string.

SolanaAddress
;

A base58-encoded 32-byte address. SolanaAddress is a branded string type and a plain string at runtime.