@nosana/kit 1.0.3 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/config/defaultConfigs.js +2 -0
  2. package/dist/config/types.d.ts +1 -0
  3. package/dist/generated_clients/merkle_distributor/accounts/claimStatus.d.ts +53 -0
  4. package/dist/generated_clients/merkle_distributor/accounts/claimStatus.js +65 -0
  5. package/dist/generated_clients/merkle_distributor/accounts/index.d.ts +9 -0
  6. package/dist/generated_clients/merkle_distributor/accounts/index.js +9 -0
  7. package/dist/generated_clients/merkle_distributor/accounts/merkleDistributor.d.ts +109 -0
  8. package/dist/generated_clients/merkle_distributor/accounts/merkleDistributor.js +93 -0
  9. package/dist/generated_clients/merkle_distributor/errors/index.d.ts +8 -0
  10. package/dist/generated_clients/merkle_distributor/errors/index.js +8 -0
  11. package/dist/generated_clients/merkle_distributor/errors/merkleDistributor.d.ts +63 -0
  12. package/dist/generated_clients/merkle_distributor/errors/merkleDistributor.js +89 -0
  13. package/dist/generated_clients/merkle_distributor/index.d.ts +11 -0
  14. package/dist/generated_clients/merkle_distributor/index.js +11 -0
  15. package/dist/generated_clients/merkle_distributor/instructions/claimLocked.d.ts +69 -0
  16. package/dist/generated_clients/merkle_distributor/instructions/claimLocked.js +84 -0
  17. package/dist/generated_clients/merkle_distributor/instructions/clawback.d.ts +69 -0
  18. package/dist/generated_clients/merkle_distributor/instructions/clawback.js +88 -0
  19. package/dist/generated_clients/merkle_distributor/instructions/closeClaimStatus.d.ts +45 -0
  20. package/dist/generated_clients/merkle_distributor/instructions/closeClaimStatus.js +73 -0
  21. package/dist/generated_clients/merkle_distributor/instructions/closeDistributor.d.ts +64 -0
  22. package/dist/generated_clients/merkle_distributor/instructions/closeDistributor.js +84 -0
  23. package/dist/generated_clients/merkle_distributor/instructions/index.d.ts +16 -0
  24. package/dist/generated_clients/merkle_distributor/instructions/index.js +16 -0
  25. package/dist/generated_clients/merkle_distributor/instructions/newClaim.d.ts +78 -0
  26. package/dist/generated_clients/merkle_distributor/instructions/newClaim.js +101 -0
  27. package/dist/generated_clients/merkle_distributor/instructions/newDistributor.d.ts +113 -0
  28. package/dist/generated_clients/merkle_distributor/instructions/newDistributor.js +122 -0
  29. package/dist/generated_clients/merkle_distributor/instructions/setAdmin.d.ts +48 -0
  30. package/dist/generated_clients/merkle_distributor/instructions/setAdmin.js +70 -0
  31. package/dist/generated_clients/merkle_distributor/instructions/setClawbackReceiver.d.ts +48 -0
  32. package/dist/generated_clients/merkle_distributor/instructions/setClawbackReceiver.js +76 -0
  33. package/dist/generated_clients/merkle_distributor/instructions/setEnableSlot.d.ts +47 -0
  34. package/dist/generated_clients/merkle_distributor/instructions/setEnableSlot.js +73 -0
  35. package/dist/generated_clients/merkle_distributor/programs/index.d.ts +8 -0
  36. package/dist/generated_clients/merkle_distributor/programs/index.js +8 -0
  37. package/dist/generated_clients/merkle_distributor/programs/merkleDistributor.d.ts +50 -0
  38. package/dist/generated_clients/merkle_distributor/programs/merkleDistributor.js +67 -0
  39. package/dist/generated_clients/merkle_distributor/shared/index.d.ts +49 -0
  40. package/dist/generated_clients/merkle_distributor/shared/index.js +86 -0
  41. package/dist/index.d.ts +5 -0
  42. package/dist/index.js +5 -0
  43. package/dist/programs/MerkleDistributorProgram.d.ts +101 -0
  44. package/dist/programs/MerkleDistributorProgram.js +296 -0
  45. package/package.json +19 -13
  46. package/.gitlab-ci.yml +0 -54
  47. package/.prettierignore +0 -17
  48. package/eslint.config.js +0 -47
  49. package/examples/browser/.gitlab-ci.yml +0 -78
  50. package/examples/browser/FEATURES.md +0 -141
  51. package/examples/browser/QUICK_START.md +0 -76
  52. package/examples/browser/README.md +0 -182
  53. package/examples/browser/app.vue +0 -1840
  54. package/examples/browser/assets/css/main.css +0 -7
  55. package/examples/browser/nuxt.config.ts +0 -30
  56. package/examples/browser/package-lock.json +0 -12230
  57. package/examples/browser/package.json +0 -31
  58. package/examples/browser/public/favicon.ico +0 -0
  59. package/examples/browser/public/robots.txt +0 -2
  60. package/examples/browser/start.sh +0 -38
  61. package/examples/browser/tailwind.config.js +0 -26
  62. package/examples/node/README.md +0 -261
  63. package/examples/node/example-keypair.json +0 -1
  64. package/examples/node/monitor.ts +0 -143
  65. package/examples/node/nos-service.ts +0 -117
  66. package/examples/node/package-lock.json +0 -589
  67. package/examples/node/package.json +0 -20
  68. package/examples/node/post-job.ts +0 -160
  69. package/examples/node/retrieve.ts +0 -18
  70. package/examples/node/set-wallet.ts +0 -87
  71. package/examples/node/stake-program.ts +0 -84
  72. package/scripts/generate-clients.ts +0 -22
  73. package/vitest.config.ts +0 -31
