getSolanaAddress
Derives the Solana address for an Ed25519 public key: the public key itself, base58-encoded.
Import
Section titled “Import”import { function getSolanaAddress(publicKey: Uint8Array): SolanaAddress
Derives the base58-encoded Solana address for an Ed25519 public key.
getSolanaAddress } from "@category-labs/mera";import { function createEd25519SigningSession({ privateKey, }: CreateSigningSessionOptions): Ed25519SigningSession
Creates a signing session from an Ed25519 private key.
createEd25519SigningSession, function getSolanaAddress(publicKey: Uint8Array): SolanaAddress
Derives the base58-encoded Solana address for an Ed25519 public key.
getSolanaAddress,} from "@category-labs/mera";
const const session: Ed25519SigningSession
session = function createEd25519SigningSession({ privateKey, }: CreateSigningSessionOptions): Ed25519SigningSession
Creates a signing session from an Ed25519 private key.
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.
getRandomValues(new var Uint8Array: Uint8ArrayConstructornew (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.
getSolanaAddress(const session: Ed25519SigningSession
session.publicKey: Uint8Array<ArrayBuffer>
32-byte Ed25519 public key for the session.
publicKey);// base58, like "7EcDhSYGxXyscszYEp35KHN8vvw3svAuLKTzXwCFLtV"Parameters
Section titled “Parameters”publicKey
Section titled “publicKey”- Type:
Uint8Array - Required
A 32-byte Ed25519 public key.
Returns
Section titled “Returns”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.
Errors
Section titled “Errors”INPUT_INVALID:publicKeyis not 32 bytes.