@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,79 @@
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.CLEAN_DISCRIMINATOR = void 0;
11
+ exports.getCleanDiscriminatorBytes = getCleanDiscriminatorBytes;
12
+ exports.getCleanInstructionDataEncoder = getCleanInstructionDataEncoder;
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([
21
+ 250, 191, 56, 128, 150, 251, 1, 103,
22
+ ]);
23
+ function getCleanDiscriminatorBytes() {
24
+ return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.CLEAN_DISCRIMINATOR);
25
+ }
26
+ function getCleanInstructionDataEncoder() {
27
+ return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([['discriminator', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)]]), (value) => ({ ...value, discriminator: exports.CLEAN_DISCRIMINATOR }));
28
+ }
29
+ function getCleanInstructionDataDecoder() {
30
+ return (0, kit_1.getStructDecoder)([
31
+ ['discriminator', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
32
+ ]);
33
+ }
34
+ function getCleanInstructionDataCodec() {
35
+ return (0, kit_1.combineCodec)(getCleanInstructionDataEncoder(), getCleanInstructionDataDecoder());
36
+ }
37
+ function getCleanInstruction(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
+ market: { value: input.market ?? null, isWritable: false },
44
+ payer: { value: input.payer ?? null, isWritable: true },
45
+ };
46
+ const accounts = originalAccounts;
47
+ const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, 'programId');
48
+ const instruction = {
49
+ accounts: [
50
+ getAccountMeta(accounts.job),
51
+ getAccountMeta(accounts.market),
52
+ getAccountMeta(accounts.payer),
53
+ ],
54
+ programAddress,
55
+ data: getCleanInstructionDataEncoder().encode({}),
56
+ };
57
+ return instruction;
58
+ }
59
+ function parseCleanInstruction(instruction) {
60
+ if (instruction.accounts.length < 3) {
61
+ // TODO: Coded error.
62
+ throw new Error('Not enough accounts');
63
+ }
64
+ let accountIndex = 0;
65
+ const getNextAccount = () => {
66
+ const accountMeta = instruction.accounts[accountIndex];
67
+ accountIndex += 1;
68
+ return accountMeta;
69
+ };
70
+ return {
71
+ programAddress: instruction.programAddress,
72
+ accounts: {
73
+ job: getNextAccount(),
74
+ market: getNextAccount(),
75
+ payer: getNextAccount(),
76
+ },
77
+ data: getCleanInstructionDataDecoder().decode(instruction.data),
78
+ };
79
+ }
@@ -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 IAccountSignerMeta, type IInstruction, type IInstructionWithAccounts, type IInstructionWithData, type ReadonlySignerAccount, type ReadonlyUint8Array, type TransactionSigner, type WritableAccount } from '@solana/kit';
9
+ import { NOSANA_JOBS_PROGRAM_ADDRESS } from '../programs';
10
+ export declare const CLEAN_ADMIN_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
11
+ export declare function getCleanAdminDiscriminatorBytes(): ReadonlyUint8Array;
12
+ export type CleanAdminInstruction<TProgram extends string = typeof NOSANA_JOBS_PROGRAM_ADDRESS, TAccountJob extends string | IAccountMeta<string> = string, TAccountPayer extends string | IAccountMeta<string> = string, TAccountAuthority extends string | IAccountMeta<string> = string, TRemainingAccounts extends readonly IAccountMeta<string>[] = []> = IInstruction<TProgram> & IInstructionWithData<Uint8Array> & IInstructionWithAccounts<[
13
+ TAccountJob extends string ? WritableAccount<TAccountJob> : TAccountJob,
14
+ TAccountPayer extends string ? WritableAccount<TAccountPayer> : TAccountPayer,
15
+ TAccountAuthority extends string ? ReadonlySignerAccount<TAccountAuthority> & IAccountSignerMeta<TAccountAuthority> : TAccountAuthority,
16
+ ...TRemainingAccounts
17
+ ]>;
18
+ export type CleanAdminInstructionData = {
19
+ discriminator: ReadonlyUint8Array;
20
+ };
21
+ export type CleanAdminInstructionDataArgs = {};
22
+ export declare function getCleanAdminInstructionDataEncoder(): Encoder<CleanAdminInstructionDataArgs>;
23
+ export declare function getCleanAdminInstructionDataDecoder(): Decoder<CleanAdminInstructionData>;
24
+ export declare function getCleanAdminInstructionDataCodec(): Codec<CleanAdminInstructionDataArgs, CleanAdminInstructionData>;
25
+ export type CleanAdminInput<TAccountJob extends string = string, TAccountPayer extends string = string, TAccountAuthority extends string = string> = {
26
+ job: Address<TAccountJob>;
27
+ payer: Address<TAccountPayer>;
28
+ authority: TransactionSigner<TAccountAuthority>;
29
+ };
30
+ export declare function getCleanAdminInstruction<TAccountJob extends string, TAccountPayer extends string, TAccountAuthority extends string, TProgramAddress extends Address = typeof NOSANA_JOBS_PROGRAM_ADDRESS>(input: CleanAdminInput<TAccountJob, TAccountPayer, TAccountAuthority>, config?: {
31
+ programAddress?: TProgramAddress;
32
+ }): CleanAdminInstruction<TProgramAddress, TAccountJob, TAccountPayer, TAccountAuthority>;
33
+ export type ParsedCleanAdminInstruction<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
+ payer: TAccountMetas[1];
38
+ authority: TAccountMetas[2];
39
+ };
40
+ data: CleanAdminInstructionData;
41
+ };
42
+ export declare function parseCleanAdminInstruction<TProgram extends string, TAccountMetas extends readonly IAccountMeta[]>(instruction: IInstruction<TProgram> & IInstructionWithAccounts<TAccountMetas> & IInstructionWithData<Uint8Array>): ParsedCleanAdminInstruction<TProgram, TAccountMetas>;
@@ -0,0 +1,79 @@
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.CLEAN_ADMIN_DISCRIMINATOR = void 0;
11
+ exports.getCleanAdminDiscriminatorBytes = getCleanAdminDiscriminatorBytes;
12
+ exports.getCleanAdminInstructionDataEncoder = getCleanAdminInstructionDataEncoder;
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([
21
+ 245, 90, 188, 68, 253, 235, 171, 105,
22
+ ]);
23
+ function getCleanAdminDiscriminatorBytes() {
24
+ return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.CLEAN_ADMIN_DISCRIMINATOR);
25
+ }
26
+ function getCleanAdminInstructionDataEncoder() {
27
+ return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([['discriminator', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)]]), (value) => ({ ...value, discriminator: exports.CLEAN_ADMIN_DISCRIMINATOR }));
28
+ }
29
+ function getCleanAdminInstructionDataDecoder() {
30
+ return (0, kit_1.getStructDecoder)([
31
+ ['discriminator', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
32
+ ]);
33
+ }
34
+ function getCleanAdminInstructionDataCodec() {
35
+ return (0, kit_1.combineCodec)(getCleanAdminInstructionDataEncoder(), getCleanAdminInstructionDataDecoder());
36
+ }
37
+ function getCleanAdminInstruction(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
+ payer: { value: input.payer ?? null, isWritable: true },
44
+ authority: { value: input.authority ?? null, isWritable: false },
45
+ };
46
+ const accounts = originalAccounts;
47
+ const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, 'programId');
48
+ const instruction = {
49
+ accounts: [
50
+ getAccountMeta(accounts.job),
51
+ getAccountMeta(accounts.payer),
52
+ getAccountMeta(accounts.authority),
53
+ ],
54
+ programAddress,
55
+ data: getCleanAdminInstructionDataEncoder().encode({}),
56
+ };
57
+ return instruction;
58
+ }
59
+ function parseCleanAdminInstruction(instruction) {
60
+ if (instruction.accounts.length < 3) {
61
+ // TODO: Coded error.
62
+ throw new Error('Not enough accounts');
63
+ }
64
+ let accountIndex = 0;
65
+ const getNextAccount = () => {
66
+ const accountMeta = instruction.accounts[accountIndex];
67
+ accountIndex += 1;
68
+ return accountMeta;
69
+ };
70
+ return {
71
+ programAddress: instruction.programAddress,
72
+ accounts: {
73
+ job: getNextAccount(),
74
+ payer: getNextAccount(),
75
+ authority: getNextAccount(),
76
+ },
77
+ data: getCleanAdminInstructionDataDecoder().decode(instruction.data),
78
+ };
79
+ }
@@ -0,0 +1,48 @@
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 } from '@solana/kit';
9
+ import { NOSANA_JOBS_PROGRAM_ADDRESS } from '../programs';
10
+ export declare const CLOSE_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
11
+ export declare function getCloseDiscriminatorBytes(): ReadonlyUint8Array;
12
+ export type CloseInstruction<TProgram extends string = typeof NOSANA_JOBS_PROGRAM_ADDRESS, TAccountMarket extends string | IAccountMeta<string> = string, TAccountVault extends string | IAccountMeta<string> = string, TAccountUser extends string | IAccountMeta<string> = string, TAccountAuthority extends string | IAccountMeta<string> = string, TAccountTokenProgram extends string | IAccountMeta<string> = 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA', TRemainingAccounts extends readonly IAccountMeta<string>[] = []> = IInstruction<TProgram> & IInstructionWithData<Uint8Array> & IInstructionWithAccounts<[
13
+ TAccountMarket extends string ? WritableAccount<TAccountMarket> : TAccountMarket,
14
+ TAccountVault extends string ? WritableAccount<TAccountVault> : TAccountVault,
15
+ TAccountUser extends string ? WritableAccount<TAccountUser> : TAccountUser,
16
+ TAccountAuthority extends string ? ReadonlySignerAccount<TAccountAuthority> & IAccountSignerMeta<TAccountAuthority> : TAccountAuthority,
17
+ TAccountTokenProgram extends string ? ReadonlyAccount<TAccountTokenProgram> : TAccountTokenProgram,
18
+ ...TRemainingAccounts
19
+ ]>;
20
+ export type CloseInstructionData = {
21
+ discriminator: ReadonlyUint8Array;
22
+ };
23
+ export type CloseInstructionDataArgs = {};
24
+ export declare function getCloseInstructionDataEncoder(): Encoder<CloseInstructionDataArgs>;
25
+ export declare function getCloseInstructionDataDecoder(): Decoder<CloseInstructionData>;
26
+ export declare function getCloseInstructionDataCodec(): Codec<CloseInstructionDataArgs, CloseInstructionData>;
27
+ export type CloseInput<TAccountMarket extends string = string, TAccountVault extends string = string, TAccountUser extends string = string, TAccountAuthority extends string = string, TAccountTokenProgram extends string = string> = {
28
+ market: Address<TAccountMarket>;
29
+ vault: Address<TAccountVault>;
30
+ user: Address<TAccountUser>;
31
+ authority: TransactionSigner<TAccountAuthority>;
32
+ tokenProgram?: Address<TAccountTokenProgram>;
33
+ };
34
+ export declare function getCloseInstruction<TAccountMarket extends string, TAccountVault extends string, TAccountUser extends string, TAccountAuthority extends string, TAccountTokenProgram extends string, TProgramAddress extends Address = typeof NOSANA_JOBS_PROGRAM_ADDRESS>(input: CloseInput<TAccountMarket, TAccountVault, TAccountUser, TAccountAuthority, TAccountTokenProgram>, config?: {
35
+ programAddress?: TProgramAddress;
36
+ }): CloseInstruction<TProgramAddress, TAccountMarket, TAccountVault, TAccountUser, TAccountAuthority, TAccountTokenProgram>;
37
+ export type ParsedCloseInstruction<TProgram extends string = typeof NOSANA_JOBS_PROGRAM_ADDRESS, TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[]> = {
38
+ programAddress: Address<TProgram>;
39
+ accounts: {
40
+ market: TAccountMetas[0];
41
+ vault: TAccountMetas[1];
42
+ user: TAccountMetas[2];
43
+ authority: TAccountMetas[3];
44
+ tokenProgram: TAccountMetas[4];
45
+ };
46
+ data: CloseInstructionData;
47
+ };
48
+ export declare function parseCloseInstruction<TProgram extends string, TAccountMetas extends readonly IAccountMeta[]>(instruction: IInstruction<TProgram> & IInstructionWithAccounts<TAccountMetas> & IInstructionWithData<Uint8Array>): ParsedCloseInstruction<TProgram, TAccountMetas>;
@@ -0,0 +1,90 @@
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.CLOSE_DISCRIMINATOR = void 0;
11
+ exports.getCloseDiscriminatorBytes = getCloseDiscriminatorBytes;
12
+ exports.getCloseInstructionDataEncoder = getCloseInstructionDataEncoder;
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([
21
+ 98, 165, 201, 177, 108, 65, 206, 96,
22
+ ]);
23
+ function getCloseDiscriminatorBytes() {
24
+ return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.CLOSE_DISCRIMINATOR);
25
+ }
26
+ function getCloseInstructionDataEncoder() {
27
+ return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([['discriminator', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)]]), (value) => ({ ...value, discriminator: exports.CLOSE_DISCRIMINATOR }));
28
+ }
29
+ function getCloseInstructionDataDecoder() {
30
+ return (0, kit_1.getStructDecoder)([
31
+ ['discriminator', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
32
+ ]);
33
+ }
34
+ function getCloseInstructionDataCodec() {
35
+ return (0, kit_1.combineCodec)(getCloseInstructionDataEncoder(), getCloseInstructionDataDecoder());
36
+ }
37
+ function getCloseInstruction(input, config) {
38
+ // Program address.
39
+ const programAddress = config?.programAddress ?? programs_1.NOSANA_JOBS_PROGRAM_ADDRESS;
40
+ // Original accounts.
41
+ const originalAccounts = {
42
+ market: { value: input.market ?? null, isWritable: true },
43
+ vault: { value: input.vault ?? null, isWritable: true },
44
+ user: { value: input.user ?? null, isWritable: true },
45
+ authority: { value: input.authority ?? null, isWritable: false },
46
+ tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
47
+ };
48
+ const accounts = originalAccounts;
49
+ // Resolve default values.
50
+ if (!accounts.tokenProgram.value) {
51
+ accounts.tokenProgram.value =
52
+ 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
53
+ }
54
+ const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, 'programId');
55
+ const instruction = {
56
+ accounts: [
57
+ getAccountMeta(accounts.market),
58
+ getAccountMeta(accounts.vault),
59
+ getAccountMeta(accounts.user),
60
+ getAccountMeta(accounts.authority),
61
+ getAccountMeta(accounts.tokenProgram),
62
+ ],
63
+ programAddress,
64
+ data: getCloseInstructionDataEncoder().encode({}),
65
+ };
66
+ return instruction;
67
+ }
68
+ function parseCloseInstruction(instruction) {
69
+ if (instruction.accounts.length < 5) {
70
+ // TODO: Coded error.
71
+ throw new Error('Not enough accounts');
72
+ }
73
+ let accountIndex = 0;
74
+ const getNextAccount = () => {
75
+ const accountMeta = instruction.accounts[accountIndex];
76
+ accountIndex += 1;
77
+ return accountMeta;
78
+ };
79
+ return {
80
+ programAddress: instruction.programAddress,
81
+ accounts: {
82
+ market: getNextAccount(),
83
+ vault: getNextAccount(),
84
+ user: getNextAccount(),
85
+ authority: getNextAccount(),
86
+ tokenProgram: getNextAccount(),
87
+ },
88
+ data: getCloseInstructionDataDecoder().decode(instruction.data),
89
+ };
90
+ }
@@ -0,0 +1,48 @@
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 } from '@solana/kit';
9
+ import { NOSANA_JOBS_PROGRAM_ADDRESS } from '../programs';
10
+ export declare const CLOSE_ADMIN_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
11
+ export declare function getCloseAdminDiscriminatorBytes(): ReadonlyUint8Array;
12
+ export type CloseAdminInstruction<TProgram extends string = typeof NOSANA_JOBS_PROGRAM_ADDRESS, TAccountMarket extends string | IAccountMeta<string> = string, TAccountVault extends string | IAccountMeta<string> = string, TAccountUser extends string | IAccountMeta<string> = string, TAccountAuthority extends string | IAccountMeta<string> = string, TAccountTokenProgram extends string | IAccountMeta<string> = 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA', TRemainingAccounts extends readonly IAccountMeta<string>[] = []> = IInstruction<TProgram> & IInstructionWithData<Uint8Array> & IInstructionWithAccounts<[
13
+ TAccountMarket extends string ? WritableAccount<TAccountMarket> : TAccountMarket,
14
+ TAccountVault extends string ? WritableAccount<TAccountVault> : TAccountVault,
15
+ TAccountUser extends string ? WritableAccount<TAccountUser> : TAccountUser,
16
+ TAccountAuthority extends string ? ReadonlySignerAccount<TAccountAuthority> & IAccountSignerMeta<TAccountAuthority> : TAccountAuthority,
17
+ TAccountTokenProgram extends string ? ReadonlyAccount<TAccountTokenProgram> : TAccountTokenProgram,
18
+ ...TRemainingAccounts
19
+ ]>;
20
+ export type CloseAdminInstructionData = {
21
+ discriminator: ReadonlyUint8Array;
22
+ };
23
+ export type CloseAdminInstructionDataArgs = {};
24
+ export declare function getCloseAdminInstructionDataEncoder(): Encoder<CloseAdminInstructionDataArgs>;
25
+ export declare function getCloseAdminInstructionDataDecoder(): Decoder<CloseAdminInstructionData>;
26
+ export declare function getCloseAdminInstructionDataCodec(): Codec<CloseAdminInstructionDataArgs, CloseAdminInstructionData>;
27
+ export type CloseAdminInput<TAccountMarket extends string = string, TAccountVault extends string = string, TAccountUser extends string = string, TAccountAuthority extends string = string, TAccountTokenProgram extends string = string> = {
28
+ market: Address<TAccountMarket>;
29
+ vault: Address<TAccountVault>;
30
+ user: Address<TAccountUser>;
31
+ authority: TransactionSigner<TAccountAuthority>;
32
+ tokenProgram?: Address<TAccountTokenProgram>;
33
+ };
34
+ export declare function getCloseAdminInstruction<TAccountMarket extends string, TAccountVault extends string, TAccountUser extends string, TAccountAuthority extends string, TAccountTokenProgram extends string, TProgramAddress extends Address = typeof NOSANA_JOBS_PROGRAM_ADDRESS>(input: CloseAdminInput<TAccountMarket, TAccountVault, TAccountUser, TAccountAuthority, TAccountTokenProgram>, config?: {
35
+ programAddress?: TProgramAddress;
36
+ }): CloseAdminInstruction<TProgramAddress, TAccountMarket, TAccountVault, TAccountUser, TAccountAuthority, TAccountTokenProgram>;
37
+ export type ParsedCloseAdminInstruction<TProgram extends string = typeof NOSANA_JOBS_PROGRAM_ADDRESS, TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[]> = {
38
+ programAddress: Address<TProgram>;
39
+ accounts: {
40
+ market: TAccountMetas[0];
41
+ vault: TAccountMetas[1];
42
+ user: TAccountMetas[2];
43
+ authority: TAccountMetas[3];
44
+ tokenProgram: TAccountMetas[4];
45
+ };
46
+ data: CloseAdminInstructionData;
47
+ };
48
+ export declare function parseCloseAdminInstruction<TProgram extends string, TAccountMetas extends readonly IAccountMeta[]>(instruction: IInstruction<TProgram> & IInstructionWithAccounts<TAccountMetas> & IInstructionWithData<Uint8Array>): ParsedCloseAdminInstruction<TProgram, TAccountMetas>;
@@ -0,0 +1,90 @@
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.CLOSE_ADMIN_DISCRIMINATOR = void 0;
11
+ exports.getCloseAdminDiscriminatorBytes = getCloseAdminDiscriminatorBytes;
12
+ exports.getCloseAdminInstructionDataEncoder = getCloseAdminInstructionDataEncoder;
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([
21
+ 202, 182, 185, 142, 208, 161, 145, 189,
22
+ ]);
23
+ function getCloseAdminDiscriminatorBytes() {
24
+ return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.CLOSE_ADMIN_DISCRIMINATOR);
25
+ }
26
+ function getCloseAdminInstructionDataEncoder() {
27
+ return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([['discriminator', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)]]), (value) => ({ ...value, discriminator: exports.CLOSE_ADMIN_DISCRIMINATOR }));
28
+ }
29
+ function getCloseAdminInstructionDataDecoder() {
30
+ return (0, kit_1.getStructDecoder)([
31
+ ['discriminator', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
32
+ ]);
33
+ }
34
+ function getCloseAdminInstructionDataCodec() {
35
+ return (0, kit_1.combineCodec)(getCloseAdminInstructionDataEncoder(), getCloseAdminInstructionDataDecoder());
36
+ }
37
+ function getCloseAdminInstruction(input, config) {
38
+ // Program address.
39
+ const programAddress = config?.programAddress ?? programs_1.NOSANA_JOBS_PROGRAM_ADDRESS;
40
+ // Original accounts.
41
+ const originalAccounts = {
42
+ market: { value: input.market ?? null, isWritable: true },
43
+ vault: { value: input.vault ?? null, isWritable: true },
44
+ user: { value: input.user ?? null, isWritable: true },
45
+ authority: { value: input.authority ?? null, isWritable: false },
46
+ tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
47
+ };
48
+ const accounts = originalAccounts;
49
+ // Resolve default values.
50
+ if (!accounts.tokenProgram.value) {
51
+ accounts.tokenProgram.value =
52
+ 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
53
+ }
54
+ const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, 'programId');
55
+ const instruction = {
56
+ accounts: [
57
+ getAccountMeta(accounts.market),
58
+ getAccountMeta(accounts.vault),
59
+ getAccountMeta(accounts.user),
60
+ getAccountMeta(accounts.authority),
61
+ getAccountMeta(accounts.tokenProgram),
62
+ ],
63
+ programAddress,
64
+ data: getCloseAdminInstructionDataEncoder().encode({}),
65
+ };
66
+ return instruction;
67
+ }
68
+ function parseCloseAdminInstruction(instruction) {
69
+ if (instruction.accounts.length < 5) {
70
+ // TODO: Coded error.
71
+ throw new Error('Not enough accounts');
72
+ }
73
+ let accountIndex = 0;
74
+ const getNextAccount = () => {
75
+ const accountMeta = instruction.accounts[accountIndex];
76
+ accountIndex += 1;
77
+ return accountMeta;
78
+ };
79
+ return {
80
+ programAddress: instruction.programAddress,
81
+ accounts: {
82
+ market: getNextAccount(),
83
+ vault: getNextAccount(),
84
+ user: getNextAccount(),
85
+ authority: getNextAccount(),
86
+ tokenProgram: getNextAccount(),
87
+ },
88
+ data: getCloseAdminInstructionDataDecoder().decode(instruction.data),
89
+ };
90
+ }
@@ -0,0 +1,43 @@
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 ReadonlySignerAccount, type ReadonlyUint8Array, type TransactionSigner, type WritableAccount } from '@solana/kit';
9
+ import { NOSANA_JOBS_PROGRAM_ADDRESS } from '../programs';
10
+ export declare const COMPLETE_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
11
+ export declare function getCompleteDiscriminatorBytes(): ReadonlyUint8Array;
12
+ export type CompleteInstruction<TProgram extends string = typeof NOSANA_JOBS_PROGRAM_ADDRESS, TAccountJob extends string | IAccountMeta<string> = string, TAccountAuthority extends string | IAccountMeta<string> = string, TRemainingAccounts extends readonly IAccountMeta<string>[] = []> = IInstruction<TProgram> & IInstructionWithData<Uint8Array> & IInstructionWithAccounts<[
13
+ TAccountJob extends string ? WritableAccount<TAccountJob> : TAccountJob,
14
+ TAccountAuthority extends string ? ReadonlySignerAccount<TAccountAuthority> & IAccountSignerMeta<TAccountAuthority> : TAccountAuthority,
15
+ ...TRemainingAccounts
16
+ ]>;
17
+ export type CompleteInstructionData = {
18
+ discriminator: ReadonlyUint8Array;
19
+ ipfsResult: ReadonlyUint8Array;
20
+ };
21
+ export type CompleteInstructionDataArgs = {
22
+ ipfsResult: ReadonlyUint8Array;
23
+ };
24
+ export declare function getCompleteInstructionDataEncoder(): Encoder<CompleteInstructionDataArgs>;
25
+ export declare function getCompleteInstructionDataDecoder(): Decoder<CompleteInstructionData>;
26
+ export declare function getCompleteInstructionDataCodec(): Codec<CompleteInstructionDataArgs, CompleteInstructionData>;
27
+ export type CompleteInput<TAccountJob extends string = string, TAccountAuthority extends string = string> = {
28
+ job: Address<TAccountJob>;
29
+ authority: TransactionSigner<TAccountAuthority>;
30
+ ipfsResult: CompleteInstructionDataArgs['ipfsResult'];
31
+ };
32
+ export declare function getCompleteInstruction<TAccountJob extends string, TAccountAuthority extends string, TProgramAddress extends Address = typeof NOSANA_JOBS_PROGRAM_ADDRESS>(input: CompleteInput<TAccountJob, TAccountAuthority>, config?: {
33
+ programAddress?: TProgramAddress;
34
+ }): CompleteInstruction<TProgramAddress, TAccountJob, TAccountAuthority>;
35
+ export type ParsedCompleteInstruction<TProgram extends string = typeof NOSANA_JOBS_PROGRAM_ADDRESS, TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[]> = {
36
+ programAddress: Address<TProgram>;
37
+ accounts: {
38
+ job: TAccountMetas[0];
39
+ authority: TAccountMetas[1];
40
+ };
41
+ data: CompleteInstructionData;
42
+ };
43
+ export declare function parseCompleteInstruction<TProgram extends string, TAccountMetas extends readonly IAccountMeta[]>(instruction: IInstruction<TProgram> & IInstructionWithAccounts<TAccountMetas> & IInstructionWithData<Uint8Array>): ParsedCompleteInstruction<TProgram, TAccountMetas>;
@@ -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.COMPLETE_DISCRIMINATOR = void 0;
11
+ exports.getCompleteDiscriminatorBytes = getCompleteDiscriminatorBytes;
12
+ exports.getCompleteInstructionDataEncoder = getCompleteInstructionDataEncoder;
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([
21
+ 0, 77, 224, 147, 136, 25, 88, 76,
22
+ ]);
23
+ function getCompleteDiscriminatorBytes() {
24
+ return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.COMPLETE_DISCRIMINATOR);
25
+ }
26
+ function getCompleteInstructionDataEncoder() {
27
+ return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([
28
+ ['discriminator', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)],
29
+ ['ipfsResult', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 32)],
30
+ ]), (value) => ({ ...value, discriminator: exports.COMPLETE_DISCRIMINATOR }));
31
+ }
32
+ function getCompleteInstructionDataDecoder() {
33
+ return (0, kit_1.getStructDecoder)([
34
+ ['discriminator', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
35
+ ['ipfsResult', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 32)],
36
+ ]);
37
+ }
38
+ function getCompleteInstructionDataCodec() {
39
+ return (0, kit_1.combineCodec)(getCompleteInstructionDataEncoder(), getCompleteInstructionDataDecoder());
40
+ }
41
+ function getCompleteInstruction(input, config) {
42
+ // Program address.
43
+ const programAddress = config?.programAddress ?? programs_1.NOSANA_JOBS_PROGRAM_ADDRESS;
44
+ // Original accounts.
45
+ const originalAccounts = {
46
+ job: { value: input.job ?? null, isWritable: true },
47
+ authority: { value: input.authority ?? null, isWritable: false },
48
+ };
49
+ const accounts = originalAccounts;
50
+ // Original args.
51
+ const args = { ...input };
52
+ const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, 'programId');
53
+ const instruction = {
54
+ accounts: [
55
+ getAccountMeta(accounts.job),
56
+ getAccountMeta(accounts.authority),
57
+ ],
58
+ programAddress,
59
+ data: getCompleteInstructionDataEncoder().encode(args),
60
+ };
61
+ return instruction;
62
+ }
63
+ function parseCompleteInstruction(instruction) {
64
+ if (instruction.accounts.length < 2) {
65
+ // TODO: Coded error.
66
+ throw new Error('Not enough accounts');
67
+ }
68
+ let accountIndex = 0;
69
+ const getNextAccount = () => {
70
+ const accountMeta = instruction.accounts[accountIndex];
71
+ accountIndex += 1;
72
+ return accountMeta;
73
+ };
74
+ return {
75
+ programAddress: instruction.programAddress,
76
+ accounts: {
77
+ job: getNextAccount(),
78
+ authority: getNextAccount(),
79
+ },
80
+ data: getCompleteInstructionDataDecoder().decode(instruction.data),
81
+ };
82
+ }