Jobs Program
The Jobs Program provides methods to interact with jobs, runs, and markets on the Nosana Network.
Fetching Accounts
Get Single Job
async get(address: Address, checkRun?: boolean): Promise<Job>Fetch a job account. If checkRun is true (default), automatically checks for associated run accounts to determine if a queued job is actually running.
import { function address<TAddress extends string = string>(putativeAddress: TAddress): Address<TAddress>Combines _asserting_ that a string is an address with _coercing_ it to the
{@link
Address
}
type.
It's most useful with untrusted input.address, type Job = Omit<ConvertTypesForDb<JobAccountArgs>, "state"> & {
address: Address;
state: JobState;
}
Job } from '@nosana/kit';
const const job: Jobjob: type Job = Omit<ConvertTypesForDb<JobAccountArgs>, "state"> & {
address: Address;
state: JobState;
}
Job = await const client: NosanaClientclient.NosanaClient.jobs: JobsProgramjobs.JobsProgram.get(addr: Address, checkRun?: boolean): Promise<Job>Fetch a job account by addressget(address<"job-address">(putativeAddress: "job-address"): Address<"job-address">Combines _asserting_ that a string is an address with _coercing_ it to the
{@link
Address
}
type.
It's most useful with untrusted input.address('job-address'));
var console: ConsoleThe `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
```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.log(const job: Jobjob.state: JobStatestate); // JobState enum
var console: ConsoleThe `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
```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.log(const job: Jobjob.price: number | bigintprice); // Job price in smallest unit
var console: ConsoleThe `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
```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.log(const job: Jobjob.ipfsJob: string | nullipfsJob); // IPFS CID of job definition
var console: ConsoleThe `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
```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.log(const job: Jobjob.timeStart: number | biginttimeStart); // Start timestamp (if running)Get Single Run
async run(address: Address): Promise<Run>Fetch a run account by address.
import { function address<TAddress extends string = string>(putativeAddress: TAddress): Address<TAddress>Combines _asserting_ that a string is an address with _coercing_ it to the
{@link
Address
}
type.
It's most useful with untrusted input.address, type Run = ConvertTypesForDb<RunAccountArgs> & {
address: Address;
}
Run } from '@nosana/kit';
const const run: Runrun: type Run = ConvertTypesForDb<RunAccountArgs> & {
address: Address;
}
Run = await const client: NosanaClientclient.NosanaClient.jobs: JobsProgramjobs.JobsProgram.run(addr: Address): Promise<Run>Fetch a run account by addressrun(address<"run-address">(putativeAddress: "run-address"): Address<"run-address">Combines _asserting_ that a string is an address with _coercing_ it to the
{@link
Address
}
type.
It's most useful with untrusted input.address('run-address'));
var console: ConsoleThe `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
```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.log(const run: Runrun.job: Addressjob); // Associated job address
var console: ConsoleThe `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
```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.log(const run: Runrun.node: Addressnode); // Node executing the run
var console: ConsoleThe `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
```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.log(const run: Runrun.time: number | biginttime); // Run start timeGet Single Market
async market(address: Address): Promise<Market>Fetch a market account by address.
import { function address<TAddress extends string = string>(putativeAddress: TAddress): Address<TAddress>Combines _asserting_ that a string is an address with _coercing_ it to the
{@link
Address
}
type.
It's most useful with untrusted input.address, type Market = Omit<ConvertTypesForDb<MarketAccountArgs>, "queueType"> & {
address: Address;
queueType: MarketQueueType;
}
Market } from '@nosana/kit';
const const market: Marketmarket: type Market = Omit<ConvertTypesForDb<MarketAccountArgs>, "queueType"> & {
address: Address;
queueType: MarketQueueType;
}
Market = await const client: NosanaClientclient.NosanaClient.jobs: JobsProgramjobs.JobsProgram.market(addr: Address): Promise<Market>Fetch a market account by addressmarket(address<"market-address">(putativeAddress: "market-address"): Address<"market-address">Combines _asserting_ that a string is an address with _coercing_ it to the
{@link
Address
}
type.
It's most useful with untrusted input.address('market-address'));
var console: ConsoleThe `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
```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.log(const market: Marketmarket.queueType: MarketQueueTypequeueType); // MarketQueueType enum
var console: ConsoleThe `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
```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.log(const market: Marketmarket.jobPrice: number | bigintjobPrice); // Market job priceGet Multiple Jobs
async multiple(addresses: Address[], checkRuns?: boolean): Promise<Job[]>Batch fetch multiple jobs by addresses.
import { function address<TAddress extends string = string>(putativeAddress: TAddress): Address<TAddress>Combines _asserting_ that a string is an address with _coercing_ it to the
{@link
Address
}
type.
It's most useful with untrusted input.address, type Job = Omit<ConvertTypesForDb<JobAccountArgs>, "state"> & {
address: Address;
state: JobState;
}
Job } from '@nosana/kit';
const const jobs: Job[]jobs: type Job = Omit<ConvertTypesForDb<JobAccountArgs>, "state"> & {
address: Address;
state: JobState;
}
Job[] = await const client: NosanaClientclient.NosanaClient.jobs: JobsProgramjobs.JobsProgram.multiple(addresses: Address[], checkRuns?: boolean): Promise<Job[]>Fetch multiple job accounts by addressmultiple(
[address<"job-address-1">(putativeAddress: "job-address-1"): Address<"job-address-1">Combines _asserting_ that a string is an address with _coercing_ it to the
{@link
Address
}
type.
It's most useful with untrusted input.address('job-address-1'), address<"job-address-2">(putativeAddress: "job-address-2"): Address<"job-address-2">Combines _asserting_ that a string is an address with _coercing_ it to the
{@link
Address
}
type.
It's most useful with untrusted input.address('job-address-2'), address<"job-address-3">(putativeAddress: "job-address-3"): Address<"job-address-3">Combines _asserting_ that a string is an address with _coercing_ it to the
{@link
Address
}
type.
It's most useful with untrusted input.address('job-address-3')],
true
);Querying with Filters
Query All Jobs
async all(filters?: {
state?: JobState,
market?: Address,
node?: Address,
project?: Address
}, checkRuns?: boolean): Promise<Job[]>Fetch all jobs matching filter criteria using getProgramAccounts.
import { enum JobStateJobState, function address<TAddress extends string = string>(putativeAddress: TAddress): Address<TAddress>Combines _asserting_ that a string is an address with _coercing_ it to the
{@link
Address
}
type.
It's most useful with untrusted input.address, type Job = Omit<ConvertTypesForDb<JobAccountArgs>, "state"> & {
address: Address;
state: JobState;
}
Job } from '@nosana/kit';
// Get all running jobs in a market
const const runningJobs: Job[]runningJobs: type Job = Omit<ConvertTypesForDb<JobAccountArgs>, "state"> & {
address: Address;
state: JobState;
}
Job[] = await const client: NosanaClientclient.NosanaClient.jobs: JobsProgramjobs.JobsProgram.all(filters?: {
state?: JobState;
market?: Address;
node?: Address;
project?: Address;
}, checkRuns?: boolean): Promise<Job[]>
Fetch all job accountsall({
state?: JobState | undefinedstate: enum JobStateJobState.function (enum member) JobState.RUNNING = 1RUNNING,
market?: Address | undefinedmarket: address<"market-address">(putativeAddress: "market-address"): Address<"market-address">Combines _asserting_ that a string is an address with _coercing_ it to the
{@link
Address
}
type.
It's most useful with untrusted input.address('market-address'),
});
// Get all jobs for a project
const const projectJobs: Job[]projectJobs: type Job = Omit<ConvertTypesForDb<JobAccountArgs>, "state"> & {
address: Address;
state: JobState;
}
Job[] = await const client: NosanaClientclient.NosanaClient.jobs: JobsProgramjobs.JobsProgram.all(filters?: {
state?: JobState;
market?: Address;
node?: Address;
project?: Address;
}, checkRuns?: boolean): Promise<Job[]>
Fetch all job accountsall({
project?: Address | undefinedproject: address<"project-address">(putativeAddress: "project-address"): Address<"project-address">Combines _asserting_ that a string is an address with _coercing_ it to the
{@link
Address
}
type.
It's most useful with untrusted input.address('project-address'),
});Query All Runs
async runs(filters?: {
job?: Address,
node?: Address
}): Promise<Run[]>Fetch runs with optional filtering.
import { function address<TAddress extends string = string>(putativeAddress: TAddress): Address<TAddress>Combines _asserting_ that a string is an address with _coercing_ it to the
{@link
Address
}
type.
It's most useful with untrusted input.address, type Run = ConvertTypesForDb<RunAccountArgs> & {
address: Address;
}
Run } from '@nosana/kit';
// Get all runs for a specific job
const const jobRuns: Run[]jobRuns: type Run = ConvertTypesForDb<RunAccountArgs> & {
address: Address;
}
Run[] = await const client: NosanaClientclient.NosanaClient.jobs: JobsProgramjobs.JobsProgram.runs(filters?: {
node?: Address;
job?: Address;
}): Promise<Run[]>
Fetch all run accountsruns({ job?: Address | undefinedjob: address<"job-address">(putativeAddress: "job-address"): Address<"job-address">Combines _asserting_ that a string is an address with _coercing_ it to the
{@link
Address
}
type.
It's most useful with untrusted input.address('job-address') });
// Get all runs on a specific node
const const nodeRuns: Run[]nodeRuns: type Run = ConvertTypesForDb<RunAccountArgs> & {
address: Address;
}
Run[] = await const client: NosanaClientclient.NosanaClient.jobs: JobsProgramjobs.JobsProgram.runs(filters?: {
node?: Address;
job?: Address;
}): Promise<Run[]>
Fetch all run accountsruns({ node?: Address | undefinednode: address<"node-address">(putativeAddress: "node-address"): Address<"node-address">Combines _asserting_ that a string is an address with _coercing_ it to the
{@link
Address
}
type.
It's most useful with untrusted input.address('node-address') });Query All Markets
async markets(): Promise<Market[]>Fetch all market accounts.
import { type Market = Omit<ConvertTypesForDb<MarketAccountArgs>, "queueType"> & {
address: Address;
queueType: MarketQueueType;
}
Market } from '@nosana/kit';
const const markets: Market[]markets: type Market = Omit<ConvertTypesForDb<MarketAccountArgs>, "queueType"> & {
address: Address;
queueType: MarketQueueType;
}
Market[] = await const client: NosanaClientclient.NosanaClient.jobs: JobsProgramjobs.JobsProgram.markets(): Promise<Market[]>Fetch all market accountsmarkets();Creating Jobs
Post a Job
async post(params: {
market: Address,
timeout: number | bigint,
ipfsHash: string,
node?: Address
}): Promise<Instruction>Create a list instruction for posting a job to a market. Returns an instruction that must be submitted to the network.
The ipfsHash parameter should contain the IPFS hash of your job definition, which describes what container to run, what commands to execute, and what resources are needed.
import { function address<TAddress extends string = string>(putativeAddress: TAddress): Address<TAddress>Combines _asserting_ that a string is an address with _coercing_ it to the
{@link
Address
}
type.
It's most useful with untrusted input.address } from '@nosana/kit';
import type { interface Instruction<TProgramAddress extends string = string, TAccounts extends readonly (AccountLookupMeta | AccountMeta)[] = readonly (AccountLookupMeta<string, string> | AccountMeta<string>)[]>An instruction destined for a given program.Instruction } from '@solana/kit';
// Set wallet first
const client: NosanaClientclient.NosanaClient.wallet: Wallet | undefinedThe wallet. Must be a Wallet (supports both message and transaction signing).
Set this property directly to configure the wallet.wallet = const yourWallet: 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[]>;
}>
yourWallet;
// Create job instruction
const const instruction: Instruction<string, readonly (AccountLookupMeta<string, string> | AccountMeta<string>)[]>instruction: interface Instruction<TProgramAddress extends string = string, TAccounts extends readonly (AccountLookupMeta | AccountMeta)[] = readonly (AccountLookupMeta<string, string> | AccountMeta<string>)[]>An instruction destined for a given program.Instruction = await const client: NosanaClientclient.NosanaClient.jobs: JobsProgramjobs.JobsProgram.post(params: ListParams | AssignParams): Promise<ListInstruction | AssignInstruction>Post a new job to the marketplace (can list or assign based on params)post({
market: Address<"market-address">market: address<"market-address">(putativeAddress: "market-address"): Address<"market-address">Combines _asserting_ that a string is an address with _coercing_ it to the
{@link
Address
}
type.
It's most useful with untrusted input.address('market-address'),
timeout: numbertimeout: 3600, // Timeout in seconds
ipfsHash: stringipfsHash: 'QmXxx...', // IPFS CID of job definition
node: Addressnode: address<"node-address">(putativeAddress: "node-address"): Address<"node-address">Combines _asserting_ that a string is an address with _coercing_ it to the
{@link
Address
}
type.
It's most useful with untrusted input.address('node-address'), // Optional: target specific node
});
// Submit the instruction
await const client: NosanaClientclient.NosanaClient.solana: SolanaServicesolana.SolanaService.buildSignAndSend(instructions: Instruction | Instruction[], options?: {
feePayer?: TransactionSigner;
commitment?: "processed" | "confirmed" | "finalized";
estimateComputeUnits?: boolean;
}): Promise<Signature>
buildSignAndSend(const instruction: Instruction<string, readonly (AccountLookupMeta<string, string> | AccountMeta<string>)[]>instruction);Market Settings
A market can be protected with a project access key: an NFT collection whose holders are the only projects allowed to post jobs. The settings are a separate account next to the market, so an open market has no settings account and marketSettings returns null.
async setMarketSettings(params: { market: Address, projectAccessKey: Address }): Promise<Instruction>
async closeMarketSettings(params: { market: Address }): Promise<Instruction>
async marketSettings(market: Address): Promise<MarketSettings | null>Only the market authority can set or close the settings. Posting to a protected market needs no extra parameters: post, list and assign look up the wallet's NFT from the access key collection and throw when the wallet holds none.
Real-time Monitoring
The SDK provides monitoring methods using async iterators for real-time account updates via WebSocket. See the Examples section for detailed monitoring examples.
Account Types
Job
type Job = {
address: Address;
state: JobState; // QUEUED | RUNNING | COMPLETED | STOPPED
ipfsJob: string | null; // IPFS CID of job definition
ipfsResult: string | null; // IPFS CID of job result
market: Address;
node: Address;
payer: Address;
project: Address;
price: number;
timeStart: number; // Unix timestamp
timeEnd: number; // Unix timestamp
timeout: number; // Seconds
};
enum JobState {
QUEUED = 0,
RUNNING = 1,
COMPLETED = 2,
STOPPED = 3,
}Run
type Run = {
address: Address;
job: Address; // Associated job
node: Address; // Node executing the job
time: number; // Unix timestamp
};Market
type Market = {
address: Address;
queueType: MarketQueueType; // JOB_QUEUE | NODE_QUEUE
jobPrice: number;
nodeStakeMinimum: number;
jobTimeout: number;
jobType: number;
project: Address;
// ... additional fields
};
enum MarketQueueType {
JOB_QUEUE = 0,
NODE_QUEUE = 1,
}