@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,111 @@
|
|
|
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.FINISH_DISCRIMINATOR = void 0;
|
|
11
|
+
exports.getFinishDiscriminatorBytes = getFinishDiscriminatorBytes;
|
|
12
|
+
exports.getFinishInstructionDataEncoder = getFinishInstructionDataEncoder;
|
|
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([
|
|
21
|
+
67, 74, 170, 132, 125, 233, 182, 37,
|
|
22
|
+
]);
|
|
23
|
+
function getFinishDiscriminatorBytes() {
|
|
24
|
+
return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.FINISH_DISCRIMINATOR);
|
|
25
|
+
}
|
|
26
|
+
function getFinishInstructionDataEncoder() {
|
|
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.FINISH_DISCRIMINATOR }));
|
|
31
|
+
}
|
|
32
|
+
function getFinishInstructionDataDecoder() {
|
|
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 getFinishInstructionDataCodec() {
|
|
39
|
+
return (0, kit_1.combineCodec)(getFinishInstructionDataEncoder(), getFinishInstructionDataDecoder());
|
|
40
|
+
}
|
|
41
|
+
function getFinishInstruction(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
|
+
run: { value: input.run ?? null, isWritable: true },
|
|
48
|
+
market: { value: input.market ?? null, isWritable: false },
|
|
49
|
+
vault: { value: input.vault ?? null, isWritable: true },
|
|
50
|
+
deposit: { value: input.deposit ?? null, isWritable: true },
|
|
51
|
+
user: { value: input.user ?? null, isWritable: true },
|
|
52
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
53
|
+
project: { value: input.project ?? null, isWritable: true },
|
|
54
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
55
|
+
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
56
|
+
};
|
|
57
|
+
const accounts = originalAccounts;
|
|
58
|
+
// Original args.
|
|
59
|
+
const args = { ...input };
|
|
60
|
+
// Resolve default values.
|
|
61
|
+
if (!accounts.tokenProgram.value) {
|
|
62
|
+
accounts.tokenProgram.value =
|
|
63
|
+
'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
|
|
64
|
+
}
|
|
65
|
+
const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, 'programId');
|
|
66
|
+
const instruction = {
|
|
67
|
+
accounts: [
|
|
68
|
+
getAccountMeta(accounts.job),
|
|
69
|
+
getAccountMeta(accounts.run),
|
|
70
|
+
getAccountMeta(accounts.market),
|
|
71
|
+
getAccountMeta(accounts.vault),
|
|
72
|
+
getAccountMeta(accounts.deposit),
|
|
73
|
+
getAccountMeta(accounts.user),
|
|
74
|
+
getAccountMeta(accounts.payer),
|
|
75
|
+
getAccountMeta(accounts.project),
|
|
76
|
+
getAccountMeta(accounts.authority),
|
|
77
|
+
getAccountMeta(accounts.tokenProgram),
|
|
78
|
+
],
|
|
79
|
+
programAddress,
|
|
80
|
+
data: getFinishInstructionDataEncoder().encode(args),
|
|
81
|
+
};
|
|
82
|
+
return instruction;
|
|
83
|
+
}
|
|
84
|
+
function parseFinishInstruction(instruction) {
|
|
85
|
+
if (instruction.accounts.length < 10) {
|
|
86
|
+
// TODO: Coded error.
|
|
87
|
+
throw new Error('Not enough accounts');
|
|
88
|
+
}
|
|
89
|
+
let accountIndex = 0;
|
|
90
|
+
const getNextAccount = () => {
|
|
91
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
92
|
+
accountIndex += 1;
|
|
93
|
+
return accountMeta;
|
|
94
|
+
};
|
|
95
|
+
return {
|
|
96
|
+
programAddress: instruction.programAddress,
|
|
97
|
+
accounts: {
|
|
98
|
+
job: getNextAccount(),
|
|
99
|
+
run: getNextAccount(),
|
|
100
|
+
market: getNextAccount(),
|
|
101
|
+
vault: getNextAccount(),
|
|
102
|
+
deposit: getNextAccount(),
|
|
103
|
+
user: getNextAccount(),
|
|
104
|
+
payer: getNextAccount(),
|
|
105
|
+
project: getNextAccount(),
|
|
106
|
+
authority: getNextAccount(),
|
|
107
|
+
tokenProgram: getNextAccount(),
|
|
108
|
+
},
|
|
109
|
+
data: getFinishInstructionDataDecoder().decode(instruction.data),
|
|
110
|
+
};
|
|
111
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
export * from './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';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This code was AUTOGENERATED using the codama library.
|
|
4
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
5
|
+
* to add features, then rerun codama to update it.
|
|
6
|
+
*
|
|
7
|
+
* @see https://github.com/codama-idl/codama
|
|
8
|
+
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
21
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
__exportStar(require("./claim"), exports);
|
|
25
|
+
__exportStar(require("./clean"), exports);
|
|
26
|
+
__exportStar(require("./cleanAdmin"), exports);
|
|
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);
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
import { type Address, type Codec, type Decoder, type Encoder, type IAccountMeta, type IAccountSignerMeta, type IInstruction, type IInstructionWithAccounts, type IInstructionWithData, type ReadonlyAccount, type ReadonlySignerAccount, type ReadonlyUint8Array, type TransactionSigner, type WritableAccount, type WritableSignerAccount } from '@solana/kit';
|
|
9
|
+
import { NOSANA_JOBS_PROGRAM_ADDRESS } from '../programs';
|
|
10
|
+
export declare const LIST_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
|
|
11
|
+
export declare function getListDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
|
+
export type ListInstruction<TProgram extends string = typeof NOSANA_JOBS_PROGRAM_ADDRESS, TAccountJob extends string | IAccountMeta<string> = string, TAccountMarket extends string | IAccountMeta<string> = string, TAccountRun extends string | IAccountMeta<string> = string, TAccountUser extends string | IAccountMeta<string> = string, TAccountVault extends string | IAccountMeta<string> = string, TAccountPayer extends string | IAccountMeta<string> = string, TAccountRewardsReflection extends string | IAccountMeta<string> = string, TAccountRewardsVault extends string | IAccountMeta<string> = string, TAccountAuthority extends string | IAccountMeta<string> = string, TAccountRewardsProgram extends string | IAccountMeta<string> = string, TAccountTokenProgram extends string | IAccountMeta<string> = 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA', TAccountSystemProgram extends string | IAccountMeta<string> = '11111111111111111111111111111111', TRemainingAccounts extends readonly IAccountMeta<string>[] = []> = IInstruction<TProgram> & IInstructionWithData<Uint8Array> & IInstructionWithAccounts<[
|
|
13
|
+
TAccountJob extends string ? WritableSignerAccount<TAccountJob> & IAccountSignerMeta<TAccountJob> : TAccountJob,
|
|
14
|
+
TAccountMarket extends string ? WritableAccount<TAccountMarket> : TAccountMarket,
|
|
15
|
+
TAccountRun extends string ? WritableSignerAccount<TAccountRun> & IAccountSignerMeta<TAccountRun> : TAccountRun,
|
|
16
|
+
TAccountUser extends string ? WritableAccount<TAccountUser> : TAccountUser,
|
|
17
|
+
TAccountVault extends string ? WritableAccount<TAccountVault> : TAccountVault,
|
|
18
|
+
TAccountPayer extends string ? WritableSignerAccount<TAccountPayer> & IAccountSignerMeta<TAccountPayer> : TAccountPayer,
|
|
19
|
+
TAccountRewardsReflection extends string ? WritableAccount<TAccountRewardsReflection> : TAccountRewardsReflection,
|
|
20
|
+
TAccountRewardsVault extends string ? WritableAccount<TAccountRewardsVault> : TAccountRewardsVault,
|
|
21
|
+
TAccountAuthority extends string ? ReadonlySignerAccount<TAccountAuthority> & IAccountSignerMeta<TAccountAuthority> : TAccountAuthority,
|
|
22
|
+
TAccountRewardsProgram extends string ? ReadonlyAccount<TAccountRewardsProgram> : TAccountRewardsProgram,
|
|
23
|
+
TAccountTokenProgram extends string ? ReadonlyAccount<TAccountTokenProgram> : TAccountTokenProgram,
|
|
24
|
+
TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
|
|
25
|
+
...TRemainingAccounts
|
|
26
|
+
]>;
|
|
27
|
+
export type ListInstructionData = {
|
|
28
|
+
discriminator: ReadonlyUint8Array;
|
|
29
|
+
ipfsJob: ReadonlyUint8Array;
|
|
30
|
+
timeout: bigint;
|
|
31
|
+
};
|
|
32
|
+
export type ListInstructionDataArgs = {
|
|
33
|
+
ipfsJob: ReadonlyUint8Array;
|
|
34
|
+
timeout: number | bigint;
|
|
35
|
+
};
|
|
36
|
+
export declare function getListInstructionDataEncoder(): Encoder<ListInstructionDataArgs>;
|
|
37
|
+
export declare function getListInstructionDataDecoder(): Decoder<ListInstructionData>;
|
|
38
|
+
export declare function getListInstructionDataCodec(): Codec<ListInstructionDataArgs, ListInstructionData>;
|
|
39
|
+
export type ListInput<TAccountJob extends string = string, TAccountMarket extends string = string, TAccountRun extends string = string, TAccountUser extends string = string, TAccountVault extends string = string, TAccountPayer extends string = string, TAccountRewardsReflection extends string = string, TAccountRewardsVault extends string = string, TAccountAuthority extends string = string, TAccountRewardsProgram extends string = string, TAccountTokenProgram extends string = string, TAccountSystemProgram extends string = string> = {
|
|
40
|
+
job: TransactionSigner<TAccountJob>;
|
|
41
|
+
market: Address<TAccountMarket>;
|
|
42
|
+
run: TransactionSigner<TAccountRun>;
|
|
43
|
+
user: Address<TAccountUser>;
|
|
44
|
+
vault: Address<TAccountVault>;
|
|
45
|
+
payer: TransactionSigner<TAccountPayer>;
|
|
46
|
+
rewardsReflection: Address<TAccountRewardsReflection>;
|
|
47
|
+
rewardsVault: Address<TAccountRewardsVault>;
|
|
48
|
+
authority: TransactionSigner<TAccountAuthority>;
|
|
49
|
+
rewardsProgram: Address<TAccountRewardsProgram>;
|
|
50
|
+
tokenProgram?: Address<TAccountTokenProgram>;
|
|
51
|
+
systemProgram?: Address<TAccountSystemProgram>;
|
|
52
|
+
ipfsJob: ListInstructionDataArgs['ipfsJob'];
|
|
53
|
+
timeout: ListInstructionDataArgs['timeout'];
|
|
54
|
+
};
|
|
55
|
+
export declare function getListInstruction<TAccountJob extends string, TAccountMarket extends string, TAccountRun extends string, TAccountUser extends string, TAccountVault extends string, TAccountPayer extends string, TAccountRewardsReflection extends string, TAccountRewardsVault extends string, TAccountAuthority extends string, TAccountRewardsProgram extends string, TAccountTokenProgram extends string, TAccountSystemProgram extends string, TProgramAddress extends Address = typeof NOSANA_JOBS_PROGRAM_ADDRESS>(input: ListInput<TAccountJob, TAccountMarket, TAccountRun, TAccountUser, TAccountVault, TAccountPayer, TAccountRewardsReflection, TAccountRewardsVault, TAccountAuthority, TAccountRewardsProgram, TAccountTokenProgram, TAccountSystemProgram>, config?: {
|
|
56
|
+
programAddress?: TProgramAddress;
|
|
57
|
+
}): ListInstruction<TProgramAddress, TAccountJob, TAccountMarket, TAccountRun, TAccountUser, TAccountVault, TAccountPayer, TAccountRewardsReflection, TAccountRewardsVault, TAccountAuthority, TAccountRewardsProgram, TAccountTokenProgram, TAccountSystemProgram>;
|
|
58
|
+
export type ParsedListInstruction<TProgram extends string = typeof NOSANA_JOBS_PROGRAM_ADDRESS, TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[]> = {
|
|
59
|
+
programAddress: Address<TProgram>;
|
|
60
|
+
accounts: {
|
|
61
|
+
job: TAccountMetas[0];
|
|
62
|
+
market: TAccountMetas[1];
|
|
63
|
+
run: TAccountMetas[2];
|
|
64
|
+
user: TAccountMetas[3];
|
|
65
|
+
vault: TAccountMetas[4];
|
|
66
|
+
payer: TAccountMetas[5];
|
|
67
|
+
rewardsReflection: TAccountMetas[6];
|
|
68
|
+
rewardsVault: TAccountMetas[7];
|
|
69
|
+
authority: TAccountMetas[8];
|
|
70
|
+
rewardsProgram: TAccountMetas[9];
|
|
71
|
+
tokenProgram: TAccountMetas[10];
|
|
72
|
+
systemProgram: TAccountMetas[11];
|
|
73
|
+
};
|
|
74
|
+
data: ListInstructionData;
|
|
75
|
+
};
|
|
76
|
+
export declare function parseListInstruction<TProgram extends string, TAccountMetas extends readonly IAccountMeta[]>(instruction: IInstruction<TProgram> & IInstructionWithAccounts<TAccountMetas> & IInstructionWithData<Uint8Array>): ParsedListInstruction<TProgram, TAccountMetas>;
|
|
@@ -0,0 +1,126 @@
|
|
|
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.LIST_DISCRIMINATOR = void 0;
|
|
11
|
+
exports.getListDiscriminatorBytes = getListDiscriminatorBytes;
|
|
12
|
+
exports.getListInstructionDataEncoder = getListInstructionDataEncoder;
|
|
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([
|
|
21
|
+
54, 174, 193, 67, 17, 41, 132, 38,
|
|
22
|
+
]);
|
|
23
|
+
function getListDiscriminatorBytes() {
|
|
24
|
+
return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.LIST_DISCRIMINATOR);
|
|
25
|
+
}
|
|
26
|
+
function getListInstructionDataEncoder() {
|
|
27
|
+
return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([
|
|
28
|
+
['discriminator', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)],
|
|
29
|
+
['ipfsJob', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 32)],
|
|
30
|
+
['timeout', (0, kit_1.getI64Encoder)()],
|
|
31
|
+
]), (value) => ({ ...value, discriminator: exports.LIST_DISCRIMINATOR }));
|
|
32
|
+
}
|
|
33
|
+
function getListInstructionDataDecoder() {
|
|
34
|
+
return (0, kit_1.getStructDecoder)([
|
|
35
|
+
['discriminator', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
|
|
36
|
+
['ipfsJob', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 32)],
|
|
37
|
+
['timeout', (0, kit_1.getI64Decoder)()],
|
|
38
|
+
]);
|
|
39
|
+
}
|
|
40
|
+
function getListInstructionDataCodec() {
|
|
41
|
+
return (0, kit_1.combineCodec)(getListInstructionDataEncoder(), getListInstructionDataDecoder());
|
|
42
|
+
}
|
|
43
|
+
function getListInstruction(input, config) {
|
|
44
|
+
// Program address.
|
|
45
|
+
const programAddress = config?.programAddress ?? programs_1.NOSANA_JOBS_PROGRAM_ADDRESS;
|
|
46
|
+
// Original accounts.
|
|
47
|
+
const originalAccounts = {
|
|
48
|
+
job: { value: input.job ?? null, isWritable: true },
|
|
49
|
+
market: { value: input.market ?? null, isWritable: true },
|
|
50
|
+
run: { value: input.run ?? null, isWritable: true },
|
|
51
|
+
user: { value: input.user ?? null, isWritable: true },
|
|
52
|
+
vault: { value: input.vault ?? null, isWritable: true },
|
|
53
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
54
|
+
rewardsReflection: {
|
|
55
|
+
value: input.rewardsReflection ?? null,
|
|
56
|
+
isWritable: true,
|
|
57
|
+
},
|
|
58
|
+
rewardsVault: { value: input.rewardsVault ?? null, isWritable: true },
|
|
59
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
60
|
+
rewardsProgram: { value: input.rewardsProgram ?? null, isWritable: false },
|
|
61
|
+
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
62
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
63
|
+
};
|
|
64
|
+
const accounts = originalAccounts;
|
|
65
|
+
// Original args.
|
|
66
|
+
const args = { ...input };
|
|
67
|
+
// Resolve default values.
|
|
68
|
+
if (!accounts.tokenProgram.value) {
|
|
69
|
+
accounts.tokenProgram.value =
|
|
70
|
+
'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
|
|
71
|
+
}
|
|
72
|
+
if (!accounts.systemProgram.value) {
|
|
73
|
+
accounts.systemProgram.value =
|
|
74
|
+
'11111111111111111111111111111111';
|
|
75
|
+
}
|
|
76
|
+
const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, 'programId');
|
|
77
|
+
const instruction = {
|
|
78
|
+
accounts: [
|
|
79
|
+
getAccountMeta(accounts.job),
|
|
80
|
+
getAccountMeta(accounts.market),
|
|
81
|
+
getAccountMeta(accounts.run),
|
|
82
|
+
getAccountMeta(accounts.user),
|
|
83
|
+
getAccountMeta(accounts.vault),
|
|
84
|
+
getAccountMeta(accounts.payer),
|
|
85
|
+
getAccountMeta(accounts.rewardsReflection),
|
|
86
|
+
getAccountMeta(accounts.rewardsVault),
|
|
87
|
+
getAccountMeta(accounts.authority),
|
|
88
|
+
getAccountMeta(accounts.rewardsProgram),
|
|
89
|
+
getAccountMeta(accounts.tokenProgram),
|
|
90
|
+
getAccountMeta(accounts.systemProgram),
|
|
91
|
+
],
|
|
92
|
+
programAddress,
|
|
93
|
+
data: getListInstructionDataEncoder().encode(args),
|
|
94
|
+
};
|
|
95
|
+
return instruction;
|
|
96
|
+
}
|
|
97
|
+
function parseListInstruction(instruction) {
|
|
98
|
+
if (instruction.accounts.length < 12) {
|
|
99
|
+
// TODO: Coded error.
|
|
100
|
+
throw new Error('Not enough accounts');
|
|
101
|
+
}
|
|
102
|
+
let accountIndex = 0;
|
|
103
|
+
const getNextAccount = () => {
|
|
104
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
105
|
+
accountIndex += 1;
|
|
106
|
+
return accountMeta;
|
|
107
|
+
};
|
|
108
|
+
return {
|
|
109
|
+
programAddress: instruction.programAddress,
|
|
110
|
+
accounts: {
|
|
111
|
+
job: getNextAccount(),
|
|
112
|
+
market: getNextAccount(),
|
|
113
|
+
run: getNextAccount(),
|
|
114
|
+
user: getNextAccount(),
|
|
115
|
+
vault: getNextAccount(),
|
|
116
|
+
payer: getNextAccount(),
|
|
117
|
+
rewardsReflection: getNextAccount(),
|
|
118
|
+
rewardsVault: getNextAccount(),
|
|
119
|
+
authority: getNextAccount(),
|
|
120
|
+
rewardsProgram: getNextAccount(),
|
|
121
|
+
tokenProgram: getNextAccount(),
|
|
122
|
+
systemProgram: getNextAccount(),
|
|
123
|
+
},
|
|
124
|
+
data: getListInstructionDataDecoder().decode(instruction.data),
|
|
125
|
+
};
|
|
126
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
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 ReadonlyUint8Array, type TransactionSigner, type WritableAccount, type WritableSignerAccount } from '@solana/kit';
|
|
9
|
+
import { NOSANA_JOBS_PROGRAM_ADDRESS } from '../programs';
|
|
10
|
+
export declare const OPEN_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
|
|
11
|
+
export declare function getOpenDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
|
+
export type OpenInstruction<TProgram extends string = typeof NOSANA_JOBS_PROGRAM_ADDRESS, TAccountMint extends string | IAccountMeta<string> = string, TAccountMarket extends string | IAccountMeta<string> = string, TAccountVault extends string | IAccountMeta<string> = string, TAccountAuthority extends string | IAccountMeta<string> = string, TAccountAccessKey extends string | IAccountMeta<string> = string, TAccountRent extends string | IAccountMeta<string> = 'SysvarRent111111111111111111111111111111111', TAccountSystemProgram extends string | IAccountMeta<string> = '11111111111111111111111111111111', TAccountTokenProgram extends string | IAccountMeta<string> = 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA', TRemainingAccounts extends readonly IAccountMeta<string>[] = []> = IInstruction<TProgram> & IInstructionWithData<Uint8Array> & IInstructionWithAccounts<[
|
|
13
|
+
TAccountMint extends string ? ReadonlyAccount<TAccountMint> : TAccountMint,
|
|
14
|
+
TAccountMarket extends string ? WritableSignerAccount<TAccountMarket> & IAccountSignerMeta<TAccountMarket> : TAccountMarket,
|
|
15
|
+
TAccountVault extends string ? WritableAccount<TAccountVault> : TAccountVault,
|
|
16
|
+
TAccountAuthority extends string ? WritableSignerAccount<TAccountAuthority> & IAccountSignerMeta<TAccountAuthority> : TAccountAuthority,
|
|
17
|
+
TAccountAccessKey extends string ? ReadonlyAccount<TAccountAccessKey> : TAccountAccessKey,
|
|
18
|
+
TAccountRent extends string ? ReadonlyAccount<TAccountRent> : TAccountRent,
|
|
19
|
+
TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
|
|
20
|
+
TAccountTokenProgram extends string ? ReadonlyAccount<TAccountTokenProgram> : TAccountTokenProgram,
|
|
21
|
+
...TRemainingAccounts
|
|
22
|
+
]>;
|
|
23
|
+
export type OpenInstructionData = {
|
|
24
|
+
discriminator: ReadonlyUint8Array;
|
|
25
|
+
jobExpiration: bigint;
|
|
26
|
+
jobPrice: bigint;
|
|
27
|
+
jobTimeout: bigint;
|
|
28
|
+
jobType: number;
|
|
29
|
+
nodeXnosMinimum: bigint;
|
|
30
|
+
};
|
|
31
|
+
export type OpenInstructionDataArgs = {
|
|
32
|
+
jobExpiration: number | bigint;
|
|
33
|
+
jobPrice: number | bigint;
|
|
34
|
+
jobTimeout: number | bigint;
|
|
35
|
+
jobType: number;
|
|
36
|
+
nodeXnosMinimum: number | bigint;
|
|
37
|
+
};
|
|
38
|
+
export declare function getOpenInstructionDataEncoder(): Encoder<OpenInstructionDataArgs>;
|
|
39
|
+
export declare function getOpenInstructionDataDecoder(): Decoder<OpenInstructionData>;
|
|
40
|
+
export declare function getOpenInstructionDataCodec(): Codec<OpenInstructionDataArgs, OpenInstructionData>;
|
|
41
|
+
export type OpenInput<TAccountMint extends string = string, TAccountMarket extends string = string, TAccountVault extends string = string, TAccountAuthority extends string = string, TAccountAccessKey extends string = string, TAccountRent extends string = string, TAccountSystemProgram extends string = string, TAccountTokenProgram extends string = string> = {
|
|
42
|
+
mint: Address<TAccountMint>;
|
|
43
|
+
market: TransactionSigner<TAccountMarket>;
|
|
44
|
+
vault: Address<TAccountVault>;
|
|
45
|
+
authority: TransactionSigner<TAccountAuthority>;
|
|
46
|
+
accessKey: Address<TAccountAccessKey>;
|
|
47
|
+
rent?: Address<TAccountRent>;
|
|
48
|
+
systemProgram?: Address<TAccountSystemProgram>;
|
|
49
|
+
tokenProgram?: Address<TAccountTokenProgram>;
|
|
50
|
+
jobExpiration: OpenInstructionDataArgs['jobExpiration'];
|
|
51
|
+
jobPrice: OpenInstructionDataArgs['jobPrice'];
|
|
52
|
+
jobTimeout: OpenInstructionDataArgs['jobTimeout'];
|
|
53
|
+
jobType: OpenInstructionDataArgs['jobType'];
|
|
54
|
+
nodeXnosMinimum: OpenInstructionDataArgs['nodeXnosMinimum'];
|
|
55
|
+
};
|
|
56
|
+
export declare function getOpenInstruction<TAccountMint extends string, TAccountMarket extends string, TAccountVault extends string, TAccountAuthority extends string, TAccountAccessKey extends string, TAccountRent extends string, TAccountSystemProgram extends string, TAccountTokenProgram extends string, TProgramAddress extends Address = typeof NOSANA_JOBS_PROGRAM_ADDRESS>(input: OpenInput<TAccountMint, TAccountMarket, TAccountVault, TAccountAuthority, TAccountAccessKey, TAccountRent, TAccountSystemProgram, TAccountTokenProgram>, config?: {
|
|
57
|
+
programAddress?: TProgramAddress;
|
|
58
|
+
}): OpenInstruction<TProgramAddress, TAccountMint, TAccountMarket, TAccountVault, TAccountAuthority, TAccountAccessKey, TAccountRent, TAccountSystemProgram, TAccountTokenProgram>;
|
|
59
|
+
export type ParsedOpenInstruction<TProgram extends string = typeof NOSANA_JOBS_PROGRAM_ADDRESS, TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[]> = {
|
|
60
|
+
programAddress: Address<TProgram>;
|
|
61
|
+
accounts: {
|
|
62
|
+
mint: TAccountMetas[0];
|
|
63
|
+
market: TAccountMetas[1];
|
|
64
|
+
vault: TAccountMetas[2];
|
|
65
|
+
authority: TAccountMetas[3];
|
|
66
|
+
accessKey: TAccountMetas[4];
|
|
67
|
+
rent: TAccountMetas[5];
|
|
68
|
+
systemProgram: TAccountMetas[6];
|
|
69
|
+
tokenProgram: TAccountMetas[7];
|
|
70
|
+
};
|
|
71
|
+
data: OpenInstructionData;
|
|
72
|
+
};
|
|
73
|
+
export declare function parseOpenInstruction<TProgram extends string, TAccountMetas extends readonly IAccountMeta[]>(instruction: IInstruction<TProgram> & IInstructionWithAccounts<TAccountMetas> & IInstructionWithData<Uint8Array>): ParsedOpenInstruction<TProgram, TAccountMetas>;
|
|
@@ -0,0 +1,121 @@
|
|
|
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.OPEN_DISCRIMINATOR = void 0;
|
|
11
|
+
exports.getOpenDiscriminatorBytes = getOpenDiscriminatorBytes;
|
|
12
|
+
exports.getOpenInstructionDataEncoder = getOpenInstructionDataEncoder;
|
|
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([
|
|
21
|
+
228, 220, 155, 71, 199, 189, 60, 45,
|
|
22
|
+
]);
|
|
23
|
+
function getOpenDiscriminatorBytes() {
|
|
24
|
+
return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.OPEN_DISCRIMINATOR);
|
|
25
|
+
}
|
|
26
|
+
function getOpenInstructionDataEncoder() {
|
|
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
|
+
['jobTimeout', (0, kit_1.getI64Encoder)()],
|
|
32
|
+
['jobType', (0, kit_1.getU8Encoder)()],
|
|
33
|
+
['nodeXnosMinimum', (0, kit_1.getU128Encoder)()],
|
|
34
|
+
]), (value) => ({ ...value, discriminator: exports.OPEN_DISCRIMINATOR }));
|
|
35
|
+
}
|
|
36
|
+
function getOpenInstructionDataDecoder() {
|
|
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
|
+
['jobTimeout', (0, kit_1.getI64Decoder)()],
|
|
42
|
+
['jobType', (0, kit_1.getU8Decoder)()],
|
|
43
|
+
['nodeXnosMinimum', (0, kit_1.getU128Decoder)()],
|
|
44
|
+
]);
|
|
45
|
+
}
|
|
46
|
+
function getOpenInstructionDataCodec() {
|
|
47
|
+
return (0, kit_1.combineCodec)(getOpenInstructionDataEncoder(), getOpenInstructionDataDecoder());
|
|
48
|
+
}
|
|
49
|
+
function getOpenInstruction(input, config) {
|
|
50
|
+
// Program address.
|
|
51
|
+
const programAddress = config?.programAddress ?? programs_1.NOSANA_JOBS_PROGRAM_ADDRESS;
|
|
52
|
+
// Original accounts.
|
|
53
|
+
const originalAccounts = {
|
|
54
|
+
mint: { value: input.mint ?? null, isWritable: false },
|
|
55
|
+
market: { value: input.market ?? null, isWritable: true },
|
|
56
|
+
vault: { value: input.vault ?? null, isWritable: true },
|
|
57
|
+
authority: { value: input.authority ?? null, isWritable: true },
|
|
58
|
+
accessKey: { value: input.accessKey ?? null, isWritable: false },
|
|
59
|
+
rent: { value: input.rent ?? null, isWritable: false },
|
|
60
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
61
|
+
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
62
|
+
};
|
|
63
|
+
const accounts = originalAccounts;
|
|
64
|
+
// Original args.
|
|
65
|
+
const args = { ...input };
|
|
66
|
+
// Resolve default values.
|
|
67
|
+
if (!accounts.rent.value) {
|
|
68
|
+
accounts.rent.value =
|
|
69
|
+
'SysvarRent111111111111111111111111111111111';
|
|
70
|
+
}
|
|
71
|
+
if (!accounts.systemProgram.value) {
|
|
72
|
+
accounts.systemProgram.value =
|
|
73
|
+
'11111111111111111111111111111111';
|
|
74
|
+
}
|
|
75
|
+
if (!accounts.tokenProgram.value) {
|
|
76
|
+
accounts.tokenProgram.value =
|
|
77
|
+
'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
|
|
78
|
+
}
|
|
79
|
+
const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, 'programId');
|
|
80
|
+
const instruction = {
|
|
81
|
+
accounts: [
|
|
82
|
+
getAccountMeta(accounts.mint),
|
|
83
|
+
getAccountMeta(accounts.market),
|
|
84
|
+
getAccountMeta(accounts.vault),
|
|
85
|
+
getAccountMeta(accounts.authority),
|
|
86
|
+
getAccountMeta(accounts.accessKey),
|
|
87
|
+
getAccountMeta(accounts.rent),
|
|
88
|
+
getAccountMeta(accounts.systemProgram),
|
|
89
|
+
getAccountMeta(accounts.tokenProgram),
|
|
90
|
+
],
|
|
91
|
+
programAddress,
|
|
92
|
+
data: getOpenInstructionDataEncoder().encode(args),
|
|
93
|
+
};
|
|
94
|
+
return instruction;
|
|
95
|
+
}
|
|
96
|
+
function parseOpenInstruction(instruction) {
|
|
97
|
+
if (instruction.accounts.length < 8) {
|
|
98
|
+
// TODO: Coded error.
|
|
99
|
+
throw new Error('Not enough accounts');
|
|
100
|
+
}
|
|
101
|
+
let accountIndex = 0;
|
|
102
|
+
const getNextAccount = () => {
|
|
103
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
104
|
+
accountIndex += 1;
|
|
105
|
+
return accountMeta;
|
|
106
|
+
};
|
|
107
|
+
return {
|
|
108
|
+
programAddress: instruction.programAddress,
|
|
109
|
+
accounts: {
|
|
110
|
+
mint: getNextAccount(),
|
|
111
|
+
market: getNextAccount(),
|
|
112
|
+
vault: getNextAccount(),
|
|
113
|
+
authority: getNextAccount(),
|
|
114
|
+
accessKey: getNextAccount(),
|
|
115
|
+
rent: getNextAccount(),
|
|
116
|
+
systemProgram: getNextAccount(),
|
|
117
|
+
tokenProgram: getNextAccount(),
|
|
118
|
+
},
|
|
119
|
+
data: getOpenInstructionDataDecoder().decode(instruction.data),
|
|
120
|
+
};
|
|
121
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
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_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
|
|
11
|
+
export declare function getQuitDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
|
+
export type QuitInstruction<TProgram extends string = typeof NOSANA_JOBS_PROGRAM_ADDRESS, TAccountJob extends string | IAccountMeta<string> = string, 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
|
+
TAccountJob extends string ? WritableAccount<TAccountJob> : TAccountJob,
|
|
14
|
+
TAccountRun extends string ? WritableAccount<TAccountRun> : TAccountRun,
|
|
15
|
+
TAccountPayer extends string ? WritableAccount<TAccountPayer> : TAccountPayer,
|
|
16
|
+
TAccountAuthority extends string ? ReadonlySignerAccount<TAccountAuthority> & IAccountSignerMeta<TAccountAuthority> : TAccountAuthority,
|
|
17
|
+
...TRemainingAccounts
|
|
18
|
+
]>;
|
|
19
|
+
export type QuitInstructionData = {
|
|
20
|
+
discriminator: ReadonlyUint8Array;
|
|
21
|
+
};
|
|
22
|
+
export type QuitInstructionDataArgs = {};
|
|
23
|
+
export declare function getQuitInstructionDataEncoder(): Encoder<QuitInstructionDataArgs>;
|
|
24
|
+
export declare function getQuitInstructionDataDecoder(): Decoder<QuitInstructionData>;
|
|
25
|
+
export declare function getQuitInstructionDataCodec(): Codec<QuitInstructionDataArgs, QuitInstructionData>;
|
|
26
|
+
export type QuitInput<TAccountJob extends string = string, TAccountRun extends string = string, TAccountPayer extends string = string, TAccountAuthority extends string = string> = {
|
|
27
|
+
job: Address<TAccountJob>;
|
|
28
|
+
run: Address<TAccountRun>;
|
|
29
|
+
payer: Address<TAccountPayer>;
|
|
30
|
+
authority: TransactionSigner<TAccountAuthority>;
|
|
31
|
+
};
|
|
32
|
+
export declare function getQuitInstruction<TAccountJob extends string, TAccountRun extends string, TAccountPayer extends string, TAccountAuthority extends string, TProgramAddress extends Address = typeof NOSANA_JOBS_PROGRAM_ADDRESS>(input: QuitInput<TAccountJob, TAccountRun, TAccountPayer, TAccountAuthority>, config?: {
|
|
33
|
+
programAddress?: TProgramAddress;
|
|
34
|
+
}): QuitInstruction<TProgramAddress, TAccountJob, TAccountRun, TAccountPayer, TAccountAuthority>;
|
|
35
|
+
export type ParsedQuitInstruction<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
|
+
run: TAccountMetas[1];
|
|
40
|
+
payer: TAccountMetas[2];
|
|
41
|
+
authority: TAccountMetas[3];
|
|
42
|
+
};
|
|
43
|
+
data: QuitInstructionData;
|
|
44
|
+
};
|
|
45
|
+
export declare function parseQuitInstruction<TProgram extends string, TAccountMetas extends readonly IAccountMeta[]>(instruction: IInstruction<TProgram> & IInstructionWithAccounts<TAccountMetas> & IInstructionWithData<Uint8Array>): ParsedQuitInstruction<TProgram, TAccountMetas>;
|