Skip to content

Configuration ​

Networks ​

The SDK supports two networks:

  • NosanaNetwork.MAINNET - Production network (mainnet-beta)
  • NosanaNetwork.DEVNET - Development network (devnet)

Configuration Options ​

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
, type LogLevel = "none" | "fatal" | "error" | "warn" | "info" | "debug" | "trace"LogLevel } from '@nosana/kit';
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
} from '@solana/kit';
import type { type Wallet = MessageSigner & TransactionSigner
A wallet that can sign both messages and transactions. This is a combination of MessageSigner and TransactionSigner, allowing the wallet to be used for both message signing and transaction signing.
@group@nosana/kit
Wallet
} from '@nosana/kit';
const const myWallet: WalletmyWallet: type Wallet = MessageSigner & TransactionSigner
A wallet that can sign both messages and transactions. This is a combination of MessageSigner and TransactionSigner, allowing the wallet to be used for both message signing and transaction signing.
@group@nosana/kit
Wallet
= 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
();
const const client: NosanaClientclient = 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.solana?: Partial<SolanaConfig> | undefinedsolana: { cluster?: SolanaClusterMoniker | undefinedcluster: 'mainnet-beta', rpcEndpoint?: string | undefinedrpcEndpoint: 'https://api.mainnet-beta.solana.com', commitment?: SolanaCommitment | undefinedcommitment: 'confirmed', }, PartialClientConfig.ipfs?: Partial<IPFSConfig> | undefinedipfs: { api?: string | undefinedapi: 'https://api.pinata.cloud', jwt?: string | undefinedjwt: 'your-pinata-jwt-token', gateway?: string | undefinedgateway: 'https://gateway.pinata.cloud/ipfs/', }, PartialClientConfig.api?: Partial<APIConfig> | undefinedapi: { apiKey?: string | undefinedapiKey: 'your-api-key', // Optional: API key for authentication }, PartialClientConfig.logLevel?: LogLevel | undefinedlogLevel: 'debug', PartialClientConfig.wallet?: Wallet | undefinedwallet:
const myWallet: Readonly<{
    address: Address<string>;
    signMessages(messages: readonly SignableMessage[], config?: MessagePartialSignerConfig): Promise<readonly SignatureDictionary[]>;
}> & Readonly<{
    address: Address<string>;
    signTransactions(transactions: readonly (Transaction & TransactionWithinSizeLimit & TransactionWithLifetime)[], config?: TransactionPartialSignerConfig): Promise<readonly SignatureDictionary[]>;
}>
myWallet
, // Optional: Set wallet during initialization (must be a Wallet type)
});

Logging ​

Configure logging levels.

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
} from '@nosana/kit';
const const client: NosanaClientclient = 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.logLevel?: LogLevel | undefinedlogLevel: 'debug', // DEBUG | INFO | WARN | ERROR | NONE });