Skip to content

Wallet Configuration ​

The SDK supports universal wallet configuration through a unified Wallet type that must support both message and transaction signing (MessageSigner & TransactionSigner). This enables compatibility with both browser wallets (wallet-standard) and keypair-based wallets.

Wallet Requirements ​

The wallet must implement both MessageSigner and TransactionSigner interfaces from @solana/kit. This allows the SDK to use the wallet for:

  • Message signing - For API authentication and authorization
  • Transaction signing - For on-chain operations

Keypair Helpers ​

The SDK provides convenient helper functions to create wallets without needing to install @solana/kit directly.

Generate a New Wallet ​

ts
import { 
function createNosanaClient(network: NosanaNetwork | undefined, customConfig: PartialClientConfig & {
    connect: ConnectFactoryConfig & {
        clientSecret: string;
    };
}): NosanaClient & {
    connect: ServerConnect;
} (+3 overloads)
createNosanaClient
, function generateWallet(): Promise<Wallet>
Generate a new random wallet (keypair signer).
@returnsA new randomly generated wallet@example```ts import { generateWallet } from '@nosana/kit'; const wallet = await generateWallet(); console.log(wallet.address); ```@group@nosana/kit
generateWallet
} from '@nosana/kit';
const const wallet: Walletwallet = await function generateWallet(): Promise<Wallet>
Generate a new random wallet (keypair signer).
@returnsA new randomly generated wallet@example```ts import { generateWallet } from '@nosana/kit'; const wallet = await generateWallet(); console.log(wallet.address); ```@group@nosana/kit
generateWallet
();
var console: Console
The `console` module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers. The module exports two specific components: * A `Console` class with methods such as `console.log()`, `console.error()` and `console.warn()` that can be used to write to any Node.js stream. * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v24.x/api/process.html#processstdout) and [`process.stderr`](https://nodejs.org/docs/latest-v24.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module. _**Warning**_: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v24.x/api/process.html#a-note-on-process-io) for more information. Example using the global `console`: ```js console.log('hello world'); // Prints: hello world, to stdout console.log('hello %s', 'world'); // Prints: hello world, to stdout console.error(new Error('Whoops, something bad happened')); // Prints error message and stack trace to stderr: // Error: Whoops, something bad happened // at [eval]:5:15 // at Script.runInThisContext (node:vm:132:18) // at Object.runInThisContext (node:vm:309:38) // at node:internal/process/execution:77:19 // at [eval]-wrapper:6:22 // at evalScript (node:internal/process/execution:76:60) // at node:internal/main/eval_string:23:3 const name = 'Will Robinson'; console.warn(`Danger ${name}! Danger!`); // Prints: Danger Will Robinson! Danger!, to stderr ``` Example using the `Console` class: ```js const out = getStreamSomehow(); const err = getStreamSomehow(); const myConsole = new console.Console(out, err); myConsole.log('hello world'); // Prints: hello world, to out myConsole.log('hello %s', 'world'); // Prints: hello world, to out myConsole.error(new Error('Whoops, something bad happened')); // Prints: [Error: Whoops, something bad happened], to err const name = 'Will Robinson'; myConsole.warn(`Danger ${name}! Danger!`); // Prints: Danger Will Robinson! Danger!, to err ```
@see[source](https://github.com/nodejs/node/blob/v24.x/lib/console.js)
console
.Console.log(message?: any, ...optionalParams: any[]): void (+1 overload)
Prints to `stdout` with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilformatformat-args)). ```js const count = 5; console.log('count: %d', count); // Prints: count: 5, to stdout console.log('count:', count); // Prints: count: 5, to stdout ``` See [`util.format()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilformatformat-args) for more information.
@sincev0.1.100
log
(const wallet: Walletwallet.address: NominalType<"brand", "Address"> & NominalType<"stringEncoding", "base58"> & stringaddress);
const const client: NosanaClientclient = function createNosanaClient(network?: NosanaNetwork, customConfig?: PartialClientConfig): NosanaClient (+3 overloads)createNosanaClient(); const client: NosanaClientclient.NosanaClient.wallet: Wallet | undefined
The wallet. Must be a Wallet (supports both message and transaction signing). Set this property directly to configure the wallet.
@example```ts import { createNosanaClient, NosanaNetwork } from '@nosana/kit'; const client = createNosanaClient(NosanaNetwork.MAINNET); client.wallet = myWallet; ```
wallet
= const wallet: Walletwallet;

Load from a Keypair File ​

Load a wallet from a Solana CLI keypair JSON file (as created by solana-keygen). Defaults to ~/.config/solana/id.json.

ts
import { 
function createNosanaClient(network: NosanaNetwork | undefined, customConfig: PartialClientConfig & {
    connect: ConnectFactoryConfig & {
        clientSecret: string;
    };
}): NosanaClient & {
    connect: ServerConnect;
} (+3 overloads)
createNosanaClient
, function loadWalletFromFile(filePath?: string): Promise<Wallet>
Load a wallet from a Solana CLI keypair JSON file. Reads a JSON file containing a byte array (as used by `solana-keygen`) and creates a wallet from it. Defaults to `~/.config/solana/id.json` if no path is provided.
@paramfilePath - Path to the keypair JSON file (default: `~/.config/solana/id.json`)@returnsA wallet loaded from the file@example```ts import { loadWalletFromFile } from '@nosana/kit'; // Load default Solana CLI keypair const wallet = await loadWalletFromFile(); // Or specify a custom path const wallet = await loadWalletFromFile('/path/to/keypair.json'); console.log(wallet.address); ```@group@nosana/kit
loadWalletFromFile
} from '@nosana/kit';
// Load the default Solana CLI keypair const const wallet: Walletwallet = await function loadWalletFromFile(filePath?: string): Promise<Wallet>
Load a wallet from a Solana CLI keypair JSON file. Reads a JSON file containing a byte array (as used by `solana-keygen`) and creates a wallet from it. Defaults to `~/.config/solana/id.json` if no path is provided.
@paramfilePath - Path to the keypair JSON file (default: `~/.config/solana/id.json`)@returnsA wallet loaded from the file@example```ts import { loadWalletFromFile } from '@nosana/kit'; // Load default Solana CLI keypair const wallet = await loadWalletFromFile(); // Or specify a custom path const wallet = await loadWalletFromFile('/path/to/keypair.json'); console.log(wallet.address); ```@group@nosana/kit
loadWalletFromFile
();
// Or specify a custom path const const wallet2: Walletwallet2 = await function loadWalletFromFile(filePath?: string): Promise<Wallet>
Load a wallet from a Solana CLI keypair JSON file. Reads a JSON file containing a byte array (as used by `solana-keygen`) and creates a wallet from it. Defaults to `~/.config/solana/id.json` if no path is provided.
@paramfilePath - Path to the keypair JSON file (default: `~/.config/solana/id.json`)@returnsA wallet loaded from the file@example```ts import { loadWalletFromFile } from '@nosana/kit'; // Load default Solana CLI keypair const wallet = await loadWalletFromFile(); // Or specify a custom path const wallet = await loadWalletFromFile('/path/to/keypair.json'); console.log(wallet.address); ```@group@nosana/kit
loadWalletFromFile
('/path/to/keypair.json');
const const client: NosanaClientclient = function createNosanaClient(network?: NosanaNetwork, customConfig?: PartialClientConfig): NosanaClient (+3 overloads)createNosanaClient(); const client: NosanaClientclient.NosanaClient.wallet: Wallet | undefined
The wallet. Must be a Wallet (supports both message and transaction signing). Set this property directly to configure the wallet.
@example```ts import { createNosanaClient, NosanaNetwork } from '@nosana/kit'; const client = createNosanaClient(NosanaNetwork.MAINNET); client.wallet = myWallet; ```
wallet
= const wallet: Walletwallet;

