@nosana/kit 0.1.1 → 0.1.3
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 +152 -36
- 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 +78 -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 +11467 -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
package/.gitlab-ci.yml
CHANGED
|
@@ -5,11 +5,12 @@
|
|
|
5
5
|
|
|
6
6
|
image: node:22.8.0
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
-
|
|
8
|
+
include:
|
|
9
|
+
- local: 'examples/browser/.gitlab-ci.yml'
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
stage:
|
|
11
|
+
npm-publish:
|
|
12
|
+
stage: build
|
|
13
|
+
allow_failure: true
|
|
13
14
|
only:
|
|
14
15
|
- main
|
|
15
16
|
script:
|
|
@@ -18,4 +19,4 @@ deploy:
|
|
|
18
19
|
- git config --global user.name "Nosana"
|
|
19
20
|
- npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
|
|
20
21
|
- npm run publish:public
|
|
21
|
-
# - git push # todo: fix, not working
|
|
22
|
+
# - git push # todo: fix, not working
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const gill_1 = require("gill");
|
|
5
|
-
const types_1 = require("./types");
|
|
6
|
-
exports.DEFAULT_CONFIGS = {
|
|
1
|
+
import { address } from "gill";
|
|
2
|
+
import { NosanaLogLevel } from "./types";
|
|
3
|
+
export const DEFAULT_CONFIGS = {
|
|
7
4
|
mainnet: {
|
|
8
5
|
solana: {
|
|
9
6
|
cluster: 'mainnet-beta',
|
|
@@ -16,13 +13,13 @@ exports.DEFAULT_CONFIGS = {
|
|
|
16
13
|
gateway: 'https://nosana.mypinata.cloud/ipfs/',
|
|
17
14
|
},
|
|
18
15
|
programs: {
|
|
19
|
-
nosTokenAddress:
|
|
20
|
-
jobsAddress:
|
|
21
|
-
rewardsAddress:
|
|
22
|
-
stakeAddress:
|
|
23
|
-
poolsAddress:
|
|
16
|
+
nosTokenAddress: address('nosXBVoaCTtYdLvKY6Csb4AC8JCdQKKAaWYtx2ZMoo7'),
|
|
17
|
+
jobsAddress: address('nosJhNRqr2bc9g1nfGDcXXTXvYUmxD4cVwy2pMWhrYM'),
|
|
18
|
+
rewardsAddress: address('nosRB8DUV67oLNrL45bo2pFLrmsWPiewe2Lk2DRNYCp'),
|
|
19
|
+
stakeAddress: address('nosScmHY2uR24Zh751PmGj9ww9QRNHewh9H59AfrTJE'),
|
|
20
|
+
poolsAddress: address('nosPdZrfDzND1LAR28FLMDEATUPK53K8xbRBXAirevD'),
|
|
24
21
|
},
|
|
25
|
-
logLevel:
|
|
22
|
+
logLevel: NosanaLogLevel.ERROR,
|
|
26
23
|
},
|
|
27
24
|
devnet: {
|
|
28
25
|
solana: {
|
|
@@ -36,12 +33,12 @@ exports.DEFAULT_CONFIGS = {
|
|
|
36
33
|
gateway: 'https://nosana.mypinata.cloud/ipfs/',
|
|
37
34
|
},
|
|
38
35
|
programs: {
|
|
39
|
-
nosTokenAddress:
|
|
40
|
-
jobsAddress:
|
|
41
|
-
rewardsAddress:
|
|
42
|
-
stakeAddress:
|
|
43
|
-
poolsAddress:
|
|
36
|
+
nosTokenAddress: address('devr1BGQndEW5k5zfvG5FsLyZv1Ap73vNgAHcQ9sUVP'),
|
|
37
|
+
jobsAddress: address('nosJTmGQxvwXy23vng5UjkTbfv91Bzf9jEuro78dAGR'),
|
|
38
|
+
rewardsAddress: address('nosRB8DUV67oLNrL45bo2pFLrmsWPiewe2Lk2DRNYCp'),
|
|
39
|
+
stakeAddress: address('nosScmHY2uR24Zh751PmGj9ww9QRNHewh9H59AfrTJE'),
|
|
40
|
+
poolsAddress: address('nosPdZrfDzND1LAR28FLMDEATUPK53K8xbRBXAirevD'),
|
|
44
41
|
},
|
|
45
|
-
logLevel:
|
|
42
|
+
logLevel: NosanaLogLevel.DEBUG,
|
|
46
43
|
},
|
|
47
44
|
};
|
package/dist/config/index.js
CHANGED
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./types.js"), exports);
|
|
18
|
-
__exportStar(require("./defaultConfigs.js"), exports);
|
|
19
|
-
__exportStar(require("./utils.js"), exports);
|
|
1
|
+
export * from './types.js';
|
|
2
|
+
export * from './defaultConfigs.js';
|
|
3
|
+
export * from './utils.js';
|
package/dist/config/types.d.ts
CHANGED
|
@@ -16,9 +16,7 @@ export interface SolanaConfig {
|
|
|
16
16
|
wsEndpoint?: string;
|
|
17
17
|
commitment?: 'processed' | 'confirmed' | 'finalized';
|
|
18
18
|
}
|
|
19
|
-
export
|
|
20
|
-
signer: KeyPairSigner;
|
|
21
|
-
}
|
|
19
|
+
export type WalletConfig = KeyPairSigner | string | Iterable<number>;
|
|
22
20
|
export interface IpfsConfig {
|
|
23
21
|
api: string;
|
|
24
22
|
jwt: string;
|
package/dist/config/types.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NosanaLogLevel = exports.NosanaNetwork = void 0;
|
|
4
|
-
var NosanaNetwork;
|
|
1
|
+
export var NosanaNetwork;
|
|
5
2
|
(function (NosanaNetwork) {
|
|
6
3
|
NosanaNetwork["MAINNET"] = "mainnet";
|
|
7
4
|
NosanaNetwork["DEVNET"] = "devnet";
|
|
8
|
-
})(NosanaNetwork || (
|
|
9
|
-
var NosanaLogLevel;
|
|
5
|
+
})(NosanaNetwork || (NosanaNetwork = {}));
|
|
6
|
+
export var NosanaLogLevel;
|
|
10
7
|
(function (NosanaLogLevel) {
|
|
11
8
|
NosanaLogLevel[NosanaLogLevel["NONE"] = 0] = "NONE";
|
|
12
9
|
NosanaLogLevel[NosanaLogLevel["ERROR"] = 1] = "ERROR";
|
|
13
10
|
NosanaLogLevel[NosanaLogLevel["WARN"] = 2] = "WARN";
|
|
14
11
|
NosanaLogLevel[NosanaLogLevel["INFO"] = 3] = "INFO";
|
|
15
12
|
NosanaLogLevel[NosanaLogLevel["DEBUG"] = 4] = "DEBUG";
|
|
16
|
-
})(NosanaLogLevel || (
|
|
13
|
+
})(NosanaLogLevel || (NosanaLogLevel = {}));
|
package/dist/config/utils.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const defaultConfigs_js_1 = require("./defaultConfigs.js");
|
|
6
|
-
const types_js_1 = require("./types.js");
|
|
7
|
-
const mergeConfigs = (defaultConfig, customConfig) => {
|
|
1
|
+
import { ErrorCodes, NosanaError } from "../errors/NosanaError.js";
|
|
2
|
+
import { DEFAULT_CONFIGS } from "./defaultConfigs.js";
|
|
3
|
+
import { NosanaNetwork } from "./types.js";
|
|
4
|
+
export const mergeConfigs = (defaultConfig, customConfig) => {
|
|
8
5
|
if (!customConfig)
|
|
9
6
|
return defaultConfig;
|
|
10
7
|
return {
|
|
@@ -16,15 +13,13 @@ const mergeConfigs = (defaultConfig, customConfig) => {
|
|
|
16
13
|
},
|
|
17
14
|
};
|
|
18
15
|
};
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
const defaultConfig = defaultConfigs_js_1.DEFAULT_CONFIGS[network];
|
|
16
|
+
export const getNosanaConfig = (network = NosanaNetwork.MAINNET, config) => {
|
|
17
|
+
const defaultConfig = DEFAULT_CONFIGS[network];
|
|
22
18
|
if (!defaultConfig) {
|
|
23
|
-
throw new
|
|
19
|
+
throw new NosanaError(`Unsupported Nosana network: ${network}`, ErrorCodes.INVALID_NETWORK);
|
|
24
20
|
}
|
|
25
|
-
return
|
|
21
|
+
return mergeConfigs(defaultConfig, config);
|
|
26
22
|
};
|
|
27
|
-
exports.getNosanaConfig = getNosanaConfig;
|
|
28
23
|
// Example: Initialize with default (Mainnet) or specific network, or custom config
|
|
29
24
|
// const defaultConfig = getNosanaConfig();
|
|
30
25
|
// const devConfig = getNosanaConfig(NosanaNetwork.DEVNET);
|
|
@@ -12,5 +12,6 @@ export declare const ErrorCodes: {
|
|
|
12
12
|
readonly VALIDATION_ERROR: "VALIDATION_ERROR";
|
|
13
13
|
readonly NO_WALLET: "NO_WALLET";
|
|
14
14
|
readonly FILE_ERROR: "FILE_ERROR";
|
|
15
|
+
readonly WALLET_CONVERSION_ERROR: "WALLET_CONVERSION_ERROR";
|
|
15
16
|
};
|
|
16
17
|
export type ErrorCode = typeof ErrorCodes[keyof typeof ErrorCodes];
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ErrorCodes = exports.NosanaError = void 0;
|
|
4
|
-
class NosanaError extends Error {
|
|
1
|
+
export class NosanaError extends Error {
|
|
5
2
|
constructor(message, code, details) {
|
|
6
3
|
super(message);
|
|
7
4
|
this.code = code;
|
|
@@ -9,8 +6,7 @@ class NosanaError extends Error {
|
|
|
9
6
|
this.name = 'NosanaError';
|
|
10
7
|
}
|
|
11
8
|
}
|
|
12
|
-
|
|
13
|
-
exports.ErrorCodes = {
|
|
9
|
+
export const ErrorCodes = {
|
|
14
10
|
INVALID_NETWORK: 'INVALID_NETWORK',
|
|
15
11
|
INVALID_CONFIG: 'INVALID_CONFIG',
|
|
16
12
|
RPC_ERROR: 'RPC_ERROR',
|
|
@@ -19,4 +15,5 @@ exports.ErrorCodes = {
|
|
|
19
15
|
VALIDATION_ERROR: 'VALIDATION_ERROR',
|
|
20
16
|
NO_WALLET: 'NO_WALLET',
|
|
21
17
|
FILE_ERROR: 'FILE_ERROR',
|
|
18
|
+
WALLET_CONVERSION_ERROR: 'WALLET_CONVERSION_ERROR',
|
|
22
19
|
};
|
|
@@ -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,21 +5,6 @@
|
|
|
6
5
|
*
|
|
7
6
|
* @see https://github.com/codama-idl/codama
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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("./jobAccount"), exports);
|
|
25
|
-
__exportStar(require("./marketAccount"), exports);
|
|
26
|
-
__exportStar(require("./runAccount"), exports);
|
|
8
|
+
export * from './jobAccount';
|
|
9
|
+
export * from './marketAccount';
|
|
10
|
+
export * from './runAccount';
|
|
@@ -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,81 +5,69 @@
|
|
|
6
5
|
*
|
|
7
6
|
* @see https://github.com/codama-idl/codama
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
exports.getJobAccountDiscriminatorBytes = getJobAccountDiscriminatorBytes;
|
|
12
|
-
exports.getJobAccountEncoder = getJobAccountEncoder;
|
|
13
|
-
exports.getJobAccountDecoder = getJobAccountDecoder;
|
|
14
|
-
exports.getJobAccountCodec = getJobAccountCodec;
|
|
15
|
-
exports.decodeJobAccount = decodeJobAccount;
|
|
16
|
-
exports.fetchJobAccount = fetchJobAccount;
|
|
17
|
-
exports.fetchMaybeJobAccount = fetchMaybeJobAccount;
|
|
18
|
-
exports.fetchAllJobAccount = fetchAllJobAccount;
|
|
19
|
-
exports.fetchAllMaybeJobAccount = fetchAllMaybeJobAccount;
|
|
20
|
-
exports.getJobAccountSize = getJobAccountSize;
|
|
21
|
-
const kit_1 = require("@solana/kit");
|
|
22
|
-
exports.JOB_ACCOUNT_DISCRIMINATOR = new Uint8Array([
|
|
8
|
+
import { assertAccountExists, assertAccountsExist, combineCodec, decodeAccount, fetchEncodedAccount, fetchEncodedAccounts, fixDecoderSize, fixEncoderSize, getAddressDecoder, getAddressEncoder, getBytesDecoder, getBytesEncoder, getI64Decoder, getI64Encoder, getStructDecoder, getStructEncoder, getU64Decoder, getU64Encoder, getU8Decoder, getU8Encoder, transformEncoder, } from '@solana/kit';
|
|
9
|
+
export const JOB_ACCOUNT_DISCRIMINATOR = new Uint8Array([
|
|
23
10
|
91, 16, 162, 5, 45, 210, 125, 65,
|
|
24
11
|
]);
|
|
25
|
-
function getJobAccountDiscriminatorBytes() {
|
|
26
|
-
return
|
|
12
|
+
export function getJobAccountDiscriminatorBytes() {
|
|
13
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(JOB_ACCOUNT_DISCRIMINATOR);
|
|
27
14
|
}
|
|
28
|
-
function getJobAccountEncoder() {
|
|
29
|
-
return
|
|
30
|
-
['discriminator',
|
|
31
|
-
['ipfsJob',
|
|
32
|
-
['ipfsResult',
|
|
33
|
-
['market',
|
|
34
|
-
['node',
|
|
35
|
-
['payer',
|
|
36
|
-
['price',
|
|
37
|
-
['project',
|
|
38
|
-
['state',
|
|
39
|
-
['timeEnd',
|
|
40
|
-
['timeStart',
|
|
41
|
-
['timeout',
|
|
42
|
-
]), (value) => ({ ...value, discriminator:
|
|
15
|
+
export function getJobAccountEncoder() {
|
|
16
|
+
return transformEncoder(getStructEncoder([
|
|
17
|
+
['discriminator', fixEncoderSize(getBytesEncoder(), 8)],
|
|
18
|
+
['ipfsJob', fixEncoderSize(getBytesEncoder(), 32)],
|
|
19
|
+
['ipfsResult', fixEncoderSize(getBytesEncoder(), 32)],
|
|
20
|
+
['market', getAddressEncoder()],
|
|
21
|
+
['node', getAddressEncoder()],
|
|
22
|
+
['payer', getAddressEncoder()],
|
|
23
|
+
['price', getU64Encoder()],
|
|
24
|
+
['project', getAddressEncoder()],
|
|
25
|
+
['state', getU8Encoder()],
|
|
26
|
+
['timeEnd', getI64Encoder()],
|
|
27
|
+
['timeStart', getI64Encoder()],
|
|
28
|
+
['timeout', getI64Encoder()],
|
|
29
|
+
]), (value) => ({ ...value, discriminator: JOB_ACCOUNT_DISCRIMINATOR }));
|
|
43
30
|
}
|
|
44
|
-
function getJobAccountDecoder() {
|
|
45
|
-
return
|
|
46
|
-
['discriminator',
|
|
47
|
-
['ipfsJob',
|
|
48
|
-
['ipfsResult',
|
|
49
|
-
['market',
|
|
50
|
-
['node',
|
|
51
|
-
['payer',
|
|
52
|
-
['price',
|
|
53
|
-
['project',
|
|
54
|
-
['state',
|
|
55
|
-
['timeEnd',
|
|
56
|
-
['timeStart',
|
|
57
|
-
['timeout',
|
|
31
|
+
export function getJobAccountDecoder() {
|
|
32
|
+
return getStructDecoder([
|
|
33
|
+
['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
|
|
34
|
+
['ipfsJob', fixDecoderSize(getBytesDecoder(), 32)],
|
|
35
|
+
['ipfsResult', fixDecoderSize(getBytesDecoder(), 32)],
|
|
36
|
+
['market', getAddressDecoder()],
|
|
37
|
+
['node', getAddressDecoder()],
|
|
38
|
+
['payer', getAddressDecoder()],
|
|
39
|
+
['price', getU64Decoder()],
|
|
40
|
+
['project', getAddressDecoder()],
|
|
41
|
+
['state', getU8Decoder()],
|
|
42
|
+
['timeEnd', getI64Decoder()],
|
|
43
|
+
['timeStart', getI64Decoder()],
|
|
44
|
+
['timeout', getI64Decoder()],
|
|
58
45
|
]);
|
|
59
46
|
}
|
|
60
|
-
function getJobAccountCodec() {
|
|
61
|
-
return
|
|
47
|
+
export function getJobAccountCodec() {
|
|
48
|
+
return combineCodec(getJobAccountEncoder(), getJobAccountDecoder());
|
|
62
49
|
}
|
|
63
|
-
function decodeJobAccount(encodedAccount) {
|
|
64
|
-
return
|
|
50
|
+
export function decodeJobAccount(encodedAccount) {
|
|
51
|
+
return decodeAccount(encodedAccount, getJobAccountDecoder());
|
|
65
52
|
}
|
|
66
|
-
async function fetchJobAccount(rpc, address, config) {
|
|
53
|
+
export async function fetchJobAccount(rpc, address, config) {
|
|
67
54
|
const maybeAccount = await fetchMaybeJobAccount(rpc, address, config);
|
|
68
|
-
|
|
55
|
+
assertAccountExists(maybeAccount);
|
|
69
56
|
return maybeAccount;
|
|
70
57
|
}
|
|
71
|
-
async function fetchMaybeJobAccount(rpc, address, config) {
|
|
72
|
-
const maybeAccount = await
|
|
58
|
+
export async function fetchMaybeJobAccount(rpc, address, config) {
|
|
59
|
+
const maybeAccount = await fetchEncodedAccount(rpc, address, config);
|
|
73
60
|
return decodeJobAccount(maybeAccount);
|
|
74
61
|
}
|
|
75
|
-
async function fetchAllJobAccount(rpc, addresses, config) {
|
|
62
|
+
export async function fetchAllJobAccount(rpc, addresses, config) {
|
|
76
63
|
const maybeAccounts = await fetchAllMaybeJobAccount(rpc, addresses, config);
|
|
77
|
-
|
|
64
|
+
assertAccountsExist(maybeAccounts);
|
|
78
65
|
return maybeAccounts;
|
|
79
66
|
}
|
|
80
|
-
async function fetchAllMaybeJobAccount(rpc, addresses, config) {
|
|
81
|
-
const maybeAccounts = await
|
|
67
|
+
export async function fetchAllMaybeJobAccount(rpc, addresses, config) {
|
|
68
|
+
const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config);
|
|
82
69
|
return maybeAccounts.map((maybeAccount) => decodeJobAccount(maybeAccount));
|
|
83
70
|
}
|
|
84
|
-
function getJobAccountSize() {
|
|
71
|
+
export function getJobAccountSize() {
|
|
85
72
|
return 233;
|
|
86
73
|
}
|
|
@@ -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,77 +5,66 @@
|
|
|
6
5
|
*
|
|
7
6
|
* @see https://github.com/codama-idl/codama
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
exports.getMarketAccountDiscriminatorBytes = getMarketAccountDiscriminatorBytes;
|
|
12
|
-
exports.getMarketAccountEncoder = getMarketAccountEncoder;
|
|
13
|
-
exports.getMarketAccountDecoder = getMarketAccountDecoder;
|
|
14
|
-
exports.getMarketAccountCodec = getMarketAccountCodec;
|
|
15
|
-
exports.decodeMarketAccount = decodeMarketAccount;
|
|
16
|
-
exports.fetchMarketAccount = fetchMarketAccount;
|
|
17
|
-
exports.fetchMaybeMarketAccount = fetchMaybeMarketAccount;
|
|
18
|
-
exports.fetchAllMarketAccount = fetchAllMarketAccount;
|
|
19
|
-
exports.fetchAllMaybeMarketAccount = fetchAllMaybeMarketAccount;
|
|
20
|
-
const kit_1 = require("@solana/kit");
|
|
21
|
-
exports.MARKET_ACCOUNT_DISCRIMINATOR = new Uint8Array([
|
|
8
|
+
import { assertAccountExists, assertAccountsExist, combineCodec, decodeAccount, fetchEncodedAccount, fetchEncodedAccounts, fixDecoderSize, fixEncoderSize, getAddressDecoder, getAddressEncoder, getArrayDecoder, getArrayEncoder, getBytesDecoder, getBytesEncoder, getI64Decoder, getI64Encoder, getStructDecoder, getStructEncoder, getU128Decoder, getU128Encoder, getU64Decoder, getU64Encoder, getU8Decoder, getU8Encoder, transformEncoder, } from '@solana/kit';
|
|
9
|
+
export const MARKET_ACCOUNT_DISCRIMINATOR = new Uint8Array([
|
|
22
10
|
201, 78, 187, 225, 240, 198, 201, 251,
|
|
23
11
|
]);
|
|
24
|
-
function getMarketAccountDiscriminatorBytes() {
|
|
25
|
-
return
|
|
12
|
+
export function getMarketAccountDiscriminatorBytes() {
|
|
13
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(MARKET_ACCOUNT_DISCRIMINATOR);
|
|
26
14
|
}
|
|
27
|
-
function getMarketAccountEncoder() {
|
|
28
|
-
return
|
|
29
|
-
['discriminator',
|
|
30
|
-
['authority',
|
|
31
|
-
['jobExpiration',
|
|
32
|
-
['jobPrice',
|
|
33
|
-
['jobTimeout',
|
|
34
|
-
['jobType',
|
|
35
|
-
['vault',
|
|
36
|
-
['vaultBump',
|
|
37
|
-
['nodeAccessKey',
|
|
38
|
-
['nodeXnosMinimum',
|
|
39
|
-
['queueType',
|
|
40
|
-
['queue',
|
|
41
|
-
]), (value) => ({ ...value, discriminator:
|
|
15
|
+
export function getMarketAccountEncoder() {
|
|
16
|
+
return transformEncoder(getStructEncoder([
|
|
17
|
+
['discriminator', fixEncoderSize(getBytesEncoder(), 8)],
|
|
18
|
+
['authority', getAddressEncoder()],
|
|
19
|
+
['jobExpiration', getI64Encoder()],
|
|
20
|
+
['jobPrice', getU64Encoder()],
|
|
21
|
+
['jobTimeout', getI64Encoder()],
|
|
22
|
+
['jobType', getU8Encoder()],
|
|
23
|
+
['vault', getAddressEncoder()],
|
|
24
|
+
['vaultBump', getU8Encoder()],
|
|
25
|
+
['nodeAccessKey', getAddressEncoder()],
|
|
26
|
+
['nodeXnosMinimum', getU128Encoder()],
|
|
27
|
+
['queueType', getU8Encoder()],
|
|
28
|
+
['queue', getArrayEncoder(getAddressEncoder())],
|
|
29
|
+
]), (value) => ({ ...value, discriminator: MARKET_ACCOUNT_DISCRIMINATOR }));
|
|
42
30
|
}
|
|
43
|
-
function getMarketAccountDecoder() {
|
|
44
|
-
return
|
|
45
|
-
['discriminator',
|
|
46
|
-
['authority',
|
|
47
|
-
['jobExpiration',
|
|
48
|
-
['jobPrice',
|
|
49
|
-
['jobTimeout',
|
|
50
|
-
['jobType',
|
|
51
|
-
['vault',
|
|
52
|
-
['vaultBump',
|
|
53
|
-
['nodeAccessKey',
|
|
54
|
-
['nodeXnosMinimum',
|
|
55
|
-
['queueType',
|
|
56
|
-
['queue',
|
|
31
|
+
export function getMarketAccountDecoder() {
|
|
32
|
+
return getStructDecoder([
|
|
33
|
+
['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
|
|
34
|
+
['authority', getAddressDecoder()],
|
|
35
|
+
['jobExpiration', getI64Decoder()],
|
|
36
|
+
['jobPrice', getU64Decoder()],
|
|
37
|
+
['jobTimeout', getI64Decoder()],
|
|
38
|
+
['jobType', getU8Decoder()],
|
|
39
|
+
['vault', getAddressDecoder()],
|
|
40
|
+
['vaultBump', getU8Decoder()],
|
|
41
|
+
['nodeAccessKey', getAddressDecoder()],
|
|
42
|
+
['nodeXnosMinimum', getU128Decoder()],
|
|
43
|
+
['queueType', getU8Decoder()],
|
|
44
|
+
['queue', getArrayDecoder(getAddressDecoder())],
|
|
57
45
|
]);
|
|
58
46
|
}
|
|
59
|
-
function getMarketAccountCodec() {
|
|
60
|
-
return
|
|
47
|
+
export function getMarketAccountCodec() {
|
|
48
|
+
return combineCodec(getMarketAccountEncoder(), getMarketAccountDecoder());
|
|
61
49
|
}
|
|
62
|
-
function decodeMarketAccount(encodedAccount) {
|
|
63
|
-
return
|
|
50
|
+
export function decodeMarketAccount(encodedAccount) {
|
|
51
|
+
return decodeAccount(encodedAccount, getMarketAccountDecoder());
|
|
64
52
|
}
|
|
65
|
-
async function fetchMarketAccount(rpc, address, config) {
|
|
53
|
+
export async function fetchMarketAccount(rpc, address, config) {
|
|
66
54
|
const maybeAccount = await fetchMaybeMarketAccount(rpc, address, config);
|
|
67
|
-
|
|
55
|
+
assertAccountExists(maybeAccount);
|
|
68
56
|
return maybeAccount;
|
|
69
57
|
}
|
|
70
|
-
async function fetchMaybeMarketAccount(rpc, address, config) {
|
|
71
|
-
const maybeAccount = await
|
|
58
|
+
export async function fetchMaybeMarketAccount(rpc, address, config) {
|
|
59
|
+
const maybeAccount = await fetchEncodedAccount(rpc, address, config);
|
|
72
60
|
return decodeMarketAccount(maybeAccount);
|
|
73
61
|
}
|
|
74
|
-
async function fetchAllMarketAccount(rpc, addresses, config) {
|
|
62
|
+
export async function fetchAllMarketAccount(rpc, addresses, config) {
|
|
75
63
|
const maybeAccounts = await fetchAllMaybeMarketAccount(rpc, addresses, config);
|
|
76
|
-
|
|
64
|
+
assertAccountsExist(maybeAccounts);
|
|
77
65
|
return maybeAccounts;
|
|
78
66
|
}
|
|
79
|
-
async function fetchAllMaybeMarketAccount(rpc, addresses, config) {
|
|
80
|
-
const maybeAccounts = await
|
|
67
|
+
export async function fetchAllMaybeMarketAccount(rpc, addresses, config) {
|
|
68
|
+
const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config);
|
|
81
69
|
return maybeAccounts.map((maybeAccount) => decodeMarketAccount(maybeAccount));
|
|
82
70
|
}
|
|
@@ -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,69 +5,57 @@
|
|
|
6
5
|
*
|
|
7
6
|
* @see https://github.com/codama-idl/codama
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
exports.getRunAccountDiscriminatorBytes = getRunAccountDiscriminatorBytes;
|
|
12
|
-
exports.getRunAccountEncoder = getRunAccountEncoder;
|
|
13
|
-
exports.getRunAccountDecoder = getRunAccountDecoder;
|
|
14
|
-
exports.getRunAccountCodec = getRunAccountCodec;
|
|
15
|
-
exports.decodeRunAccount = decodeRunAccount;
|
|
16
|
-
exports.fetchRunAccount = fetchRunAccount;
|
|
17
|
-
exports.fetchMaybeRunAccount = fetchMaybeRunAccount;
|
|
18
|
-
exports.fetchAllRunAccount = fetchAllRunAccount;
|
|
19
|
-
exports.fetchAllMaybeRunAccount = fetchAllMaybeRunAccount;
|
|
20
|
-
exports.getRunAccountSize = getRunAccountSize;
|
|
21
|
-
const kit_1 = require("@solana/kit");
|
|
22
|
-
exports.RUN_ACCOUNT_DISCRIMINATOR = new Uint8Array([
|
|
8
|
+
import { assertAccountExists, assertAccountsExist, combineCodec, decodeAccount, fetchEncodedAccount, fetchEncodedAccounts, fixDecoderSize, fixEncoderSize, getAddressDecoder, getAddressEncoder, getBytesDecoder, getBytesEncoder, getI64Decoder, getI64Encoder, getStructDecoder, getStructEncoder, getU8Decoder, getU8Encoder, transformEncoder, } from '@solana/kit';
|
|
9
|
+
export const RUN_ACCOUNT_DISCRIMINATOR = new Uint8Array([
|
|
23
10
|
194, 169, 110, 230, 235, 11, 225, 22,
|
|
24
11
|
]);
|
|
25
|
-
function getRunAccountDiscriminatorBytes() {
|
|
26
|
-
return
|
|
27
|
-
}
|
|
28
|
-
function getRunAccountEncoder() {
|
|
29
|
-
return
|
|
30
|
-
['discriminator',
|
|
31
|
-
['job',
|
|
32
|
-
['node',
|
|
33
|
-
['payer',
|
|
34
|
-
['state',
|
|
35
|
-
['time',
|
|
36
|
-
]), (value) => ({ ...value, discriminator:
|
|
37
|
-
}
|
|
38
|
-
function getRunAccountDecoder() {
|
|
39
|
-
return
|
|
40
|
-
['discriminator',
|
|
41
|
-
['job',
|
|
42
|
-
['node',
|
|
43
|
-
['payer',
|
|
44
|
-
['state',
|
|
45
|
-
['time',
|
|
12
|
+
export function getRunAccountDiscriminatorBytes() {
|
|
13
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(RUN_ACCOUNT_DISCRIMINATOR);
|
|
14
|
+
}
|
|
15
|
+
export function getRunAccountEncoder() {
|
|
16
|
+
return transformEncoder(getStructEncoder([
|
|
17
|
+
['discriminator', fixEncoderSize(getBytesEncoder(), 8)],
|
|
18
|
+
['job', getAddressEncoder()],
|
|
19
|
+
['node', getAddressEncoder()],
|
|
20
|
+
['payer', getAddressEncoder()],
|
|
21
|
+
['state', getU8Encoder()],
|
|
22
|
+
['time', getI64Encoder()],
|
|
23
|
+
]), (value) => ({ ...value, discriminator: RUN_ACCOUNT_DISCRIMINATOR }));
|
|
24
|
+
}
|
|
25
|
+
export function getRunAccountDecoder() {
|
|
26
|
+
return getStructDecoder([
|
|
27
|
+
['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
|
|
28
|
+
['job', getAddressDecoder()],
|
|
29
|
+
['node', getAddressDecoder()],
|
|
30
|
+
['payer', getAddressDecoder()],
|
|
31
|
+
['state', getU8Decoder()],
|
|
32
|
+
['time', getI64Decoder()],
|
|
46
33
|
]);
|
|
47
34
|
}
|
|
48
|
-
function getRunAccountCodec() {
|
|
49
|
-
return
|
|
35
|
+
export function getRunAccountCodec() {
|
|
36
|
+
return combineCodec(getRunAccountEncoder(), getRunAccountDecoder());
|
|
50
37
|
}
|
|
51
|
-
function decodeRunAccount(encodedAccount) {
|
|
52
|
-
return
|
|
38
|
+
export function decodeRunAccount(encodedAccount) {
|
|
39
|
+
return decodeAccount(encodedAccount, getRunAccountDecoder());
|
|
53
40
|
}
|
|
54
|
-
async function fetchRunAccount(rpc, address, config) {
|
|
41
|
+
export async function fetchRunAccount(rpc, address, config) {
|
|
55
42
|
const maybeAccount = await fetchMaybeRunAccount(rpc, address, config);
|
|
56
|
-
|
|
43
|
+
assertAccountExists(maybeAccount);
|
|
57
44
|
return maybeAccount;
|
|
58
45
|
}
|
|
59
|
-
async function fetchMaybeRunAccount(rpc, address, config) {
|
|
60
|
-
const maybeAccount = await
|
|
46
|
+
export async function fetchMaybeRunAccount(rpc, address, config) {
|
|
47
|
+
const maybeAccount = await fetchEncodedAccount(rpc, address, config);
|
|
61
48
|
return decodeRunAccount(maybeAccount);
|
|
62
49
|
}
|
|
63
|
-
async function fetchAllRunAccount(rpc, addresses, config) {
|
|
50
|
+
export async function fetchAllRunAccount(rpc, addresses, config) {
|
|
64
51
|
const maybeAccounts = await fetchAllMaybeRunAccount(rpc, addresses, config);
|
|
65
|
-
|
|
52
|
+
assertAccountsExist(maybeAccounts);
|
|
66
53
|
return maybeAccounts;
|
|
67
54
|
}
|
|
68
|
-
async function fetchAllMaybeRunAccount(rpc, addresses, config) {
|
|
69
|
-
const maybeAccounts = await
|
|
55
|
+
export async function fetchAllMaybeRunAccount(rpc, addresses, config) {
|
|
56
|
+
const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config);
|
|
70
57
|
return maybeAccounts.map((maybeAccount) => decodeRunAccount(maybeAccount));
|
|
71
58
|
}
|
|
72
|
-
function getRunAccountSize() {
|
|
59
|
+
export function getRunAccountSize() {
|
|
73
60
|
return 113;
|
|
74
61
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* This code was AUTOGENERATED using the codama library.
|
|
4
3
|
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
@@ -6,19 +5,4 @@
|
|
|
6
5
|
*
|
|
7
6
|
* @see https://github.com/codama-idl/codama
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
-
}
|
|
15
|
-
Object.defineProperty(o, k2, desc);
|
|
16
|
-
}) : (function(o, m, k, k2) {
|
|
17
|
-
if (k2 === undefined) k2 = k;
|
|
18
|
-
o[k2] = m[k];
|
|
19
|
-
}));
|
|
20
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
21
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
22
|
-
};
|
|
23
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
__exportStar(require("./nosanaJobs"), exports);
|
|
8
|
+
export * from './nosanaJobs';
|