@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.
Files changed (71) hide show
  1. package/.gitlab-ci.yml +6 -5
  2. package/dist/config/defaultConfigs.js +15 -18
  3. package/dist/config/index.js +3 -19
  4. package/dist/config/types.d.ts +1 -3
  5. package/dist/config/types.js +4 -7
  6. package/dist/config/utils.js +8 -13
  7. package/dist/errors/NosanaError.d.ts +1 -0
  8. package/dist/errors/NosanaError.js +3 -6
  9. package/dist/generated_clients/jobs/accounts/index.js +3 -19
  10. package/dist/generated_clients/jobs/accounts/jobAccount.js +46 -59
  11. package/dist/generated_clients/jobs/accounts/marketAccount.js +45 -57
  12. package/dist/generated_clients/jobs/accounts/runAccount.js +36 -49
  13. package/dist/generated_clients/jobs/errors/index.js +1 -17
  14. package/dist/generated_clients/jobs/errors/nosanaJobs.js +43 -48
  15. package/dist/generated_clients/jobs/index.js +5 -21
  16. package/dist/generated_clients/jobs/instructions/claim.js +17 -26
  17. package/dist/generated_clients/jobs/instructions/clean.js +17 -26
  18. package/dist/generated_clients/jobs/instructions/cleanAdmin.js +17 -26
  19. package/dist/generated_clients/jobs/instructions/close.js +17 -26
  20. package/dist/generated_clients/jobs/instructions/closeAdmin.js +17 -26
  21. package/dist/generated_clients/jobs/instructions/complete.js +21 -30
  22. package/dist/generated_clients/jobs/instructions/delist.js +17 -26
  23. package/dist/generated_clients/jobs/instructions/end.js +17 -26
  24. package/dist/generated_clients/jobs/instructions/extend.js +21 -30
  25. package/dist/generated_clients/jobs/instructions/finish.js +21 -30
  26. package/dist/generated_clients/jobs/instructions/index.js +18 -34
  27. package/dist/generated_clients/jobs/instructions/list.js +23 -32
  28. package/dist/generated_clients/jobs/instructions/open.js +29 -38
  29. package/dist/generated_clients/jobs/instructions/quit.js +17 -26
  30. package/dist/generated_clients/jobs/instructions/quitAdmin.js +17 -26
  31. package/dist/generated_clients/jobs/instructions/recover.js +17 -26
  32. package/dist/generated_clients/jobs/instructions/stop.js +17 -26
  33. package/dist/generated_clients/jobs/instructions/update.js +29 -38
  34. package/dist/generated_clients/jobs/instructions/work.js +17 -26
  35. package/dist/generated_clients/jobs/programs/index.js +1 -17
  36. package/dist/generated_clients/jobs/programs/nosanaJobs.js +29 -34
  37. package/dist/generated_clients/jobs/shared/index.js +13 -21
  38. package/dist/generated_clients/jobs/types/index.js +3 -19
  39. package/dist/generated_clients/jobs/types/jobState.js +9 -15
  40. package/dist/generated_clients/jobs/types/jobType.js +9 -15
  41. package/dist/generated_clients/jobs/types/queueType.js +9 -15
  42. package/dist/index.d.ts +5 -1
  43. package/dist/index.js +149 -35
  44. package/dist/ipfs/IPFS.js +5 -12
  45. package/dist/logger/Logger.js +1 -5
  46. package/dist/programs/BaseProgram.js +1 -5
  47. package/dist/programs/JobsProgram.d.ts +2 -3
  48. package/dist/programs/JobsProgram.js +35 -99
  49. package/dist/solana/SolanaUtils.d.ts +15 -1
  50. package/dist/solana/SolanaUtils.js +81 -14
  51. package/dist/utils/index.js +1 -4
  52. package/examples/browser/.gitlab-ci.yml +78 -0
  53. package/examples/browser/FEATURES.md +141 -0
  54. package/examples/browser/QUICK_START.md +76 -0
  55. package/examples/browser/README.md +182 -0
  56. package/examples/browser/app.vue +1840 -0
  57. package/examples/browser/assets/css/main.css +7 -0
  58. package/examples/browser/nuxt.config.ts +24 -0
  59. package/examples/browser/package-lock.json +11855 -0
  60. package/examples/browser/package.json +31 -0
  61. package/examples/browser/public/favicon.ico +0 -0
  62. package/examples/browser/public/robots.txt +2 -0
  63. package/examples/browser/start.sh +38 -0
  64. package/examples/browser/tailwind.config.js +26 -0
  65. package/examples/node/README.md +146 -0
  66. package/examples/node/example-keypair.json +1 -0
  67. package/examples/node/package-lock.json +500 -156
  68. package/examples/node/package.json +5 -3
  69. package/examples/node/post-job.ts +160 -0
  70. package/examples/node/set-wallet.ts +87 -0
  71. 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,37 +5,29 @@
