Nosana Jobs
Projects can post pipeline jobs through the Nosana Jobs program. It lets nodes in the Nosana Network earn tokens by doing those jobs.
Program Information
| Info | Description |
|---|---|
| Type | Solana Program |
| Source Code | GitHub |
| Build Status | Anchor Verified |
| Accounts | 4 |
| Instructions | 19 |
| Types | 3 |
| Errors | 19 |
| Domain | nosana-jobs.sol |
| Address | nosJhNRqr2bc9g1nfGDcXXTXvYUmxD4cVwy2pMWhrYM |
Instructions
A number of 19 instruction are defined in the Nosana Jobs program.
To load the program with Anchor.
const programId = new PublicKey('nosJhNRqr2bc9g1nfGDcXXTXvYUmxD4cVwy2pMWhrYM');
const idl = await Program.fetchIdl(programId.toString());
const program = new Program(idl, programId);Open
Initialize a MarketAccount and VaultAccount.
Account Info
The following 8 account addresses should be provided when invoking this instruction.
| Name | Type | Description |
|---|---|---|
mint | The token Mint address for this instruction. | |
market | The MarketAccount address. | |
vault | The VaultAccount address. | |
authority | The signing authority of the program invocation. | |
accessKey | The Node Access Key address. | |
rent | The official Solana rent address. Responsible for lamports. | |
systemProgram | The official Solana system program address. Responsible for system CPIs. | |
tokenProgram | The official SPL Token Program address. Responsible for token CPIs. |
Arguments
The following 5 arguments should also be provided when invoking this instruction.
| Name | Type | Size | Offset | Description |
|---|---|---|---|---|
jobExpiration | i64 | 16 | 0 | The expiration time in seconds for jobs. |
jobPrice | u64 | 8 | 16 | The price for jobs in this market. |
jobTimeout | i64 | 16 | 24 | The timeout time in seconds for jobs. |
jobType | u8 | 1 | 40 | The JobType number. |
nodeXnosMinimum | u128 | 16 | 41 | The amount of xNOS a node needs to qualify for a market. |
Solana Dispatch ID
The Solana dispatch ID for the Open Instruction is e4dc9b47c7bd3c2d, which can also be expressed as an 8 byte discriminator:
[228,220,155,71,199,189,60,45]Example with Anchor
To invoke the Open Instruction with Anchor TS.
let tx = await program.methods
.open(
jobExpiration, // type: i64
jobPrice, // type: u64
jobTimeout, // type: i64
jobType, // type: u8
nodeXnosMinimum, // type: u128
)
.accounts({
mint, // 𐄂 writable, 𐄂 signer
market, // ✓ writable, ✓ signer
vault, // ✓ writable, 𐄂 signer
authority, // ✓ writable, ✓ signer
accessKey, // 𐄂 writable, 𐄂 signer
rent, // 𐄂 writable, 𐄂 signer
systemProgram, // 𐄂 writable, 𐄂 signer
tokenProgram, // 𐄂 writable, 𐄂 signer
})
.signers([marketKey, authorityKey])
.rpc();Accounts
A number of 4 accounts make up for the Nosana Jobs Program's state.
Market Account
The MarketAccount struct holds all the information about jobs and the nodes queue. The total size of this account is 10,211 bytes.
| Name | Type | Size | Offset | Description |
|---|---|---|---|---|
authority | publicKey | 32 | 8 | The signing authority of the program invocation. |
jobExpiration | i64 | 16 | 40 | The expiration time in seconds for jobs. |
jobPrice | u64 | 8 | 56 | The price for jobs in this market. |
jobTimeout | i64 | 16 | 64 | The timeout time in seconds for jobs. |
jobType | u8 | 1 | 80 | The JobType number. |
vault | publicKey | 32 | 81 | The VaultAccount address. |
vaultBump | u8 | 1 | 113 | The bump for the VaultAccount. |
nodeAccessKey | publicKey | 32 | 114 | The NFT collection address of an NFT that the node holds, in order to access this market. |
nodeXnosMinimum | u128 | 16 | 146 | The amount of xNOS a node needs to qualify for a market. |
queueType | u8 | 1 | 162 | The QueueType of the queue. Either Nodes or Jobs. |
queue | Vec<publicKey> | 10048 | 163 | The queue of order in the market. |
Anchor Account Discriminator
The first 8 bytes, also known as Anchor's 8 byte discriminator, for the Market Account are c94ebbe1f0c6c9fb, which can also be expressed in byte array:
[201,78,187,225,240,198,201,251]Types
A number of 3 type variants are defined in the Nosana Jobs Program's state.
Queue Type
The QueueType describes the type of queue
A number of 3 variants are defined in this enum:
| Name | Number |
|---|---|
Job | 0 |
Node | 1 |
Empty | 2 |
Diagram
Instruction Diagram
Queue Diagrams
Below a representation of the functioning for the different QueueTypes.