Skip to content

Function: createWalletFromBytes()

ts
function createWalletFromBytes(bytes): Promise<Wallet>;

Create a wallet from a 64-byte secret key (Uint8Array or number array).

The bytes should be a 64-byte array containing the 32-byte private key followed by the 32-byte public key, as used by Solana CLI keypair files.

Parameters

ParameterTypeDescription
bytes| Uint8Array<ArrayBufferLike> | readonly number[]The secret key bytes (64 bytes)

Returns

Promise<Wallet>

A wallet created from the provided bytes

Example

ts
import { createWalletFromBytes } from '@nosana/kit';

const secretKey = new Uint8Array([174, 47, 154, ...]);
const wallet = await createWalletFromBytes(secretKey);