6
5
  *
7
6
  * @see https://github.com/codama-idl/codama
8
7
  */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.QUIT_ADMIN_DISCRIMINATOR = void 0;
11
- exports.getQuitAdminDiscriminatorBytes = getQuitAdminDiscriminatorBytes;
12
- exports.getQuitAdminInstructionDataEncoder = getQuitAdminInstructionDataEncoder;
13
- exports.getQuitAdminInstructionDataDecoder = getQuitAdminInstructionDataDecoder;
14
- exports.getQuitAdminInstructionDataCodec = getQuitAdminInstructionDataCodec;
15
- exports.getQuitAdminInstruction = getQuitAdminInstruction;
16
- exports.parseQuitAdminInstruction = parseQuitAdminInstruction;
17
- const kit_1 = require("@solana/kit");
18
- const programs_1 = require("../programs");
19
- const shared_1 = require("../shared");
20
- exports.QUIT_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 QUIT_ADMIN_DISCRIMINATOR = new Uint8Array([
21
12
  103, 238, 110, 8, 182, 20, 56, 196,
22
13
  ]);
23
- function getQuitAdminDiscriminatorBytes() {
24
- return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.QUIT_ADMIN_DISCRIMINATOR);
14
+ export function getQuitAdminDiscriminatorBytes() {
15
+ return fixEncoderSize(getBytesEncoder(), 8).encode(QUIT_ADMIN_DISCRIMINATOR);
25
16
  }