@@ -0,0 +1,101 @@
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 { combineCodec, fixDecoderSize, fixEncoderSize, getArrayDecoder, getArrayEncoder, getBytesDecoder, getBytesEncoder, getStructDecoder, getStructEncoder, getU64Decoder, getU64Encoder, transformEncoder, } from '@solana/kit';
9
+ import { MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS } from '../programs';
10
+ import { getAccountMetaFactory } from '../shared';
11
+ export const NEW_CLAIM_DISCRIMINATOR = new Uint8Array([
12
+ 78, 177, 98, 123, 210, 21, 187, 83,
13
+ ]);
14
+ export function getNewClaimDiscriminatorBytes() {
15
+ return fixEncoderSize(getBytesEncoder(), 8).encode(NEW_CLAIM_DISCRIMINATOR);
16
+ }
17
+ export function getNewClaimInstructionDataEncoder() {
18
+ return transformEncoder(getStructEncoder([
19
+ ['discriminator', fixEncoderSize(getBytesEncoder(), 8)],
20
+ ['amountUnlocked', getU64Encoder()],
21
+ ['amountLocked', getU64Encoder()],
22
+ ['proof', getArrayEncoder(fixEncoderSize(getBytesEncoder(), 32))],
23
+ ]), (value) => ({ ...value, discriminator: NEW_CLAIM_DISCRIMINATOR }));
24
+ }
25
+ export function getNewClaimInstructionDataDecoder() {
26
+ return getStructDecoder([
27
+ ['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
28
+ ['amountUnlocked', getU64Decoder()],
29
+ ['amountLocked', getU64Decoder()],
30
+ ['proof', getArrayDecoder(fixDecoderSize(getBytesDecoder(), 32))],
31
+ ]);
32
+ }
33
+ export function getNewClaimInstructionDataCodec() {
34
+ return combineCodec(getNewClaimInstructionDataEncoder(), getNewClaimInstructionDataDecoder());
35
+ }
36
+ export function getNewClaimInstruction(input, config) {
37
+ // Program address.
38
+ const programAddress = config?.programAddress ?? MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS;
39
+ // Original accounts.
40
+ const originalAccounts = {
41
+ distributor: { value: input.distributor ?? null, isWritable: true },
42
+ claimStatus: { value: input.claimStatus ?? null, isWritable: true },
43
+ from: { value: input.from ?? null, isWritable: true },
44
+ to: { value: input.to ?? null, isWritable: true },
45
+ claimant: { value: input.claimant ?? null, isWritable: true },
46
+ tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
47
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
48
+ };
49
+ const accounts = originalAccounts;
50
+ // Original args.
51
+ const args = { ...input };
52
+ // Resolve default values.
53
+ if (!accounts.tokenProgram.value) {
54
+ accounts.tokenProgram.value =
55
+ 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
56
+ }
57
+ if (!accounts.systemProgram.value) {
58
+ accounts.systemProgram.value =
59
+ '11111111111111111111111111111111';
60
+ }
61
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
62
+ const instruction = {
63
+ accounts: [
64
+ getAccountMeta(accounts.distributor),
65
+ getAccountMeta(accounts.claimStatus),
66
+ getAccountMeta(accounts.from),
67
+ getAccountMeta(accounts.to),
68
+ getAccountMeta(accounts.claimant),
69
+ getAccountMeta(accounts.tokenProgram),
70
+ getAccountMeta(accounts.systemProgram),
71
+ ],
72
+ programAddress,
73
+ data: getNewClaimInstructionDataEncoder().encode(args),
74
+ };
75
+ return instruction;
76
+ }
77
+ export function parseNewClaimInstruction(instruction) {
78
+ if (instruction.accounts.length < 7) {
79
+ // TODO: Coded error.
80
+ throw new Error('Not enough accounts');
81
+ }
82
+ let accountIndex = 0;
83
+ const getNextAccount = () => {
84
+ const accountMeta = instruction.accounts[accountIndex];
85
+ accountIndex += 1;
86
+ return accountMeta;
87
+ };
88
+ return {
89
+ programAddress: instruction.programAddress,
90
+ accounts: {
91
+ distributor: getNextAccount(),
92
+ claimStatus: getNextAccount(),
93
+ from: getNextAccount(),
94
+ to: getNextAccount(),
95
+ claimant: getNextAccount(),
96
+ tokenProgram: getNextAccount(),
97
+ systemProgram: getNextAccount(),
98
+ },
99
+ data: getNewClaimInstructionDataDecoder().decode(instruction.data),
100
+ };
101
+ }
@@ -0,0 +1,113 @@
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 { MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS } from '../programs';
10
+ export declare const NEW_DISTRIBUTOR_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
11
+ export declare function getNewDistributorDiscriminatorBytes(): ReadonlyUint8Array;
12
+ export type NewDistributorInstruction<TProgram extends string = typeof MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS, TAccountDistributor extends string | IAccountMeta<string> = string, TAccountClawbackReceiver extends string | IAccountMeta<string> = string, TAccountMint extends string | IAccountMeta<string> = string, TAccountTokenVault extends string | IAccountMeta<string> = string, TAccountAdmin extends string | IAccountMeta<string> = string, TAccountSystemProgram extends string | IAccountMeta<string> = '11111111111111111111111111111111', TAccountAssociatedTokenProgram extends string | IAccountMeta<string> = string, TAccountTokenProgram extends string | IAccountMeta<string> = 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA', TRemainingAccounts extends readonly IAccountMeta<string>[] = []> = IInstruction<TProgram> & IInstructionWithData<Uint8Array> & IInstructionWithAccounts<[
13
+ TAccountDistributor extends string ? WritableAccount<TAccountDistributor> : TAccountDistributor,
14
+ TAccountClawbackReceiver extends string ? WritableAccount<TAccountClawbackReceiver> : TAccountClawbackReceiver,
15
+ TAccountMint extends string ? ReadonlyAccount<TAccountMint> : TAccountMint,
16
+ TAccountTokenVault extends string ? ReadonlyAccount<TAccountTokenVault> : TAccountTokenVault,
17
+ TAccountAdmin extends string ? WritableSignerAccount<TAccountAdmin> & IAccountSignerMeta<TAccountAdmin> : TAccountAdmin,
18
+ TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
19
+ TAccountAssociatedTokenProgram extends string ? ReadonlyAccount<TAccountAssociatedTokenProgram> : TAccountAssociatedTokenProgram,
20
+ TAccountTokenProgram extends string ? ReadonlyAccount<TAccountTokenProgram> : TAccountTokenProgram,
21
+ ...TRemainingAccounts
22
+ ]>;
23
+ export type NewDistributorInstructionData = {
24
+ discriminator: ReadonlyUint8Array;
25
+ version: bigint;
26
+ root: ReadonlyUint8Array;
27
+ maxTotalClaim: bigint;
28
+ maxNumNodes: bigint;
29
+ startVestingTs: bigint;
30
+ endVestingTs: bigint;
31
+ clawbackStartTs: bigint;
32
+ enableSlot: bigint;
33
+ closable: boolean;
34
+ };
35
+ export type NewDistributorInstructionDataArgs = {
36
+ version: number | bigint;
37
+ root: ReadonlyUint8Array;
38
+ maxTotalClaim: number | bigint;
39
+ maxNumNodes: number | bigint;
40
+ startVestingTs: number | bigint;
41
+ endVestingTs: number | bigint;
42
+ clawbackStartTs: number | bigint;
43
+ enableSlot: number | bigint;
44
+ closable: boolean;
45
+ };
46
+ export declare function getNewDistributorInstructionDataEncoder(): Encoder<NewDistributorInstructionDataArgs>;
47
+ export declare function getNewDistributorInstructionDataDecoder(): Decoder<NewDistributorInstructionData>;
48
+ export declare function getNewDistributorInstructionDataCodec(): Codec<NewDistributorInstructionDataArgs, NewDistributorInstructionData>;
49
+ export type NewDistributorInput<TAccountDistributor extends string = string, TAccountClawbackReceiver extends string = string, TAccountMint extends string = string, TAccountTokenVault extends string = string, TAccountAdmin extends string = string, TAccountSystemProgram extends string = string, TAccountAssociatedTokenProgram extends string = string, TAccountTokenProgram extends string = string> = {
50
+ /** [MerkleDistributor]. */
51
+ distributor: Address<TAccountDistributor>;
52
+ /** Clawback receiver token account */
53
+ clawbackReceiver: Address<TAccountClawbackReceiver>;
54
+ /** The mint to distribute. */
55
+ mint: Address<TAccountMint>;
56
+ /**
57
+ * Token vault
58
+ * Should create previously
59
+ */
60
+ tokenVault: Address<TAccountTokenVault>;
61
+ /**
62
+ * Admin wallet, responsible for creating the distributor and paying for the transaction.
63
+ * Also has the authority to set the clawback receiver and change itself.
64
+ */
65
+ admin: TransactionSigner<TAccountAdmin>;
66
+ /** The [System] program. */
67
+ systemProgram?: Address<TAccountSystemProgram>;
68
+ /** The [Associated Token] program. */
69
+ associatedTokenProgram: Address<TAccountAssociatedTokenProgram>;
70
+ /** The [Token] program. */
71
+ tokenProgram?: Address<TAccountTokenProgram>;
72
+ version: NewDistributorInstructionDataArgs['version'];
73
+ root: NewDistributorInstructionDataArgs['root'];
74
+ maxTotalClaim: NewDistributorInstructionDataArgs['maxTotalClaim'];
75
+ maxNumNodes: NewDistributorInstructionDataArgs['maxNumNodes'];
76
+ startVestingTs: NewDistributorInstructionDataArgs['startVestingTs'];
77
+ endVestingTs: NewDistributorInstructionDataArgs['endVestingTs'];
78
+ clawbackStartTs: NewDistributorInstructionDataArgs['clawbackStartTs'];
79
+ enableSlot: NewDistributorInstructionDataArgs['enableSlot'];
80
+ closable: NewDistributorInstructionDataArgs['closable'];
81
+ };
82
+ export declare function getNewDistributorInstruction<TAccountDistributor extends string, TAccountClawbackReceiver extends string, TAccountMint extends string, TAccountTokenVault extends string, TAccountAdmin extends string, TAccountSystemProgram extends string, TAccountAssociatedTokenProgram extends string, TAccountTokenProgram extends string, TProgramAddress extends Address = typeof MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS>(input: NewDistributorInput<TAccountDistributor, TAccountClawbackReceiver, TAccountMint, TAccountTokenVault, TAccountAdmin, TAccountSystemProgram, TAccountAssociatedTokenProgram, TAccountTokenProgram>, config?: {
83
+ programAddress?: TProgramAddress;
84
+ }): NewDistributorInstruction<TProgramAddress, TAccountDistributor, TAccountClawbackReceiver, TAccountMint, TAccountTokenVault, TAccountAdmin, TAccountSystemProgram, TAccountAssociatedTokenProgram, TAccountTokenProgram>;
85
+ export type ParsedNewDistributorInstruction<TProgram extends string = typeof MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS, TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[]> = {
86
+ programAddress: Address<TProgram>;
87
+ accounts: {
88
+ /** [MerkleDistributor]. */
89
+ distributor: TAccountMetas[0];
90
+ /** Clawback receiver token account */
91
+ clawbackReceiver: TAccountMetas[1];
92
+ /** The mint to distribute. */
93
+ mint: TAccountMetas[2];
94
+ /**
95
+ * Token vault
96
+ * Should create previously
97
+ */
98
+ tokenVault: TAccountMetas[3];
99
+ /**
100
+ * Admin wallet, responsible for creating the distributor and paying for the transaction.
101
+ * Also has the authority to set the clawback receiver and change itself.
102
+ */
103
+ admin: TAccountMetas[4];
104
+ /** The [System] program. */
105
+ systemProgram: TAccountMetas[5];
106
+ /** The [Associated Token] program. */
107
+ associatedTokenProgram: TAccountMetas[6];
108
+ /** The [Token] program. */
109
+ tokenProgram: TAccountMetas[7];
110
+ };
111
+ data: NewDistributorInstructionData;
112
+ };
113
+ export declare function parseNewDistributorInstruction<TProgram extends string, TAccountMetas extends readonly IAccountMeta[]>(instruction: IInstruction<TProgram> & IInstructionWithAccounts<TAccountMetas> & IInstructionWithData<Uint8Array>): ParsedNewDistributorInstruction<TProgram, TAccountMetas>;
@@ -0,0 +1,122 @@
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 { combineCodec, fixDecoderSize, fixEncoderSize, getBooleanDecoder, getBooleanEncoder, getBytesDecoder, getBytesEncoder, getI64Decoder, getI64Encoder, getStructDecoder, getStructEncoder, getU64Decoder, getU64Encoder, transformEncoder, } from '@solana/kit';
9
+ import { MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS } from '../programs';
10
+ import { getAccountMetaFactory } from '../shared';
11
+ export const NEW_DISTRIBUTOR_DISCRIMINATOR = new Uint8Array([
12
+ 32, 139, 112, 171, 0, 2, 225, 155,
13
+ ]);
14
+ export function getNewDistributorDiscriminatorBytes() {
15
+ return fixEncoderSize(getBytesEncoder(), 8).encode(NEW_DISTRIBUTOR_DISCRIMINATOR);
16
+ }
17
+ export function getNewDistributorInstructionDataEncoder() {
18
+ return transformEncoder(getStructEncoder([
19
+ ['discriminator', fixEncoderSize(getBytesEncoder(), 8)],
20
+ ['version', getU64Encoder()],
21
+ ['root', fixEncoderSize(getBytesEncoder(), 32)],
22
+ ['maxTotalClaim', getU64Encoder()],
23
+ ['maxNumNodes', getU64Encoder()],
24
+ ['startVestingTs', getI64Encoder()],
25
+ ['endVestingTs', getI64Encoder()],
26
+ ['clawbackStartTs', getI64Encoder()],
27
+ ['enableSlot', getU64Encoder()],
28
+ ['closable', getBooleanEncoder()],
29
+ ]), (value) => ({ ...value, discriminator: NEW_DISTRIBUTOR_DISCRIMINATOR }));
30
+ }
31
+ export function getNewDistributorInstructionDataDecoder() {
32
+ return getStructDecoder([
33
+ ['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
34
+ ['version', getU64Decoder()],
35
+ ['root', fixDecoderSize(getBytesDecoder(), 32)],
36
+ ['maxTotalClaim', getU64Decoder()],
37
+ ['maxNumNodes', getU64Decoder()],
38
+ ['startVestingTs', getI64Decoder()],
39
+ ['endVestingTs', getI64Decoder()],
40
+ ['clawbackStartTs', getI64Decoder()],
41
+ ['enableSlot', getU64Decoder()],
42
+ ['closable', getBooleanDecoder()],
43
+ ]);
44
+ }
45
+ export function getNewDistributorInstructionDataCodec() {
46
+ return combineCodec(getNewDistributorInstructionDataEncoder(), getNewDistributorInstructionDataDecoder());
47
+ }
48
+ export function getNewDistributorInstruction(input, config) {
49
+ // Program address.
50
+ const programAddress = config?.programAddress ?? MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS;
51
+ // Original accounts.
52
+ const originalAccounts = {
53
+ distributor: { value: input.distributor ?? null, isWritable: true },
54
+ clawbackReceiver: {
55
+ value: input.clawbackReceiver ?? null,
56
+ isWritable: true,
57
+ },
58
+ mint: { value: input.mint ?? null, isWritable: false },
59
+ tokenVault: { value: input.tokenVault ?? null, isWritable: false },
60
+ admin: { value: input.admin ?? null, isWritable: true },
61
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
62
+ associatedTokenProgram: {
63
+ value: input.associatedTokenProgram ?? null,
64
+ isWritable: false,
65
+ },
66
+ tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
67
+ };
68
+ const accounts = originalAccounts;
69
+ // Original args.
70
+ const args = { ...input };
71
+ // Resolve default values.
72
+ if (!accounts.systemProgram.value) {
73
+ accounts.systemProgram.value =
74
+ '11111111111111111111111111111111';
75
+ }
76
+ if (!accounts.tokenProgram.value) {
77
+ accounts.tokenProgram.value =
78
+ 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
79
+ }
80
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
81
+ const instruction = {
82
+ accounts: [
83
+ getAccountMeta(accounts.distributor),
84
+ getAccountMeta(accounts.clawbackReceiver),
85
+ getAccountMeta(accounts.mint),
86
+ getAccountMeta(accounts.tokenVault),
87
+ getAccountMeta(accounts.admin),
88
+ getAccountMeta(accounts.systemProgram),
89
+ getAccountMeta(accounts.associatedTokenProgram),
90
+ getAccountMeta(accounts.tokenProgram),
91
+ ],
92
+ programAddress,
93
+ data: getNewDistributorInstructionDataEncoder().encode(args),
94
+ };
95
+ return instruction;
96
+ }
97
+ export function parseNewDistributorInstruction(instruction) {
98
+ if (instruction.accounts.length < 8) {
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
+ distributor: getNextAccount(),
112
+ clawbackReceiver: getNextAccount(),
113
+ mint: getNextAccount(),
114
+ tokenVault: getNextAccount(),
115
+ admin: getNextAccount(),
116
+ systemProgram: getNextAccount(),
117
+ associatedTokenProgram: getNextAccount(),
118
+ tokenProgram: getNextAccount(),
119
+ },
120
+ data: getNewDistributorInstructionDataDecoder().decode(instruction.data),
121
+ };
122
+ }
@@ -0,0 +1,48 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+ import { type Address, type Codec, type Decoder, type Encoder, type IAccountMeta, type IAccountSignerMeta, type IInstruction, type IInstructionWithAccounts, type IInstructionWithData, type ReadonlyUint8Array, type TransactionSigner, type WritableAccount, type WritableSignerAccount } from '@solana/kit';
9
+ import { MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS } from '../programs';
10
+ export declare const SET_ADMIN_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
11
+ export declare function getSetAdminDiscriminatorBytes(): ReadonlyUint8Array;
12
+ export type SetAdminInstruction<TProgram extends string = typeof MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS, TAccountDistributor extends string | IAccountMeta<string> = string, TAccountAdmin extends string | IAccountMeta<string> = string, TAccountNewAdmin extends string | IAccountMeta<string> = string, TRemainingAccounts extends readonly IAccountMeta<string>[] = []> = IInstruction<TProgram> & IInstructionWithData<Uint8Array> & IInstructionWithAccounts<[
13
+ TAccountDistributor extends string ? WritableAccount<TAccountDistributor> : TAccountDistributor,
14
+ TAccountAdmin extends string ? WritableSignerAccount<TAccountAdmin> & IAccountSignerMeta<TAccountAdmin> : TAccountAdmin,
15
+ TAccountNewAdmin extends string ? WritableAccount<TAccountNewAdmin> : TAccountNewAdmin,
16
+ ...TRemainingAccounts
17
+ ]>;
18
+ export type SetAdminInstructionData = {
19
+ discriminator: ReadonlyUint8Array;
20
+ };
21
+ export type SetAdminInstructionDataArgs = {};
22
+ export declare function getSetAdminInstructionDataEncoder(): Encoder<SetAdminInstructionDataArgs>;
23
+ export declare function getSetAdminInstructionDataDecoder(): Decoder<SetAdminInstructionData>;
24
+ export declare function getSetAdminInstructionDataCodec(): Codec<SetAdminInstructionDataArgs, SetAdminInstructionData>;
25
+ export type SetAdminInput<TAccountDistributor extends string = string, TAccountAdmin extends string = string, TAccountNewAdmin extends string = string> = {
26
+ /** The [MerkleDistributor]. */
27
+ distributor: Address<TAccountDistributor>;
28
+ /** Admin signer */
29
+ admin: TransactionSigner<TAccountAdmin>;
30
+ /** New admin account */
31
+ newAdmin: Address<TAccountNewAdmin>;
32
+ };
33
+ export declare function getSetAdminInstruction<TAccountDistributor extends string, TAccountAdmin extends string, TAccountNewAdmin extends string, TProgramAddress extends Address = typeof MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS>(input: SetAdminInput<TAccountDistributor, TAccountAdmin, TAccountNewAdmin>, config?: {
34
+ programAddress?: TProgramAddress;
35
+ }): SetAdminInstruction<TProgramAddress, TAccountDistributor, TAccountAdmin, TAccountNewAdmin>;
36
+ export type ParsedSetAdminInstruction<TProgram extends string = typeof MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS, TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[]> = {
37
+ programAddress: Address<TProgram>;
38
+ accounts: {
39
+ /** The [MerkleDistributor]. */
40
+ distributor: TAccountMetas[0];
41
+ /** Admin signer */
42
+ admin: TAccountMetas[1];
43
+ /** New admin account */
44
+ newAdmin: TAccountMetas[2];
45
+ };
46
+ data: SetAdminInstructionData;
47
+ };
48
+ export declare function parseSetAdminInstruction<TProgram extends string, TAccountMetas extends readonly IAccountMeta[]>(instruction: IInstruction<TProgram> & IInstructionWithAccounts<TAccountMetas> & IInstructionWithData<Uint8Array>): ParsedSetAdminInstruction<TProgram, TAccountMetas>;
@@ -0,0 +1,70 @@
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 { combineCodec, fixDecoderSize, fixEncoderSize, getBytesDecoder, getBytesEncoder, getStructDecoder, getStructEncoder, transformEncoder, } from '@solana/kit';
9
+ import { MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS } from '../programs';
10
+ import { getAccountMetaFactory } from '../shared';
11
+ export const SET_ADMIN_DISCRIMINATOR = new Uint8Array([
12
+ 251, 163, 0, 52, 91, 194, 187, 92,
13
+ ]);
14
+ export function getSetAdminDiscriminatorBytes() {
15
+ return fixEncoderSize(getBytesEncoder(), 8).encode(SET_ADMIN_DISCRIMINATOR);
16
+ }
17
+ export function getSetAdminInstructionDataEncoder() {
18
+ return transformEncoder(getStructEncoder([['discriminator', fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({ ...value, discriminator: SET_ADMIN_DISCRIMINATOR }));
19
+ }
20
+ export function getSetAdminInstructionDataDecoder() {
21
+ return getStructDecoder([
22
+ ['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
23
+ ]);
24
+ }
25
+ export function getSetAdminInstructionDataCodec() {
26
+ return combineCodec(getSetAdminInstructionDataEncoder(), getSetAdminInstructionDataDecoder());
27
+ }
28
+ export function getSetAdminInstruction(input, config) {
29
+ // Program address.
30
+ const programAddress = config?.programAddress ?? MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS;
31
+ // Original accounts.
32
+ const originalAccounts = {
33
+ distributor: { value: input.distributor ?? null, isWritable: true },
34
+ admin: { value: input.admin ?? null, isWritable: true },
35
+ newAdmin: { value: input.newAdmin ?? null, isWritable: true },
36
+ };
37
+ const accounts = originalAccounts;
38
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
39
+ const instruction = {
40
+ accounts: [
41
+ getAccountMeta(accounts.distributor),
42
+ getAccountMeta(accounts.admin),
43
+ getAccountMeta(accounts.newAdmin),
44
+ ],
45
+ programAddress,
46
+ data: getSetAdminInstructionDataEncoder().encode({}),
47
+ };
48
+ return instruction;
49
+ }
50
+ export function parseSetAdminInstruction(instruction) {
51
+ if (instruction.accounts.length < 3) {
52
+ // TODO: Coded error.
53
+ throw new Error('Not enough accounts');
54
+ }
55
+ let accountIndex = 0;
56
+ const getNextAccount = () => {
57
+ const accountMeta = instruction.accounts[accountIndex];
58
+ accountIndex += 1;
59
+ return accountMeta;
60
+ };
61
+ return {
62
+ programAddress: instruction.programAddress,
63
+ accounts: {
64
+ distributor: getNextAccount(),
65
+ admin: getNextAccount(),
66
+ newAdmin: getNextAccount(),
67
+ },
68
+ data: getSetAdminInstructionDataDecoder().decode(instruction.data),
69
+ };
70
+ }
@@ -0,0 +1,48 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+ import { type Address, type Codec, type Decoder, type Encoder, type IAccountMeta, type IAccountSignerMeta, type IInstruction, type IInstructionWithAccounts, type IInstructionWithData, type ReadonlyAccount, type ReadonlyUint8Array, type TransactionSigner, type WritableAccount, type WritableSignerAccount } from '@solana/kit';
9
+ import { MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS } from '../programs';
10
+ export declare const SET_CLAWBACK_RECEIVER_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
11
+ export declare function getSetClawbackReceiverDiscriminatorBytes(): ReadonlyUint8Array;
12
+ export type SetClawbackReceiverInstruction<TProgram extends string = typeof MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS, TAccountDistributor extends string | IAccountMeta<string> = string, TAccountNewClawbackAccount extends string | IAccountMeta<string> = string, TAccountAdmin extends string | IAccountMeta<string> = string, TRemainingAccounts extends readonly IAccountMeta<string>[] = []> = IInstruction<TProgram> & IInstructionWithData<Uint8Array> & IInstructionWithAccounts<[
13
+ TAccountDistributor extends string ? WritableAccount<TAccountDistributor> : TAccountDistributor,
14
+ TAccountNewClawbackAccount extends string ? ReadonlyAccount<TAccountNewClawbackAccount> : TAccountNewClawbackAccount,
15
+ TAccountAdmin extends string ? WritableSignerAccount<TAccountAdmin> & IAccountSignerMeta<TAccountAdmin> : TAccountAdmin,
16
+ ...TRemainingAccounts
17
+ ]>;
18
+ export type SetClawbackReceiverInstructionData = {
19
+ discriminator: ReadonlyUint8Array;
20
+ };
21
+ export type SetClawbackReceiverInstructionDataArgs = {};
22
+ export declare function getSetClawbackReceiverInstructionDataEncoder(): Encoder<SetClawbackReceiverInstructionDataArgs>;
23
+ export declare function getSetClawbackReceiverInstructionDataDecoder(): Decoder<SetClawbackReceiverInstructionData>;
24
+ export declare function getSetClawbackReceiverInstructionDataCodec(): Codec<SetClawbackReceiverInstructionDataArgs, SetClawbackReceiverInstructionData>;
25
+ export type SetClawbackReceiverInput<TAccountDistributor extends string = string, TAccountNewClawbackAccount extends string = string, TAccountAdmin extends string = string> = {
26
+ /** The [MerkleDistributor]. */
27
+ distributor: Address<TAccountDistributor>;
28
+ /** New clawback account */
29
+ newClawbackAccount: Address<TAccountNewClawbackAccount>;
30
+ /** Admin signer */
31
+ admin: TransactionSigner<TAccountAdmin>;
32
+ };
33
+ export declare function getSetClawbackReceiverInstruction<TAccountDistributor extends string, TAccountNewClawbackAccount extends string, TAccountAdmin extends string, TProgramAddress extends Address = typeof MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS>(input: SetClawbackReceiverInput<TAccountDistributor, TAccountNewClawbackAccount, TAccountAdmin>, config?: {
34
+ programAddress?: TProgramAddress;
35
+ }): SetClawbackReceiverInstruction<TProgramAddress, TAccountDistributor, TAccountNewClawbackAccount, TAccountAdmin>;
36
+ export type ParsedSetClawbackReceiverInstruction<TProgram extends string = typeof MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS, TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[]> = {
37
+ programAddress: Address<TProgram>;
38
+ accounts: {
39
+ /** The [MerkleDistributor]. */
40
+ distributor: TAccountMetas[0];
41
+ /** New clawback account */
42
+ newClawbackAccount: TAccountMetas[1];
43
+ /** Admin signer */
44
+ admin: TAccountMetas[2];
45
+ };
46
+ data: SetClawbackReceiverInstructionData;
47
+ };
48
+ export declare function parseSetClawbackReceiverInstruction<TProgram extends string, TAccountMetas extends readonly IAccountMeta[]>(instruction: IInstruction<TProgram> & IInstructionWithAccounts<TAccountMetas> & IInstructionWithData<Uint8Array>): ParsedSetClawbackReceiverInstruction<TProgram, TAccountMetas>;
@@ -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 { combineCodec, fixDecoderSize, fixEncoderSize, getBytesDecoder, getBytesEncoder, getStructDecoder, getStructEncoder, transformEncoder, } from '@solana/kit';
9
+ import { MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS } from '../programs';
10
+ import { getAccountMetaFactory } from '../shared';
11
+ export const SET_CLAWBACK_RECEIVER_DISCRIMINATOR = new Uint8Array([
12
+ 153, 217, 34, 20, 19, 29, 229, 75,
13
+ ]);
14
+ export function getSetClawbackReceiverDiscriminatorBytes() {
15
+ return fixEncoderSize(getBytesEncoder(), 8).encode(SET_CLAWBACK_RECEIVER_DISCRIMINATOR);
16
+ }
17
+ export function getSetClawbackReceiverInstructionDataEncoder() {
18
+ return transformEncoder(getStructEncoder([['discriminator', fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({
19
+ ...value,
20
+ discriminator: SET_CLAWBACK_RECEIVER_DISCRIMINATOR,
21
+ }));
22
+ }
23
+ export function getSetClawbackReceiverInstructionDataDecoder() {
24
+ return getStructDecoder([
25
+ ['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
26
+ ]);
27
+ }
28
+ export function getSetClawbackReceiverInstructionDataCodec() {
29
+ return combineCodec(getSetClawbackReceiverInstructionDataEncoder(), getSetClawbackReceiverInstructionDataDecoder());
30
+ }
31
+ export function getSetClawbackReceiverInstruction(input, config) {
32
+ // Program address.
33
+ const programAddress = config?.programAddress ?? MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS;
34
+ // Original accounts.
35
+ const originalAccounts = {
36
+ distributor: { value: input.distributor ?? null, isWritable: true },
37
+ newClawbackAccount: {
38
+ value: input.newClawbackAccount ?? null,
39
+ isWritable: false,
40
+ },
41
+ admin: { value: input.admin ?? null, isWritable: true },
42
+ };
43
+ const accounts = originalAccounts;
44
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
45
+ const instruction = {
46
+ accounts: [
47
+ getAccountMeta(accounts.distributor),
48
+ getAccountMeta(accounts.newClawbackAccount),
49
+ getAccountMeta(accounts.admin),
50
+ ],
51
+ programAddress,
52
+ data: getSetClawbackReceiverInstructionDataEncoder().encode({}),
53
+ };
54
+ return instruction;
55
+ }
56
+ export function parseSetClawbackReceiverInstruction(instruction) {
57
+ if (instruction.accounts.length < 3) {
58
+ // TODO: Coded error.
59
+ throw new Error('Not enough accounts');
60
+ }
61
+ let accountIndex = 0;
62
+ const getNextAccount = () => {
63
+ const accountMeta = instruction.accounts[accountIndex];
64
+ accountIndex += 1;
65
+ return accountMeta;
66
+ };
67
+ return {
68
+ programAddress: instruction.programAddress,
69
+ accounts: {
70
+ distributor: getNextAccount(),
71
+ newClawbackAccount: getNextAccount(),
72
+ admin: getNextAccount(),
73
+ },
74
+ data: getSetClawbackReceiverInstructionDataDecoder().decode(instruction.data),
75
+ };
76
+ }
@@ -0,0 +1,47 @@
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 ReadonlyUint8Array, type TransactionSigner, type WritableAccount, type WritableSignerAccount } from '@solana/kit';
9
+ import { MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS } from '../programs';
10
+ export declare const SET_ENABLE_SLOT_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
11
+ export declare function getSetEnableSlotDiscriminatorBytes(): ReadonlyUint8Array;
12
+ export type SetEnableSlotInstruction<TProgram extends string = typeof MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS, TAccountDistributor extends string | IAccountMeta<string> = string, TAccountAdmin extends string | IAccountMeta<string> = string, TRemainingAccounts extends readonly IAccountMeta<string>[] = []> = IInstruction<TProgram> & IInstructionWithData<Uint8Array> & IInstructionWithAccounts<[
13
+ TAccountDistributor extends string ? WritableAccount<TAccountDistributor> : TAccountDistributor,
14
+ TAccountAdmin extends string ? WritableSignerAccount<TAccountAdmin> & IAccountSignerMeta<TAccountAdmin> : TAccountAdmin,
15
+ ...TRemainingAccounts
16
+ ]>;
17
+ export type SetEnableSlotInstructionData = {
18
+ discriminator: ReadonlyUint8Array;
19
+ enableSlot: bigint;
20
+ };
21
+ export type SetEnableSlotInstructionDataArgs = {
22
+ enableSlot: number | bigint;
23
+ };
24
+ export declare function getSetEnableSlotInstructionDataEncoder(): Encoder<SetEnableSlotInstructionDataArgs>;
25
+ export declare function getSetEnableSlotInstructionDataDecoder(): Decoder<SetEnableSlotInstructionData>;
26
+ export declare function getSetEnableSlotInstructionDataCodec(): Codec<SetEnableSlotInstructionDataArgs, SetEnableSlotInstructionData>;
27
+ export type SetEnableSlotInput<TAccountDistributor extends string = string, TAccountAdmin extends string = string> = {
28
+ /** [MerkleDistributor]. */
29
+ distributor: Address<TAccountDistributor>;
30
+ /** Payer to create the distributor. */
31
+ admin: TransactionSigner<TAccountAdmin>;
32
+ enableSlot: SetEnableSlotInstructionDataArgs['enableSlot'];
33
+ };
34
+ export declare function getSetEnableSlotInstruction<TAccountDistributor extends string, TAccountAdmin extends string, TProgramAddress extends Address = typeof MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS>(input: SetEnableSlotInput<TAccountDistributor, TAccountAdmin>, config?: {
35
+ programAddress?: TProgramAddress;
36
+ }): SetEnableSlotInstruction<TProgramAddress, TAccountDistributor, TAccountAdmin>;
37
+ export type ParsedSetEnableSlotInstruction<TProgram extends string = typeof MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS, TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[]> = {
38
+ programAddress: Address<TProgram>;
39
+ accounts: {
40
+ /** [MerkleDistributor]. */
41
+ distributor: TAccountMetas[0];
42
+ /** Payer to create the distributor. */
43
+ admin: TAccountMetas[1];
44
+ };
45
+ data: SetEnableSlotInstructionData;
46
+ };
47
+ export declare function parseSetEnableSlotInstruction<TProgram extends string, TAccountMetas extends readonly IAccountMeta[]>(instruction: IInstruction<TProgram> & IInstructionWithAccounts<TAccountMetas> & IInstructionWithData<Uint8Array>): ParsedSetEnableSlotInstruction<TProgram, TAccountMetas>;