@nosana/kit 0.1.1

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.
Files changed (98) hide show
  1. package/.gitlab-ci.yml +21 -0
  2. package/README.md +159 -0
  3. package/dist/config/defaultConfigs.d.ts +2 -0
  4. package/dist/config/defaultConfigs.js +47 -0
  5. package/dist/config/index.d.ts +3 -0
  6. package/dist/config/index.js +19 -0
  7. package/dist/config/types.d.ts +43 -0
  8. package/dist/config/types.js +16 -0
  9. package/dist/config/utils.d.ts +3 -0
  10. package/dist/config/utils.js +35 -0
  11. package/dist/errors/NosanaError.d.ts +16 -0
  12. package/dist/errors/NosanaError.js +22 -0
  13. package/dist/generated_clients/jobs/accounts/index.d.ts +10 -0
  14. package/dist/generated_clients/jobs/accounts/index.js +26 -0
  15. package/dist/generated_clients/jobs/accounts/jobAccount.d.ts +47 -0
  16. package/dist/generated_clients/jobs/accounts/jobAccount.js +86 -0
  17. package/dist/generated_clients/jobs/accounts/marketAccount.d.ts +46 -0
  18. package/dist/generated_clients/jobs/accounts/marketAccount.js +82 -0
  19. package/dist/generated_clients/jobs/accounts/runAccount.d.ts +35 -0
  20. package/dist/generated_clients/jobs/accounts/runAccount.js +74 -0
  21. package/dist/generated_clients/jobs/errors/index.d.ts +8 -0
  22. package/dist/generated_clients/jobs/errors/index.js +24 -0
  23. package/dist/generated_clients/jobs/errors/nosanaJobs.d.ts +57 -0
  24. package/dist/generated_clients/jobs/errors/nosanaJobs.js +85 -0
  25. package/dist/generated_clients/jobs/index.d.ts +12 -0
  26. package/dist/generated_clients/jobs/index.js +28 -0
  27. package/dist/generated_clients/jobs/instructions/claim.d.ts +60 -0
  28. package/dist/generated_clients/jobs/instructions/claim.js +102 -0
  29. package/dist/generated_clients/jobs/instructions/clean.d.ts +42 -0
  30. package/dist/generated_clients/jobs/instructions/clean.js +79 -0
  31. package/dist/generated_clients/jobs/instructions/cleanAdmin.d.ts +42 -0
  32. package/dist/generated_clients/jobs/instructions/cleanAdmin.js +79 -0
  33. package/dist/generated_clients/jobs/instructions/close.d.ts +48 -0
  34. package/dist/generated_clients/jobs/instructions/close.js +90 -0
  35. package/dist/generated_clients/jobs/instructions/closeAdmin.d.ts +48 -0
  36. package/dist/generated_clients/jobs/instructions/closeAdmin.js +90 -0
  37. package/dist/generated_clients/jobs/instructions/complete.d.ts +43 -0
  38. package/dist/generated_clients/jobs/instructions/complete.js +82 -0
  39. package/dist/generated_clients/jobs/instructions/delist.d.ts +54 -0
  40. package/dist/generated_clients/jobs/instructions/delist.js +96 -0
  41. package/dist/generated_clients/jobs/instructions/end.d.ts +60 -0
  42. package/dist/generated_clients/jobs/instructions/end.js +102 -0
  43. package/dist/generated_clients/jobs/instructions/extend.d.ts +64 -0
  44. package/dist/generated_clients/jobs/instructions/extend.js +111 -0
  45. package/dist/generated_clients/jobs/instructions/finish.d.ts +67 -0
  46. package/dist/generated_clients/jobs/instructions/finish.js +111 -0
  47. package/dist/generated_clients/jobs/instructions/index.d.ts +25 -0
  48. package/dist/generated_clients/jobs/instructions/index.js +41 -0
  49. package/dist/generated_clients/jobs/instructions/list.d.ts +76 -0
  50. package/dist/generated_clients/jobs/instructions/list.js +126 -0
  51. package/dist/generated_clients/jobs/instructions/open.d.ts +73 -0
  52. package/dist/generated_clients/jobs/instructions/open.js +121 -0
  53. package/dist/generated_clients/jobs/instructions/quit.d.ts +45 -0
  54. package/dist/generated_clients/jobs/instructions/quit.js +82 -0
  55. package/dist/generated_clients/jobs/instructions/quitAdmin.d.ts +42 -0
  56. package/dist/generated_clients/jobs/instructions/quitAdmin.js +79 -0
  57. package/dist/generated_clients/jobs/instructions/recover.d.ts +54 -0
  58. package/dist/generated_clients/jobs/instructions/recover.js +96 -0
  59. package/dist/generated_clients/jobs/instructions/stop.d.ts +42 -0
  60. package/dist/generated_clients/jobs/instructions/stop.js +79 -0
  61. package/dist/generated_clients/jobs/instructions/update.d.ts +58 -0
  62. package/dist/generated_clients/jobs/instructions/update.js +93 -0
  63. package/dist/generated_clients/jobs/instructions/work.d.ts +57 -0
  64. package/dist/generated_clients/jobs/instructions/work.js +99 -0
  65. package/dist/generated_clients/jobs/programs/index.d.ts +8 -0
  66. package/dist/generated_clients/jobs/programs/index.js +24 -0
  67. package/dist/generated_clients/jobs/programs/nosanaJobs.d.ts +78 -0
  68. package/dist/generated_clients/jobs/programs/nosanaJobs.js +112 -0
  69. package/dist/generated_clients/jobs/shared/index.d.ts +49 -0
  70. package/dist/generated_clients/jobs/shared/index.js +94 -0
  71. package/dist/generated_clients/jobs/types/index.d.ts +10 -0
  72. package/dist/generated_clients/jobs/types/index.js +26 -0
  73. package/dist/generated_clients/jobs/types/jobState.d.ts +18 -0
  74. package/dist/generated_clients/jobs/types/jobState.js +30 -0
  75. package/dist/generated_clients/jobs/types/jobType.d.ts +21 -0
  76. package/dist/generated_clients/jobs/types/jobType.js +33 -0
  77. package/dist/generated_clients/jobs/types/queueType.d.ts +18 -0
  78. package/dist/generated_clients/jobs/types/queueType.js +30 -0
  79. package/dist/index.d.ts +19 -0
  80. package/dist/index.js +43 -0
  81. package/dist/ipfs/IPFS.d.ts +19 -0
  82. package/dist/ipfs/IPFS.js +47 -0
  83. package/dist/logger/Logger.d.ts +24 -0
  84. package/dist/logger/Logger.js +63 -0
  85. package/dist/programs/BaseProgram.d.ts +20 -0
  86. package/dist/programs/BaseProgram.js +39 -0
  87. package/dist/programs/JobsProgram.d.ts +118 -0
  88. package/dist/programs/JobsProgram.js +611 -0
  89. package/dist/solana/SolanaUtils.d.ts +15 -0
  90. package/dist/solana/SolanaUtils.js +48 -0
  91. package/dist/utils/index.d.ts +19 -0
  92. package/dist/utils/index.js +17 -0
  93. package/examples/node/monitor.ts +143 -0
  94. package/examples/node/package-lock.json +245 -0
  95. package/examples/node/package.json +16 -0
  96. package/examples/node/retrieve.ts +18 -0
  97. package/package.json +47 -0
  98. package/scripts/generate-clients.ts +9 -0
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ /**
3
+ * This code was AUTOGENERATED using the codama library.
4
+ * Please DO NOT EDIT THIS FILE, instead use visitors
5
+ * to add features, then rerun codama to update it.
6
+ *
7
+ * @see https://github.com/codama-idl/codama
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.MARKET_ACCOUNT_DISCRIMINATOR = void 0;
11
+ exports.getMarketAccountDiscriminatorBytes = getMarketAccountDiscriminatorBytes;
12
+ exports.getMarketAccountEncoder = getMarketAccountEncoder;
13
+ exports.getMarketAccountDecoder = getMarketAccountDecoder;
14
+ exports.getMarketAccountCodec = getMarketAccountCodec;
15
+ exports.decodeMarketAccount = decodeMarketAccount;
16
+ exports.fetchMarketAccount = fetchMarketAccount;
17
+ exports.fetchMaybeMarketAccount = fetchMaybeMarketAccount;
18
+ exports.fetchAllMarketAccount = fetchAllMarketAccount;
19
+ exports.fetchAllMaybeMarketAccount = fetchAllMaybeMarketAccount;
20
+ const kit_1 = require("@solana/kit");
21
+ exports.MARKET_ACCOUNT_DISCRIMINATOR = new Uint8Array([
22
+ 201, 78, 187, 225, 240, 198, 201, 251,
23
+ ]);
24
+ function getMarketAccountDiscriminatorBytes() {
25
+ return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.MARKET_ACCOUNT_DISCRIMINATOR);
26
+ }
27
+ function getMarketAccountEncoder() {
28
+ return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([
29
+ ['discriminator', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)],
30
+ ['authority', (0, kit_1.getAddressEncoder)()],
31
+ ['jobExpiration', (0, kit_1.getI64Encoder)()],
32
+ ['jobPrice', (0, kit_1.getU64Encoder)()],
33
+ ['jobTimeout', (0, kit_1.getI64Encoder)()],
34
+ ['jobType', (0, kit_1.getU8Encoder)()],
35
+ ['vault', (0, kit_1.getAddressEncoder)()],
36
+ ['vaultBump', (0, kit_1.getU8Encoder)()],
37
+ ['nodeAccessKey', (0, kit_1.getAddressEncoder)()],
38
+ ['nodeXnosMinimum', (0, kit_1.getU128Encoder)()],
39
+ ['queueType', (0, kit_1.getU8Encoder)()],
40
+ ['queue', (0, kit_1.getArrayEncoder)((0, kit_1.getAddressEncoder)())],
41
+ ]), (value) => ({ ...value, discriminator: exports.MARKET_ACCOUNT_DISCRIMINATOR }));
42
+ }
43
+ function getMarketAccountDecoder() {
44
+ return (0, kit_1.getStructDecoder)([
45
+ ['discriminator', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
46
+ ['authority', (0, kit_1.getAddressDecoder)()],
47
+ ['jobExpiration', (0, kit_1.getI64Decoder)()],
48
+ ['jobPrice', (0, kit_1.getU64Decoder)()],
49
+ ['jobTimeout', (0, kit_1.getI64Decoder)()],
50
+ ['jobType', (0, kit_1.getU8Decoder)()],
51
+ ['vault', (0, kit_1.getAddressDecoder)()],
52
+ ['vaultBump', (0, kit_1.getU8Decoder)()],
53
+ ['nodeAccessKey', (0, kit_1.getAddressDecoder)()],
54
+ ['nodeXnosMinimum', (0, kit_1.getU128Decoder)()],
55
+ ['queueType', (0, kit_1.getU8Decoder)()],
56
+ ['queue', (0, kit_1.getArrayDecoder)((0, kit_1.getAddressDecoder)())],
57
+ ]);
58
+ }
59
+ function getMarketAccountCodec() {
60
+ return (0, kit_1.combineCodec)(getMarketAccountEncoder(), getMarketAccountDecoder());
61
+ }
62
+ function decodeMarketAccount(encodedAccount) {
63
+ return (0, kit_1.decodeAccount)(encodedAccount, getMarketAccountDecoder());
64
+ }
65
+ async function fetchMarketAccount(rpc, address, config) {
66
+ const maybeAccount = await fetchMaybeMarketAccount(rpc, address, config);
67
+ (0, kit_1.assertAccountExists)(maybeAccount);
68
+ return maybeAccount;
69
+ }
70
+ async function fetchMaybeMarketAccount(rpc, address, config) {
71
+ const maybeAccount = await (0, kit_1.fetchEncodedAccount)(rpc, address, config);
72
+ return decodeMarketAccount(maybeAccount);
73
+ }
74
+ async function fetchAllMarketAccount(rpc, addresses, config) {
75
+ const maybeAccounts = await fetchAllMaybeMarketAccount(rpc, addresses, config);
76
+ (0, kit_1.assertAccountsExist)(maybeAccounts);
77
+ return maybeAccounts;
78
+ }
79
+ async function fetchAllMaybeMarketAccount(rpc, addresses, config) {
80
+ const maybeAccounts = await (0, kit_1.fetchEncodedAccounts)(rpc, addresses, config);
81
+ return maybeAccounts.map((maybeAccount) => decodeMarketAccount(maybeAccount));
82
+ }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+ import { fetchEncodedAccount, fetchEncodedAccounts, type Account, type Address, type Codec, type Decoder, type EncodedAccount, type Encoder, type FetchAccountConfig, type FetchAccountsConfig, type MaybeAccount, type MaybeEncodedAccount, type ReadonlyUint8Array } from '@solana/kit';
9
+ export declare const RUN_ACCOUNT_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
10
+ export declare function getRunAccountDiscriminatorBytes(): ReadonlyUint8Array;
11
+ export type RunAccount = {
12
+ discriminator: ReadonlyUint8Array;
13
+ job: Address;
14
+ node: Address;
15
+ payer: Address;
16
+ state: number;
17
+ time: bigint;
18
+ };
19
+ export type RunAccountArgs = {
20
+ job: Address;
21
+ node: Address;
22
+ payer: Address;
23
+ state: number;
24
+ time: number | bigint;
25
+ };
26
+ export declare function getRunAccountEncoder(): Encoder<RunAccountArgs>;
27
+ export declare function getRunAccountDecoder(): Decoder<RunAccount>;
28
+ export declare function getRunAccountCodec(): Codec<RunAccountArgs, RunAccount>;
29
+ export declare function decodeRunAccount<TAddress extends string = string>(encodedAccount: EncodedAccount<TAddress>): Account<RunAccount, TAddress>;
30
+ export declare function decodeRunAccount<TAddress extends string = string>(encodedAccount: MaybeEncodedAccount<TAddress>): MaybeAccount<RunAccount, TAddress>;
31
+ export declare function fetchRunAccount<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<Account<RunAccount, TAddress>>;
32
+ export declare function fetchMaybeRunAccount<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<MaybeAccount<RunAccount, TAddress>>;
33
+ export declare function fetchAllRunAccount(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<Account<RunAccount>[]>;
34
+ export declare function fetchAllMaybeRunAccount(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<MaybeAccount<RunAccount>[]>;
35
+ export declare function getRunAccountSize(): number;
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ /**
3
+ * This code was AUTOGENERATED using the codama library.
4
+ * Please DO NOT EDIT THIS FILE, instead use visitors
5
+ * to add features, then rerun codama to update it.
6
+ *
7
+ * @see https://github.com/codama-idl/codama
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.RUN_ACCOUNT_DISCRIMINATOR = void 0;
11
+ exports.getRunAccountDiscriminatorBytes = getRunAccountDiscriminatorBytes;
12
+ exports.getRunAccountEncoder = getRunAccountEncoder;
13
+ exports.getRunAccountDecoder = getRunAccountDecoder;
14
+ exports.getRunAccountCodec = getRunAccountCodec;
15
+ exports.decodeRunAccount = decodeRunAccount;
16
+ exports.fetchRunAccount = fetchRunAccount;
17
+ exports.fetchMaybeRunAccount = fetchMaybeRunAccount;
18
+ exports.fetchAllRunAccount = fetchAllRunAccount;
19
+ exports.fetchAllMaybeRunAccount = fetchAllMaybeRunAccount;
20
+ exports.getRunAccountSize = getRunAccountSize;
21
+ const kit_1 = require("@solana/kit");
22
+ exports.RUN_ACCOUNT_DISCRIMINATOR = new Uint8Array([
23
+ 194, 169, 110, 230, 235, 11, 225, 22,
24
+ ]);
25
+ function getRunAccountDiscriminatorBytes() {
26
+ return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.RUN_ACCOUNT_DISCRIMINATOR);
27
+ }
28
+ function getRunAccountEncoder() {
29
+ return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([
30
+ ['discriminator', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)],
31
+ ['job', (0, kit_1.getAddressEncoder)()],
32
+ ['node', (0, kit_1.getAddressEncoder)()],
33
+ ['payer', (0, kit_1.getAddressEncoder)()],
34
+ ['state', (0, kit_1.getU8Encoder)()],
35
+ ['time', (0, kit_1.getI64Encoder)()],
36
+ ]), (value) => ({ ...value, discriminator: exports.RUN_ACCOUNT_DISCRIMINATOR }));
37
+ }
38
+ function getRunAccountDecoder() {
39
+ return (0, kit_1.getStructDecoder)([
40
+ ['discriminator', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
41
+ ['job', (0, kit_1.getAddressDecoder)()],
42
+ ['node', (0, kit_1.getAddressDecoder)()],
43
+ ['payer', (0, kit_1.getAddressDecoder)()],
44
+ ['state', (0, kit_1.getU8Decoder)()],
45
+ ['time', (0, kit_1.getI64Decoder)()],
46
+ ]);
47
+ }
48
+ function getRunAccountCodec() {
49
+ return (0, kit_1.combineCodec)(getRunAccountEncoder(), getRunAccountDecoder());
50
+ }
51
+ function decodeRunAccount(encodedAccount) {
52
+ return (0, kit_1.decodeAccount)(encodedAccount, getRunAccountDecoder());
53
+ }
54
+ async function fetchRunAccount(rpc, address, config) {
55
+ const maybeAccount = await fetchMaybeRunAccount(rpc, address, config);
56
+ (0, kit_1.assertAccountExists)(maybeAccount);
57
+ return maybeAccount;
58
+ }
59
+ async function fetchMaybeRunAccount(rpc, address, config) {
60
+ const maybeAccount = await (0, kit_1.fetchEncodedAccount)(rpc, address, config);
61
+ return decodeRunAccount(maybeAccount);
62
+ }
63
+ async function fetchAllRunAccount(rpc, addresses, config) {
64
+ const maybeAccounts = await fetchAllMaybeRunAccount(rpc, addresses, config);
65
+ (0, kit_1.assertAccountsExist)(maybeAccounts);
66
+ return maybeAccounts;
67
+ }
68
+ async function fetchAllMaybeRunAccount(rpc, addresses, config) {
69
+ const maybeAccounts = await (0, kit_1.fetchEncodedAccounts)(rpc, addresses, config);
70
+ return maybeAccounts.map((maybeAccount) => decodeRunAccount(maybeAccount));
71
+ }
72
+ function getRunAccountSize() {
73
+ return 113;
74
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+ export * from './nosanaJobs';
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ /**
3
+ * This code was AUTOGENERATED using the codama library.
4
+ * Please DO NOT EDIT THIS FILE, instead use visitors
5
+ * to add features, then rerun codama to update it.
6
+ *
7
+ * @see https://github.com/codama-idl/codama
8
+ */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
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("./nosanaJobs"), exports);
@@ -0,0 +1,57 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+ import { type Address, type SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM, type SolanaError } from '@solana/kit';
9
+ /** InvalidMarketAccount: This market account is not valid. */
10
+ export declare const NOSANA_JOBS_ERROR__INVALID_MARKET_ACCOUNT = 6000;
11
+ /** MarketInWrongState: This market does not have the right status. */
12
+ export declare const NOSANA_JOBS_ERROR__MARKET_IN_WRONG_STATE = 6001;
13
+ /** NotInMarketQueue: Account cannot be find account in market queue. */
14
+ export declare const NOSANA_JOBS_ERROR__NOT_IN_MARKET_QUEUE = 6002;
15
+ /** InvalidJobAccount: This job account is not valid. */
16
+ export declare const NOSANA_JOBS_ERROR__INVALID_JOB_ACCOUNT = 6003;
17
+ /** JobInWrongState: This job does not have the right status. */
18
+ export declare const NOSANA_JOBS_ERROR__JOB_IN_WRONG_STATE = 6004;
19
+ /** JobNotExpired: The job has not yet expired. */
20
+ export declare const NOSANA_JOBS_ERROR__JOB_NOT_EXPIRED = 6005;
21
+ /** JobResultNull: The job result can not be null. */
22
+ export declare const NOSANA_JOBS_ERROR__JOB_RESULT_NULL = 6006;
23
+ /** JobInvalidProject: The job has a different project owner. */
24
+ export declare const NOSANA_JOBS_ERROR__JOB_INVALID_PROJECT = 6007;
25
+ /** JobTimeoutNotGreater: The new job timeout should be larger than the current one. */
26
+ export declare const NOSANA_JOBS_ERROR__JOB_TIMEOUT_NOT_GREATER = 6008;
27
+ /** JobInvalidRunAccount: The run account does not match the job. */
28
+ export declare const NOSANA_JOBS_ERROR__JOB_INVALID_RUN_ACCOUNT = 6009;
29
+ /** JobResultsAlreadySet: The job results are already set. */
30
+ export declare const NOSANA_JOBS_ERROR__JOB_RESULTS_ALREADY_SET = 6010;
31
+ /** NodeQueueDoesNotMatch: This node queue does not match. */
32
+ export declare const NOSANA_JOBS_ERROR__NODE_QUEUE_DOES_NOT_MATCH = 6011;
33
+ /** NodeStakeUnauthorized: This node is not authorizing this stake. */
34
+ export declare const NOSANA_JOBS_ERROR__NODE_STAKE_UNAUTHORIZED = 6012;
35
+ /** NodeNotEnoughStake: This node has not staked enough tokens. */
36
+ export declare const NOSANA_JOBS_ERROR__NODE_NOT_ENOUGH_STAKE = 6013;
37
+ /** NodeAlreadyQueued: This node is already present in the queue. */
38
+ export declare const NOSANA_JOBS_ERROR__NODE_ALREADY_QUEUED = 6014;
39
+ /** NodeNftWrongMetadata: This metadata does not have the correct address. */
40
+ export declare const NOSANA_JOBS_ERROR__NODE_NFT_WRONG_METADATA = 6015;
41
+ /** NodeNftWrongOwner: This NFT is not owned by this node. */
42
+ export declare const NOSANA_JOBS_ERROR__NODE_NFT_WRONG_OWNER = 6016;
43
+ /** NodeNftInvalidAmount: Access NFT amount cannot be 0. */
44
+ export declare const NOSANA_JOBS_ERROR__NODE_NFT_INVALID_AMOUNT = 6017;
45
+ /** NodeKeyInvalidCollection: This access key does not belong to a verified collection. */
46
+ export declare const NOSANA_JOBS_ERROR__NODE_KEY_INVALID_COLLECTION = 6018;
47
+ export type NosanaJobsError = typeof NOSANA_JOBS_ERROR__INVALID_JOB_ACCOUNT | typeof NOSANA_JOBS_ERROR__INVALID_MARKET_ACCOUNT | typeof NOSANA_JOBS_ERROR__JOB_INVALID_PROJECT | typeof NOSANA_JOBS_ERROR__JOB_INVALID_RUN_ACCOUNT | typeof NOSANA_JOBS_ERROR__JOB_IN_WRONG_STATE | typeof NOSANA_JOBS_ERROR__JOB_NOT_EXPIRED | typeof NOSANA_JOBS_ERROR__JOB_RESULT_NULL | typeof NOSANA_JOBS_ERROR__JOB_RESULTS_ALREADY_SET | typeof NOSANA_JOBS_ERROR__JOB_TIMEOUT_NOT_GREATER | typeof NOSANA_JOBS_ERROR__MARKET_IN_WRONG_STATE | typeof NOSANA_JOBS_ERROR__NODE_ALREADY_QUEUED | typeof NOSANA_JOBS_ERROR__NODE_KEY_INVALID_COLLECTION | typeof NOSANA_JOBS_ERROR__NODE_NFT_INVALID_AMOUNT | typeof NOSANA_JOBS_ERROR__NODE_NFT_WRONG_METADATA | typeof NOSANA_JOBS_ERROR__NODE_NFT_WRONG_OWNER | typeof NOSANA_JOBS_ERROR__NODE_NOT_ENOUGH_STAKE | typeof NOSANA_JOBS_ERROR__NODE_QUEUE_DOES_NOT_MATCH | typeof NOSANA_JOBS_ERROR__NODE_STAKE_UNAUTHORIZED | typeof NOSANA_JOBS_ERROR__NOT_IN_MARKET_QUEUE;
48
+ export declare function getNosanaJobsErrorMessage(code: NosanaJobsError): string;
49
+ export declare function isNosanaJobsError<TProgramErrorCode extends NosanaJobsError>(error: unknown, transactionMessage: {
50
+ instructions: Record<number, {
51
+ programAddress: Address;
52
+ }>;
53
+ }, code?: TProgramErrorCode): error is SolanaError<typeof SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM> & Readonly<{
54
+ context: Readonly<{
55
+ code: TProgramErrorCode;
56
+ }>;
57
+ }>;
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ /**
3
+ * This code was AUTOGENERATED using the codama library.
4
+ * Please DO NOT EDIT THIS FILE, instead use visitors
5
+ * to add features, then rerun codama to update it.
6
+ *
7
+ * @see https://github.com/codama-idl/codama
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.NOSANA_JOBS_ERROR__NODE_KEY_INVALID_COLLECTION = exports.NOSANA_JOBS_ERROR__NODE_NFT_INVALID_AMOUNT = exports.NOSANA_JOBS_ERROR__NODE_NFT_WRONG_OWNER = exports.NOSANA_JOBS_ERROR__NODE_NFT_WRONG_METADATA = exports.NOSANA_JOBS_ERROR__NODE_ALREADY_QUEUED = exports.NOSANA_JOBS_ERROR__NODE_NOT_ENOUGH_STAKE = exports.NOSANA_JOBS_ERROR__NODE_STAKE_UNAUTHORIZED = exports.NOSANA_JOBS_ERROR__NODE_QUEUE_DOES_NOT_MATCH = exports.NOSANA_JOBS_ERROR__JOB_RESULTS_ALREADY_SET = exports.NOSANA_JOBS_ERROR__JOB_INVALID_RUN_ACCOUNT = exports.NOSANA_JOBS_ERROR__JOB_TIMEOUT_NOT_GREATER = exports.NOSANA_JOBS_ERROR__JOB_INVALID_PROJECT = exports.NOSANA_JOBS_ERROR__JOB_RESULT_NULL = exports.NOSANA_JOBS_ERROR__JOB_NOT_EXPIRED = exports.NOSANA_JOBS_ERROR__JOB_IN_WRONG_STATE = exports.NOSANA_JOBS_ERROR__INVALID_JOB_ACCOUNT = exports.NOSANA_JOBS_ERROR__NOT_IN_MARKET_QUEUE = exports.NOSANA_JOBS_ERROR__MARKET_IN_WRONG_STATE = exports.NOSANA_JOBS_ERROR__INVALID_MARKET_ACCOUNT = void 0;
11
+ exports.getNosanaJobsErrorMessage = getNosanaJobsErrorMessage;
12
+ exports.isNosanaJobsError = isNosanaJobsError;
13
+ const kit_1 = require("@solana/kit");
14
+ const programs_1 = require("../programs");
15
+ /** InvalidMarketAccount: This market account is not valid. */
16
+ exports.NOSANA_JOBS_ERROR__INVALID_MARKET_ACCOUNT = 0x1770; // 6000
17
+ /** MarketInWrongState: This market does not have the right status. */
18
+ exports.NOSANA_JOBS_ERROR__MARKET_IN_WRONG_STATE = 0x1771; // 6001
19
+ /** NotInMarketQueue: Account cannot be find account in market queue. */
20
+ exports.NOSANA_JOBS_ERROR__NOT_IN_MARKET_QUEUE = 0x1772; // 6002
21
+ /** InvalidJobAccount: This job account is not valid. */
22
+ exports.NOSANA_JOBS_ERROR__INVALID_JOB_ACCOUNT = 0x1773; // 6003
23
+ /** JobInWrongState: This job does not have the right status. */
24
+ exports.NOSANA_JOBS_ERROR__JOB_IN_WRONG_STATE = 0x1774; // 6004
25
+ /** JobNotExpired: The job has not yet expired. */
26
+ exports.NOSANA_JOBS_ERROR__JOB_NOT_EXPIRED = 0x1775; // 6005
27
+ /** JobResultNull: The job result can not be null. */
28
+ exports.NOSANA_JOBS_ERROR__JOB_RESULT_NULL = 0x1776; // 6006
29
+ /** JobInvalidProject: The job has a different project owner. */
30
+ exports.NOSANA_JOBS_ERROR__JOB_INVALID_PROJECT = 0x1777; // 6007
31
+ /** JobTimeoutNotGreater: The new job timeout should be larger than the current one. */
32
+ exports.NOSANA_JOBS_ERROR__JOB_TIMEOUT_NOT_GREATER = 0x1778; // 6008
33
+ /** JobInvalidRunAccount: The run account does not match the job. */
34
+ exports.NOSANA_JOBS_ERROR__JOB_INVALID_RUN_ACCOUNT = 0x1779; // 6009
35
+ /** JobResultsAlreadySet: The job results are already set. */
36
+ exports.NOSANA_JOBS_ERROR__JOB_RESULTS_ALREADY_SET = 0x177a; // 6010
37
+ /** NodeQueueDoesNotMatch: This node queue does not match. */
38
+ exports.NOSANA_JOBS_ERROR__NODE_QUEUE_DOES_NOT_MATCH = 0x177b; // 6011
39
+ /** NodeStakeUnauthorized: This node is not authorizing this stake. */
40
+ exports.NOSANA_JOBS_ERROR__NODE_STAKE_UNAUTHORIZED = 0x177c; // 6012
41
+ /** NodeNotEnoughStake: This node has not staked enough tokens. */
42
+ exports.NOSANA_JOBS_ERROR__NODE_NOT_ENOUGH_STAKE = 0x177d; // 6013
43
+ /** NodeAlreadyQueued: This node is already present in the queue. */
44
+ exports.NOSANA_JOBS_ERROR__NODE_ALREADY_QUEUED = 0x177e; // 6014
45
+ /** NodeNftWrongMetadata: This metadata does not have the correct address. */
46
+ exports.NOSANA_JOBS_ERROR__NODE_NFT_WRONG_METADATA = 0x177f; // 6015
47
+ /** NodeNftWrongOwner: This NFT is not owned by this node. */
48
+ exports.NOSANA_JOBS_ERROR__NODE_NFT_WRONG_OWNER = 0x1780; // 6016
49
+ /** NodeNftInvalidAmount: Access NFT amount cannot be 0. */
50
+ exports.NOSANA_JOBS_ERROR__NODE_NFT_INVALID_AMOUNT = 0x1781; // 6017
51
+ /** NodeKeyInvalidCollection: This access key does not belong to a verified collection. */
52
+ exports.NOSANA_JOBS_ERROR__NODE_KEY_INVALID_COLLECTION = 0x1782; // 6018
53
+ let nosanaJobsErrorMessages;
54
+ if (process.env.NODE_ENV !== 'production') {
55
+ nosanaJobsErrorMessages = {
56
+ [exports.NOSANA_JOBS_ERROR__INVALID_JOB_ACCOUNT]: `This job account is not valid.`,
57
+ [exports.NOSANA_JOBS_ERROR__INVALID_MARKET_ACCOUNT]: `This market account is not valid.`,
58
+ [exports.NOSANA_JOBS_ERROR__JOB_INVALID_PROJECT]: `The job has a different project owner.`,
59
+ [exports.NOSANA_JOBS_ERROR__JOB_INVALID_RUN_ACCOUNT]: `The run account does not match the job.`,
60
+ [exports.NOSANA_JOBS_ERROR__JOB_IN_WRONG_STATE]: `This job does not have the right status.`,
61
+ [exports.NOSANA_JOBS_ERROR__JOB_NOT_EXPIRED]: `The job has not yet expired.`,
62
+ [exports.NOSANA_JOBS_ERROR__JOB_RESULT_NULL]: `The job result can not be null.`,
63
+ [exports.NOSANA_JOBS_ERROR__JOB_RESULTS_ALREADY_SET]: `The job results are already set.`,
64
+ [exports.NOSANA_JOBS_ERROR__JOB_TIMEOUT_NOT_GREATER]: `The new job timeout should be larger than the current one.`,
65
+ [exports.NOSANA_JOBS_ERROR__MARKET_IN_WRONG_STATE]: `This market does not have the right status.`,
66
+ [exports.NOSANA_JOBS_ERROR__NODE_ALREADY_QUEUED]: `This node is already present in the queue.`,
67
+ [exports.NOSANA_JOBS_ERROR__NODE_KEY_INVALID_COLLECTION]: `This access key does not belong to a verified collection.`,
68
+ [exports.NOSANA_JOBS_ERROR__NODE_NFT_INVALID_AMOUNT]: `Access NFT amount cannot be 0.`,
69
+ [exports.NOSANA_JOBS_ERROR__NODE_NFT_WRONG_METADATA]: `This metadata does not have the correct address.`,
70
+ [exports.NOSANA_JOBS_ERROR__NODE_NFT_WRONG_OWNER]: `This NFT is not owned by this node.`,
71
+ [exports.NOSANA_JOBS_ERROR__NODE_NOT_ENOUGH_STAKE]: `This node has not staked enough tokens.`,
72
+ [exports.NOSANA_JOBS_ERROR__NODE_QUEUE_DOES_NOT_MATCH]: `This node queue does not match.`,
73
+ [exports.NOSANA_JOBS_ERROR__NODE_STAKE_UNAUTHORIZED]: `This node is not authorizing this stake.`,
74
+ [exports.NOSANA_JOBS_ERROR__NOT_IN_MARKET_QUEUE]: `Account cannot be find account in market queue.`,
75
+ };
76
+ }
77
+ function getNosanaJobsErrorMessage(code) {
78
+ if (process.env.NODE_ENV !== 'production') {
79
+ return nosanaJobsErrorMessages[code];
80
+ }
81
+ return 'Error message not available in production bundles.';
82
+ }
83
+ function isNosanaJobsError(error, transactionMessage, code) {
84
+ return (0, kit_1.isProgramError)(error, transactionMessage, programs_1.NOSANA_JOBS_PROGRAM_ADDRESS, code);
85
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+ export * from './accounts';
9
+ export * from './errors';
10
+ export * from './instructions';
11
+ export * from './programs';
12
+ export * from './types';
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ /**
3
+ * This code was AUTOGENERATED using the codama library.
4
+ * Please DO NOT EDIT THIS FILE, instead use visitors
5
+ * to add features, then rerun codama to update it.
6
+ *
7
+ * @see https://github.com/codama-idl/codama
8
+ */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
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);
@@ -0,0 +1,60 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+ import { type Address, type Codec, type Decoder, type Encoder, type IAccountMeta, type IAccountSignerMeta, type IInstruction, type IInstructionWithAccounts, type IInstructionWithData, type ReadonlyAccount, type ReadonlySignerAccount, type ReadonlyUint8Array, type TransactionSigner, type WritableAccount, type WritableSignerAccount } from '@solana/kit';
9
+ import { NOSANA_JOBS_PROGRAM_ADDRESS } from '../programs';
10
+ export declare const CLAIM_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
11
+ export declare function getClaimDiscriminatorBytes(): ReadonlyUint8Array;
12
+ export type ClaimInstruction<TProgram extends string = typeof NOSANA_JOBS_PROGRAM_ADDRESS, TAccountJob extends string | IAccountMeta<string> = string, TAccountRun extends string | IAccountMeta<string> = string, TAccountMarket extends string | IAccountMeta<string> = string, TAccountStake extends string | IAccountMeta<string> = string, TAccountNft extends string | IAccountMeta<string> = string, TAccountMetadata extends string | IAccountMeta<string> = string, TAccountPayer extends string | IAccountMeta<string> = string, TAccountAuthority extends string | IAccountMeta<string> = string, TAccountSystemProgram extends string | IAccountMeta<string> = '11111111111111111111111111111111', TRemainingAccounts extends readonly IAccountMeta<string>[] = []> = IInstruction<TProgram> & IInstructionWithData<Uint8Array> & IInstructionWithAccounts<[
13
+ TAccountJob extends string ? WritableAccount<TAccountJob> : TAccountJob,
14
+ TAccountRun extends string ? WritableSignerAccount<TAccountRun> & IAccountSignerMeta<TAccountRun> : TAccountRun,
15
+ TAccountMarket extends string ? ReadonlyAccount<TAccountMarket> : TAccountMarket,
16
+ TAccountStake extends string ? ReadonlyAccount<TAccountStake> : TAccountStake,
17
+ TAccountNft extends string ? ReadonlyAccount<TAccountNft> : TAccountNft,
18
+ TAccountMetadata extends string ? ReadonlyAccount<TAccountMetadata> : TAccountMetadata,
19
+ TAccountPayer extends string ? WritableSignerAccount<TAccountPayer> & IAccountSignerMeta<TAccountPayer> : TAccountPayer,
20
+ TAccountAuthority extends string ? ReadonlySignerAccount<TAccountAuthority> & IAccountSignerMeta<TAccountAuthority> : TAccountAuthority,
21
+ TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
22
+ ...TRemainingAccounts
23
+ ]>;
24
+ export type ClaimInstructionData = {
25
+ discriminator: ReadonlyUint8Array;
26
+ };
27
+ export type ClaimInstructionDataArgs = {};
28
+ export declare function getClaimInstructionDataEncoder(): Encoder<ClaimInstructionDataArgs>;
29
+ export declare function getClaimInstructionDataDecoder(): Decoder<ClaimInstructionData>;
30
+ export declare function getClaimInstructionDataCodec(): Codec<ClaimInstructionDataArgs, ClaimInstructionData>;
31
+ export type ClaimInput<TAccountJob extends string = string, TAccountRun extends string = string, TAccountMarket extends string = string, TAccountStake extends string = string, TAccountNft extends string = string, TAccountMetadata extends string = string, TAccountPayer extends string = string, TAccountAuthority extends string = string, TAccountSystemProgram extends string = string> = {
32
+ job: Address<TAccountJob>;
33
+ run: TransactionSigner<TAccountRun>;
34
+ market: Address<TAccountMarket>;
35
+ stake: Address<TAccountStake>;
36
+ nft: Address<TAccountNft>;
37
+ metadata: Address<TAccountMetadata>;
38
+ payer: TransactionSigner<TAccountPayer>;
39
+ authority: TransactionSigner<TAccountAuthority>;
40
+ systemProgram?: Address<TAccountSystemProgram>;
41
+ };
42
+ export declare function getClaimInstruction<TAccountJob extends string, TAccountRun extends string, TAccountMarket extends string, TAccountStake extends string, TAccountNft extends string, TAccountMetadata extends string, TAccountPayer extends string, TAccountAuthority extends string, TAccountSystemProgram extends string, TProgramAddress extends Address = typeof NOSANA_JOBS_PROGRAM_ADDRESS>(input: ClaimInput<TAccountJob, TAccountRun, TAccountMarket, TAccountStake, TAccountNft, TAccountMetadata, TAccountPayer, TAccountAuthority, TAccountSystemProgram>, config?: {
43
+ programAddress?: TProgramAddress;
44
+ }): ClaimInstruction<TProgramAddress, TAccountJob, TAccountRun, TAccountMarket, TAccountStake, TAccountNft, TAccountMetadata, TAccountPayer, TAccountAuthority, TAccountSystemProgram>;
45
+ export type ParsedClaimInstruction<TProgram extends string = typeof NOSANA_JOBS_PROGRAM_ADDRESS, TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[]> = {
46
+ programAddress: Address<TProgram>;
47
+ accounts: {
48
+ job: TAccountMetas[0];
49
+ run: TAccountMetas[1];
50
+ market: TAccountMetas[2];
51
+ stake: TAccountMetas[3];
52
+ nft: TAccountMetas[4];
53
+ metadata: TAccountMetas[5];
54
+ payer: TAccountMetas[6];
55
+ authority: TAccountMetas[7];
56
+ systemProgram: TAccountMetas[8];
57
+ };
58
+ data: ClaimInstructionData;
59
+ };
60
+ export declare function parseClaimInstruction<TProgram extends string, TAccountMetas extends readonly IAccountMeta[]>(instruction: IInstruction<TProgram> & IInstructionWithAccounts<TAccountMetas> & IInstructionWithData<Uint8Array>): ParsedClaimInstruction<TProgram, TAccountMetas>;
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ /**
3
+ * This code was AUTOGENERATED using the codama library.
4
+ * Please DO NOT EDIT THIS FILE, instead use visitors
5
+ * to add features, then rerun codama to update it.
6
+ *
7
+ * @see https://github.com/codama-idl/codama
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.CLAIM_DISCRIMINATOR = void 0;
11
+ exports.getClaimDiscriminatorBytes = getClaimDiscriminatorBytes;
12
+ exports.getClaimInstructionDataEncoder = getClaimInstructionDataEncoder;
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([
21
+ 62, 198, 214, 193, 213, 159, 108, 210,
22
+ ]);
23
+ function getClaimDiscriminatorBytes() {
24
+ return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.CLAIM_DISCRIMINATOR);
25
+ }
26
+ function getClaimInstructionDataEncoder() {
27
+ return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([['discriminator', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)]]), (value) => ({ ...value, discriminator: exports.CLAIM_DISCRIMINATOR }));
28
+ }
29
+ function getClaimInstructionDataDecoder() {
30
+ return (0, kit_1.getStructDecoder)([
31
+ ['discriminator', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
32
+ ]);
33
+ }
34
+ function getClaimInstructionDataCodec() {
35
+ return (0, kit_1.combineCodec)(getClaimInstructionDataEncoder(), getClaimInstructionDataDecoder());
36
+ }
37
+ function getClaimInstruction(input, config) {
38
+ // Program address.
39
+ const programAddress = config?.programAddress ?? programs_1.NOSANA_JOBS_PROGRAM_ADDRESS;
40
+ // Original accounts.
41
+ const originalAccounts = {
42
+ job: { value: input.job ?? null, isWritable: true },
43
+ run: { value: input.run ?? null, isWritable: true },
44
+ market: { value: input.market ?? null, isWritable: false },
45
+ stake: { value: input.stake ?? null, isWritable: false },
46
+ nft: { value: input.nft ?? null, isWritable: false },
47
+ metadata: { value: input.metadata ?? null, isWritable: false },
48
+ payer: { value: input.payer ?? null, isWritable: true },
49
+ authority: { value: input.authority ?? null, isWritable: false },
50
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
51
+ };
52
+ const accounts = originalAccounts;
53
+ // Resolve default values.
54
+ if (!accounts.systemProgram.value) {
55
+ accounts.systemProgram.value =
56
+ '11111111111111111111111111111111';
57
+ }
58
+ const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, 'programId');
59
+ const instruction = {
60
+ accounts: [
61
+ getAccountMeta(accounts.job),
62
+ getAccountMeta(accounts.run),
63
+ getAccountMeta(accounts.market),
64
+ getAccountMeta(accounts.stake),
65
+ getAccountMeta(accounts.nft),
66
+ getAccountMeta(accounts.metadata),
67
+ getAccountMeta(accounts.payer),
68
+ getAccountMeta(accounts.authority),
69
+ getAccountMeta(accounts.systemProgram),
70
+ ],
71
+ programAddress,
72
+ data: getClaimInstructionDataEncoder().encode({}),
73
+ };
74
+ return instruction;
75
+ }
76
+ function parseClaimInstruction(instruction) {
77
+ if (instruction.accounts.length < 9) {
78
+ // TODO: Coded error.
79
+ throw new Error('Not enough accounts');
80
+ }
81
+ let accountIndex = 0;
82
+ const getNextAccount = () => {
83
+ const accountMeta = instruction.accounts[accountIndex];
84
+ accountIndex += 1;
85
+ return accountMeta;
86
+ };
87
+ return {
88
+ programAddress: instruction.programAddress,
89
+ accounts: {
90
+ job: getNextAccount(),
91
+ run: getNextAccount(),
92
+ market: getNextAccount(),
93
+ stake: getNextAccount(),
94
+ nft: getNextAccount(),
95
+ metadata: getNextAccount(),
96
+ payer: getNextAccount(),
97
+ authority: getNextAccount(),
98
+ systemProgram: getNextAccount(),
99
+ },
100
+ data: getClaimInstructionDataDecoder().decode(instruction.data),
101
+ };
102
+ }
@@ -0,0 +1,42 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+ import { type Address, type Codec, type Decoder, type Encoder, type IAccountMeta, type IInstruction, type IInstructionWithAccounts, type IInstructionWithData, type ReadonlyAccount, type ReadonlyUint8Array, type WritableAccount } from '@solana/kit';
9
+ import { NOSANA_JOBS_PROGRAM_ADDRESS } from '../programs';
10
+ export declare const CLEAN_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
11
+ export declare function getCleanDiscriminatorBytes(): ReadonlyUint8Array;
12
+ export type CleanInstruction<TProgram extends string = typeof NOSANA_JOBS_PROGRAM_ADDRESS, TAccountJob extends string | IAccountMeta<string> = string, TAccountMarket extends string | IAccountMeta<string> = string, TAccountPayer extends string | IAccountMeta<string> = string, TRemainingAccounts extends readonly IAccountMeta<string>[] = []> = IInstruction<TProgram> & IInstructionWithData<Uint8Array> & IInstructionWithAccounts<[
13
+ TAccountJob extends string ? WritableAccount<TAccountJob> : TAccountJob,
14
+ TAccountMarket extends string ? ReadonlyAccount<TAccountMarket> : TAccountMarket,
15
+ TAccountPayer extends string ? WritableAccount<TAccountPayer> : TAccountPayer,
16
+ ...TRemainingAccounts
17
+ ]>;
18
+ export type CleanInstructionData = {
19
+ discriminator: ReadonlyUint8Array;
20
+ };
21
+ export type CleanInstructionDataArgs = {};
22
+ export declare function getCleanInstructionDataEncoder(): Encoder<CleanInstructionDataArgs>;
23
+ export declare function getCleanInstructionDataDecoder(): Decoder<CleanInstructionData>;
24
+ export declare function getCleanInstructionDataCodec(): Codec<CleanInstructionDataArgs, CleanInstructionData>;
25
+ export type CleanInput<TAccountJob extends string = string, TAccountMarket extends string = string, TAccountPayer extends string = string> = {
26
+ job: Address<TAccountJob>;
27
+ market: Address<TAccountMarket>;
28
+ payer: Address<TAccountPayer>;
29
+ };
30
+ export declare function getCleanInstruction<TAccountJob extends string, TAccountMarket extends string, TAccountPayer extends string, TProgramAddress extends Address = typeof NOSANA_JOBS_PROGRAM_ADDRESS>(input: CleanInput<TAccountJob, TAccountMarket, TAccountPayer>, config?: {
31
+ programAddress?: TProgramAddress;
32
+ }): CleanInstruction<TProgramAddress, TAccountJob, TAccountMarket, TAccountPayer>;
33
+ export type ParsedCleanInstruction<TProgram extends string = typeof NOSANA_JOBS_PROGRAM_ADDRESS, TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[]> = {
34
+ programAddress: Address<TProgram>;
35
+ accounts: {
36
+ job: TAccountMetas[0];
37
+ market: TAccountMetas[1];
38
+ payer: TAccountMetas[2];
39
+ };
40
+ data: CleanInstructionData;
41
+ };
42
+ export declare function parseCleanInstruction<TProgram extends string, TAccountMetas extends readonly IAccountMeta[]>(instruction: IInstruction<TProgram> & IInstructionWithAccounts<TAccountMetas> & IInstructionWithData<Uint8Array>): ParsedCleanInstruction<TProgram, TAccountMetas>;