Skip to content

Basic Usage Examples

This page demonstrates common patterns for using Nosana Kit.

Initialize Client

ts
import { 
createNosanaClient
} from '@nosana/kit';
const
client
=
createNosanaClient
();

TIP

The createNosanaClient function returns a fully typed NosanaClient instance. All methods and properties are type-checked at compile time.

Fetch a Job

ts
import { 
createNosanaClient
} from '@nosana/kit';
const
client
=
createNosanaClient
();

INFO

The Job type includes all properties from the on-chain account data. Hover over job in your IDE to see the full type definition, or check the SDK Reference.

Query Jobs with Filters

ts
import { 
createNosanaClient
,
JobState
} from '@nosana/kit';
const
client
=
createNosanaClient
();

Set Up Wallet

Wallet Configuration

A wallet is required for signing transactions. You can set it during client initialization or dynamically.
ts
import { 
createNosanaClient
,
NosanaNetwork
} from '@nosana/kit';
import {
generateKeyPairSigner
} from '@solana/kit';
import type {
Wallet
} from '@nosana/kit';
// Option 1: Set wallet during initialization const
keypair
:
Wallet
= await
generateKeyPairSigner
();
const
client
=
createNosanaClient
(
NosanaNetwork
.
MAINNET
, {
wallet
:
keypair
,
});

WARNING

Never share your private key or seed phrase. Always use secure key management practices in production.