26
- function getQuitAdminInstructionDataEncoder() {
27
- return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([['discriminator', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)]]), (value) => ({ ...value, discriminator: exports.QUIT_ADMIN_DISCRIMINATOR }));
17
+ export function getQuitAdminInstructionDataEncoder() {
18
+ return transformEncoder(getStructEncoder([['discriminator', fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({ ...value, discriminator: QUIT_ADMIN_DISCRIMINATOR }));
28
19
  }
29
- function getQuitAdminInstructionDataDecoder() {
30
- return (0, kit_1.getStructDecoder)([
31
- ['discriminator', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
20
+ export function getQuitAdminInstructionDataDecoder() {
21
+ return getStructDecoder([
22
+ ['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
32
23
  ]);
33
24
  }
34
- function getQuitAdminInstructionDataCodec() {
35
- return (0, kit_1.combineCodec)(getQuitAdminInstructionDataEncoder(), getQuitAdminInstructionDataDecoder());
25
+ export function getQuitAdminInstructionDataCodec() {
26
+ return combineCodec(getQuitAdminInstructionDataEncoder(), getQuitAdminInstructionDataDecoder());
36
27
  }
37
- function getQuitAdminInstruction(input, config) {
28
+ export function getQuitAdminInstruction(input, config) {
38
29
  // Program address.
39
- const programAddress = config?.programAddress ?? programs_1.NOSANA_JOBS_PROGRAM_ADDRESS;
30
+ const programAddress = config?.programAddress ?? NOSANA_JOBS_PROGRAM_ADDRESS;
40
31
  // Original accounts.
41
32
  const originalAccounts = {
42
33
  run: { value: input.run ?? null, isWritable: true },
@@ -44,7 +35,7 @@ function getQuitAdminInstruction(input, config) {
44
35
  authority: { value: input.authority ?? null, isWritable: false },
45
36
  };
46
37
  const accounts = originalAccounts;
47
- const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, 'programId');
38
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
48
39
  const instruction = {
49
40
  accounts: [
50
41
  getAccountMeta(accounts.run),
@@ -56,7 +47,7 @@ function getQuitAdminInstruction(input, config) {
56
47
  };
57
48
  return instruction;
58
49
  }
59
- function parseQuitAdminInstruction(instruction) {
50
+ export function parseQuitAdminInstruction(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
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.RECOVER_DISCRIMINATOR = void 0;
11
- exports.getRecoverDiscriminatorBytes = getRecoverDiscriminatorBytes;
12
- exports.getRecoverInstructionDataEncoder = getRecoverInstructionDataEncoder;
13
- exports.getRecoverInstructionDataDecoder = getRecoverInstructionDataDecoder;
14
- exports.getRecoverInstructionDataCodec = getRecoverInstructionDataCodec;
15
- exports.getRecoverInstruction = getRecoverInstruction;
16
- exports.parseRecoverInstruction = parseRecoverInstruction;
17
- const kit_1 = require("@solana/kit");
18
- const programs_1 = require("../programs");
19
- const shared_1 = require("../shared");
20
- exports.RECOVER_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 RECOVER_DISCRIMINATOR = new Uint8Array([
21
12
  108, 216, 38, 58, 109, 146, 116, 17,
22
13
  ]);
23
- function getRecoverDiscriminatorBytes() {
24
- return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.RECOVER_DISCRIMINATOR);
14
+ export function getRecoverDiscriminatorBytes() {
15
+ return fixEncoderSize(getBytesEncoder(), 8).encode(RECOVER_DISCRIMINATOR);
25
16
  }
26
- function getRecoverInstructionDataEncoder() {
27
- return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([['discriminator', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)]]), (value) => ({ ...value, discriminator: exports.RECOVER_DISCRIMINATOR }));
17
+ export function getRecoverInstructionDataEncoder() {
18
+ return transformEncoder(getStructEncoder([['discriminator', fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({ ...value, discriminator: RECOVER_DISCRIMINATOR }));
28
19
  }
29
- function getRecoverInstructionDataDecoder() {
30
- return (0, kit_1.getStructDecoder)([
31
- ['discriminator', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
20
+ export function getRecoverInstructionDataDecoder() {
21
+ return getStructDecoder([
22
+ ['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
32
23
  ]);
33
24
  }
34
- function getRecoverInstructionDataCodec() {
35
- return (0, kit_1.combineCodec)(getRecoverInstructionDataEncoder(), getRecoverInstructionDataDecoder());
25
+ export function getRecoverInstructionDataCodec() {
26
+ return combineCodec(getRecoverInstructionDataEncoder(), getRecoverInstructionDataDecoder());
36
27
  }
37
- function getRecoverInstruction(input, config) {
28
+ export function getRecoverInstruction(input, config) {
38
29
  // Program address.
39
- const programAddress = config?.programAddress ?? programs_1.NOSANA_JOBS_PROGRAM_ADDRESS;
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 },
@@ -53,7 +44,7 @@ function getRecoverInstruction(input, config) {
53
44
  accounts.tokenProgram.value =
54
45
  'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
55
46
  }
56
- const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, 'programId');
47
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
57
48
  const instruction = {
58
49
  accounts: [
59
50
  getAccountMeta(accounts.job),
@@ -69,7 +60,7 @@ function getRecoverInstruction(input, config) {
69
60
  };
70
61
  return instruction;
71
62
  }
72
- function parseRecoverInstruction(instruction) {
63
+ export function parseRecoverInstruction(instruction) {
73
64
  if (instruction.accounts.length < 7) {
74
65
  // TODO: Coded error.
75
66
  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
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.STOP_DISCRIMINATOR = void 0;
11
- exports.getStopDiscriminatorBytes = getStopDiscriminatorBytes;
12
- exports.getStopInstructionDataEncoder = getStopInstructionDataEncoder;
13
- exports.getStopInstructionDataDecoder = getStopInstructionDataDecoder;
14
- exports.getStopInstructionDataCodec = getStopInstructionDataCodec;
15
- exports.getStopInstruction = getStopInstruction;
16
- exports.parseStopInstruction = parseStopInstruction;
17
- const kit_1 = require("@solana/kit");
18
- const programs_1 = require("../programs");
19
- const shared_1 = require("../shared");
20
- exports.STOP_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 STOP_DISCRIMINATOR = new Uint8Array([
21
12
  42, 133, 32, 60, 171, 253, 184, 155,
22
13
  ]);
23
- function getStopDiscriminatorBytes() {
24
- return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.STOP_DISCRIMINATOR);
14
+ export function getStopDiscriminatorBytes() {
15
+ return fixEncoderSize(getBytesEncoder(), 8).encode(STOP_DISCRIMINATOR);
25
16
  }
26
- function getStopInstructionDataEncoder() {
27
- return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([['discriminator', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)]]), (value) => ({ ...value, discriminator: exports.STOP_DISCRIMINATOR }));
17
+ export function getStopInstructionDataEncoder() {
18
+ return transformEncoder(getStructEncoder([['discriminator', fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({ ...value, discriminator: STOP_DISCRIMINATOR }));
28
19
  }
29
- function getStopInstructionDataDecoder() {
30
- return (0, kit_1.getStructDecoder)([
31
- ['discriminator', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
20
+ export function getStopInstructionDataDecoder() {
21
+ return getStructDecoder([
22
+ ['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
32
23
  ]);
33
24
  }
34
- function getStopInstructionDataCodec() {
35
- return (0, kit_1.combineCodec)(getStopInstructionDataEncoder(), getStopInstructionDataDecoder());
25
+ export function getStopInstructionDataCodec() {
26
+ return combineCodec(getStopInstructionDataEncoder(), getStopInstructionDataDecoder());
36
27
  }
37
- function getStopInstruction(input, config) {
28
+ export function getStopInstruction(input, config) {
38
29
  // Program address.
39
- const programAddress = config?.programAddress ?? programs_1.NOSANA_JOBS_PROGRAM_ADDRESS;
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 },
@@ -44,7 +35,7 @@ function getStopInstruction(input, config) {
44
35
  authority: { value: input.authority ?? null, isWritable: false },
45
36
  };
46
37
  const accounts = originalAccounts;
47
- const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, 'programId');
38
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
48
39
  const instruction = {
49
40
  accounts: [
50
41
  getAccountMeta(accounts.market),
@@ -56,7 +47,7 @@ function getStopInstruction(input, config) {
56
47
  };
57
48
  return instruction;
58
49
  }
59
- function parseStopInstruction(instruction) {
50
+ export function parseStopInstruction(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,49 +5,41 @@
6
5
  *
7
6
  * @see https://github.com/codama-idl/codama
8
7
  */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.UPDATE_DISCRIMINATOR = void 0;
11
- exports.getUpdateDiscriminatorBytes = getUpdateDiscriminatorBytes;
12
- exports.getUpdateInstructionDataEncoder = getUpdateInstructionDataEncoder;
13
- exports.getUpdateInstructionDataDecoder = getUpdateInstructionDataDecoder;
14
- exports.getUpdateInstructionDataCodec = getUpdateInstructionDataCodec;
15
- exports.getUpdateInstruction = getUpdateInstruction;
16
- exports.parseUpdateInstruction = parseUpdateInstruction;
17
- const kit_1 = require("@solana/kit");
18
- const programs_1 = require("../programs");
19
- const shared_1 = require("../shared");
20
- exports.UPDATE_DISCRIMINATOR = new Uint8Array([
8
+ import { combineCodec, fixDecoderSize, fixEncoderSize, getBytesDecoder, getBytesEncoder, getI64Decoder, getI64Encoder, getStructDecoder, getStructEncoder, getU128Decoder, getU128Encoder, getU64Decoder, getU64Encoder, getU8Decoder, getU8Encoder, transformEncoder, } from '@solana/kit';
9
+ import { NOSANA_JOBS_PROGRAM_ADDRESS } from '../programs';
10
+ import { getAccountMetaFactory } from '../shared';
11
+ export const UPDATE_DISCRIMINATOR = new Uint8Array([
21
12
  219, 200, 88, 176, 158, 63, 253, 127,
22
13
  ]);
23
- function getUpdateDiscriminatorBytes() {
24
- return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.UPDATE_DISCRIMINATOR);
14
+ export function getUpdateDiscriminatorBytes() {
15
+ return fixEncoderSize(getBytesEncoder(), 8).encode(UPDATE_DISCRIMINATOR);
25
16
  }
26
- function getUpdateInstructionDataEncoder() {
27
- return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([
28
- ['discriminator', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)],
29
- ['jobExpiration', (0, kit_1.getI64Encoder)()],
30
- ['jobPrice', (0, kit_1.getU64Encoder)()],
31
- ['jobType', (0, kit_1.getU8Encoder)()],
32
- ['nodeStakeMinimum', (0, kit_1.getU128Encoder)()],
33
- ['jobTimeout', (0, kit_1.getI64Encoder)()],
34
- ]), (value) => ({ ...value, discriminator: exports.UPDATE_DISCRIMINATOR }));
17
+ export function getUpdateInstructionDataEncoder() {
18
+ return transformEncoder(getStructEncoder([
19
+ ['discriminator', fixEncoderSize(getBytesEncoder(), 8)],
20
+ ['jobExpiration', getI64Encoder()],
21
+ ['jobPrice', getU64Encoder()],
22
+ ['jobType', getU8Encoder()],
23
+ ['nodeStakeMinimum', getU128Encoder()],
24
+ ['jobTimeout', getI64Encoder()],
25
+ ]), (value) => ({ ...value, discriminator: UPDATE_DISCRIMINATOR }));
35
26
  }
36
- function getUpdateInstructionDataDecoder() {
37
- return (0, kit_1.getStructDecoder)([
38
- ['discriminator', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
39
- ['jobExpiration', (0, kit_1.getI64Decoder)()],
40
- ['jobPrice', (0, kit_1.getU64Decoder)()],
41
- ['jobType', (0, kit_1.getU8Decoder)()],
42
- ['nodeStakeMinimum', (0, kit_1.getU128Decoder)()],
43
- ['jobTimeout', (0, kit_1.getI64Decoder)()],
27
+ export function getUpdateInstructionDataDecoder() {
28
+ return getStructDecoder([
29
+ ['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
30
+ ['jobExpiration', getI64Decoder()],
31
+ ['jobPrice', getU64Decoder()],
32
+ ['jobType', getU8Decoder()],
33
+ ['nodeStakeMinimum', getU128Decoder()],
34
+ ['jobTimeout', getI64Decoder()],
44
35
  ]);
45
36
  }
46
- function getUpdateInstructionDataCodec() {
47
- return (0, kit_1.combineCodec)(getUpdateInstructionDataEncoder(), getUpdateInstructionDataDecoder());
37
+ export function getUpdateInstructionDataCodec() {
38
+ return combineCodec(getUpdateInstructionDataEncoder(), getUpdateInstructionDataDecoder());
48
39
  }
49
- function getUpdateInstruction(input, config) {
40
+ export function getUpdateInstruction(input, config) {
50
41
  // Program address.
51
- const programAddress = config?.programAddress ?? programs_1.NOSANA_JOBS_PROGRAM_ADDRESS;
42
+ const programAddress = config?.programAddress ?? NOSANA_JOBS_PROGRAM_ADDRESS;
52
43
  // Original accounts.
53
44
  const originalAccounts = {
54
45
  market: { value: input.market ?? null, isWritable: true },
@@ -58,7 +49,7 @@ function getUpdateInstruction(input, config) {
58
49
  const accounts = originalAccounts;
59
50
  // Original args.
60
51
  const args = { ...input };
61
- const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, 'programId');
52
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
62
53
  const instruction = {
63
54
  accounts: [
64
55
  getAccountMeta(accounts.market),
@@ -70,7 +61,7 @@ function getUpdateInstruction(input, config) {
70
61
  };
71
62
  return instruction;
72
63
  }
73
- function parseUpdateInstruction(instruction) {
64
+ export function parseUpdateInstruction(instruction) {
74
65
  if (instruction.accounts.length < 3) {
75
66
  // TODO: Coded error.
76
67
  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
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.WORK_DISCRIMINATOR = void 0;
11
- exports.getWorkDiscriminatorBytes = getWorkDiscriminatorBytes;
12
- exports.getWorkInstructionDataEncoder = getWorkInstructionDataEncoder;
13
- exports.getWorkInstructionDataDecoder = getWorkInstructionDataDecoder;
14
- exports.getWorkInstructionDataCodec = getWorkInstructionDataCodec;
15
- exports.getWorkInstruction = getWorkInstruction;
16
- exports.parseWorkInstruction = parseWorkInstruction;
17
- const kit_1 = require("@solana/kit");
18
- const programs_1 = require("../programs");
19
- const shared_1 = require("../shared");
20
- exports.WORK_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 WORK_DISCRIMINATOR = new Uint8Array([
21
12
  15, 67, 45, 195, 215, 137, 229, 47,
22
13
  ]);
23
- function getWorkDiscriminatorBytes() {
24
- return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.WORK_DISCRIMINATOR);
14
+ export function getWorkDiscriminatorBytes() {
15
+ return fixEncoderSize(getBytesEncoder(), 8).encode(WORK_DISCRIMINATOR);
25
16
  }
26
- function getWorkInstructionDataEncoder() {
27
- return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([['discriminator', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)]]), (value) => ({ ...value, discriminator: exports.WORK_DISCRIMINATOR }));
17
+ export function getWorkInstructionDataEncoder() {
18
+ return transformEncoder(getStructEncoder([['discriminator', fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({ ...value, discriminator: WORK_DISCRIMINATOR }));
28
19
  }
29
- function getWorkInstructionDataDecoder() {
30
- return (0, kit_1.getStructDecoder)([
31
- ['discriminator', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
20
+ export function getWorkInstructionDataDecoder() {
21
+ return getStructDecoder([
22
+ ['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
32
23
  ]);
33
24
  }
34
- function getWorkInstructionDataCodec() {
35
- return (0, kit_1.combineCodec)(getWorkInstructionDataEncoder(), getWorkInstructionDataDecoder());
25
+ export function getWorkInstructionDataCodec() {
26
+ return combineCodec(getWorkInstructionDataEncoder(), getWorkInstructionDataDecoder());
36
27
  }
37
- function getWorkInstruction(input, config) {
28
+ export function getWorkInstruction(input, config) {
38
29
  // Program address.
39
- const programAddress = config?.programAddress ?? programs_1.NOSANA_JOBS_PROGRAM_ADDRESS;
30
+ const programAddress = config?.programAddress ?? NOSANA_JOBS_PROGRAM_ADDRESS;
40
31
  // Original accounts.
41
32
  const originalAccounts = {
42
33
  run: { value: input.run ?? null, isWritable: true },
@@ -54,7 +45,7 @@ function getWorkInstruction(input, config) {
54
45
  accounts.systemProgram.value =
55
46
  '11111111111111111111111111111111';
56
47
  }
57
- const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, 'programId');
48
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
58
49
  const instruction = {
59
50
  accounts: [
60
51
  getAccountMeta(accounts.run),
@@ -71,7 +62,7 @@ function getWorkInstruction(input, config) {
71
62
  };
72
63
  return instruction;
73
64
  }
74
- function parseWorkInstruction(instruction) {
65
+ export function parseWorkInstruction(instruction) {
75
66
  if (instruction.accounts.length < 8) {
76
67
  // TODO: Coded error.
77
68
  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,19 +5,4 @@
6
5
  *
7
6
  * @see https://github.com/codama-idl/codama
8
7
  */
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);
8
+ export * from './nosanaJobs';
@@ -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,32 +5,28 @@
6
5
  *
7
6
  * @see https://github.com/codama-idl/codama
8
7
  */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.NosanaJobsInstruction = exports.NosanaJobsAccount = exports.NOSANA_JOBS_PROGRAM_ADDRESS = void 0;
11
- exports.identifyNosanaJobsAccount = identifyNosanaJobsAccount;
12
- exports.identifyNosanaJobsInstruction = identifyNosanaJobsInstruction;
13
- const kit_1 = require("@solana/kit");
14
- exports.NOSANA_JOBS_PROGRAM_ADDRESS = 'nosJTmGQxvwXy23vng5UjkTbfv91Bzf9jEuro78dAGR';
15
- var NosanaJobsAccount;
8
+ import { containsBytes, fixEncoderSize, getBytesEncoder, } from '@solana/kit';
9
+ export const NOSANA_JOBS_PROGRAM_ADDRESS = 'nosJTmGQxvwXy23vng5UjkTbfv91Bzf9jEuro78dAGR';
10
+ export var NosanaJobsAccount;
16
11
  (function (NosanaJobsAccount) {
17
12
  NosanaJobsAccount[NosanaJobsAccount["MarketAccount"] = 0] = "MarketAccount";
18
13
  NosanaJobsAccount[NosanaJobsAccount["JobAccount"] = 1] = "JobAccount";
19
14
  NosanaJobsAccount[NosanaJobsAccount["RunAccount"] = 2] = "RunAccount";
20
- })(NosanaJobsAccount || (exports.NosanaJobsAccount = NosanaJobsAccount = {}));
21
- function identifyNosanaJobsAccount(account) {
15
+ })(NosanaJobsAccount || (NosanaJobsAccount = {}));
16
+ export function identifyNosanaJobsAccount(account) {
22
17
  const data = 'data' in account ? account.data : account;
23
- if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([201, 78, 187, 225, 240, 198, 201, 251])), 0)) {
18
+ if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([201, 78, 187, 225, 240, 198, 201, 251])), 0)) {
24
19
  return NosanaJobsAccount.MarketAccount;
25
20
  }
26
- if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([91, 16, 162, 5, 45, 210, 125, 65])), 0)) {
21
+ if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([91, 16, 162, 5, 45, 210, 125, 65])), 0)) {
27
22
  return NosanaJobsAccount.JobAccount;
28
23
  }
29
- if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([194, 169, 110, 230, 235, 11, 225, 22])), 0)) {
24
+ if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([194, 169, 110, 230, 235, 11, 225, 22])), 0)) {
30
25
  return NosanaJobsAccount.RunAccount;
31
26
  }
32
27
  throw new Error('The provided account could not be identified as a nosanaJobs account.');
33
28
  }
34
- var NosanaJobsInstruction;
29
+ export var NosanaJobsInstruction;
35
30
  (function (NosanaJobsInstruction) {
36
31
  NosanaJobsInstruction[NosanaJobsInstruction["Open"] = 0] = "Open";
37
32
  NosanaJobsInstruction[NosanaJobsInstruction["Update"] = 1] = "Update";
@@ -51,61 +46,61 @@ var NosanaJobsInstruction;
51
46
  NosanaJobsInstruction[NosanaJobsInstruction["QuitAdmin"] = 15] = "QuitAdmin";
52
47
  NosanaJobsInstruction[NosanaJobsInstruction["Clean"] = 16] = "Clean";
53
48
  NosanaJobsInstruction[NosanaJobsInstruction["CleanAdmin"] = 17] = "CleanAdmin";
54
- })(NosanaJobsInstruction || (exports.NosanaJobsInstruction = NosanaJobsInstruction = {}));
55
- function identifyNosanaJobsInstruction(instruction) {
49
+ })(NosanaJobsInstruction || (NosanaJobsInstruction = {}));
50
+ export function identifyNosanaJobsInstruction(instruction) {
56
51
  const data = 'data' in instruction ? instruction.data : instruction;
57
- if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([228, 220, 155, 71, 199, 189, 60, 45])), 0)) {
52
+ if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([228, 220, 155, 71, 199, 189, 60, 45])), 0)) {
58
53
  return NosanaJobsInstruction.Open;
59
54
  }
60
- if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([219, 200, 88, 176, 158, 63, 253, 127])), 0)) {
55
+ if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([219, 200, 88, 176, 158, 63, 253, 127])), 0)) {
61
56
  return NosanaJobsInstruction.Update;
62
57
  }
63
- if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([98, 165, 201, 177, 108, 65, 206, 96])), 0)) {
58
+ if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([98, 165, 201, 177, 108, 65, 206, 96])), 0)) {
64
59
  return NosanaJobsInstruction.Close;
65
60
  }
66
- if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([202, 182, 185, 142, 208, 161, 145, 189])), 0)) {
61
+ if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([202, 182, 185, 142, 208, 161, 145, 189])), 0)) {
67
62
  return NosanaJobsInstruction.CloseAdmin;
68
63
  }
69
- if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([54, 174, 193, 67, 17, 41, 132, 38])), 0)) {
64
+ if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([54, 174, 193, 67, 17, 41, 132, 38])), 0)) {
70
65
  return NosanaJobsInstruction.List;
71
66
  }
72
- if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([55, 136, 205, 107, 107, 173, 4, 31])), 0)) {
67
+ if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([55, 136, 205, 107, 107, 173, 4, 31])), 0)) {
73
68
  return NosanaJobsInstruction.Delist;
74
69
  }
75
- if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([108, 216, 38, 58, 109, 146, 116, 17])), 0)) {
70
+ if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([108, 216, 38, 58, 109, 146, 116, 17])), 0)) {
76
71
  return NosanaJobsInstruction.Recover;
77
72
  }
78
- if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([228, 127, 0, 1, 227, 154, 54, 168])), 0)) {
73
+ if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([228, 127, 0, 1, 227, 154, 54, 168])), 0)) {
79
74
  return NosanaJobsInstruction.Extend;
80
75
  }
81
- if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([180, 160, 249, 217, 194, 121, 70, 16])), 0)) {
76
+ if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([180, 160, 249, 217, 194, 121, 70, 16])), 0)) {
82
77
  return NosanaJobsInstruction.End;
83
78
  }
84
- if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([15, 67, 45, 195, 215, 137, 229, 47])), 0)) {
79
+ if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([15, 67, 45, 195, 215, 137, 229, 47])), 0)) {
85
80
  return NosanaJobsInstruction.Work;
86
81
  }
