@nosana/kit 1.0.2 → 1.0.7

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 (49) hide show
  1. package/.gitlab-ci.yml +2 -2
  2. package/dist/config/defaultConfigs.js +2 -0
  3. package/dist/config/types.d.ts +1 -0
  4. package/dist/generated_clients/merkle_distributor/accounts/claimStatus.d.ts +53 -0
  5. package/dist/generated_clients/merkle_distributor/accounts/claimStatus.js +65 -0
  6. package/dist/generated_clients/merkle_distributor/accounts/index.d.ts +9 -0
  7. package/dist/generated_clients/merkle_distributor/accounts/index.js +9 -0
  8. package/dist/generated_clients/merkle_distributor/accounts/merkleDistributor.d.ts +109 -0
  9. package/dist/generated_clients/merkle_distributor/accounts/merkleDistributor.js +93 -0
  10. package/dist/generated_clients/merkle_distributor/errors/index.d.ts +8 -0
  11. package/dist/generated_clients/merkle_distributor/errors/index.js +8 -0
  12. package/dist/generated_clients/merkle_distributor/errors/merkleDistributor.d.ts +63 -0
  13. package/dist/generated_clients/merkle_distributor/errors/merkleDistributor.js +89 -0
  14. package/dist/generated_clients/merkle_distributor/index.d.ts +11 -0
  15. package/dist/generated_clients/merkle_distributor/index.js +11 -0
  16. package/dist/generated_clients/merkle_distributor/instructions/claimLocked.d.ts +69 -0
  17. package/dist/generated_clients/merkle_distributor/instructions/claimLocked.js +84 -0
  18. package/dist/generated_clients/merkle_distributor/instructions/clawback.d.ts +69 -0
  19. package/dist/generated_clients/merkle_distributor/instructions/clawback.js +88 -0
  20. package/dist/generated_clients/merkle_distributor/instructions/closeClaimStatus.d.ts +45 -0
  21. package/dist/generated_clients/merkle_distributor/instructions/closeClaimStatus.js +73 -0
  22. package/dist/generated_clients/merkle_distributor/instructions/closeDistributor.d.ts +64 -0
  23. package/dist/generated_clients/merkle_distributor/instructions/closeDistributor.js +84 -0
  24. package/dist/generated_clients/merkle_distributor/instructions/index.d.ts +16 -0
  25. package/dist/generated_clients/merkle_distributor/instructions/index.js +16 -0
  26. package/dist/generated_clients/merkle_distributor/instructions/newClaim.d.ts +78 -0
  27. package/dist/generated_clients/merkle_distributor/instructions/newClaim.js +101 -0
  28. package/dist/generated_clients/merkle_distributor/instructions/newDistributor.d.ts +113 -0
  29. package/dist/generated_clients/merkle_distributor/instructions/newDistributor.js +122 -0
  30. package/dist/generated_clients/merkle_distributor/instructions/setAdmin.d.ts +48 -0
  31. package/dist/generated_clients/merkle_distributor/instructions/setAdmin.js +70 -0
  32. package/dist/generated_clients/merkle_distributor/instructions/setClawbackReceiver.d.ts +48 -0
  33. package/dist/generated_clients/merkle_distributor/instructions/setClawbackReceiver.js +76 -0
  34. package/dist/generated_clients/merkle_distributor/instructions/setEnableSlot.d.ts +47 -0
  35. package/dist/generated_clients/merkle_distributor/instructions/setEnableSlot.js +73 -0
  36. package/dist/generated_clients/merkle_distributor/programs/index.d.ts +8 -0
  37. package/dist/generated_clients/merkle_distributor/programs/index.js +8 -0
  38. package/dist/generated_clients/merkle_distributor/programs/merkleDistributor.d.ts +50 -0
  39. package/dist/generated_clients/merkle_distributor/programs/merkleDistributor.js +67 -0
  40. package/dist/generated_clients/merkle_distributor/shared/index.d.ts +49 -0
  41. package/dist/generated_clients/merkle_distributor/shared/index.js +86 -0
  42. package/dist/index.d.ts +5 -0
  43. package/dist/index.js +5 -0
  44. package/dist/programs/MerkleDistributorProgram.d.ts +101 -0
  45. package/dist/programs/MerkleDistributorProgram.js +296 -0
  46. package/dist/services/NosService.js +5 -0
  47. package/eslint.config.js +1 -3
  48. package/package.json +13 -12
  49. package/scripts/generate-clients.ts +11 -0