Create from a Base58 Private Key ​

ts
import { 
function createNosanaClient(network: NosanaNetwork | undefined, customConfig: PartialClientConfig & {
    connect: ConnectFactoryConfig & {
        clientSecret: string;
    };
}): NosanaClient & {
    connect: ServerConnect;
} (+3 overloads)
createNosanaClient
, function createWalletFromBase58(base58Key: string): Promise<Wallet>
Create a wallet from a base58-encoded private key string. This accepts the full 64-byte keypair encoded as base58, as commonly exported from wallets and tools like `solana-keygen`.
@parambase58Key - The base58-encoded secret key string@returnsA wallet created from the provided key@example```ts import { createWalletFromBase58 } from '@nosana/kit'; const wallet = await createWalletFromBase58( '5MaiiCavjCmn9Hs1o3eznqDEhRwxo7pXiAYez7keQUviUkauRiTMD8DrESdrNjN8zd9mTmVhRvBJeg5vhyvgrAhG' ); console.log(wallet.address); ```@group@nosana/kit
createWalletFromBase58
} from '@nosana/kit';
const const wallet: Walletwallet = await function createWalletFromBase58(base58Key: string): Promise<Wallet>
Create a wallet from a base58-encoded private key string. This accepts the full 64-byte keypair encoded as base58, as commonly exported from wallets and tools like `solana-keygen`.
@parambase58Key - The base58-encoded secret key string@returnsA wallet created from the provided key@example```ts import { createWalletFromBase58 } from '@nosana/kit'; const wallet = await createWalletFromBase58( '5MaiiCavjCmn9Hs1o3eznqDEhRwxo7pXiAYez7keQUviUkauRiTMD8DrESdrNjN8zd9mTmVhRvBJeg5vhyvgrAhG' ); console.log(wallet.address); ```@group@nosana/kit
createWalletFromBase58
(
'your-base-58-encoded-private-key' ); const const client: NosanaClientclient = function createNosanaClient(network?: NosanaNetwork, customConfig?: PartialClientConfig): NosanaClient (+3 overloads)createNosanaClient(); const client: NosanaClientclient.NosanaClient.wallet: Wallet | undefined
The wallet. Must be a Wallet (supports both message and transaction signing). Set this property directly to configure the wallet.
@example```ts import { createNosanaClient, NosanaNetwork } from '@nosana/kit'; const client = createNosanaClient(NosanaNetwork.MAINNET); client.wallet = myWallet; ```
wallet
= const wallet: Walletwallet;