87
- if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([42, 133, 32, 60, 171, 253, 184, 155])), 0)) {
82
+ if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([42, 133, 32, 60, 171, 253, 184, 155])), 0)) {
88
83
  return NosanaJobsInstruction.Stop;
89
84
  }
90
- if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([62, 198, 214, 193, 213, 159, 108, 210])), 0)) {
85
+ if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([62, 198, 214, 193, 213, 159, 108, 210])), 0)) {
91
86
  return NosanaJobsInstruction.Claim;
92
87
  }
93
- if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([0, 77, 224, 147, 136, 25, 88, 76])), 0)) {
88
+ if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([0, 77, 224, 147, 136, 25, 88, 76])), 0)) {
94
89
  return NosanaJobsInstruction.Complete;
95
90
  }
96
- if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([67, 74, 170, 132, 125, 233, 182, 37])), 0)) {
91
+ if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([67, 74, 170, 132, 125, 233, 182, 37])), 0)) {
97
92
  return NosanaJobsInstruction.Finish;
98
93
  }
99
- if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([191, 103, 141, 240, 80, 129, 103, 153])), 0)) {
94
+ if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([191, 103, 141, 240, 80, 129, 103, 153])), 0)) {
100
95
  return NosanaJobsInstruction.Quit;
101
96
  }
102
- if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([103, 238, 110, 8, 182, 20, 56, 196])), 0)) {
97
+ if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([103, 238, 110, 8, 182, 20, 56, 196])), 0)) {
103
98
  return NosanaJobsInstruction.QuitAdmin;
104
99
  }
105
- if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([250, 191, 56, 128, 150, 251, 1, 103])), 0)) {
100
+ if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([250, 191, 56, 128, 150, 251, 1, 103])), 0)) {
106
101
  return NosanaJobsInstruction.Clean;
107
102
  }
108
- if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([245, 90, 188, 68, 253, 235, 171, 105])), 0)) {
103
+ if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([245, 90, 188, 68, 253, 235, 171, 105])), 0)) {
109
104
  return NosanaJobsInstruction.CleanAdmin;
110
105
  }
111
106
  throw new Error('The provided instruction could not be identified as a nosanaJobs instruction.');