@nosana/kit 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitlab-ci.yml +6 -5
- package/dist/config/defaultConfigs.js +15 -18
- package/dist/config/index.js +3 -19
- package/dist/config/types.d.ts +1 -3
- package/dist/config/types.js +4 -7
- package/dist/config/utils.js +8 -13
- package/dist/errors/NosanaError.d.ts +1 -0
- package/dist/errors/NosanaError.js +3 -6
- package/dist/generated_clients/jobs/accounts/index.js +3 -19
- package/dist/generated_clients/jobs/accounts/jobAccount.js +46 -59
- package/dist/generated_clients/jobs/accounts/marketAccount.js +45 -57
- package/dist/generated_clients/jobs/accounts/runAccount.js +36 -49
- package/dist/generated_clients/jobs/errors/index.js +1 -17
- package/dist/generated_clients/jobs/errors/nosanaJobs.js +43 -48
- package/dist/generated_clients/jobs/index.js +5 -21
- package/dist/generated_clients/jobs/instructions/claim.js +17 -26
- package/dist/generated_clients/jobs/instructions/clean.js +17 -26
- package/dist/generated_clients/jobs/instructions/cleanAdmin.js +17 -26
- package/dist/generated_clients/jobs/instructions/close.js +17 -26
- package/dist/generated_clients/jobs/instructions/closeAdmin.js +17 -26
- package/dist/generated_clients/jobs/instructions/complete.js +21 -30
- package/dist/generated_clients/jobs/instructions/delist.js +17 -26
- package/dist/generated_clients/jobs/instructions/end.js +17 -26
- package/dist/generated_clients/jobs/instructions/extend.js +21 -30
- package/dist/generated_clients/jobs/instructions/finish.js +21 -30
- package/dist/generated_clients/jobs/instructions/index.js +18 -34
- package/dist/generated_clients/jobs/instructions/list.js +23 -32
- package/dist/generated_clients/jobs/instructions/open.js +29 -38
- package/dist/generated_clients/jobs/instructions/quit.js +17 -26
- package/dist/generated_clients/jobs/instructions/quitAdmin.js +17 -26
- package/dist/generated_clients/jobs/instructions/recover.js +17 -26
- package/dist/generated_clients/jobs/instructions/stop.js +17 -26
- package/dist/generated_clients/jobs/instructions/update.js +29 -38
- package/dist/generated_clients/jobs/instructions/work.js +17 -26
- package/dist/generated_clients/jobs/programs/index.js +1 -17
- package/dist/generated_clients/jobs/programs/nosanaJobs.js +29 -34
- package/dist/generated_clients/jobs/shared/index.js +13 -21
- package/dist/generated_clients/jobs/types/index.js +3 -19
- package/dist/generated_clients/jobs/types/jobState.js +9 -15
- package/dist/generated_clients/jobs/types/jobType.js +9 -15
- package/dist/generated_clients/jobs/types/queueType.js +9 -15
- package/dist/index.d.ts +5 -1
- package/dist/index.js +149 -35
- package/dist/ipfs/IPFS.js +5 -12
- package/dist/logger/Logger.js +1 -5
- package/dist/programs/BaseProgram.js +1 -5
- package/dist/programs/JobsProgram.d.ts +2 -3
- package/dist/programs/JobsProgram.js +35 -99
- package/dist/solana/SolanaUtils.d.ts +15 -1
- package/dist/solana/SolanaUtils.js +81 -14
- package/dist/utils/index.js +1 -4
- package/examples/browser/.gitlab-ci.yml +78 -0
- package/examples/browser/FEATURES.md +141 -0
- package/examples/browser/QUICK_START.md +76 -0
- package/examples/browser/README.md +182 -0
- package/examples/browser/app.vue +1840 -0
- package/examples/browser/assets/css/main.css +7 -0
- package/examples/browser/nuxt.config.ts +24 -0
- package/examples/browser/package-lock.json +11855 -0
- package/examples/browser/package.json +31 -0
- package/examples/browser/public/favicon.ico +0 -0
- package/examples/browser/public/robots.txt +2 -0
- package/examples/browser/start.sh +38 -0
- package/examples/browser/tailwind.config.js +26 -0
- package/examples/node/README.md +146 -0
- package/examples/node/example-keypair.json +1 -0
- package/examples/node/package-lock.json +500 -156
- package/examples/node/package.json +5 -3
- package/examples/node/post-job.ts +160 -0
- package/examples/node/set-wallet.ts +87 -0
- package/package.json +3 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* This code was AUTOGENERATED using the codama library.
|
|
4
3
|
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
@@ -6,37 +5,29 @@
|
|
|
6
5
|
*
|
|
7
6
|
* @see https://github.com/codama-idl/codama
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports.getDelistInstructionDataDecoder = getDelistInstructionDataDecoder;
|
|
14
|
-
exports.getDelistInstructionDataCodec = getDelistInstructionDataCodec;
|
|
15
|
-
exports.getDelistInstruction = getDelistInstruction;
|
|
16
|
-
exports.parseDelistInstruction = parseDelistInstruction;
|
|
17
|
-
const kit_1 = require("@solana/kit");
|
|
18
|
-
const programs_1 = require("../programs");
|
|
19
|
-
const shared_1 = require("../shared");
|
|
20
|
-
exports.DELIST_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 DELIST_DISCRIMINATOR = new Uint8Array([
|
|
21
12
|
55, 136, 205, 107, 107, 173, 4, 31,
|
|
22
13
|
]);
|
|
23
|
-
function getDelistDiscriminatorBytes() {
|
|
24
|
-
return
|
|
14
|
+
export function getDelistDiscriminatorBytes() {
|
|
15
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(DELIST_DISCRIMINATOR);
|
|
25
16
|
}
|
|
26
|
-
function getDelistInstructionDataEncoder() {
|
|
27
|
-
return
|
|
17
|
+
export function getDelistInstructionDataEncoder() {
|
|
18
|
+
return transformEncoder(getStructEncoder([['discriminator', fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({ ...value, discriminator: DELIST_DISCRIMINATOR }));
|
|
28
19
|
}
|
|
29
|
-
function getDelistInstructionDataDecoder() {
|
|
30
|
-
return
|
|
31
|
-
['discriminator',
|
|
20
|
+
export function getDelistInstructionDataDecoder() {
|
|
21
|
+
return getStructDecoder([
|
|
22
|
+
['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
|
|
32
23
|
]);
|
|
33
24
|
}
|
|
34
|
-
function getDelistInstructionDataCodec() {
|
|
35
|
-
return
|
|
25
|
+
export function getDelistInstructionDataCodec() {
|
|
26
|
+
return combineCodec(getDelistInstructionDataEncoder(), getDelistInstructionDataDecoder());
|
|
36
27
|
}
|
|
37
|
-
function getDelistInstruction(input, config) {
|
|
28
|
+
export function getDelistInstruction(input, config) {
|
|
38
29
|
// Program address.
|
|
39
|
-
const programAddress = config?.programAddress ??
|
|
30
|
+
const programAddress = config?.programAddress ?? NOSANA_JOBS_PROGRAM_ADDRESS;
|
|
40
31
|
// Original accounts.
|
|
41
32
|
const originalAccounts = {
|
|
42
33
|
job: { value: input.job ?? null, isWritable: true },
|
|
@@ -53,7 +44,7 @@ function getDelistInstruction(input, config) {
|
|
|
53
44
|
accounts.tokenProgram.value =
|
|
54
45
|
'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
|
|
55
46
|
}
|
|
56
|
-
const getAccountMeta =
|
|
47
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
|
|
57
48
|
const instruction = {
|
|
58
49
|
accounts: [
|
|
59
50
|
getAccountMeta(accounts.job),
|
|
@@ -69,7 +60,7 @@ function getDelistInstruction(input, config) {
|
|
|
69
60
|
};
|
|
70
61
|
return instruction;
|
|
71
62
|
}
|
|
72
|
-
function parseDelistInstruction(instruction) {
|
|
63
|
+
export function parseDelistInstruction(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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports.getEndInstructionDataDecoder = getEndInstructionDataDecoder;
|
|
14
|
-
exports.getEndInstructionDataCodec = getEndInstructionDataCodec;
|
|
15
|
-
exports.getEndInstruction = getEndInstruction;
|
|
16
|
-
exports.parseEndInstruction = parseEndInstruction;
|
|
17
|
-
const kit_1 = require("@solana/kit");
|
|
18
|
-
const programs_1 = require("../programs");
|
|
19
|
-
const shared_1 = require("../shared");
|
|
20
|
-
exports.END_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 END_DISCRIMINATOR = new Uint8Array([
|
|
21
12
|
180, 160, 249, 217, 194, 121, 70, 16,
|
|
22
13
|
]);
|
|
23
|
-
function getEndDiscriminatorBytes() {
|
|
24
|
-
return
|
|
14
|
+
export function getEndDiscriminatorBytes() {
|
|
15
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(END_DISCRIMINATOR);
|
|
25
16
|
}
|
|
26
|
-
function getEndInstructionDataEncoder() {
|
|
27
|
-
return
|
|
17
|
+
export function getEndInstructionDataEncoder() {
|
|
18
|
+
return transformEncoder(getStructEncoder([['discriminator', fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({ ...value, discriminator: END_DISCRIMINATOR }));
|
|
28
19
|
}
|
|
29
|
-
function getEndInstructionDataDecoder() {
|
|
30
|
-
return
|
|
31
|
-
['discriminator',
|
|
20
|
+
export function getEndInstructionDataDecoder() {
|
|
21
|
+
return getStructDecoder([
|
|
22
|
+
['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
|
|
32
23
|
]);
|
|
33
24
|
}
|
|
34
|
-
function getEndInstructionDataCodec() {
|
|
35
|
-
return
|
|
25
|
+
export function getEndInstructionDataCodec() {
|
|
26
|
+
return combineCodec(getEndInstructionDataEncoder(), getEndInstructionDataDecoder());
|
|
36
27
|
}
|
|
37
|
-
function getEndInstruction(input, config) {
|
|
28
|
+
export function getEndInstruction(input, config) {
|
|
38
29
|
// Program address.
|
|
39
|
-
const programAddress = config?.programAddress ??
|
|
30
|
+
const programAddress = config?.programAddress ?? NOSANA_JOBS_PROGRAM_ADDRESS;
|
|
40
31
|
// Original accounts.
|
|
41
32
|
const originalAccounts = {
|
|
42
33
|
job: { value: input.job ?? null, isWritable: true },
|
|
@@ -55,7 +46,7 @@ function getEndInstruction(input, config) {
|
|
|
55
46
|
accounts.tokenProgram.value =
|
|
56
47
|
'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
|
|
57
48
|
}
|
|
58
|
-
const getAccountMeta =
|
|
49
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
|
|
59
50
|
const instruction = {
|
|
60
51
|
accounts: [
|
|
61
52
|
getAccountMeta(accounts.job),
|
|
@@ -73,7 +64,7 @@ function getEndInstruction(input, config) {
|
|
|
73
64
|
};
|
|
74
65
|
return instruction;
|
|
75
66
|
}
|
|
76
|
-
function parseEndInstruction(instruction) {
|
|
67
|
+
export function parseEndInstruction(instruction) {
|
|
77
68
|
if (instruction.accounts.length < 9) {
|
|
78
69
|
// TODO: Coded error.
|
|
79
70
|
throw new Error('Not enough accounts');
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* This code was AUTOGENERATED using the codama library.
|
|
4
3
|
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
@@ -6,41 +5,33 @@
|
|
|
6
5
|
*
|
|
7
6
|
* @see https://github.com/codama-idl/codama
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports.getExtendInstructionDataDecoder = getExtendInstructionDataDecoder;
|
|
14
|
-
exports.getExtendInstructionDataCodec = getExtendInstructionDataCodec;
|
|
15
|
-
exports.getExtendInstruction = getExtendInstruction;
|
|
16
|
-
exports.parseExtendInstruction = parseExtendInstruction;
|
|
17
|
-
const kit_1 = require("@solana/kit");
|
|
18
|
-
const programs_1 = require("../programs");
|
|
19
|
-
const shared_1 = require("../shared");
|
|
20
|
-
exports.EXTEND_DISCRIMINATOR = new Uint8Array([
|
|
8
|
+
import { combineCodec, fixDecoderSize, fixEncoderSize, getBytesDecoder, getBytesEncoder, getI64Decoder, getI64Encoder, getStructDecoder, getStructEncoder, transformEncoder, } from '@solana/kit';
|
|
9
|
+
import { NOSANA_JOBS_PROGRAM_ADDRESS } from '../programs';
|
|
10
|
+
import { getAccountMetaFactory } from '../shared';
|
|
11
|
+
export const EXTEND_DISCRIMINATOR = new Uint8Array([
|
|
21
12
|
228, 127, 0, 1, 227, 154, 54, 168,
|
|
22
13
|
]);
|
|
23
|
-
function getExtendDiscriminatorBytes() {
|
|
24
|
-
return
|
|
14
|
+
export function getExtendDiscriminatorBytes() {
|
|
15
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(EXTEND_DISCRIMINATOR);
|
|
25
16
|
}
|
|
26
|
-
function getExtendInstructionDataEncoder() {
|
|
27
|
-
return
|
|
28
|
-
['discriminator',
|
|
29
|
-
['timeout',
|
|
30
|
-
]), (value) => ({ ...value, discriminator:
|
|
17
|
+
export function getExtendInstructionDataEncoder() {
|
|
18
|
+
return transformEncoder(getStructEncoder([
|
|
19
|
+
['discriminator', fixEncoderSize(getBytesEncoder(), 8)],
|
|
20
|
+
['timeout', getI64Encoder()],
|
|
21
|
+
]), (value) => ({ ...value, discriminator: EXTEND_DISCRIMINATOR }));
|
|
31
22
|
}
|
|
32
|
-
function getExtendInstructionDataDecoder() {
|
|
33
|
-
return
|
|
34
|
-
['discriminator',
|
|
35
|
-
['timeout',
|
|
23
|
+
export function getExtendInstructionDataDecoder() {
|
|
24
|
+
return getStructDecoder([
|
|
25
|
+
['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
|
|
26
|
+
['timeout', getI64Decoder()],
|
|
36
27
|
]);
|
|
37
28
|
}
|
|
38
|
-
function getExtendInstructionDataCodec() {
|
|
39
|
-
return
|
|
29
|
+
export function getExtendInstructionDataCodec() {
|
|
30
|
+
return combineCodec(getExtendInstructionDataEncoder(), getExtendInstructionDataDecoder());
|
|
40
31
|
}
|
|
41
|
-
function getExtendInstruction(input, config) {
|
|
32
|
+
export function getExtendInstruction(input, config) {
|
|
42
33
|
// Program address.
|
|
43
|
-
const programAddress = config?.programAddress ??
|
|
34
|
+
const programAddress = config?.programAddress ?? NOSANA_JOBS_PROGRAM_ADDRESS;
|
|
44
35
|
// Original accounts.
|
|
45
36
|
const originalAccounts = {
|
|
46
37
|
job: { value: input.job ?? null, isWritable: true },
|
|
@@ -64,7 +55,7 @@ function getExtendInstruction(input, config) {
|
|
|
64
55
|
accounts.tokenProgram.value =
|
|
65
56
|
'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
|
|
66
57
|
}
|
|
67
|
-
const getAccountMeta =
|
|
58
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
|
|
68
59
|
const instruction = {
|
|
69
60
|
accounts: [
|
|
70
61
|
getAccountMeta(accounts.job),
|
|
@@ -82,7 +73,7 @@ function getExtendInstruction(input, config) {
|
|
|
82
73
|
};
|
|
83
74
|
return instruction;
|
|
84
75
|
}
|
|
85
|
-
function parseExtendInstruction(instruction) {
|
|
76
|
+
export function parseExtendInstruction(instruction) {
|
|
86
77
|
if (instruction.accounts.length < 9) {
|
|
87
78
|
// TODO: Coded error.
|
|
88
79
|
throw new Error('Not enough accounts');
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* This code was AUTOGENERATED using the codama library.
|
|
4
3
|
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
@@ -6,41 +5,33 @@
|
|
|
6
5
|
*
|
|
7
6
|
* @see https://github.com/codama-idl/codama
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports.getFinishInstructionDataDecoder = getFinishInstructionDataDecoder;
|
|
14
|
-
exports.getFinishInstructionDataCodec = getFinishInstructionDataCodec;
|
|
15
|
-
exports.getFinishInstruction = getFinishInstruction;
|
|
16
|
-
exports.parseFinishInstruction = parseFinishInstruction;
|
|
17
|
-
const kit_1 = require("@solana/kit");
|
|
18
|
-
const programs_1 = require("../programs");
|
|
19
|
-
const shared_1 = require("../shared");
|
|
20
|
-
exports.FINISH_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 FINISH_DISCRIMINATOR = new Uint8Array([
|
|
21
12
|
67, 74, 170, 132, 125, 233, 182, 37,
|
|
22
13
|
]);
|
|
23
|
-
function getFinishDiscriminatorBytes() {
|
|
24
|
-
return
|
|
14
|
+
export function getFinishDiscriminatorBytes() {
|
|
15
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(FINISH_DISCRIMINATOR);
|
|
25
16
|
}
|
|
26
|
-
function getFinishInstructionDataEncoder() {
|
|
27
|
-
return
|
|
28
|
-
['discriminator',
|
|
29
|
-
['ipfsResult',
|
|
30
|
-
]), (value) => ({ ...value, discriminator:
|
|
17
|
+
export function getFinishInstructionDataEncoder() {
|
|
18
|
+
return transformEncoder(getStructEncoder([
|
|
19
|
+
['discriminator', fixEncoderSize(getBytesEncoder(), 8)],
|
|
20
|
+
['ipfsResult', fixEncoderSize(getBytesEncoder(), 32)],
|
|
21
|
+
]), (value) => ({ ...value, discriminator: FINISH_DISCRIMINATOR }));
|
|
31
22
|
}
|
|
32
|
-
function getFinishInstructionDataDecoder() {
|
|
33
|
-
return
|
|
34
|
-
['discriminator',
|
|
35
|
-
['ipfsResult',
|
|
23
|
+
export function getFinishInstructionDataDecoder() {
|
|
24
|
+
return getStructDecoder([
|
|
25
|
+
['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
|
|
26
|
+
['ipfsResult', fixDecoderSize(getBytesDecoder(), 32)],
|
|
36
27
|
]);
|
|
37
28
|
}
|
|
38
|
-
function getFinishInstructionDataCodec() {
|
|
39
|
-
return
|
|
29
|
+
export function getFinishInstructionDataCodec() {
|
|
30
|
+
return combineCodec(getFinishInstructionDataEncoder(), getFinishInstructionDataDecoder());
|
|
40
31
|
}
|
|
41
|
-
function getFinishInstruction(input, config) {
|
|
32
|
+
export function getFinishInstruction(input, config) {
|
|
42
33
|
// Program address.
|
|
43
|
-
const programAddress = config?.programAddress ??
|
|
34
|
+
const programAddress = config?.programAddress ?? NOSANA_JOBS_PROGRAM_ADDRESS;
|
|
44
35
|
// Original accounts.
|
|
45
36
|
const originalAccounts = {
|
|
46
37
|
job: { value: input.job ?? null, isWritable: true },
|
|
@@ -62,7 +53,7 @@ function getFinishInstruction(input, config) {
|
|
|
62
53
|
accounts.tokenProgram.value =
|
|
63
54
|
'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
|
|
64
55
|
}
|
|
65
|
-
const getAccountMeta =
|
|
56
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
|
|
66
57
|
const instruction = {
|
|
67
58
|
accounts: [
|
|
68
59
|
getAccountMeta(accounts.job),
|
|
@@ -81,7 +72,7 @@ function getFinishInstruction(input, config) {
|
|
|
81
72
|
};
|
|
82
73
|
return instruction;
|
|
83
74
|
}
|
|
84
|
-
function parseFinishInstruction(instruction) {
|
|
75
|
+
export function parseFinishInstruction(instruction) {
|
|
85
76
|
if (instruction.accounts.length < 10) {
|
|
86
77
|
// TODO: Coded error.
|
|
87
78
|
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,36 +5,21 @@
|
|
|
6
5
|
*
|
|
7
6
|
* @see https://github.com/codama-idl/codama
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
__exportStar(require("./close"), exports);
|
|
28
|
-
__exportStar(require("./closeAdmin"), exports);
|
|
29
|
-
__exportStar(require("./complete"), exports);
|
|
30
|
-
__exportStar(require("./delist"), exports);
|
|
31
|
-
__exportStar(require("./end"), exports);
|
|
32
|
-
__exportStar(require("./extend"), exports);
|
|
33
|
-
__exportStar(require("./finish"), exports);
|
|
34
|
-
__exportStar(require("./list"), exports);
|
|
35
|
-
__exportStar(require("./open"), exports);
|
|
36
|
-
__exportStar(require("./quit"), exports);
|
|
37
|
-
__exportStar(require("./quitAdmin"), exports);
|
|
38
|
-
__exportStar(require("./recover"), exports);
|
|
39
|
-
__exportStar(require("./stop"), exports);
|
|
40
|
-
__exportStar(require("./update"), exports);
|
|
41
|
-
__exportStar(require("./work"), exports);
|
|
8
|
+
export * from './claim';
|
|
9
|
+
export * from './clean';
|
|
10
|
+
export * from './cleanAdmin';
|
|
11
|
+
export * from './close';
|
|
12
|
+
export * from './closeAdmin';
|
|
13
|
+
export * from './complete';
|
|
14
|
+
export * from './delist';
|
|
15
|
+
export * from './end';
|
|
16
|
+
export * from './extend';
|
|
17
|
+
export * from './finish';
|
|
18
|
+
export * from './list';
|
|
19
|
+
export * from './open';
|
|
20
|
+
export * from './quit';
|
|
21
|
+
export * from './quitAdmin';
|
|
22
|
+
export * from './recover';
|
|
23
|
+
export * from './stop';
|
|
24
|
+
export * from './update';
|
|
25
|
+
export * from './work';
|
|
@@ -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,43 +5,35 @@
|
|
|
6
5
|
*
|
|
7
6
|
* @see https://github.com/codama-idl/codama
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports.getListInstructionDataDecoder = getListInstructionDataDecoder;
|
|
14
|
-
exports.getListInstructionDataCodec = getListInstructionDataCodec;
|
|
15
|
-
exports.getListInstruction = getListInstruction;
|
|
16
|
-
exports.parseListInstruction = parseListInstruction;
|
|
17
|
-
const kit_1 = require("@solana/kit");
|
|
18
|
-
const programs_1 = require("../programs");
|
|
19
|
-
const shared_1 = require("../shared");
|
|
20
|
-
exports.LIST_DISCRIMINATOR = new Uint8Array([
|
|
8
|
+
import { combineCodec, fixDecoderSize, fixEncoderSize, getBytesDecoder, getBytesEncoder, getI64Decoder, getI64Encoder, getStructDecoder, getStructEncoder, transformEncoder, } from '@solana/kit';
|
|
9
|
+
import { NOSANA_JOBS_PROGRAM_ADDRESS } from '../programs';
|
|
10
|
+
import { getAccountMetaFactory } from '../shared';
|
|
11
|
+
export const LIST_DISCRIMINATOR = new Uint8Array([
|
|
21
12
|
54, 174, 193, 67, 17, 41, 132, 38,
|
|
22
13
|
]);
|
|
23
|
-
function getListDiscriminatorBytes() {
|
|
24
|
-
return
|
|
14
|
+
export function getListDiscriminatorBytes() {
|
|
15
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(LIST_DISCRIMINATOR);
|
|
25
16
|
}
|
|
26
|
-
function getListInstructionDataEncoder() {
|
|
27
|
-
return
|
|
28
|
-
['discriminator',
|
|
29
|
-
['ipfsJob',
|
|
30
|
-
['timeout',
|
|
31
|
-
]), (value) => ({ ...value, discriminator:
|
|
17
|
+
export function getListInstructionDataEncoder() {
|
|
18
|
+
return transformEncoder(getStructEncoder([
|
|
19
|
+
['discriminator', fixEncoderSize(getBytesEncoder(), 8)],
|
|
20
|
+
['ipfsJob', fixEncoderSize(getBytesEncoder(), 32)],
|
|
21
|
+
['timeout', getI64Encoder()],
|
|
22
|
+
]), (value) => ({ ...value, discriminator: LIST_DISCRIMINATOR }));
|
|
32
23
|
}
|
|
33
|
-
function getListInstructionDataDecoder() {
|
|
34
|
-
return
|
|
35
|
-
['discriminator',
|
|
36
|
-
['ipfsJob',
|
|
37
|
-
['timeout',
|
|
24
|
+
export function getListInstructionDataDecoder() {
|
|
25
|
+
return getStructDecoder([
|
|
26
|
+
['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
|
|
27
|
+
['ipfsJob', fixDecoderSize(getBytesDecoder(), 32)],
|
|
28
|
+
['timeout', getI64Decoder()],
|
|
38
29
|
]);
|
|
39
30
|
}
|
|
40
|
-
function getListInstructionDataCodec() {
|
|
41
|
-
return
|
|
31
|
+
export function getListInstructionDataCodec() {
|
|
32
|
+
return combineCodec(getListInstructionDataEncoder(), getListInstructionDataDecoder());
|
|
42
33
|
}
|
|
43
|
-
function getListInstruction(input, config) {
|
|
34
|
+
export function getListInstruction(input, config) {
|
|
44
35
|
// Program address.
|
|
45
|
-
const programAddress = config?.programAddress ??
|
|
36
|
+
const programAddress = config?.programAddress ?? NOSANA_JOBS_PROGRAM_ADDRESS;
|
|
46
37
|
// Original accounts.
|
|
47
38
|
const originalAccounts = {
|
|
48
39
|
job: { value: input.job ?? null, isWritable: true },
|
|
@@ -73,7 +64,7 @@ function getListInstruction(input, config) {
|
|
|
73
64
|
accounts.systemProgram.value =
|
|
74
65
|
'11111111111111111111111111111111';
|
|
75
66
|
}
|
|
76
|
-
const getAccountMeta =
|
|
67
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
|
|
77
68
|
const instruction = {
|
|
78
69
|
accounts: [
|
|
79
70
|
getAccountMeta(accounts.job),
|
|
@@ -94,7 +85,7 @@ function getListInstruction(input, config) {
|
|
|
94
85
|
};
|
|
95
86
|
return instruction;
|
|
96
87
|
}
|
|
97
|
-
function parseListInstruction(instruction) {
|
|
88
|
+
export function parseListInstruction(instruction) {
|
|
98
89
|
if (instruction.accounts.length < 12) {
|
|
99
90
|
// TODO: Coded error.
|
|
100
91
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports.getOpenInstructionDataDecoder = getOpenInstructionDataDecoder;
|
|
14
|
-
exports.getOpenInstructionDataCodec = getOpenInstructionDataCodec;
|
|
15
|
-
exports.getOpenInstruction = getOpenInstruction;
|
|
16
|
-
exports.parseOpenInstruction = parseOpenInstruction;
|
|
17
|
-
const kit_1 = require("@solana/kit");
|
|
18
|
-
const programs_1 = require("../programs");
|
|
19
|
-
const shared_1 = require("../shared");
|
|
20
|
-
exports.OPEN_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 OPEN_DISCRIMINATOR = new Uint8Array([
|
|
21
12
|
228, 220, 155, 71, 199, 189, 60, 45,
|
|
22
13
|
]);
|
|
23
|
-
function getOpenDiscriminatorBytes() {
|
|
24
|
-
return
|
|
14
|
+
export function getOpenDiscriminatorBytes() {
|
|
15
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(OPEN_DISCRIMINATOR);
|
|
25
16
|
}
|
|
26
|
-
function getOpenInstructionDataEncoder() {
|
|
27
|
-
return
|
|
28
|
-
['discriminator',
|
|
29
|
-
['jobExpiration',
|
|
30
|
-
['jobPrice',
|
|
31
|
-
['jobTimeout',
|
|
32
|
-
['jobType',
|
|
33
|
-
['nodeXnosMinimum',
|
|
34
|
-
]), (value) => ({ ...value, discriminator:
|
|
17
|
+
export function getOpenInstructionDataEncoder() {
|
|
18
|
+
return transformEncoder(getStructEncoder([
|
|
19
|
+
['discriminator', fixEncoderSize(getBytesEncoder(), 8)],
|
|
20
|
+
['jobExpiration', getI64Encoder()],
|
|
21
|
+
['jobPrice', getU64Encoder()],
|
|
22
|
+
['jobTimeout', getI64Encoder()],
|
|
23
|
+
['jobType', getU8Encoder()],
|
|
24
|
+
['nodeXnosMinimum', getU128Encoder()],
|
|
25
|
+
]), (value) => ({ ...value, discriminator: OPEN_DISCRIMINATOR }));
|
|
35
26
|
}
|
|
36
|
-
function getOpenInstructionDataDecoder() {
|
|
37
|
-
return
|
|
38
|
-
['discriminator',
|
|
39
|
-
['jobExpiration',
|
|
40
|
-
['jobPrice',
|
|
41
|
-
['jobTimeout',
|
|
42
|
-
['jobType',
|
|
43
|
-
['nodeXnosMinimum',
|
|
27
|
+
export function getOpenInstructionDataDecoder() {
|
|
28
|
+
return getStructDecoder([
|
|
29
|
+
['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
|
|
30
|
+
['jobExpiration', getI64Decoder()],
|
|
31
|
+
['jobPrice', getU64Decoder()],
|
|
32
|
+
['jobTimeout', getI64Decoder()],
|
|
33
|
+
['jobType', getU8Decoder()],
|
|
34
|
+
['nodeXnosMinimum', getU128Decoder()],
|
|
44
35
|
]);
|
|
45
36
|
}
|
|
46
|
-
function getOpenInstructionDataCodec() {
|
|
47
|
-
return
|
|
37
|
+
export function getOpenInstructionDataCodec() {
|
|
38
|
+
return combineCodec(getOpenInstructionDataEncoder(), getOpenInstructionDataDecoder());
|
|
48
39
|
}
|
|
49
|
-
function getOpenInstruction(input, config) {
|
|
40
|
+
export function getOpenInstruction(input, config) {
|
|
50
41
|
// Program address.
|
|
51
|
-
const programAddress = config?.programAddress ??
|
|
42
|
+
const programAddress = config?.programAddress ?? NOSANA_JOBS_PROGRAM_ADDRESS;
|
|
52
43
|
// Original accounts.
|
|
53
44
|
const originalAccounts = {
|
|
54
45
|
mint: { value: input.mint ?? null, isWritable: false },
|
|
@@ -76,7 +67,7 @@ function getOpenInstruction(input, config) {
|
|
|
76
67
|
accounts.tokenProgram.value =
|
|
77
68
|
'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
|
|
78
69
|
}
|
|
79
|
-
const getAccountMeta =
|
|
70
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
|
|
80
71
|
const instruction = {
|
|
81
72
|
accounts: [
|
|
82
73
|
getAccountMeta(accounts.mint),
|
|
@@ -93,7 +84,7 @@ function getOpenInstruction(input, config) {
|
|
|
93
84
|
};
|
|
94
85
|
return instruction;
|
|
95
86
|
}
|
|
96
|
-
function parseOpenInstruction(instruction) {
|
|
87
|
+
export function parseOpenInstruction(instruction) {
|
|
97
88
|
if (instruction.accounts.length < 8) {
|
|
98
89
|
// TODO: Coded error.
|
|
99
90
|
throw new Error('Not enough accounts');
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* This code was AUTOGENERATED using the codama library.
|
|
4
3
|
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
@@ -6,37 +5,29 @@
|
|
|
6
5
|
*
|
|
7
6
|
* @see https://github.com/codama-idl/codama
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports.getQuitInstructionDataDecoder = getQuitInstructionDataDecoder;
|
|
14
|
-
exports.getQuitInstructionDataCodec = getQuitInstructionDataCodec;
|
|
15
|
-
exports.getQuitInstruction = getQuitInstruction;
|
|
16
|
-
exports.parseQuitInstruction = parseQuitInstruction;
|
|
17
|
-
const kit_1 = require("@solana/kit");
|
|
18
|
-
const programs_1 = require("../programs");
|
|
19
|
-
const shared_1 = require("../shared");
|
|
20
|
-
exports.QUIT_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_DISCRIMINATOR = new Uint8Array([
|
|
21
12
|
191, 103, 141, 240, 80, 129, 103, 153,
|
|
22
13
|
]);
|
|
23
|
-
function getQuitDiscriminatorBytes() {
|
|
24
|
-
return
|
|
14
|
+
export function getQuitDiscriminatorBytes() {
|
|
15
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(QUIT_DISCRIMINATOR);
|
|
25
16
|
}
|
|
26
|
-
function getQuitInstructionDataEncoder() {
|
|
27
|
-
return
|
|
17
|
+
export function getQuitInstructionDataEncoder() {
|
|
18
|
+
return transformEncoder(getStructEncoder([['discriminator', fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({ ...value, discriminator: QUIT_DISCRIMINATOR }));
|
|
28
19
|
}
|
|
29
|
-
function getQuitInstructionDataDecoder() {
|
|
30
|
-
return
|
|
31
|
-
['discriminator',
|
|
20
|
+
export function getQuitInstructionDataDecoder() {
|
|
21
|
+
return getStructDecoder([
|
|
22
|
+
['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
|
|
32
23
|
]);
|
|
33
24
|
}
|
|
34
|
-
function getQuitInstructionDataCodec() {
|
|
35
|
-
return
|
|
25
|
+
export function getQuitInstructionDataCodec() {
|
|
26
|
+
return combineCodec(getQuitInstructionDataEncoder(), getQuitInstructionDataDecoder());
|
|
36
27
|
}
|
|
37
|
-
function getQuitInstruction(input, config) {
|
|
28
|
+
export function getQuitInstruction(input, config) {
|
|
38
29
|
// Program address.
|
|
39
|
-
const programAddress = config?.programAddress ??
|
|
30
|
+
const programAddress = config?.programAddress ?? NOSANA_JOBS_PROGRAM_ADDRESS;
|
|
40
31
|
// Original accounts.
|
|
41
32
|
const originalAccounts = {
|
|
42
33
|
job: { value: input.job ?? null, isWritable: true },
|
|
@@ -45,7 +36,7 @@ function getQuitInstruction(input, config) {
|
|
|
45
36
|
authority: { value: input.authority ?? null, isWritable: false },
|
|
46
37
|
};
|
|
47
38
|
const accounts = originalAccounts;
|
|
48
|
-
const getAccountMeta =
|
|
39
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
|
|
49
40
|
const instruction = {
|
|
50
41
|
accounts: [
|
|
51
42
|
getAccountMeta(accounts.job),
|
|
@@ -58,7 +49,7 @@ function getQuitInstruction(input, config) {
|
|
|
58
49
|
};
|
|
59
50
|
return instruction;
|
|
60
51
|
}
|
|
61
|
-
function parseQuitInstruction(instruction) {
|
|
52
|
+
export function parseQuitInstruction(instruction) {
|
|
62
53
|
if (instruction.accounts.length < 4) {
|
|
63
54
|
// TODO: Coded error.
|
|
64
55
|
throw new Error('Not enough accounts');
|