@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.
- package/.gitlab-ci.yml +21 -0
- package/README.md +159 -0
- package/dist/config/defaultConfigs.d.ts +2 -0
- package/dist/config/defaultConfigs.js +47 -0
- package/dist/config/index.d.ts +3 -0
- package/dist/config/index.js +19 -0
- package/dist/config/types.d.ts +43 -0
- package/dist/config/types.js +16 -0
- package/dist/config/utils.d.ts +3 -0
- package/dist/config/utils.js +35 -0
- package/dist/errors/NosanaError.d.ts +16 -0
- package/dist/errors/NosanaError.js +22 -0
- package/dist/generated_clients/jobs/accounts/index.d.ts +10 -0
- package/dist/generated_clients/jobs/accounts/index.js +26 -0
- package/dist/generated_clients/jobs/accounts/jobAccount.d.ts +47 -0
- package/dist/generated_clients/jobs/accounts/jobAccount.js +86 -0
- package/dist/generated_clients/jobs/accounts/marketAccount.d.ts +46 -0
- package/dist/generated_clients/jobs/accounts/marketAccount.js +82 -0
- package/dist/generated_clients/jobs/accounts/runAccount.d.ts +35 -0
- package/dist/generated_clients/jobs/accounts/runAccount.js +74 -0
- package/dist/generated_clients/jobs/errors/index.d.ts +8 -0
- package/dist/generated_clients/jobs/errors/index.js +24 -0
- package/dist/generated_clients/jobs/errors/nosanaJobs.d.ts +57 -0
- package/dist/generated_clients/jobs/errors/nosanaJobs.js +85 -0
- package/dist/generated_clients/jobs/index.d.ts +12 -0
- package/dist/generated_clients/jobs/index.js +28 -0
- package/dist/generated_clients/jobs/instructions/claim.d.ts +60 -0
- package/dist/generated_clients/jobs/instructions/claim.js +102 -0
- package/dist/generated_clients/jobs/instructions/clean.d.ts +42 -0
- package/dist/generated_clients/jobs/instructions/clean.js +79 -0
- package/dist/generated_clients/jobs/instructions/cleanAdmin.d.ts +42 -0
- package/dist/generated_clients/jobs/instructions/cleanAdmin.js +79 -0
- package/dist/generated_clients/jobs/instructions/close.d.ts +48 -0
- package/dist/generated_clients/jobs/instructions/close.js +90 -0
- package/dist/generated_clients/jobs/instructions/closeAdmin.d.ts +48 -0
- package/dist/generated_clients/jobs/instructions/closeAdmin.js +90 -0
- package/dist/generated_clients/jobs/instructions/complete.d.ts +43 -0
- package/dist/generated_clients/jobs/instructions/complete.js +82 -0
- package/dist/generated_clients/jobs/instructions/delist.d.ts +54 -0
- package/dist/generated_clients/jobs/instructions/delist.js +96 -0
- package/dist/generated_clients/jobs/instructions/end.d.ts +60 -0
- package/dist/generated_clients/jobs/instructions/end.js +102 -0
- package/dist/generated_clients/jobs/instructions/extend.d.ts +64 -0
- package/dist/generated_clients/jobs/instructions/extend.js +111 -0
- package/dist/generated_clients/jobs/instructions/finish.d.ts +67 -0
- package/dist/generated_clients/jobs/instructions/finish.js +111 -0
- package/dist/generated_clients/jobs/instructions/index.d.ts +25 -0
- package/dist/generated_clients/jobs/instructions/index.js +41 -0
- package/dist/generated_clients/jobs/instructions/list.d.ts +76 -0
- package/dist/generated_clients/jobs/instructions/list.js +126 -0
- package/dist/generated_clients/jobs/instructions/open.d.ts +73 -0
- package/dist/generated_clients/jobs/instructions/open.js +121 -0
- package/dist/generated_clients/jobs/instructions/quit.d.ts +45 -0
- package/dist/generated_clients/jobs/instructions/quit.js +82 -0
- package/dist/generated_clients/jobs/instructions/quitAdmin.d.ts +42 -0
- package/dist/generated_clients/jobs/instructions/quitAdmin.js +79 -0
- package/dist/generated_clients/jobs/instructions/recover.d.ts +54 -0
- package/dist/generated_clients/jobs/instructions/recover.js +96 -0
- package/dist/generated_clients/jobs/instructions/stop.d.ts +42 -0
- package/dist/generated_clients/jobs/instructions/stop.js +79 -0
- package/dist/generated_clients/jobs/instructions/update.d.ts +58 -0
- package/dist/generated_clients/jobs/instructions/update.js +93 -0
- package/dist/generated_clients/jobs/instructions/work.d.ts +57 -0
- package/dist/generated_clients/jobs/instructions/work.js +99 -0
- package/dist/generated_clients/jobs/programs/index.d.ts +8 -0
- package/dist/generated_clients/jobs/programs/index.js +24 -0
- package/dist/generated_clients/jobs/programs/nosanaJobs.d.ts +78 -0
- package/dist/generated_clients/jobs/programs/nosanaJobs.js +112 -0
- package/dist/generated_clients/jobs/shared/index.d.ts +49 -0
- package/dist/generated_clients/jobs/shared/index.js +94 -0
- package/dist/generated_clients/jobs/types/index.d.ts +10 -0
- package/dist/generated_clients/jobs/types/index.js +26 -0
- package/dist/generated_clients/jobs/types/jobState.d.ts +18 -0
- package/dist/generated_clients/jobs/types/jobState.js +30 -0
- package/dist/generated_clients/jobs/types/jobType.d.ts +21 -0
- package/dist/generated_clients/jobs/types/jobType.js +33 -0
- package/dist/generated_clients/jobs/types/queueType.d.ts +18 -0
- package/dist/generated_clients/jobs/types/queueType.js +30 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +43 -0
- package/dist/ipfs/IPFS.d.ts +19 -0
- package/dist/ipfs/IPFS.js +47 -0
- package/dist/logger/Logger.d.ts +24 -0
- package/dist/logger/Logger.js +63 -0
- package/dist/programs/BaseProgram.d.ts +20 -0
- package/dist/programs/BaseProgram.js +39 -0
- package/dist/programs/JobsProgram.d.ts +118 -0
- package/dist/programs/JobsProgram.js +611 -0
- package/dist/solana/SolanaUtils.d.ts +15 -0
- package/dist/solana/SolanaUtils.js +48 -0
- package/dist/utils/index.d.ts +19 -0
- package/dist/utils/index.js +17 -0
- package/examples/node/monitor.ts +143 -0
- package/examples/node/package-lock.json +245 -0
- package/examples/node/package.json +16 -0
- package/examples/node/retrieve.ts +18 -0
- package/package.json +47 -0
- package/scripts/generate-clients.ts +9 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This code was AUTOGENERATED using the codama library.
|
|
4
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
5
|
+
* to add features, then rerun codama to update it.
|
|
6
|
+
*
|
|
7
|
+
* @see https://github.com/codama-idl/codama
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.QUIT_DISCRIMINATOR = void 0;
|
|
11
|
+
exports.getQuitDiscriminatorBytes = getQuitDiscriminatorBytes;
|
|
12
|
+
exports.getQuitInstructionDataEncoder = getQuitInstructionDataEncoder;
|
|
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([
|
|
21
|
+
191, 103, 141, 240, 80, 129, 103, 153,
|
|
22
|
+
]);
|
|
23
|
+
function getQuitDiscriminatorBytes() {
|
|
24
|
+
return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.QUIT_DISCRIMINATOR);
|
|
25
|
+
}
|
|
26
|
+
function getQuitInstructionDataEncoder() {
|
|
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_DISCRIMINATOR }));
|
|
28
|
+
}
|
|
29
|
+
function getQuitInstructionDataDecoder() {
|
|
30
|
+
return (0, kit_1.getStructDecoder)([
|
|
31
|
+
['discriminator', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
|
|
32
|
+
]);
|
|
33
|
+
}
|
|
34
|
+
function getQuitInstructionDataCodec() {
|
|
35
|
+
return (0, kit_1.combineCodec)(getQuitInstructionDataEncoder(), getQuitInstructionDataDecoder());
|
|
36
|
+
}
|
|
37
|
+
function getQuitInstruction(input, config) {
|
|
38
|
+
// Program address.
|
|
39
|
+
const programAddress = config?.programAddress ?? programs_1.NOSANA_JOBS_PROGRAM_ADDRESS;
|
|
40
|
+
// Original accounts.
|
|
41
|
+
const originalAccounts = {
|
|
42
|
+
job: { value: input.job ?? null, isWritable: true },
|
|
43
|
+
run: { value: input.run ?? null, isWritable: true },
|
|
44
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
45
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
46
|
+
};
|
|
47
|
+
const accounts = originalAccounts;
|
|
48
|
+
const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, 'programId');
|
|
49
|
+
const instruction = {
|
|
50
|
+
accounts: [
|
|
51
|
+
getAccountMeta(accounts.job),
|
|
52
|
+
getAccountMeta(accounts.run),
|
|
53
|
+
getAccountMeta(accounts.payer),
|
|
54
|
+
getAccountMeta(accounts.authority),
|
|
55
|
+
],
|
|
56
|
+
programAddress,
|
|
57
|
+
data: getQuitInstructionDataEncoder().encode({}),
|
|
58
|
+
};
|
|
59
|
+
return instruction;
|
|
60
|
+
}
|
|
61
|
+
function parseQuitInstruction(instruction) {
|
|
62
|
+
if (instruction.accounts.length < 4) {
|
|
63
|
+
// TODO: Coded error.
|
|
64
|
+
throw new Error('Not enough accounts');
|
|
65
|
+
}
|
|
66
|
+
let accountIndex = 0;
|
|
67
|
+
const getNextAccount = () => {
|
|
68
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
69
|
+
accountIndex += 1;
|
|
70
|
+
return accountMeta;
|
|
71
|
+
};
|
|
72
|
+
return {
|
|
73
|
+
programAddress: instruction.programAddress,
|
|
74
|
+
accounts: {
|
|
75
|
+
job: getNextAccount(),
|
|
76
|
+
run: getNextAccount(),
|
|
77
|
+
payer: getNextAccount(),
|
|
78
|
+
authority: getNextAccount(),
|
|
79
|
+
},
|
|
80
|
+
data: getQuitInstructionDataDecoder().decode(instruction.data),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
@@ -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 QUIT_ADMIN_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
|
|
11
|
+
export declare function getQuitAdminDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
|
+
export type QuitAdminInstruction<TProgram extends string = typeof NOSANA_JOBS_PROGRAM_ADDRESS, TAccountRun 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
|
+
TAccountRun extends string ? WritableAccount<TAccountRun> : TAccountRun,
|
|
14
|
+
TAccountPayer extends string ? WritableAccount<TAccountPayer> : TAccountPayer,
|
|
15
|
+
TAccountAuthority extends string ? ReadonlySignerAccount<TAccountAuthority> & IAccountSignerMeta<TAccountAuthority> : TAccountAuthority,
|
|
16
|
+
...TRemainingAccounts
|
|
17
|
+
]>;
|
|
18
|
+
export type QuitAdminInstructionData = {
|
|
19
|
+
discriminator: ReadonlyUint8Array;
|
|
20
|
+
};
|
|
21
|
+
export type QuitAdminInstructionDataArgs = {};
|
|
22
|
+
export declare function getQuitAdminInstructionDataEncoder(): Encoder<QuitAdminInstructionDataArgs>;
|
|
23
|
+
export declare function getQuitAdminInstructionDataDecoder(): Decoder<QuitAdminInstructionData>;
|
|
24
|
+
export declare function getQuitAdminInstructionDataCodec(): Codec<QuitAdminInstructionDataArgs, QuitAdminInstructionData>;
|
|
25
|
+
export type QuitAdminInput<TAccountRun extends string = string, TAccountPayer extends string = string, TAccountAuthority extends string = string> = {
|
|
26
|
+
run: Address<TAccountRun>;
|
|
27
|
+
payer: Address<TAccountPayer>;
|
|
28
|
+
authority: TransactionSigner<TAccountAuthority>;
|
|
29
|
+
};
|
|
30
|
+
export declare function getQuitAdminInstruction<TAccountRun extends string, TAccountPayer extends string, TAccountAuthority extends string, TProgramAddress extends Address = typeof NOSANA_JOBS_PROGRAM_ADDRESS>(input: QuitAdminInput<TAccountRun, TAccountPayer, TAccountAuthority>, config?: {
|
|
31
|
+
programAddress?: TProgramAddress;
|
|
32
|
+
}): QuitAdminInstruction<TProgramAddress, TAccountRun, TAccountPayer, TAccountAuthority>;
|
|
33
|
+
export type ParsedQuitAdminInstruction<TProgram extends string = typeof NOSANA_JOBS_PROGRAM_ADDRESS, TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[]> = {
|
|
34
|
+
programAddress: Address<TProgram>;
|
|
35
|
+
accounts: {
|
|
36
|
+
run: TAccountMetas[0];
|
|
37
|
+
payer: TAccountMetas[1];
|
|
38
|
+
authority: TAccountMetas[2];
|
|
39
|
+
};
|
|
40
|
+
data: QuitAdminInstructionData;
|
|
41
|
+
};
|
|
42
|
+
export declare function parseQuitAdminInstruction<TProgram extends string, TAccountMetas extends readonly IAccountMeta[]>(instruction: IInstruction<TProgram> & IInstructionWithAccounts<TAccountMetas> & IInstructionWithData<Uint8Array>): ParsedQuitAdminInstruction<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.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([
|
|
21
|
+
103, 238, 110, 8, 182, 20, 56, 196,
|
|
22
|
+
]);
|
|
23
|
+
function getQuitAdminDiscriminatorBytes() {
|
|
24
|
+
return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.QUIT_ADMIN_DISCRIMINATOR);
|
|
25
|
+
}
|
|
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 }));
|
|
28
|
+
}
|
|
29
|
+
function getQuitAdminInstructionDataDecoder() {
|
|
30
|
+
return (0, kit_1.getStructDecoder)([
|
|
31
|
+
['discriminator', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
|
|
32
|
+
]);
|
|
33
|
+
}
|
|
34
|
+
function getQuitAdminInstructionDataCodec() {
|
|
35
|
+
return (0, kit_1.combineCodec)(getQuitAdminInstructionDataEncoder(), getQuitAdminInstructionDataDecoder());
|
|
36
|
+
}
|
|
37
|
+
function getQuitAdminInstruction(input, config) {
|
|
38
|
+
// Program address.
|
|
39
|
+
const programAddress = config?.programAddress ?? programs_1.NOSANA_JOBS_PROGRAM_ADDRESS;
|
|
40
|
+
// Original accounts.
|
|
41
|
+
const originalAccounts = {
|
|
42
|
+
run: { value: input.run ?? 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.run),
|
|
51
|
+
getAccountMeta(accounts.payer),
|
|
52
|
+
getAccountMeta(accounts.authority),
|
|
53
|
+
],
|
|
54
|
+
programAddress,
|
|
55
|
+
data: getQuitAdminInstructionDataEncoder().encode({}),
|
|
56
|
+
};
|
|
57
|
+
return instruction;
|
|
58
|
+
}
|
|
59
|
+
function parseQuitAdminInstruction(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
|
+
run: getNextAccount(),
|
|
74
|
+
payer: getNextAccount(),
|
|
75
|
+
authority: getNextAccount(),
|
|
76
|
+
},
|
|
77
|
+
data: getQuitAdminInstructionDataDecoder().decode(instruction.data),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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 RECOVER_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
|
|
11
|
+
export declare function getRecoverDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
|
+
export type RecoverInstruction<TProgram extends string = typeof NOSANA_JOBS_PROGRAM_ADDRESS, TAccountJob extends string | IAccountMeta<string> = string, TAccountMarket extends string | IAccountMeta<string> = string, TAccountVault extends string | IAccountMeta<string> = string, TAccountUser extends string | IAccountMeta<string> = string, TAccountPayer 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
|
+
TAccountJob extends string ? WritableAccount<TAccountJob> : TAccountJob,
|
|
14
|
+
TAccountMarket extends string ? ReadonlyAccount<TAccountMarket> : TAccountMarket,
|
|
15
|
+
TAccountVault extends string ? WritableAccount<TAccountVault> : TAccountVault,
|
|
16
|
+
TAccountUser extends string ? WritableAccount<TAccountUser> : TAccountUser,
|
|
17
|
+
TAccountPayer extends string ? WritableAccount<TAccountPayer> : TAccountPayer,
|
|
18
|
+
TAccountAuthority extends string ? ReadonlySignerAccount<TAccountAuthority> & IAccountSignerMeta<TAccountAuthority> : TAccountAuthority,
|
|
19
|
+
TAccountTokenProgram extends string ? ReadonlyAccount<TAccountTokenProgram> : TAccountTokenProgram,
|
|
20
|
+
...TRemainingAccounts
|
|
21
|
+
]>;
|
|
22
|
+
export type RecoverInstructionData = {
|
|
23
|
+
discriminator: ReadonlyUint8Array;
|
|
24
|
+
};
|
|
25
|
+
export type RecoverInstructionDataArgs = {};
|
|
26
|
+
export declare function getRecoverInstructionDataEncoder(): Encoder<RecoverInstructionDataArgs>;
|
|
27
|
+
export declare function getRecoverInstructionDataDecoder(): Decoder<RecoverInstructionData>;
|
|
28
|
+
export declare function getRecoverInstructionDataCodec(): Codec<RecoverInstructionDataArgs, RecoverInstructionData>;
|
|
29
|
+
export type RecoverInput<TAccountJob extends string = string, TAccountMarket extends string = string, TAccountVault extends string = string, TAccountUser extends string = string, TAccountPayer extends string = string, TAccountAuthority extends string = string, TAccountTokenProgram extends string = string> = {
|
|
30
|
+
job: Address<TAccountJob>;
|
|
31
|
+
market: Address<TAccountMarket>;
|
|
32
|
+
vault: Address<TAccountVault>;
|
|
33
|
+
user: Address<TAccountUser>;
|
|
34
|
+
payer: Address<TAccountPayer>;
|
|
35
|
+
authority: TransactionSigner<TAccountAuthority>;
|
|
36
|
+
tokenProgram?: Address<TAccountTokenProgram>;
|
|
37
|
+
};
|
|
38
|
+
export declare function getRecoverInstruction<TAccountJob extends string, TAccountMarket extends string, TAccountVault extends string, TAccountUser extends string, TAccountPayer extends string, TAccountAuthority extends string, TAccountTokenProgram extends string, TProgramAddress extends Address = typeof NOSANA_JOBS_PROGRAM_ADDRESS>(input: RecoverInput<TAccountJob, TAccountMarket, TAccountVault, TAccountUser, TAccountPayer, TAccountAuthority, TAccountTokenProgram>, config?: {
|
|
39
|
+
programAddress?: TProgramAddress;
|
|
40
|
+
}): RecoverInstruction<TProgramAddress, TAccountJob, TAccountMarket, TAccountVault, TAccountUser, TAccountPayer, TAccountAuthority, TAccountTokenProgram>;
|
|
41
|
+
export type ParsedRecoverInstruction<TProgram extends string = typeof NOSANA_JOBS_PROGRAM_ADDRESS, TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[]> = {
|
|
42
|
+
programAddress: Address<TProgram>;
|
|
43
|
+
accounts: {
|
|
44
|
+
job: TAccountMetas[0];
|
|
45
|
+
market: TAccountMetas[1];
|
|
46
|
+
vault: TAccountMetas[2];
|
|
47
|
+
user: TAccountMetas[3];
|
|
48
|
+
payer: TAccountMetas[4];
|
|
49
|
+
authority: TAccountMetas[5];
|
|
50
|
+
tokenProgram: TAccountMetas[6];
|
|
51
|
+
};
|
|
52
|
+
data: RecoverInstructionData;
|
|
53
|
+
};
|
|
54
|
+
export declare function parseRecoverInstruction<TProgram extends string, TAccountMetas extends readonly IAccountMeta[]>(instruction: IInstruction<TProgram> & IInstructionWithAccounts<TAccountMetas> & IInstructionWithData<Uint8Array>): ParsedRecoverInstruction<TProgram, TAccountMetas>;
|
|
@@ -0,0 +1,96 @@
|
|
|
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.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([
|
|
21
|
+
108, 216, 38, 58, 109, 146, 116, 17,
|
|
22
|
+
]);
|
|
23
|
+
function getRecoverDiscriminatorBytes() {
|
|
24
|
+
return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.RECOVER_DISCRIMINATOR);
|
|
25
|
+
}
|
|
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 }));
|
|
28
|
+
}
|
|
29
|
+
function getRecoverInstructionDataDecoder() {
|
|
30
|
+
return (0, kit_1.getStructDecoder)([
|
|
31
|
+
['discriminator', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
|
|
32
|
+
]);
|
|
33
|
+
}
|
|
34
|
+
function getRecoverInstructionDataCodec() {
|
|
35
|
+
return (0, kit_1.combineCodec)(getRecoverInstructionDataEncoder(), getRecoverInstructionDataDecoder());
|
|
36
|
+
}
|
|
37
|
+
function getRecoverInstruction(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
|
+
vault: { value: input.vault ?? null, isWritable: true },
|
|
45
|
+
user: { value: input.user ?? null, isWritable: true },
|
|
46
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
47
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
48
|
+
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
49
|
+
};
|
|
50
|
+
const accounts = originalAccounts;
|
|
51
|
+
// Resolve default values.
|
|
52
|
+
if (!accounts.tokenProgram.value) {
|
|
53
|
+
accounts.tokenProgram.value =
|
|
54
|
+
'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
|
|
55
|
+
}
|
|
56
|
+
const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, 'programId');
|
|
57
|
+
const instruction = {
|
|
58
|
+
accounts: [
|
|
59
|
+
getAccountMeta(accounts.job),
|
|
60
|
+
getAccountMeta(accounts.market),
|
|
61
|
+
getAccountMeta(accounts.vault),
|
|
62
|
+
getAccountMeta(accounts.user),
|
|
63
|
+
getAccountMeta(accounts.payer),
|
|
64
|
+
getAccountMeta(accounts.authority),
|
|
65
|
+
getAccountMeta(accounts.tokenProgram),
|
|
66
|
+
],
|
|
67
|
+
programAddress,
|
|
68
|
+
data: getRecoverInstructionDataEncoder().encode({}),
|
|
69
|
+
};
|
|
70
|
+
return instruction;
|
|
71
|
+
}
|
|
72
|
+
function parseRecoverInstruction(instruction) {
|
|
73
|
+
if (instruction.accounts.length < 7) {
|
|
74
|
+
// TODO: Coded error.
|
|
75
|
+
throw new Error('Not enough accounts');
|
|
76
|
+
}
|
|
77
|
+
let accountIndex = 0;
|
|
78
|
+
const getNextAccount = () => {
|
|
79
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
80
|
+
accountIndex += 1;
|
|
81
|
+
return accountMeta;
|
|
82
|
+
};
|
|
83
|
+
return {
|
|
84
|
+
programAddress: instruction.programAddress,
|
|
85
|
+
accounts: {
|
|
86
|
+
job: getNextAccount(),
|
|
87
|
+
market: getNextAccount(),
|
|
88
|
+
vault: getNextAccount(),
|
|
89
|
+
user: getNextAccount(),
|
|
90
|
+
payer: getNextAccount(),
|
|
91
|
+
authority: getNextAccount(),
|
|
92
|
+
tokenProgram: getNextAccount(),
|
|
93
|
+
},
|
|
94
|
+
data: getRecoverInstructionDataDecoder().decode(instruction.data),
|
|
95
|
+
};
|
|
96
|
+
}
|
|
@@ -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 ReadonlyAccount, type ReadonlySignerAccount, type ReadonlyUint8Array, type TransactionSigner, type WritableAccount } from '@solana/kit';
|
|
9
|
+
import { NOSANA_JOBS_PROGRAM_ADDRESS } from '../programs';
|
|
10
|
+
export declare const STOP_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
|
|
11
|
+
export declare function getStopDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
|
+
export type StopInstruction<TProgram extends string = typeof NOSANA_JOBS_PROGRAM_ADDRESS, TAccountMarket extends string | IAccountMeta<string> = string, TAccountNode extends string | IAccountMeta<string> = string, TAccountAuthority extends string | IAccountMeta<string> = string, TRemainingAccounts extends readonly IAccountMeta<string>[] = []> = IInstruction<TProgram> & IInstructionWithData<Uint8Array> & IInstructionWithAccounts<[
|
|
13
|
+
TAccountMarket extends string ? WritableAccount<TAccountMarket> : TAccountMarket,
|
|
14
|
+
TAccountNode extends string ? ReadonlyAccount<TAccountNode> : TAccountNode,
|
|
15
|
+
TAccountAuthority extends string ? ReadonlySignerAccount<TAccountAuthority> & IAccountSignerMeta<TAccountAuthority> : TAccountAuthority,
|
|
16
|
+
...TRemainingAccounts
|
|
17
|
+
]>;
|
|
18
|
+
export type StopInstructionData = {
|
|
19
|
+
discriminator: ReadonlyUint8Array;
|
|
20
|
+
};
|
|
21
|
+
export type StopInstructionDataArgs = {};
|
|
22
|
+
export declare function getStopInstructionDataEncoder(): Encoder<StopInstructionDataArgs>;
|
|
23
|
+
export declare function getStopInstructionDataDecoder(): Decoder<StopInstructionData>;
|
|
24
|
+
export declare function getStopInstructionDataCodec(): Codec<StopInstructionDataArgs, StopInstructionData>;
|
|
25
|
+
export type StopInput<TAccountMarket extends string = string, TAccountNode extends string = string, TAccountAuthority extends string = string> = {
|
|
26
|
+
market: Address<TAccountMarket>;
|
|
27
|
+
node: Address<TAccountNode>;
|
|
28
|
+
authority: TransactionSigner<TAccountAuthority>;
|
|
29
|
+
};
|
|
30
|
+
export declare function getStopInstruction<TAccountMarket extends string, TAccountNode extends string, TAccountAuthority extends string, TProgramAddress extends Address = typeof NOSANA_JOBS_PROGRAM_ADDRESS>(input: StopInput<TAccountMarket, TAccountNode, TAccountAuthority>, config?: {
|
|
31
|
+
programAddress?: TProgramAddress;
|
|
32
|
+
}): StopInstruction<TProgramAddress, TAccountMarket, TAccountNode, TAccountAuthority>;
|
|
33
|
+
export type ParsedStopInstruction<TProgram extends string = typeof NOSANA_JOBS_PROGRAM_ADDRESS, TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[]> = {
|
|
34
|
+
programAddress: Address<TProgram>;
|
|
35
|
+
accounts: {
|
|
36
|
+
market: TAccountMetas[0];
|
|
37
|
+
node: TAccountMetas[1];
|
|
38
|
+
authority: TAccountMetas[2];
|
|
39
|
+
};
|
|
40
|
+
data: StopInstructionData;
|
|
41
|
+
};
|
|
42
|
+
export declare function parseStopInstruction<TProgram extends string, TAccountMetas extends readonly IAccountMeta[]>(instruction: IInstruction<TProgram> & IInstructionWithAccounts<TAccountMetas> & IInstructionWithData<Uint8Array>): ParsedStopInstruction<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.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([
|
|
21
|
+
42, 133, 32, 60, 171, 253, 184, 155,
|
|
22
|
+
]);
|
|
23
|
+
function getStopDiscriminatorBytes() {
|
|
24
|
+
return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.STOP_DISCRIMINATOR);
|
|
25
|
+
}
|
|
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 }));
|
|
28
|
+
}
|
|
29
|
+
function getStopInstructionDataDecoder() {
|
|
30
|
+
return (0, kit_1.getStructDecoder)([
|
|
31
|
+
['discriminator', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
|
|
32
|
+
]);
|
|
33
|
+
}
|
|
34
|
+
function getStopInstructionDataCodec() {
|
|
35
|
+
return (0, kit_1.combineCodec)(getStopInstructionDataEncoder(), getStopInstructionDataDecoder());
|
|
36
|
+
}
|
|
37
|
+
function getStopInstruction(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
|
+
node: { value: input.node ?? null, isWritable: false },
|
|
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.market),
|
|
51
|
+
getAccountMeta(accounts.node),
|
|
52
|
+
getAccountMeta(accounts.authority),
|
|
53
|
+
],
|
|
54
|
+
programAddress,
|
|
55
|
+
data: getStopInstructionDataEncoder().encode({}),
|
|
56
|
+
};
|
|
57
|
+
return instruction;
|
|
58
|
+
}
|
|
59
|
+
function parseStopInstruction(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
|
+
market: getNextAccount(),
|
|
74
|
+
node: getNextAccount(),
|
|
75
|
+
authority: getNextAccount(),
|
|
76
|
+
},
|
|
77
|
+
data: getStopInstructionDataDecoder().decode(instruction.data),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
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 UPDATE_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
|
|
11
|
+
export declare function getUpdateDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
|
+
export type UpdateInstruction<TProgram extends string = typeof NOSANA_JOBS_PROGRAM_ADDRESS, TAccountMarket extends string | IAccountMeta<string> = string, TAccountAccessKey extends string | IAccountMeta<string> = string, TAccountAuthority extends string | IAccountMeta<string> = string, TRemainingAccounts extends readonly IAccountMeta<string>[] = []> = IInstruction<TProgram> & IInstructionWithData<Uint8Array> & IInstructionWithAccounts<[
|
|
13
|
+
TAccountMarket extends string ? WritableAccount<TAccountMarket> : TAccountMarket,
|
|
14
|
+
TAccountAccessKey extends string ? ReadonlyAccount<TAccountAccessKey> : TAccountAccessKey,
|
|
15
|
+
TAccountAuthority extends string ? ReadonlySignerAccount<TAccountAuthority> & IAccountSignerMeta<TAccountAuthority> : TAccountAuthority,
|
|
16
|
+
...TRemainingAccounts
|
|
17
|
+
]>;
|
|
18
|
+
export type UpdateInstructionData = {
|
|
19
|
+
discriminator: ReadonlyUint8Array;
|
|
20
|
+
jobExpiration: bigint;
|
|
21
|
+
jobPrice: bigint;
|
|
22
|
+
jobType: number;
|
|
23
|
+
nodeStakeMinimum: bigint;
|
|
24
|
+
jobTimeout: bigint;
|
|
25
|
+
};
|
|
26
|
+
export type UpdateInstructionDataArgs = {
|
|
27
|
+
jobExpiration: number | bigint;
|
|
28
|
+
jobPrice: number | bigint;
|
|
29
|
+
jobType: number;
|
|
30
|
+
nodeStakeMinimum: number | bigint;
|
|
31
|
+
jobTimeout: number | bigint;
|
|
32
|
+
};
|
|
33
|
+
export declare function getUpdateInstructionDataEncoder(): Encoder<UpdateInstructionDataArgs>;
|
|
34
|
+
export declare function getUpdateInstructionDataDecoder(): Decoder<UpdateInstructionData>;
|
|
35
|
+
export declare function getUpdateInstructionDataCodec(): Codec<UpdateInstructionDataArgs, UpdateInstructionData>;
|
|
36
|
+
export type UpdateInput<TAccountMarket extends string = string, TAccountAccessKey extends string = string, TAccountAuthority extends string = string> = {
|
|
37
|
+
market: Address<TAccountMarket>;
|
|
38
|
+
accessKey: Address<TAccountAccessKey>;
|
|
39
|
+
authority: TransactionSigner<TAccountAuthority>;
|
|
40
|
+
jobExpiration: UpdateInstructionDataArgs['jobExpiration'];
|
|
41
|
+
jobPrice: UpdateInstructionDataArgs['jobPrice'];
|
|
42
|
+
jobType: UpdateInstructionDataArgs['jobType'];
|
|
43
|
+
nodeStakeMinimum: UpdateInstructionDataArgs['nodeStakeMinimum'];
|
|
44
|
+
jobTimeout: UpdateInstructionDataArgs['jobTimeout'];
|
|
45
|
+
};
|
|
46
|
+
export declare function getUpdateInstruction<TAccountMarket extends string, TAccountAccessKey extends string, TAccountAuthority extends string, TProgramAddress extends Address = typeof NOSANA_JOBS_PROGRAM_ADDRESS>(input: UpdateInput<TAccountMarket, TAccountAccessKey, TAccountAuthority>, config?: {
|
|
47
|
+
programAddress?: TProgramAddress;
|
|
48
|
+
}): UpdateInstruction<TProgramAddress, TAccountMarket, TAccountAccessKey, TAccountAuthority>;
|
|
49
|
+
export type ParsedUpdateInstruction<TProgram extends string = typeof NOSANA_JOBS_PROGRAM_ADDRESS, TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[]> = {
|
|
50
|
+
programAddress: Address<TProgram>;
|
|
51
|
+
accounts: {
|
|
52
|
+
market: TAccountMetas[0];
|
|
53
|
+
accessKey: TAccountMetas[1];
|
|
54
|
+
authority: TAccountMetas[2];
|
|
55
|
+
};
|
|
56
|
+
data: UpdateInstructionData;
|
|
57
|
+
};
|
|
58
|
+
export declare function parseUpdateInstruction<TProgram extends string, TAccountMetas extends readonly IAccountMeta[]>(instruction: IInstruction<TProgram> & IInstructionWithAccounts<TAccountMetas> & IInstructionWithData<Uint8Array>): ParsedUpdateInstruction<TProgram, TAccountMetas>;
|
|
@@ -0,0 +1,93 @@
|
|
|
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.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([
|
|
21
|
+
219, 200, 88, 176, 158, 63, 253, 127,
|
|
22
|
+
]);
|
|
23
|
+
function getUpdateDiscriminatorBytes() {
|
|
24
|
+
return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.UPDATE_DISCRIMINATOR);
|
|
25
|
+
}
|
|
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 }));
|
|
35
|
+
}
|
|
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)()],
|
|
44
|
+
]);
|
|
45
|
+
}
|
|
46
|
+
function getUpdateInstructionDataCodec() {
|
|
47
|
+
return (0, kit_1.combineCodec)(getUpdateInstructionDataEncoder(), getUpdateInstructionDataDecoder());
|
|
48
|
+
}
|
|
49
|
+
function getUpdateInstruction(input, config) {
|
|
50
|
+
// Program address.
|
|
51
|
+
const programAddress = config?.programAddress ?? programs_1.NOSANA_JOBS_PROGRAM_ADDRESS;
|
|
52
|
+
// Original accounts.
|
|
53
|
+
const originalAccounts = {
|
|
54
|
+
market: { value: input.market ?? null, isWritable: true },
|
|
55
|
+
accessKey: { value: input.accessKey ?? null, isWritable: false },
|
|
56
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
57
|
+
};
|
|
58
|
+
const accounts = originalAccounts;
|
|
59
|
+
// Original args.
|
|
60
|
+
const args = { ...input };
|
|
61
|
+
const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, 'programId');
|
|
62
|
+
const instruction = {
|
|
63
|
+
accounts: [
|
|
64
|
+
getAccountMeta(accounts.market),
|
|
65
|
+
getAccountMeta(accounts.accessKey),
|
|
66
|
+
getAccountMeta(accounts.authority),
|
|
67
|
+
],
|
|
68
|
+
programAddress,
|
|
69
|
+
data: getUpdateInstructionDataEncoder().encode(args),
|
|
70
|
+
};
|
|
71
|
+
return instruction;
|
|
72
|
+
}
|
|
73
|
+
function parseUpdateInstruction(instruction) {
|
|
74
|
+
if (instruction.accounts.length < 3) {
|
|
75
|
+
// TODO: Coded error.
|
|
76
|
+
throw new Error('Not enough accounts');
|
|
77
|
+
}
|
|
78
|
+
let accountIndex = 0;
|
|
79
|
+
const getNextAccount = () => {
|
|
80
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
81
|
+
accountIndex += 1;
|
|
82
|
+
return accountMeta;
|
|
83
|
+
};
|
|
84
|
+
return {
|
|
85
|
+
programAddress: instruction.programAddress,
|
|
86
|
+
accounts: {
|
|
87
|
+
market: getNextAccount(),
|
|
88
|
+
accessKey: getNextAccount(),
|
|
89
|
+
authority: getNextAccount(),
|
|
90
|
+
},
|
|
91
|
+
data: getUpdateInstructionDataDecoder().decode(instruction.data),
|
|
92
|
+
};
|
|
93
|
+
}
|