@nosana/kit 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitlab-ci.yml +6 -5
- package/dist/config/defaultConfigs.js +15 -18
- package/dist/config/index.js +3 -19
- package/dist/config/types.d.ts +1 -3
- package/dist/config/types.js +4 -7
- package/dist/config/utils.js +8 -13
- package/dist/errors/NosanaError.d.ts +1 -0
- package/dist/errors/NosanaError.js +3 -6
- package/dist/generated_clients/jobs/accounts/index.js +3 -19
- package/dist/generated_clients/jobs/accounts/jobAccount.js +46 -59
- package/dist/generated_clients/jobs/accounts/marketAccount.js +45 -57
- package/dist/generated_clients/jobs/accounts/runAccount.js +36 -49
- package/dist/generated_clients/jobs/errors/index.js +1 -17
- package/dist/generated_clients/jobs/errors/nosanaJobs.js +43 -48
- package/dist/generated_clients/jobs/index.js +5 -21
- package/dist/generated_clients/jobs/instructions/claim.js +17 -26
- package/dist/generated_clients/jobs/instructions/clean.js +17 -26
- package/dist/generated_clients/jobs/instructions/cleanAdmin.js +17 -26
- package/dist/generated_clients/jobs/instructions/close.js +17 -26
- package/dist/generated_clients/jobs/instructions/closeAdmin.js +17 -26
- package/dist/generated_clients/jobs/instructions/complete.js +21 -30
- package/dist/generated_clients/jobs/instructions/delist.js +17 -26
- package/dist/generated_clients/jobs/instructions/end.js +17 -26
- package/dist/generated_clients/jobs/instructions/extend.js +21 -30
- package/dist/generated_clients/jobs/instructions/finish.js +21 -30
- package/dist/generated_clients/jobs/instructions/index.js +18 -34
- package/dist/generated_clients/jobs/instructions/list.js +23 -32
- package/dist/generated_clients/jobs/instructions/open.js +29 -38
- package/dist/generated_clients/jobs/instructions/quit.js +17 -26
- package/dist/generated_clients/jobs/instructions/quitAdmin.js +17 -26
- package/dist/generated_clients/jobs/instructions/recover.js +17 -26
- package/dist/generated_clients/jobs/instructions/stop.js +17 -26
- package/dist/generated_clients/jobs/instructions/update.js +29 -38
- package/dist/generated_clients/jobs/instructions/work.js +17 -26
- package/dist/generated_clients/jobs/programs/index.js +1 -17
- package/dist/generated_clients/jobs/programs/nosanaJobs.js +29 -34
- package/dist/generated_clients/jobs/shared/index.js +13 -21
- package/dist/generated_clients/jobs/types/index.js +3 -19
- package/dist/generated_clients/jobs/types/jobState.js +9 -15
- package/dist/generated_clients/jobs/types/jobType.js +9 -15
- package/dist/generated_clients/jobs/types/queueType.js +9 -15
- package/dist/index.d.ts +5 -1
- package/dist/index.js +149 -35
- package/dist/ipfs/IPFS.js +5 -12
- package/dist/logger/Logger.js +1 -5
- package/dist/programs/BaseProgram.js +1 -5
- package/dist/programs/JobsProgram.d.ts +2 -3
- package/dist/programs/JobsProgram.js +35 -99
- package/dist/solana/SolanaUtils.d.ts +15 -1
- package/dist/solana/SolanaUtils.js +81 -14
- package/dist/utils/index.js +1 -4
- package/examples/browser/.gitlab-ci.yml +78 -0
- package/examples/browser/FEATURES.md +141 -0
- package/examples/browser/QUICK_START.md +76 -0
- package/examples/browser/README.md +182 -0
- package/examples/browser/app.vue +1840 -0
- package/examples/browser/assets/css/main.css +7 -0
- package/examples/browser/nuxt.config.ts +24 -0
- package/examples/browser/package-lock.json +11855 -0
- package/examples/browser/package.json +31 -0
- package/examples/browser/public/favicon.ico +0 -0
- package/examples/browser/public/robots.txt +2 -0
- package/examples/browser/start.sh +38 -0
- package/examples/browser/tailwind.config.js +26 -0
- package/examples/node/README.md +146 -0
- package/examples/node/example-keypair.json +1 -0
- package/examples/node/package-lock.json +500 -156
- package/examples/node/package.json +5 -3
- package/examples/node/post-job.ts +160 -0
- package/examples/node/set-wallet.ts +87 -0
- package/package.json +3 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* This code was AUTOGENERATED using the codama library.
|
|
4
3
|
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
@@ -6,80 +5,76 @@
|
|
|
6
5
|
*
|
|
7
6
|
* @see https://github.com/codama-idl/codama
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
exports.getNosanaJobsErrorMessage = getNosanaJobsErrorMessage;
|
|
12
|
-
exports.isNosanaJobsError = isNosanaJobsError;
|
|
13
|
-
const kit_1 = require("@solana/kit");
|
|
14
|
-
const programs_1 = require("../programs");
|
|
8
|
+
import { isProgramError, } from '@solana/kit';
|
|
9
|
+
import { NOSANA_JOBS_PROGRAM_ADDRESS } from '../programs';
|
|
15
10
|
/** InvalidMarketAccount: This market account is not valid. */
|
|
16
|
-
|
|
11
|
+
export const NOSANA_JOBS_ERROR__INVALID_MARKET_ACCOUNT = 0x1770; // 6000
|
|
17
12
|
/** MarketInWrongState: This market does not have the right status. */
|
|
18
|
-
|
|
13
|
+
export const NOSANA_JOBS_ERROR__MARKET_IN_WRONG_STATE = 0x1771; // 6001
|
|
19
14
|
/** NotInMarketQueue: Account cannot be find account in market queue. */
|
|
20
|
-
|
|
15
|
+
export const NOSANA_JOBS_ERROR__NOT_IN_MARKET_QUEUE = 0x1772; // 6002
|
|
21
16
|
/** InvalidJobAccount: This job account is not valid. */
|
|
22
|
-
|
|
17
|
+
export const NOSANA_JOBS_ERROR__INVALID_JOB_ACCOUNT = 0x1773; // 6003
|
|
23
18
|
/** JobInWrongState: This job does not have the right status. */
|
|
24
|
-
|
|
19
|
+
export const NOSANA_JOBS_ERROR__JOB_IN_WRONG_STATE = 0x1774; // 6004
|
|
25
20
|
/** JobNotExpired: The job has not yet expired. */
|
|
26
|
-
|
|
21
|
+
export const NOSANA_JOBS_ERROR__JOB_NOT_EXPIRED = 0x1775; // 6005
|
|
27
22
|
/** JobResultNull: The job result can not be null. */
|
|
28
|
-
|
|
23
|
+
export const NOSANA_JOBS_ERROR__JOB_RESULT_NULL = 0x1776; // 6006
|
|
29
24
|
/** JobInvalidProject: The job has a different project owner. */
|
|
30
|
-
|
|
25
|
+
export const NOSANA_JOBS_ERROR__JOB_INVALID_PROJECT = 0x1777; // 6007
|
|
31
26
|
/** JobTimeoutNotGreater: The new job timeout should be larger than the current one. */
|
|
32
|
-
|
|
27
|
+
export const NOSANA_JOBS_ERROR__JOB_TIMEOUT_NOT_GREATER = 0x1778; // 6008
|
|
33
28
|
/** JobInvalidRunAccount: The run account does not match the job. */
|
|
34
|
-
|
|
29
|
+
export const NOSANA_JOBS_ERROR__JOB_INVALID_RUN_ACCOUNT = 0x1779; // 6009
|
|
35
30
|
/** JobResultsAlreadySet: The job results are already set. */
|
|
36
|
-
|
|
31
|
+
export const NOSANA_JOBS_ERROR__JOB_RESULTS_ALREADY_SET = 0x177a; // 6010
|
|
37
32
|
/** NodeQueueDoesNotMatch: This node queue does not match. */
|
|
38
|
-
|
|
33
|
+
export const NOSANA_JOBS_ERROR__NODE_QUEUE_DOES_NOT_MATCH = 0x177b; // 6011
|
|
39
34
|
/** NodeStakeUnauthorized: This node is not authorizing this stake. */
|
|
40
|
-
|
|
35
|
+
export const NOSANA_JOBS_ERROR__NODE_STAKE_UNAUTHORIZED = 0x177c; // 6012
|
|
41
36
|
/** NodeNotEnoughStake: This node has not staked enough tokens. */
|
|
42
|
-
|
|
37
|
+
export const NOSANA_JOBS_ERROR__NODE_NOT_ENOUGH_STAKE = 0x177d; // 6013
|
|
43
38
|
/** NodeAlreadyQueued: This node is already present in the queue. */
|
|
44
|
-
|
|
39
|
+
export const NOSANA_JOBS_ERROR__NODE_ALREADY_QUEUED = 0x177e; // 6014
|
|
45
40
|
/** NodeNftWrongMetadata: This metadata does not have the correct address. */
|
|
46
|
-
|
|
41
|
+
export const NOSANA_JOBS_ERROR__NODE_NFT_WRONG_METADATA = 0x177f; // 6015
|
|
47
42
|
/** NodeNftWrongOwner: This NFT is not owned by this node. */
|
|
48
|
-
|
|
43
|
+
export const NOSANA_JOBS_ERROR__NODE_NFT_WRONG_OWNER = 0x1780; // 6016
|
|
49
44
|
/** NodeNftInvalidAmount: Access NFT amount cannot be 0. */
|
|
50
|
-
|
|
45
|
+
export const NOSANA_JOBS_ERROR__NODE_NFT_INVALID_AMOUNT = 0x1781; // 6017
|
|
51
46
|
/** NodeKeyInvalidCollection: This access key does not belong to a verified collection. */
|
|
52
|
-
|
|
47
|
+
export const NOSANA_JOBS_ERROR__NODE_KEY_INVALID_COLLECTION = 0x1782; // 6018
|
|
53
48
|
let nosanaJobsErrorMessages;
|
|
54
49
|
if (process.env.NODE_ENV !== 'production') {
|
|
55
50
|
nosanaJobsErrorMessages = {
|
|
56
|
-
[
|
|
57
|
-
[
|
|
58
|
-
[
|
|
59
|
-
[
|
|
60
|
-
[
|
|
61
|
-
[
|
|
62
|
-
[
|
|
63
|
-
[
|
|
64
|
-
[
|
|
65
|
-
[
|
|
66
|
-
[
|
|
67
|
-
[
|
|
68
|
-
[
|
|
69
|
-
[
|
|
70
|
-
[
|
|
71
|
-
[
|
|
72
|
-
[
|
|
73
|
-
[
|
|
74
|
-
[
|
|
51
|
+
[NOSANA_JOBS_ERROR__INVALID_JOB_ACCOUNT]: `This job account is not valid.`,
|
|
52
|
+
[NOSANA_JOBS_ERROR__INVALID_MARKET_ACCOUNT]: `This market account is not valid.`,
|
|
53
|
+
[NOSANA_JOBS_ERROR__JOB_INVALID_PROJECT]: `The job has a different project owner.`,
|
|
54
|
+
[NOSANA_JOBS_ERROR__JOB_INVALID_RUN_ACCOUNT]: `The run account does not match the job.`,
|
|
55
|
+
[NOSANA_JOBS_ERROR__JOB_IN_WRONG_STATE]: `This job does not have the right status.`,
|
|
56
|
+
[NOSANA_JOBS_ERROR__JOB_NOT_EXPIRED]: `The job has not yet expired.`,
|
|
57
|
+
[NOSANA_JOBS_ERROR__JOB_RESULT_NULL]: `The job result can not be null.`,
|
|
58
|
+
[NOSANA_JOBS_ERROR__JOB_RESULTS_ALREADY_SET]: `The job results are already set.`,
|
|
59
|
+
[NOSANA_JOBS_ERROR__JOB_TIMEOUT_NOT_GREATER]: `The new job timeout should be larger than the current one.`,
|
|
60
|
+
[NOSANA_JOBS_ERROR__MARKET_IN_WRONG_STATE]: `This market does not have the right status.`,
|
|
61
|
+
[NOSANA_JOBS_ERROR__NODE_ALREADY_QUEUED]: `This node is already present in the queue.`,
|
|
62
|
+
[NOSANA_JOBS_ERROR__NODE_KEY_INVALID_COLLECTION]: `This access key does not belong to a verified collection.`,
|
|
63
|
+
[NOSANA_JOBS_ERROR__NODE_NFT_INVALID_AMOUNT]: `Access NFT amount cannot be 0.`,
|
|
64
|
+
[NOSANA_JOBS_ERROR__NODE_NFT_WRONG_METADATA]: `This metadata does not have the correct address.`,
|
|
65
|
+
[NOSANA_JOBS_ERROR__NODE_NFT_WRONG_OWNER]: `This NFT is not owned by this node.`,
|
|
66
|
+
[NOSANA_JOBS_ERROR__NODE_NOT_ENOUGH_STAKE]: `This node has not staked enough tokens.`,
|
|
67
|
+
[NOSANA_JOBS_ERROR__NODE_QUEUE_DOES_NOT_MATCH]: `This node queue does not match.`,
|
|
68
|
+
[NOSANA_JOBS_ERROR__NODE_STAKE_UNAUTHORIZED]: `This node is not authorizing this stake.`,
|
|
69
|
+
[NOSANA_JOBS_ERROR__NOT_IN_MARKET_QUEUE]: `Account cannot be find account in market queue.`,
|
|
75
70
|
};
|
|
76
71
|
}
|
|
77
|
-
function getNosanaJobsErrorMessage(code) {
|
|
72
|
+
export function getNosanaJobsErrorMessage(code) {
|
|
78
73
|
if (process.env.NODE_ENV !== 'production') {
|
|
79
74
|
return nosanaJobsErrorMessages[code];
|
|
80
75
|
}
|
|
81
76
|
return 'Error message not available in production bundles.';
|
|
82
77
|
}
|
|
83
|
-
function isNosanaJobsError(error, transactionMessage, code) {
|
|
84
|
-
return
|
|
78
|
+
export function isNosanaJobsError(error, transactionMessage, code) {
|
|
79
|
+
return isProgramError(error, transactionMessage, NOSANA_JOBS_PROGRAM_ADDRESS, code);
|
|
85
80
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* This code was AUTOGENERATED using the codama library.
|
|
4
3
|
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
@@ -6,23 +5,8 @@
|
|
|
6
5
|
*
|
|
7
6
|
* @see https://github.com/codama-idl/codama
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
Object.defineProperty(o, k2, desc);
|
|
16
|
-
}) : (function(o, m, k, k2) {
|
|
17
|
-
if (k2 === undefined) k2 = k;
|
|
18
|
-
o[k2] = m[k];
|
|
19
|
-
}));
|
|
20
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
21
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
22
|
-
};
|
|
23
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
__exportStar(require("./accounts"), exports);
|
|
25
|
-
__exportStar(require("./errors"), exports);
|
|
26
|
-
__exportStar(require("./instructions"), exports);
|
|
27
|
-
__exportStar(require("./programs"), exports);
|
|
28
|
-
__exportStar(require("./types"), exports);
|
|
8
|
+
export * from './accounts';
|
|
9
|
+
export * from './errors';
|
|
10
|
+
export * from './instructions';
|
|
11
|
+
export * from './programs';
|
|
12
|
+
export * from './types';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* This code was AUTOGENERATED using the codama library.
|
|
4
3
|
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
@@ -6,37 +5,29 @@
|
|
|
6
5
|
*
|
|
7
6
|
* @see https://github.com/codama-idl/codama
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports.getClaimInstructionDataDecoder = getClaimInstructionDataDecoder;
|
|
14
|
-
exports.getClaimInstructionDataCodec = getClaimInstructionDataCodec;
|
|
15
|
-
exports.getClaimInstruction = getClaimInstruction;
|
|
16
|
-
exports.parseClaimInstruction = parseClaimInstruction;
|
|
17
|
-
const kit_1 = require("@solana/kit");
|
|
18
|
-
const programs_1 = require("../programs");
|
|
19
|
-
const shared_1 = require("../shared");
|
|
20
|
-
exports.CLAIM_DISCRIMINATOR = new Uint8Array([
|
|
8
|
+
import { combineCodec, fixDecoderSize, fixEncoderSize, getBytesDecoder, getBytesEncoder, getStructDecoder, getStructEncoder, transformEncoder, } from '@solana/kit';
|
|
9
|
+
import { NOSANA_JOBS_PROGRAM_ADDRESS } from '../programs';
|
|
10
|
+
import { getAccountMetaFactory } from '../shared';
|
|
11
|
+
export const CLAIM_DISCRIMINATOR = new Uint8Array([
|
|
21
12
|
62, 198, 214, 193, 213, 159, 108, 210,
|
|
22
13
|
]);
|
|
23
|
-
function getClaimDiscriminatorBytes() {
|
|
24
|
-
return
|
|
14
|
+
export function getClaimDiscriminatorBytes() {
|
|
15
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(CLAIM_DISCRIMINATOR);
|
|
25
16
|
}
|
|
26
|
-
function getClaimInstructionDataEncoder() {
|
|
27
|
-
return
|
|
17
|
+
export function getClaimInstructionDataEncoder() {
|
|
18
|
+
return transformEncoder(getStructEncoder([['discriminator', fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({ ...value, discriminator: CLAIM_DISCRIMINATOR }));
|
|
28
19
|
}
|
|
29
|
-
function getClaimInstructionDataDecoder() {
|
|
30
|
-
return
|
|
31
|
-
['discriminator',
|
|
20
|
+
export function getClaimInstructionDataDecoder() {
|
|
21
|
+
return getStructDecoder([
|
|
22
|
+
['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
|
|
32
23
|
]);
|
|
33
24
|
}
|
|
34
|
-
function getClaimInstructionDataCodec() {
|
|
35
|
-
return
|
|
25
|
+
export function getClaimInstructionDataCodec() {
|
|
26
|
+
return combineCodec(getClaimInstructionDataEncoder(), getClaimInstructionDataDecoder());
|
|
36
27
|
}
|
|
37
|
-
function getClaimInstruction(input, config) {
|
|
28
|
+
export function getClaimInstruction(input, config) {
|
|
38
29
|
// Program address.
|
|
39
|
-
const programAddress = config?.programAddress ??
|
|
30
|
+
const programAddress = config?.programAddress ?? NOSANA_JOBS_PROGRAM_ADDRESS;
|
|
40
31
|
// Original accounts.
|
|
41
32
|
const originalAccounts = {
|
|
42
33
|
job: { value: input.job ?? null, isWritable: true },
|
|
@@ -55,7 +46,7 @@ function getClaimInstruction(input, config) {
|
|
|
55
46
|
accounts.systemProgram.value =
|
|
56
47
|
'11111111111111111111111111111111';
|
|
57
48
|
}
|
|
58
|
-
const getAccountMeta =
|
|
49
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
|
|
59
50
|
const instruction = {
|
|
60
51
|
accounts: [
|
|
61
52
|
getAccountMeta(accounts.job),
|
|
@@ -73,7 +64,7 @@ function getClaimInstruction(input, config) {
|
|
|
73
64
|
};
|
|
74
65
|
return instruction;
|
|
75
66
|
}
|
|
76
|
-
function parseClaimInstruction(instruction) {
|
|
67
|
+
export function parseClaimInstruction(instruction) {
|
|
77
68
|
if (instruction.accounts.length < 9) {
|
|
78
69
|
// TODO: Coded error.
|
|
79
70
|
throw new Error('Not enough accounts');
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* This code was AUTOGENERATED using the codama library.
|
|
4
3
|
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
@@ -6,37 +5,29 @@
|
|
|
6
5
|
*
|
|
7
6
|
* @see https://github.com/codama-idl/codama
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports.getCleanInstructionDataDecoder = getCleanInstructionDataDecoder;
|
|
14
|
-
exports.getCleanInstructionDataCodec = getCleanInstructionDataCodec;
|
|
15
|
-
exports.getCleanInstruction = getCleanInstruction;
|
|
16
|
-
exports.parseCleanInstruction = parseCleanInstruction;
|
|
17
|
-
const kit_1 = require("@solana/kit");
|
|
18
|
-
const programs_1 = require("../programs");
|
|
19
|
-
const shared_1 = require("../shared");
|
|
20
|
-
exports.CLEAN_DISCRIMINATOR = new Uint8Array([
|
|
8
|
+
import { combineCodec, fixDecoderSize, fixEncoderSize, getBytesDecoder, getBytesEncoder, getStructDecoder, getStructEncoder, transformEncoder, } from '@solana/kit';
|
|
9
|
+
import { NOSANA_JOBS_PROGRAM_ADDRESS } from '../programs';
|
|
10
|
+
import { getAccountMetaFactory } from '../shared';
|
|
11
|
+
export const CLEAN_DISCRIMINATOR = new Uint8Array([
|
|
21
12
|
250, 191, 56, 128, 150, 251, 1, 103,
|
|
22
13
|
]);
|
|
23
|
-
function getCleanDiscriminatorBytes() {
|
|
24
|
-
return
|
|
14
|
+
export function getCleanDiscriminatorBytes() {
|
|
15
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(CLEAN_DISCRIMINATOR);
|
|
25
16
|
}
|
|
26
|
-
function getCleanInstructionDataEncoder() {
|
|
27
|
-
return
|
|
17
|
+
export function getCleanInstructionDataEncoder() {
|
|
18
|
+
return transformEncoder(getStructEncoder([['discriminator', fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({ ...value, discriminator: CLEAN_DISCRIMINATOR }));
|
|
28
19
|
}
|
|
29
|
-
function getCleanInstructionDataDecoder() {
|
|
30
|
-
return
|
|
31
|
-
['discriminator',
|
|
20
|
+
export function getCleanInstructionDataDecoder() {
|
|
21
|
+
return getStructDecoder([
|
|
22
|
+
['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
|
|
32
23
|
]);
|
|
33
24
|
}
|
|
34
|
-
function getCleanInstructionDataCodec() {
|
|
35
|
-
return
|
|
25
|
+
export function getCleanInstructionDataCodec() {
|
|
26
|
+
return combineCodec(getCleanInstructionDataEncoder(), getCleanInstructionDataDecoder());
|
|
36
27
|
}
|
|
37
|
-
function getCleanInstruction(input, config) {
|
|
28
|
+
export function getCleanInstruction(input, config) {
|
|
38
29
|
// Program address.
|
|
39
|
-
const programAddress = config?.programAddress ??
|
|
30
|
+
const programAddress = config?.programAddress ?? NOSANA_JOBS_PROGRAM_ADDRESS;
|
|
40
31
|
// Original accounts.
|
|
41
32
|
const originalAccounts = {
|
|
42
33
|
job: { value: input.job ?? null, isWritable: true },
|
|
@@ -44,7 +35,7 @@ function getCleanInstruction(input, config) {
|
|
|
44
35
|
payer: { value: input.payer ?? null, isWritable: true },
|
|
45
36
|
};
|
|
46
37
|
const accounts = originalAccounts;
|
|
47
|
-
const getAccountMeta =
|
|
38
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
|
|
48
39
|
const instruction = {
|
|
49
40
|
accounts: [
|
|
50
41
|
getAccountMeta(accounts.job),
|
|
@@ -56,7 +47,7 @@ function getCleanInstruction(input, config) {
|
|
|
56
47
|
};
|
|
57
48
|
return instruction;
|
|
58
49
|
}
|
|
59
|
-
function parseCleanInstruction(instruction) {
|
|
50
|
+
export function parseCleanInstruction(instruction) {
|
|
60
51
|
if (instruction.accounts.length < 3) {
|
|
61
52
|
// TODO: Coded error.
|
|
62
53
|
throw new Error('Not enough accounts');
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* This code was AUTOGENERATED using the codama library.
|
|
4
3
|
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
@@ -6,37 +5,29 @@
|
|
|
6
5
|
*
|
|
7
6
|
* @see https://github.com/codama-idl/codama
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports.getCleanAdminInstructionDataDecoder = getCleanAdminInstructionDataDecoder;
|
|
14
|
-
exports.getCleanAdminInstructionDataCodec = getCleanAdminInstructionDataCodec;
|
|
15
|
-
exports.getCleanAdminInstruction = getCleanAdminInstruction;
|
|
16
|
-
exports.parseCleanAdminInstruction = parseCleanAdminInstruction;
|
|
17
|
-
const kit_1 = require("@solana/kit");
|
|
18
|
-
const programs_1 = require("../programs");
|
|
19
|
-
const shared_1 = require("../shared");
|
|
20
|
-
exports.CLEAN_ADMIN_DISCRIMINATOR = new Uint8Array([
|
|
8
|
+
import { combineCodec, fixDecoderSize, fixEncoderSize, getBytesDecoder, getBytesEncoder, getStructDecoder, getStructEncoder, transformEncoder, } from '@solana/kit';
|
|
9
|
+
import { NOSANA_JOBS_PROGRAM_ADDRESS } from '../programs';
|
|
10
|
+
import { getAccountMetaFactory } from '../shared';
|
|
11
|
+
export const CLEAN_ADMIN_DISCRIMINATOR = new Uint8Array([
|
|
21
12
|
245, 90, 188, 68, 253, 235, 171, 105,
|
|
22
13
|
]);
|
|
23
|
-
function getCleanAdminDiscriminatorBytes() {
|
|
24
|
-
return
|
|
14
|
+
export function getCleanAdminDiscriminatorBytes() {
|
|
15
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(CLEAN_ADMIN_DISCRIMINATOR);
|
|
25
16
|
}
|
|
26
|
-
function getCleanAdminInstructionDataEncoder() {
|
|
27
|
-
return
|
|
17
|
+
export function getCleanAdminInstructionDataEncoder() {
|
|
18
|
+
return transformEncoder(getStructEncoder([['discriminator', fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({ ...value, discriminator: CLEAN_ADMIN_DISCRIMINATOR }));
|
|
28
19
|
}
|
|
29
|
-
function getCleanAdminInstructionDataDecoder() {
|
|
30
|
-
return
|
|
31
|
-
['discriminator',
|
|
20
|
+
export function getCleanAdminInstructionDataDecoder() {
|
|
21
|
+
return getStructDecoder([
|
|
22
|
+
['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
|
|
32
23
|
]);
|
|
33
24
|
}
|
|
34
|
-
function getCleanAdminInstructionDataCodec() {
|
|
35
|
-
return
|
|
25
|
+
export function getCleanAdminInstructionDataCodec() {
|
|
26
|
+
return combineCodec(getCleanAdminInstructionDataEncoder(), getCleanAdminInstructionDataDecoder());
|
|
36
27
|
}
|
|
37
|
-
function getCleanAdminInstruction(input, config) {
|
|
28
|
+
export function getCleanAdminInstruction(input, config) {
|
|
38
29
|
// Program address.
|
|
39
|
-
const programAddress = config?.programAddress ??
|
|
30
|
+
const programAddress = config?.programAddress ?? NOSANA_JOBS_PROGRAM_ADDRESS;
|
|
40
31
|
// Original accounts.
|
|
41
32
|
const originalAccounts = {
|
|
42
33
|
job: { value: input.job ?? null, isWritable: true },
|
|
@@ -44,7 +35,7 @@ function getCleanAdminInstruction(input, config) {
|
|
|
44
35
|
authority: { value: input.authority ?? null, isWritable: false },
|
|
45
36
|
};
|
|
46
37
|
const accounts = originalAccounts;
|
|
47
|
-
const getAccountMeta =
|
|
38
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
|
|
48
39
|
const instruction = {
|
|
49
40
|
accounts: [
|
|
50
41
|
getAccountMeta(accounts.job),
|
|
@@ -56,7 +47,7 @@ function getCleanAdminInstruction(input, config) {
|
|
|
56
47
|
};
|
|
57
48
|
return instruction;
|
|
58
49
|
}
|
|
59
|
-
function parseCleanAdminInstruction(instruction) {
|
|
50
|
+
export function parseCleanAdminInstruction(instruction) {
|
|
60
51
|
if (instruction.accounts.length < 3) {
|
|
61
52
|
// TODO: Coded error.
|
|
62
53
|
throw new Error('Not enough accounts');
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* This code was AUTOGENERATED using the codama library.
|
|
4
3
|
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
@@ -6,37 +5,29 @@
|
|
|
6
5
|
*
|
|
7
6
|
* @see https://github.com/codama-idl/codama
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports.getCloseInstructionDataDecoder = getCloseInstructionDataDecoder;
|
|
14
|
-
exports.getCloseInstructionDataCodec = getCloseInstructionDataCodec;
|
|
15
|
-
exports.getCloseInstruction = getCloseInstruction;
|
|
16
|
-
exports.parseCloseInstruction = parseCloseInstruction;
|
|
17
|
-
const kit_1 = require("@solana/kit");
|
|
18
|
-
const programs_1 = require("../programs");
|
|
19
|
-
const shared_1 = require("../shared");
|
|
20
|
-
exports.CLOSE_DISCRIMINATOR = new Uint8Array([
|
|
8
|
+
import { combineCodec, fixDecoderSize, fixEncoderSize, getBytesDecoder, getBytesEncoder, getStructDecoder, getStructEncoder, transformEncoder, } from '@solana/kit';
|
|
9
|
+
import { NOSANA_JOBS_PROGRAM_ADDRESS } from '../programs';
|
|
10
|
+
import { getAccountMetaFactory } from '../shared';
|
|
11
|
+
export const CLOSE_DISCRIMINATOR = new Uint8Array([
|
|
21
12
|
98, 165, 201, 177, 108, 65, 206, 96,
|
|
22
13
|
]);
|
|
23
|
-
function getCloseDiscriminatorBytes() {
|
|
24
|
-
return
|
|
14
|
+
export function getCloseDiscriminatorBytes() {
|
|
15
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(CLOSE_DISCRIMINATOR);
|
|
25
16
|
}
|
|
26
|
-
function getCloseInstructionDataEncoder() {
|
|
27
|
-
return
|
|
17
|
+
export function getCloseInstructionDataEncoder() {
|
|
18
|
+
return transformEncoder(getStructEncoder([['discriminator', fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({ ...value, discriminator: CLOSE_DISCRIMINATOR }));
|
|
28
19
|
}
|
|
29
|
-
function getCloseInstructionDataDecoder() {
|
|
30
|
-
return
|
|
31
|
-
['discriminator',
|
|
20
|
+
export function getCloseInstructionDataDecoder() {
|
|
21
|
+
return getStructDecoder([
|
|
22
|
+
['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
|
|
32
23
|
]);
|
|
33
24
|
}
|
|
34
|
-
function getCloseInstructionDataCodec() {
|
|
35
|
-
return
|
|
25
|
+
export function getCloseInstructionDataCodec() {
|
|
26
|
+
return combineCodec(getCloseInstructionDataEncoder(), getCloseInstructionDataDecoder());
|
|
36
27
|
}
|
|
37
|
-
function getCloseInstruction(input, config) {
|
|
28
|
+
export function getCloseInstruction(input, config) {
|
|
38
29
|
// Program address.
|
|
39
|
-
const programAddress = config?.programAddress ??
|
|
30
|
+
const programAddress = config?.programAddress ?? NOSANA_JOBS_PROGRAM_ADDRESS;
|
|
40
31
|
// Original accounts.
|
|
41
32
|
const originalAccounts = {
|
|
42
33
|
market: { value: input.market ?? null, isWritable: true },
|
|
@@ -51,7 +42,7 @@ function getCloseInstruction(input, config) {
|
|
|
51
42
|
accounts.tokenProgram.value =
|
|
52
43
|
'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
|
|
53
44
|
}
|
|
54
|
-
const getAccountMeta =
|
|
45
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
|
|
55
46
|
const instruction = {
|
|
56
47
|
accounts: [
|
|
57
48
|
getAccountMeta(accounts.market),
|
|
@@ -65,7 +56,7 @@ function getCloseInstruction(input, config) {
|
|
|
65
56
|
};
|
|
66
57
|
return instruction;
|
|
67
58
|
}
|
|
68
|
-
function parseCloseInstruction(instruction) {
|
|
59
|
+
export function parseCloseInstruction(instruction) {
|
|
69
60
|
if (instruction.accounts.length < 5) {
|
|
70
61
|
// TODO: Coded error.
|
|
71
62
|
throw new Error('Not enough accounts');
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* This code was AUTOGENERATED using the codama library.
|
|
4
3
|
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
@@ -6,37 +5,29 @@
|
|
|
6
5
|
*
|
|
7
6
|
* @see https://github.com/codama-idl/codama
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports.getCloseAdminInstructionDataDecoder = getCloseAdminInstructionDataDecoder;
|
|
14
|
-
exports.getCloseAdminInstructionDataCodec = getCloseAdminInstructionDataCodec;
|
|
15
|
-
exports.getCloseAdminInstruction = getCloseAdminInstruction;
|
|
16
|
-
exports.parseCloseAdminInstruction = parseCloseAdminInstruction;
|
|
17
|
-
const kit_1 = require("@solana/kit");
|
|
18
|
-
const programs_1 = require("../programs");
|
|
19
|
-
const shared_1 = require("../shared");
|
|
20
|
-
exports.CLOSE_ADMIN_DISCRIMINATOR = new Uint8Array([
|
|
8
|
+
import { combineCodec, fixDecoderSize, fixEncoderSize, getBytesDecoder, getBytesEncoder, getStructDecoder, getStructEncoder, transformEncoder, } from '@solana/kit';
|
|
9
|
+
import { NOSANA_JOBS_PROGRAM_ADDRESS } from '../programs';
|
|
10
|
+
import { getAccountMetaFactory } from '../shared';
|
|
11
|
+
export const CLOSE_ADMIN_DISCRIMINATOR = new Uint8Array([
|
|
21
12
|
202, 182, 185, 142, 208, 161, 145, 189,
|
|
22
13
|
]);
|
|
23
|
-
function getCloseAdminDiscriminatorBytes() {
|
|
24
|
-
return
|
|
14
|
+
export function getCloseAdminDiscriminatorBytes() {
|
|
15
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(CLOSE_ADMIN_DISCRIMINATOR);
|
|
25
16
|
}
|
|
26
|
-
function getCloseAdminInstructionDataEncoder() {
|
|
27
|
-
return
|
|
17
|
+
export function getCloseAdminInstructionDataEncoder() {
|
|
18
|
+
return transformEncoder(getStructEncoder([['discriminator', fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({ ...value, discriminator: CLOSE_ADMIN_DISCRIMINATOR }));
|
|
28
19
|
}
|
|
29
|
-
function getCloseAdminInstructionDataDecoder() {
|
|
30
|
-
return
|
|
31
|
-
['discriminator',
|
|
20
|
+
export function getCloseAdminInstructionDataDecoder() {
|
|
21
|
+
return getStructDecoder([
|
|
22
|
+
['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
|
|
32
23
|
]);
|
|
33
24
|
}
|
|
34
|
-
function getCloseAdminInstructionDataCodec() {
|
|
35
|
-
return
|
|
25
|
+
export function getCloseAdminInstructionDataCodec() {
|
|
26
|
+
return combineCodec(getCloseAdminInstructionDataEncoder(), getCloseAdminInstructionDataDecoder());
|
|
36
27
|
}
|
|
37
|
-
function getCloseAdminInstruction(input, config) {
|
|
28
|
+
export function getCloseAdminInstruction(input, config) {
|
|
38
29
|
// Program address.
|
|
39
|
-
const programAddress = config?.programAddress ??
|
|
30
|
+
const programAddress = config?.programAddress ?? NOSANA_JOBS_PROGRAM_ADDRESS;
|
|
40
31
|
// Original accounts.
|
|
41
32
|
const originalAccounts = {
|
|
42
33
|
market: { value: input.market ?? null, isWritable: true },
|
|
@@ -51,7 +42,7 @@ function getCloseAdminInstruction(input, config) {
|
|
|
51
42
|
accounts.tokenProgram.value =
|
|
52
43
|
'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
|
|
53
44
|
}
|
|
54
|
-
const getAccountMeta =
|
|
45
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
|
|
55
46
|
const instruction = {
|
|
56
47
|
accounts: [
|
|
57
48
|
getAccountMeta(accounts.market),
|
|
@@ -65,7 +56,7 @@ function getCloseAdminInstruction(input, config) {
|
|
|
65
56
|
};
|
|
66
57
|
return instruction;
|
|
67
58
|
}
|
|
68
|
-
function parseCloseAdminInstruction(instruction) {
|
|
59
|
+
export function parseCloseAdminInstruction(instruction) {
|
|
69
60
|
if (instruction.accounts.length < 5) {
|
|
70
61
|
// TODO: Coded error.
|
|
71
62
|
throw new Error('Not enough accounts');
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* This code was AUTOGENERATED using the codama library.
|
|
4
3
|
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
@@ -6,41 +5,33 @@
|
|
|
6
5
|
*
|
|
7
6
|
* @see https://github.com/codama-idl/codama
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports.getCompleteInstructionDataDecoder = getCompleteInstructionDataDecoder;
|
|
14
|
-
exports.getCompleteInstructionDataCodec = getCompleteInstructionDataCodec;
|
|
15
|
-
exports.getCompleteInstruction = getCompleteInstruction;
|
|
16
|
-
exports.parseCompleteInstruction = parseCompleteInstruction;
|
|
17
|
-
const kit_1 = require("@solana/kit");
|
|
18
|
-
const programs_1 = require("../programs");
|
|
19
|
-
const shared_1 = require("../shared");
|
|
20
|
-
exports.COMPLETE_DISCRIMINATOR = new Uint8Array([
|
|
8
|
+
import { combineCodec, fixDecoderSize, fixEncoderSize, getBytesDecoder, getBytesEncoder, getStructDecoder, getStructEncoder, transformEncoder, } from '@solana/kit';
|
|
9
|
+
import { NOSANA_JOBS_PROGRAM_ADDRESS } from '../programs';
|
|
10
|
+
import { getAccountMetaFactory } from '../shared';
|
|
11
|
+
export const COMPLETE_DISCRIMINATOR = new Uint8Array([
|
|
21
12
|
0, 77, 224, 147, 136, 25, 88, 76,
|
|
22
13
|
]);
|
|
23
|
-
function getCompleteDiscriminatorBytes() {
|
|
24
|
-
return
|
|
14
|
+
export function getCompleteDiscriminatorBytes() {
|
|
15
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(COMPLETE_DISCRIMINATOR);
|
|
25
16
|
}
|
|
26
|
-
function getCompleteInstructionDataEncoder() {
|
|
27
|
-
return
|
|
28
|
-
['discriminator',
|
|
29
|
-
['ipfsResult',
|
|
30
|
-
]), (value) => ({ ...value, discriminator:
|
|
17
|
+
export function getCompleteInstructionDataEncoder() {
|
|
18
|
+
return transformEncoder(getStructEncoder([
|
|
19
|
+
['discriminator', fixEncoderSize(getBytesEncoder(), 8)],
|
|
20
|
+
['ipfsResult', fixEncoderSize(getBytesEncoder(), 32)],
|
|
21
|
+
]), (value) => ({ ...value, discriminator: COMPLETE_DISCRIMINATOR }));
|
|
31
22
|
}
|
|
32
|
-
function getCompleteInstructionDataDecoder() {
|
|
33
|
-
return
|
|
34
|
-
['discriminator',
|
|
35
|
-
['ipfsResult',
|
|
23
|
+
export function getCompleteInstructionDataDecoder() {
|
|
24
|
+
return getStructDecoder([
|
|
25
|
+
['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
|
|
26
|
+
['ipfsResult', fixDecoderSize(getBytesDecoder(), 32)],
|
|
36
27
|
]);
|
|
37
28
|
}
|
|
38
|
-
function getCompleteInstructionDataCodec() {
|
|
39
|
-
return
|
|
29
|
+
export function getCompleteInstructionDataCodec() {
|
|
30
|
+
return combineCodec(getCompleteInstructionDataEncoder(), getCompleteInstructionDataDecoder());
|
|
40
31
|
}
|
|
41
|
-
function getCompleteInstruction(input, config) {
|
|
32
|
+
export function getCompleteInstruction(input, config) {
|
|
42
33
|
// Program address.
|
|
43
|
-
const programAddress = config?.programAddress ??
|
|
34
|
+
const programAddress = config?.programAddress ?? NOSANA_JOBS_PROGRAM_ADDRESS;
|
|
44
35
|
// Original accounts.
|
|
45
36
|
const originalAccounts = {
|
|
46
37
|
job: { value: input.job ?? null, isWritable: true },
|
|
@@ -49,7 +40,7 @@ function getCompleteInstruction(input, config) {
|
|
|
49
40
|
const accounts = originalAccounts;
|
|
50
41
|
// Original args.
|
|
51
42
|
const args = { ...input };
|
|
52
|
-
const getAccountMeta =
|
|
43
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
|
|
53
44
|
const instruction = {
|
|
54
45
|
accounts: [
|
|
55
46
|
getAccountMeta(accounts.job),
|
|
@@ -60,7 +51,7 @@ function getCompleteInstruction(input, config) {
|
|
|
60
51
|
};
|
|
61
52
|
return instruction;
|
|
62
53
|
}
|
|
63
|
-
function parseCompleteInstruction(instruction) {
|
|
54
|
+
export function parseCompleteInstruction(instruction) {
|
|
64
55
|
if (instruction.accounts.length < 2) {
|
|
65
56
|
// TODO: Coded error.
|
|
66
57
|
throw new Error('Not enough accounts');
|