@@ -0,0 +1,78 @@
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_CLAIM_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
11
+ export declare function getNewClaimDiscriminatorBytes(): ReadonlyUint8Array;
12
+ export type NewClaimInstruction<TProgram extends string = typeof MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS, TAccountDistributor extends string | IAccountMeta<string> = string, TAccountClaimStatus extends string | IAccountMeta<string> = string, TAccountFrom extends string | IAccountMeta<string> = string, TAccountTo extends string | IAccountMeta<string> = string, TAccountClaimant 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
+ TAccountDistributor extends string ? WritableAccount<TAccountDistributor> : TAccountDistributor,
14
+ TAccountClaimStatus extends string ? WritableAccount<TAccountClaimStatus> : TAccountClaimStatus,
15
+ TAccountFrom extends string ? WritableAccount<TAccountFrom> : TAccountFrom,
16
+ TAccountTo extends string ? WritableAccount<TAccountTo> : TAccountTo,
17
+ TAccountClaimant extends string ? WritableSignerAccount<TAccountClaimant> & IAccountSignerMeta<TAccountClaimant> : TAccountClaimant,
18
+ TAccountTokenProgram extends string ? ReadonlyAccount<TAccountTokenProgram> : TAccountTokenProgram,
19
+ TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
20
+ ...TRemainingAccounts
21
+ ]>;
22
+ export type NewClaimInstructionData = {
23
+ discriminator: ReadonlyUint8Array;
24
+ amountUnlocked: bigint;
25
+ amountLocked: bigint;
26
+ proof: Array<ReadonlyUint8Array>;
27
+ };
28
+ export type NewClaimInstructionDataArgs = {
29
+ amountUnlocked: number | bigint;
30
+ amountLocked: number | bigint;
31
+ proof: Array<ReadonlyUint8Array>;
32
+ };
33
+ export declare function getNewClaimInstructionDataEncoder(): Encoder<NewClaimInstructionDataArgs>;
34
+ export declare function getNewClaimInstructionDataDecoder(): Decoder<NewClaimInstructionData>;
35
+ export declare function getNewClaimInstructionDataCodec(): Codec<NewClaimInstructionDataArgs, NewClaimInstructionData>;
36
+ export type NewClaimInput<TAccountDistributor extends string = string, TAccountClaimStatus extends string = string, TAccountFrom extends string = string, TAccountTo extends string = string, TAccountClaimant extends string = string, TAccountTokenProgram extends string = string, TAccountSystemProgram extends string = string> = {
37
+ /** The [MerkleDistributor]. */
38
+ distributor: Address<TAccountDistributor>;
39
+ /** Claim status PDA */
40
+ claimStatus: Address<TAccountClaimStatus>;
41
+ /** Distributor ATA containing the tokens to distribute. */
42
+ from: Address<TAccountFrom>;
43
+ /** Account to send the claimed tokens to. */
44
+ to: Address<TAccountTo>;
45
+ /** Who is claiming the tokens. */
46
+ claimant: TransactionSigner<TAccountClaimant>;
47
+ /** SPL [Token] program. */
48
+ tokenProgram?: Address<TAccountTokenProgram>;
49
+ /** The [System] program. */
50
+ systemProgram?: Address<TAccountSystemProgram>;
51
+ amountUnlocked: NewClaimInstructionDataArgs['amountUnlocked'];
52
+ amountLocked: NewClaimInstructionDataArgs['amountLocked'];
53
+ proof: NewClaimInstructionDataArgs['proof'];
54
+ };
55
+ export declare function getNewClaimInstruction<TAccountDistributor extends string, TAccountClaimStatus extends string, TAccountFrom extends string, TAccountTo extends string, TAccountClaimant extends string, TAccountTokenProgram extends string, TAccountSystemProgram extends string, TProgramAddress extends Address = typeof MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS>(input: NewClaimInput<TAccountDistributor, TAccountClaimStatus, TAccountFrom, TAccountTo, TAccountClaimant, TAccountTokenProgram, TAccountSystemProgram>, config?: {
56
+ programAddress?: TProgramAddress;
57
+ }): NewClaimInstruction<TProgramAddress, TAccountDistributor, TAccountClaimStatus, TAccountFrom, TAccountTo, TAccountClaimant, TAccountTokenProgram, TAccountSystemProgram>;
58
+ export type ParsedNewClaimInstruction<TProgram extends string = typeof MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS, TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[]> = {
59
+ programAddress: Address<TProgram>;
60
+ accounts: {
61
+ /** The [MerkleDistributor]. */
62
+ distributor: TAccountMetas[0];
63
+ /** Claim status PDA */
64
+ claimStatus: TAccountMetas[1];
65
+ /** Distributor ATA containing the tokens to distribute. */
66
+ from: TAccountMetas[2];
67
+ /** Account to send the claimed tokens to. */
68
+ to: TAccountMetas[3];
69
+ /** Who is claiming the tokens. */
70
+ claimant: TAccountMetas[4];
71
+ /** SPL [Token] program. */
72
+ tokenProgram: TAccountMetas[5];
73
+ /** The [System] program. */
74
+ systemProgram: TAccountMetas[6];
75
+ };
76
+ data: NewClaimInstructionData;
77
+ };
78
+ export declare function parseNewClaimInstruction<TProgram extends string, TAccountMetas extends readonly IAccountMeta[]>(instruction: IInstruction<TProgram> & IInstructionWithAccounts<TAccountMetas> & IInstructionWithData<Uint8Array>): ParsedNewClaimInstruction<TProgram, TAccountMetas>;
@@ -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>;