Create from Bytes ​

ts
import { 
function createNosanaClient(network: NosanaNetwork | undefined, customConfig: PartialClientConfig & {
    connect: ConnectFactoryConfig & {
        clientSecret: string;
    };
}): NosanaClient & {
    connect: ServerConnect;
} (+3 overloads)
createNosanaClient
, function createWalletFromBytes(bytes: Uint8Array | ReadonlyArray<number>): 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.
@parambytes - The secret key bytes (64 bytes)@returnsA 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); ```@group@nosana/kit
createWalletFromBytes
} from '@nosana/kit';
const const secretKey: Uint8Array<ArrayBuffer>secretKey = new
var Uint8Array: Uint8ArrayConstructor
new (elements: Iterable<number>) => Uint8Array<ArrayBuffer> (+6 overloads)
Uint8Array
([174, 47, 154, 16, 202, 193, 206, 113, /* ... */]);
const const wallet: Walletwallet = await function createWalletFromBytes(bytes: Uint8Array | ReadonlyArray<number>): 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.
@parambytes - The secret key bytes (64 bytes)@returnsA 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); ```@group@nosana/kit
createWalletFromBytes
(const secretKey: Uint8Array<ArrayBuffer>secretKey);
const const client: NosanaClientclient = function createNosanaClient(network?: NosanaNetwork, customConfig?: PartialClientConfig): NosanaClient (+3 overloads)createNosanaClient(); const client: NosanaClientclient.NosanaClient.wallet: Wallet | undefined
The wallet. Must be a Wallet (supports both message and transaction signing). Set this property directly to configure the wallet.
@example```ts import { createNosanaClient, NosanaNetwork } from '@nosana/kit'; const client = createNosanaClient(NosanaNetwork.MAINNET); client.wallet = myWallet; ```
wallet
= const wallet: Walletwallet;

Using @solana/kit Directly ​

The SDK also re-exports the underlying @solana/kit keypair functions if you need more control:

ts
import {
  function generateKeyPairSigner(extractable?: boolean): Promise<KeyPairSigner>
Generates a signer capable of signing messages and transactions by generating a {@link CryptoKeyPair } and creating a {@link KeyPairSigner } from it.
@paramextractable Setting this to `true` makes it possible to extract the bytes of the private key using the [`crypto.subtle.exportKey()`](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/exportKey) API. Defaults to `false`, which prevents the bytes of the private key from being visible to JS.@example```ts import { generateKeyPairSigner } from '@solana/signers'; const signer = await generateKeyPairSigner(); ```@see{@link createSignerFromKeyPair}
generateKeyPairSigner
,
function createKeyPairSignerFromBytes(bytes: ReadonlyUint8Array, extractable?: boolean): Promise<KeyPairSigner>
Creates a new {@link KeyPairSigner } from a 64-bytes `Uint8Array` secret key (private key and public key).
@example```ts import fs from 'fs'; import { createKeyPairSignerFromBytes } from '@solana/signers'; // Get bytes from local keypair file. const keypairFile = fs.readFileSync('~/.config/solana/id.json'); const keypairBytes = new Uint8Array(JSON.parse(keypairFile.toString())); // Create a KeyPairSigner from the bytes. const signer = await createKeyPairSignerFromBytes(keypairBytes); ```@see{@link createKeyPairSignerFromPrivateKeyBytes} if you only have the 32-bytes private key instead.@see{@link writeKeyPairSigner } — the inverse helper that persists a signer's key pair to disk in the same format.
createKeyPairSignerFromBytes
,
function createKeyPairFromBytes(bytes: ReadonlyUint8Array, extractable?: boolean): Promise<CryptoKeyPair>
Given a 64-byte `Uint8Array` secret key, creates an Ed25519 public/private key pair for use with other methods in this package that accept [`CryptoKey`](https://developer.mozilla.org/en-US/docs/Web/API/CryptoKey) objects.
@parambytes 64 bytes, the first 32 of which represent the private key and the last 32 of which represent its associated public key@paramextractable Setting this to `true` makes it possible to extract the bytes of the private key using the [`crypto.subtle.exportKey()`](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/exportKey) API. Defaults to `false`.@example```ts import fs from 'fs'; import { createKeyPairFromBytes } from '@solana/keys'; // Get bytes from local keypair file. const keypairFile = fs.readFileSync('~/.config/solana/id.json'); const keypairBytes = new Uint8Array(JSON.parse(keypairFile.toString())); // Create a CryptoKeyPair from the bytes. const { privateKey, publicKey } = await createKeyPairFromBytes(keypairBytes); ```@see{@link writeKeyPair } — the inverse helper that persists a key pair to disk in the same format.
createKeyPairFromBytes
,
function createSignerFromKeyPair(keyPair: CryptoKeyPair): Promise<KeyPairSigner>
Creates a {@link KeyPairSigner } from a provided {@link CryptoKeyPair } . The {@link MessagePartialSigner#signMessages signMessages } and {@link TransactionPartialSigner#signTransactions signTransactions } functions of the returned signer will use the private key of the provided key pair to sign messages and transactions. Note that both the {@link MessagePartialSigner#signMessages signMessages } and {@link TransactionPartialSigner#signTransactions signTransactions } implementations are parallelized, meaning that they will sign all provided messages and transactions in parallel.
@example```ts import { generateKeyPair } from '@solana/keys'; import { createSignerFromKeyPair, KeyPairSigner } from '@solana/signers'; const keyPair: CryptoKeyPair = await generateKeyPair(); const signer: KeyPairSigner = await createSignerFromKeyPair(keyPair); ```
createSignerFromKeyPair
,
} from '@nosana/kit'; const const signer: KeyPairSigner<string>signer = await function generateKeyPairSigner(extractable?: boolean): Promise<KeyPairSigner>
Generates a signer capable of signing messages and transactions by generating a {@link CryptoKeyPair } and creating a {@link KeyPairSigner } from it.
@paramextractable Setting this to `true` makes it possible to extract the bytes of the private key using the [`crypto.subtle.exportKey()`](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/exportKey) API. Defaults to `false`, which prevents the bytes of the private key from being visible to JS.@example```ts import { generateKeyPairSigner } from '@solana/signers'; const signer = await generateKeyPairSigner(); ```@see{@link createSignerFromKeyPair}
generateKeyPairSigner
();

Browser Wallets (Wallet-Standard) ​

Full support for wallet-standard compatible browser wallets (Phantom, Solflare, etc.).

ts
import { createNosanaClient } from '@nosana/kit';
import { useWalletAccountSigner } from '@nosana/solana-vue';

// Create client
const client = createNosanaClient();

// Set browser wallet (wallet-standard compatible)
client.wallet = useWalletAccountSigner(account, currentChain);

Configuration Options ​

Wallets can be set at client initialization or dynamically assigned.

ts
import { 
function createNosanaClient(network: NosanaNetwork | undefined, customConfig: PartialClientConfig & {
    connect: ConnectFactoryConfig & {
        clientSecret: string;
    };
}): NosanaClient & {
    connect: ServerConnect;
} (+3 overloads)
createNosanaClient
,
type NosanaNetwork = "mainnet" | "devnet" | "localnet"
const NosanaNetwork: {
    readonly MAINNET: "mainnet";
    readonly DEVNET: "devnet";
    readonly LOCALNET: "localnet";
}
NosanaNetwork
, function generateWallet(): Promise<Wallet>
Generate a new random wallet (keypair signer).
@returnsA new randomly generated wallet@example```ts import { generateWallet } from '@nosana/kit'; const wallet = await generateWallet(); console.log(wallet.address); ```@group@nosana/kit
generateWallet
} from '@nosana/kit';
const const myWallet: WalletmyWallet = await function generateWallet(): Promise<Wallet>
Generate a new random wallet (keypair signer).
@returnsA new randomly generated wallet@example```ts import { generateWallet } from '@nosana/kit'; const wallet = await generateWallet(); console.log(wallet.address); ```@group@nosana/kit
generateWallet
();
const const anotherWallet: WalletanotherWallet = await function generateWallet(): Promise<Wallet>
Generate a new random wallet (keypair signer).
@returnsA new randomly generated wallet@example```ts import { generateWallet } from '@nosana/kit'; const wallet = await generateWallet(); console.log(wallet.address); ```@group@nosana/kit
generateWallet
();
// Option 1: Set wallet during initialization const const client1: NosanaClientclient1 = function createNosanaClient(network?: NosanaNetwork, customConfig?: PartialClientConfig): NosanaClient (+3 overloads)createNosanaClient(
const NosanaNetwork: {
    readonly MAINNET: "mainnet";
    readonly DEVNET: "devnet";
    readonly LOCALNET: "localnet";
}
NosanaNetwork
.type MAINNET: "mainnet"MAINNET, {
PartialClientConfig.wallet?: Wallet | undefinedwallet: const myWallet: WalletmyWallet, }); // Option 2: Set wallet dynamically const const client2: NosanaClientclient2 = function createNosanaClient(network?: NosanaNetwork, customConfig?: PartialClientConfig): NosanaClient (+3 overloads)createNosanaClient(); const client2: NosanaClientclient2.NosanaClient.wallet: Wallet | undefined
The wallet. Must be a Wallet (supports both message and transaction signing). Set this property directly to configure the wallet.
@example```ts import { createNosanaClient, NosanaNetwork } from '@nosana/kit'; const client = createNosanaClient(NosanaNetwork.MAINNET); client.wallet = myWallet; ```
wallet
= const myWallet: WalletmyWallet;
// Option 3: Change wallet at runtime const client2: NosanaClientclient2.NosanaClient.wallet: Wallet | undefined
The wallet. Must be a Wallet (supports both message and transaction signing). Set this property directly to configure the wallet.
@example```ts import { createNosanaClient, NosanaNetwork } from '@nosana/kit'; const client = createNosanaClient(NosanaNetwork.MAINNET); client.wallet = myWallet; ```
wallet
= const anotherWallet: WalletanotherWallet;

Type Safety ​

The SDK leverages @solana/kit types for compile-time safety, ensuring wallet compatibility before runtime.