@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.
- package/.gitlab-ci.yml +2 -2
- package/dist/config/defaultConfigs.js +2 -0
- package/dist/config/types.d.ts +1 -0
- package/dist/generated_clients/merkle_distributor/accounts/claimStatus.d.ts +53 -0
- package/dist/generated_clients/merkle_distributor/accounts/claimStatus.js +65 -0
- package/dist/generated_clients/merkle_distributor/accounts/index.d.ts +9 -0
- package/dist/generated_clients/merkle_distributor/accounts/index.js +9 -0
- package/dist/generated_clients/merkle_distributor/accounts/merkleDistributor.d.ts +109 -0
- package/dist/generated_clients/merkle_distributor/accounts/merkleDistributor.js +93 -0
- package/dist/generated_clients/merkle_distributor/errors/index.d.ts +8 -0
- package/dist/generated_clients/merkle_distributor/errors/index.js +8 -0
- package/dist/generated_clients/merkle_distributor/errors/merkleDistributor.d.ts +63 -0
- package/dist/generated_clients/merkle_distributor/errors/merkleDistributor.js +89 -0
- package/dist/generated_clients/merkle_distributor/index.d.ts +11 -0
- package/dist/generated_clients/merkle_distributor/index.js +11 -0
- package/dist/generated_clients/merkle_distributor/instructions/claimLocked.d.ts +69 -0
- package/dist/generated_clients/merkle_distributor/instructions/claimLocked.js +84 -0
- package/dist/generated_clients/merkle_distributor/instructions/clawback.d.ts +69 -0
- package/dist/generated_clients/merkle_distributor/instructions/clawback.js +88 -0
- package/dist/generated_clients/merkle_distributor/instructions/closeClaimStatus.d.ts +45 -0
- package/dist/generated_clients/merkle_distributor/instructions/closeClaimStatus.js +73 -0
- package/dist/generated_clients/merkle_distributor/instructions/closeDistributor.d.ts +64 -0
- package/dist/generated_clients/merkle_distributor/instructions/closeDistributor.js +84 -0
- package/dist/generated_clients/merkle_distributor/instructions/index.d.ts +16 -0
- package/dist/generated_clients/merkle_distributor/instructions/index.js +16 -0
- package/dist/generated_clients/merkle_distributor/instructions/newClaim.d.ts +78 -0
- package/dist/generated_clients/merkle_distributor/instructions/newClaim.js +101 -0
- package/dist/generated_clients/merkle_distributor/instructions/newDistributor.d.ts +113 -0
- package/dist/generated_clients/merkle_distributor/instructions/newDistributor.js +122 -0
- package/dist/generated_clients/merkle_distributor/instructions/setAdmin.d.ts +48 -0
- package/dist/generated_clients/merkle_distributor/instructions/setAdmin.js +70 -0
- package/dist/generated_clients/merkle_distributor/instructions/setClawbackReceiver.d.ts +48 -0
- package/dist/generated_clients/merkle_distributor/instructions/setClawbackReceiver.js +76 -0
- package/dist/generated_clients/merkle_distributor/instructions/setEnableSlot.d.ts +47 -0
- package/dist/generated_clients/merkle_distributor/instructions/setEnableSlot.js +73 -0
- package/dist/generated_clients/merkle_distributor/programs/index.d.ts +8 -0
- package/dist/generated_clients/merkle_distributor/programs/index.js +8 -0
- package/dist/generated_clients/merkle_distributor/programs/merkleDistributor.d.ts +50 -0
- package/dist/generated_clients/merkle_distributor/programs/merkleDistributor.js +67 -0
- package/dist/generated_clients/merkle_distributor/shared/index.d.ts +49 -0
- package/dist/generated_clients/merkle_distributor/shared/index.js +86 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/programs/MerkleDistributorProgram.d.ts +101 -0
- package/dist/programs/MerkleDistributorProgram.js +296 -0
- package/dist/services/NosService.js +5 -0
- package/eslint.config.js +1 -3
- package/package.json +13 -12
- package/scripts/generate-clients.ts +11 -0
|
@@ -0,0 +1,69 @@
|
|
|
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 CLAIM_LOCKED_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
|
|
11
|
+
export declare function getClaimLockedDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
|
+
export type ClaimLockedInstruction<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', 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
|
+
...TRemainingAccounts
|
|
20
|
+
]>;
|
|
21
|
+
export type ClaimLockedInstructionData = {
|
|
22
|
+
discriminator: ReadonlyUint8Array;
|
|
23
|
+
};
|
|
24
|
+
export type ClaimLockedInstructionDataArgs = {};
|
|
25
|
+
export declare function getClaimLockedInstructionDataEncoder(): Encoder<ClaimLockedInstructionDataArgs>;
|
|
26
|
+
export declare function getClaimLockedInstructionDataDecoder(): Decoder<ClaimLockedInstructionData>;
|
|
27
|
+
export declare function getClaimLockedInstructionDataCodec(): Codec<ClaimLockedInstructionDataArgs, ClaimLockedInstructionData>;
|
|
28
|
+
export type ClaimLockedInput<TAccountDistributor extends string = string, TAccountClaimStatus extends string = string, TAccountFrom extends string = string, TAccountTo extends string = string, TAccountClaimant extends string = string, TAccountTokenProgram extends string = string> = {
|
|
29
|
+
/** The [MerkleDistributor]. */
|
|
30
|
+
distributor: Address<TAccountDistributor>;
|
|
31
|
+
/** Claim Status PDA */
|
|
32
|
+
claimStatus: Address<TAccountClaimStatus>;
|
|
33
|
+
/** Distributor ATA containing the tokens to distribute. */
|
|
34
|
+
from: Address<TAccountFrom>;
|
|
35
|
+
/**
|
|
36
|
+
* Account to send the claimed tokens to.
|
|
37
|
+
* Claimant must sign the transaction and can only claim on behalf of themself
|
|
38
|
+
*/
|
|
39
|
+
to: Address<TAccountTo>;
|
|
40
|
+
/** Who is claiming the tokens. */
|
|
41
|
+
claimant: TransactionSigner<TAccountClaimant>;
|
|
42
|
+
/** SPL [Token] program. */
|
|
43
|
+
tokenProgram?: Address<TAccountTokenProgram>;
|
|
44
|
+
};
|
|
45
|
+
export declare function getClaimLockedInstruction<TAccountDistributor extends string, TAccountClaimStatus extends string, TAccountFrom extends string, TAccountTo extends string, TAccountClaimant extends string, TAccountTokenProgram extends string, TProgramAddress extends Address = typeof MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS>(input: ClaimLockedInput<TAccountDistributor, TAccountClaimStatus, TAccountFrom, TAccountTo, TAccountClaimant, TAccountTokenProgram>, config?: {
|
|
46
|
+
programAddress?: TProgramAddress;
|
|
47
|
+
}): ClaimLockedInstruction<TProgramAddress, TAccountDistributor, TAccountClaimStatus, TAccountFrom, TAccountTo, TAccountClaimant, TAccountTokenProgram>;
|
|
48
|
+
export type ParsedClaimLockedInstruction<TProgram extends string = typeof MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS, TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[]> = {
|
|
49
|
+
programAddress: Address<TProgram>;
|
|
50
|
+
accounts: {
|
|
51
|
+
/** The [MerkleDistributor]. */
|
|
52
|
+
distributor: TAccountMetas[0];
|
|
53
|
+
/** Claim Status PDA */
|
|
54
|
+
claimStatus: TAccountMetas[1];
|
|
55
|
+
/** Distributor ATA containing the tokens to distribute. */
|
|
56
|
+
from: TAccountMetas[2];
|
|
57
|
+
/**
|
|
58
|
+
* Account to send the claimed tokens to.
|
|
59
|
+
* Claimant must sign the transaction and can only claim on behalf of themself
|
|
60
|
+
*/
|
|
61
|
+
to: TAccountMetas[3];
|
|
62
|
+
/** Who is claiming the tokens. */
|
|
63
|
+
claimant: TAccountMetas[4];
|
|
64
|
+
/** SPL [Token] program. */
|
|
65
|
+
tokenProgram: TAccountMetas[5];
|
|
66
|
+
};
|
|
67
|
+
data: ClaimLockedInstructionData;
|
|
68
|
+
};
|
|
69
|
+
export declare function parseClaimLockedInstruction<TProgram extends string, TAccountMetas extends readonly IAccountMeta[]>(instruction: IInstruction<TProgram> & IInstructionWithAccounts<TAccountMetas> & IInstructionWithData<Uint8Array>): ParsedClaimLockedInstruction<TProgram, TAccountMetas>;
|
|
@@ -0,0 +1,84 @@
|
|
|
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 CLAIM_LOCKED_DISCRIMINATOR = new Uint8Array([
|
|
12
|
+
34, 206, 181, 23, 11, 207, 147, 90,
|
|
13
|
+
]);
|
|
14
|
+
export function getClaimLockedDiscriminatorBytes() {
|
|
15
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(CLAIM_LOCKED_DISCRIMINATOR);
|
|
16
|
+
}
|
|
17
|
+
export function getClaimLockedInstructionDataEncoder() {
|
|
18
|
+
return transformEncoder(getStructEncoder([['discriminator', fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({ ...value, discriminator: CLAIM_LOCKED_DISCRIMINATOR }));
|
|
19
|
+
}
|
|
20
|
+
export function getClaimLockedInstructionDataDecoder() {
|
|
21
|
+
return getStructDecoder([
|
|
22
|
+
['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
|
|
23
|
+
]);
|
|
24
|
+
}
|
|
25
|
+
export function getClaimLockedInstructionDataCodec() {
|
|
26
|
+
return combineCodec(getClaimLockedInstructionDataEncoder(), getClaimLockedInstructionDataDecoder());
|
|
27
|
+
}
|
|
28
|
+
export function getClaimLockedInstruction(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
|
+
claimStatus: { value: input.claimStatus ?? null, isWritable: true },
|
|
35
|
+
from: { value: input.from ?? null, isWritable: true },
|
|
36
|
+
to: { value: input.to ?? null, isWritable: true },
|
|
37
|
+
claimant: { value: input.claimant ?? null, isWritable: true },
|
|
38
|
+
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
39
|
+
};
|
|
40
|
+
const accounts = originalAccounts;
|
|
41
|
+
// Resolve default values.
|
|
42
|
+
if (!accounts.tokenProgram.value) {
|
|
43
|
+
accounts.tokenProgram.value =
|
|
44
|
+
'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
|
|
45
|
+
}
|
|
46
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
|
|
47
|
+
const instruction = {
|
|
48
|
+
accounts: [
|
|
49
|
+
getAccountMeta(accounts.distributor),
|
|
50
|
+
getAccountMeta(accounts.claimStatus),
|
|
51
|
+
getAccountMeta(accounts.from),
|
|
52
|
+
getAccountMeta(accounts.to),
|
|
53
|
+
getAccountMeta(accounts.claimant),
|
|
54
|
+
getAccountMeta(accounts.tokenProgram),
|
|
55
|
+
],
|
|
56
|
+
programAddress,
|
|
57
|
+
data: getClaimLockedInstructionDataEncoder().encode({}),
|
|
58
|
+
};
|
|
59
|
+
return instruction;
|
|
60
|
+
}
|
|
61
|
+
export function parseClaimLockedInstruction(instruction) {
|
|
62
|
+
if (instruction.accounts.length < 6) {
|
|
63
|
+
// TODO: Coded error.
|
|
64
|
+
throw new Error('Not enough accounts');
|
|
65
|
+
}
|
|
66
|
+
let accountIndex = 0;
|
|
67
|
+
const getNextAccount = () => {
|
|
68
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
69
|
+
accountIndex += 1;
|
|
70
|
+
return accountMeta;
|
|
71
|
+
};
|
|
72
|
+
return {
|
|
73
|
+
programAddress: instruction.programAddress,
|
|
74
|
+
accounts: {
|
|
75
|
+
distributor: getNextAccount(),
|
|
76
|
+
claimStatus: getNextAccount(),
|
|
77
|
+
from: getNextAccount(),
|
|
78
|
+
to: getNextAccount(),
|
|
79
|
+
claimant: getNextAccount(),
|
|
80
|
+
tokenProgram: getNextAccount(),
|
|
81
|
+
},
|
|
82
|
+
data: getClaimLockedInstructionDataDecoder().decode(instruction.data),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
import { type Address, type Codec, type Decoder, type Encoder, type IAccountMeta, type IAccountSignerMeta, type IInstruction, type IInstructionWithAccounts, type IInstructionWithData, type ReadonlyAccount, type ReadonlySignerAccount, type ReadonlyUint8Array, type TransactionSigner, type WritableAccount } from '@solana/kit';
|
|
9
|
+
import { MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS } from '../programs';
|
|
10
|
+
export declare const CLAWBACK_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
|
|
11
|
+
export declare function getClawbackDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
|
+
export type ClawbackInstruction<TProgram extends string = typeof MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS, TAccountDistributor extends string | IAccountMeta<string> = string, TAccountFrom extends string | IAccountMeta<string> = string, TAccountTo extends string | IAccountMeta<string> = string, TAccountClaimant extends string | IAccountMeta<string> = string, TAccountSystemProgram extends string | IAccountMeta<string> = '11111111111111111111111111111111', TAccountTokenProgram extends string | IAccountMeta<string> = 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA', TRemainingAccounts extends readonly IAccountMeta<string>[] = []> = IInstruction<TProgram> & IInstructionWithData<Uint8Array> & IInstructionWithAccounts<[
|
|
13
|
+
TAccountDistributor extends string ? WritableAccount<TAccountDistributor> : TAccountDistributor,
|
|
14
|
+
TAccountFrom extends string ? WritableAccount<TAccountFrom> : TAccountFrom,
|
|
15
|
+
TAccountTo extends string ? WritableAccount<TAccountTo> : TAccountTo,
|
|
16
|
+
TAccountClaimant extends string ? ReadonlySignerAccount<TAccountClaimant> & IAccountSignerMeta<TAccountClaimant> : TAccountClaimant,
|
|
17
|
+
TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
|
|
18
|
+
TAccountTokenProgram extends string ? ReadonlyAccount<TAccountTokenProgram> : TAccountTokenProgram,
|
|
19
|
+
...TRemainingAccounts
|
|
20
|
+
]>;
|
|
21
|
+
export type ClawbackInstructionData = {
|
|
22
|
+
discriminator: ReadonlyUint8Array;
|
|
23
|
+
};
|
|
24
|
+
export type ClawbackInstructionDataArgs = {};
|
|
25
|
+
export declare function getClawbackInstructionDataEncoder(): Encoder<ClawbackInstructionDataArgs>;
|
|
26
|
+
export declare function getClawbackInstructionDataDecoder(): Decoder<ClawbackInstructionData>;
|
|
27
|
+
export declare function getClawbackInstructionDataCodec(): Codec<ClawbackInstructionDataArgs, ClawbackInstructionData>;
|
|
28
|
+
export type ClawbackInput<TAccountDistributor extends string = string, TAccountFrom extends string = string, TAccountTo extends string = string, TAccountClaimant extends string = string, TAccountSystemProgram extends string = string, TAccountTokenProgram extends string = string> = {
|
|
29
|
+
/** The [MerkleDistributor]. */
|
|
30
|
+
distributor: Address<TAccountDistributor>;
|
|
31
|
+
/** Distributor ATA containing the tokens to distribute. */
|
|
32
|
+
from: Address<TAccountFrom>;
|
|
33
|
+
/** The Clawback token account. */
|
|
34
|
+
to: Address<TAccountTo>;
|
|
35
|
+
/**
|
|
36
|
+
* Claimant account
|
|
37
|
+
* Anyone can claw back the funds
|
|
38
|
+
*/
|
|
39
|
+
claimant: TransactionSigner<TAccountClaimant>;
|
|
40
|
+
/** The [System] program. */
|
|
41
|
+
systemProgram?: Address<TAccountSystemProgram>;
|
|
42
|
+
/** SPL [Token] program. */
|
|
43
|
+
tokenProgram?: Address<TAccountTokenProgram>;
|
|
44
|
+
};
|
|
45
|
+
export declare function getClawbackInstruction<TAccountDistributor extends string, TAccountFrom extends string, TAccountTo extends string, TAccountClaimant extends string, TAccountSystemProgram extends string, TAccountTokenProgram extends string, TProgramAddress extends Address = typeof MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS>(input: ClawbackInput<TAccountDistributor, TAccountFrom, TAccountTo, TAccountClaimant, TAccountSystemProgram, TAccountTokenProgram>, config?: {
|
|
46
|
+
programAddress?: TProgramAddress;
|
|
47
|
+
}): ClawbackInstruction<TProgramAddress, TAccountDistributor, TAccountFrom, TAccountTo, TAccountClaimant, TAccountSystemProgram, TAccountTokenProgram>;
|
|
48
|
+
export type ParsedClawbackInstruction<TProgram extends string = typeof MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS, TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[]> = {
|
|
49
|
+
programAddress: Address<TProgram>;
|
|
50
|
+
accounts: {
|
|
51
|
+
/** The [MerkleDistributor]. */
|
|
52
|
+
distributor: TAccountMetas[0];
|
|
53
|
+
/** Distributor ATA containing the tokens to distribute. */
|
|
54
|
+
from: TAccountMetas[1];
|
|
55
|
+
/** The Clawback token account. */
|
|
56
|
+
to: TAccountMetas[2];
|
|
57
|
+
/**
|
|
58
|
+
* Claimant account
|
|
59
|
+
* Anyone can claw back the funds
|
|
60
|
+
*/
|
|
61
|
+
claimant: TAccountMetas[3];
|
|
62
|
+
/** The [System] program. */
|
|
63
|
+
systemProgram: TAccountMetas[4];
|
|
64
|
+
/** SPL [Token] program. */
|
|
65
|
+
tokenProgram: TAccountMetas[5];
|
|
66
|
+
};
|
|
67
|
+
data: ClawbackInstructionData;
|
|
68
|
+
};
|
|
69
|
+
export declare function parseClawbackInstruction<TProgram extends string, TAccountMetas extends readonly IAccountMeta[]>(instruction: IInstruction<TProgram> & IInstructionWithAccounts<TAccountMetas> & IInstructionWithData<Uint8Array>): ParsedClawbackInstruction<TProgram, TAccountMetas>;
|
|
@@ -0,0 +1,88 @@
|
|
|
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 CLAWBACK_DISCRIMINATOR = new Uint8Array([
|
|
12
|
+
111, 92, 142, 79, 33, 234, 82, 27,
|
|
13
|
+
]);
|
|
14
|
+
export function getClawbackDiscriminatorBytes() {
|
|
15
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(CLAWBACK_DISCRIMINATOR);
|
|
16
|
+
}
|
|
17
|
+
export function getClawbackInstructionDataEncoder() {
|
|
18
|
+
return transformEncoder(getStructEncoder([['discriminator', fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({ ...value, discriminator: CLAWBACK_DISCRIMINATOR }));
|
|
19
|
+
}
|
|
20
|
+
export function getClawbackInstructionDataDecoder() {
|
|
21
|
+
return getStructDecoder([
|
|
22
|
+
['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
|
|
23
|
+
]);
|
|
24
|
+
}
|
|
25
|
+
export function getClawbackInstructionDataCodec() {
|
|
26
|
+
return combineCodec(getClawbackInstructionDataEncoder(), getClawbackInstructionDataDecoder());
|
|
27
|
+
}
|
|
28
|
+
export function getClawbackInstruction(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
|
+
from: { value: input.from ?? null, isWritable: true },
|
|
35
|
+
to: { value: input.to ?? null, isWritable: true },
|
|
36
|
+
claimant: { value: input.claimant ?? null, isWritable: false },
|
|
37
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
38
|
+
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
39
|
+
};
|
|
40
|
+
const accounts = originalAccounts;
|
|
41
|
+
// Resolve default values.
|
|
42
|
+
if (!accounts.systemProgram.value) {
|
|
43
|
+
accounts.systemProgram.value =
|
|
44
|
+
'11111111111111111111111111111111';
|
|
45
|
+
}
|
|
46
|
+
if (!accounts.tokenProgram.value) {
|
|
47
|
+
accounts.tokenProgram.value =
|
|
48
|
+
'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
|
|
49
|
+
}
|
|
50
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
|
|
51
|
+
const instruction = {
|
|
52
|
+
accounts: [
|
|
53
|
+
getAccountMeta(accounts.distributor),
|
|
54
|
+
getAccountMeta(accounts.from),
|
|
55
|
+
getAccountMeta(accounts.to),
|
|
56
|
+
getAccountMeta(accounts.claimant),
|
|
57
|
+
getAccountMeta(accounts.systemProgram),
|
|
58
|
+
getAccountMeta(accounts.tokenProgram),
|
|
59
|
+
],
|
|
60
|
+
programAddress,
|
|
61
|
+
data: getClawbackInstructionDataEncoder().encode({}),
|
|
62
|
+
};
|
|
63
|
+
return instruction;
|
|
64
|
+
}
|
|
65
|
+
export function parseClawbackInstruction(instruction) {
|
|
66
|
+
if (instruction.accounts.length < 6) {
|
|
67
|
+
// TODO: Coded error.
|
|
68
|
+
throw new Error('Not enough accounts');
|
|
69
|
+
}
|
|
70
|
+
let accountIndex = 0;
|
|
71
|
+
const getNextAccount = () => {
|
|
72
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
73
|
+
accountIndex += 1;
|
|
74
|
+
return accountMeta;
|
|
75
|
+
};
|
|
76
|
+
return {
|
|
77
|
+
programAddress: instruction.programAddress,
|
|
78
|
+
accounts: {
|
|
79
|
+
distributor: getNextAccount(),
|
|
80
|
+
from: getNextAccount(),
|
|
81
|
+
to: getNextAccount(),
|
|
82
|
+
claimant: getNextAccount(),
|
|
83
|
+
systemProgram: getNextAccount(),
|
|
84
|
+
tokenProgram: getNextAccount(),
|
|
85
|
+
},
|
|
86
|
+
data: getClawbackInstructionDataDecoder().decode(instruction.data),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
import { type Address, type Codec, type Decoder, type Encoder, type IAccountMeta, type IAccountSignerMeta, type IInstruction, type IInstructionWithAccounts, type IInstructionWithData, type ReadonlyAccount, type ReadonlySignerAccount, type ReadonlyUint8Array, type TransactionSigner, type WritableAccount } from '@solana/kit';
|
|
9
|
+
import { MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS } from '../programs';
|
|
10
|
+
export declare const CLOSE_CLAIM_STATUS_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
|
|
11
|
+
export declare function getCloseClaimStatusDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
|
+
export type CloseClaimStatusInstruction<TProgram extends string = typeof MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS, TAccountClaimStatus extends string | IAccountMeta<string> = string, TAccountClaimant extends string | IAccountMeta<string> = string, TAccountAdmin extends string | IAccountMeta<string> = string, TAccountDistributor extends string | IAccountMeta<string> = string, TRemainingAccounts extends readonly IAccountMeta<string>[] = []> = IInstruction<TProgram> & IInstructionWithData<Uint8Array> & IInstructionWithAccounts<[
|
|
13
|
+
TAccountClaimStatus extends string ? WritableAccount<TAccountClaimStatus> : TAccountClaimStatus,
|
|
14
|
+
TAccountClaimant extends string ? WritableAccount<TAccountClaimant> : TAccountClaimant,
|
|
15
|
+
TAccountAdmin extends string ? ReadonlySignerAccount<TAccountAdmin> & IAccountSignerMeta<TAccountAdmin> : TAccountAdmin,
|
|
16
|
+
TAccountDistributor extends string ? ReadonlyAccount<TAccountDistributor> : TAccountDistributor,
|
|
17
|
+
...TRemainingAccounts
|
|
18
|
+
]>;
|
|
19
|
+
export type CloseClaimStatusInstructionData = {
|
|
20
|
+
discriminator: ReadonlyUint8Array;
|
|
21
|
+
};
|
|
22
|
+
export type CloseClaimStatusInstructionDataArgs = {};
|
|
23
|
+
export declare function getCloseClaimStatusInstructionDataEncoder(): Encoder<CloseClaimStatusInstructionDataArgs>;
|
|
24
|
+
export declare function getCloseClaimStatusInstructionDataDecoder(): Decoder<CloseClaimStatusInstructionData>;
|
|
25
|
+
export declare function getCloseClaimStatusInstructionDataCodec(): Codec<CloseClaimStatusInstructionDataArgs, CloseClaimStatusInstructionData>;
|
|
26
|
+
export type CloseClaimStatusInput<TAccountClaimStatus extends string = string, TAccountClaimant extends string = string, TAccountAdmin extends string = string, TAccountDistributor extends string = string> = {
|
|
27
|
+
claimStatus: Address<TAccountClaimStatus>;
|
|
28
|
+
claimant: Address<TAccountClaimant>;
|
|
29
|
+
admin: TransactionSigner<TAccountAdmin>;
|
|
30
|
+
distributor: Address<TAccountDistributor>;
|
|
31
|
+
};
|
|
32
|
+
export declare function getCloseClaimStatusInstruction<TAccountClaimStatus extends string, TAccountClaimant extends string, TAccountAdmin extends string, TAccountDistributor extends string, TProgramAddress extends Address = typeof MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS>(input: CloseClaimStatusInput<TAccountClaimStatus, TAccountClaimant, TAccountAdmin, TAccountDistributor>, config?: {
|
|
33
|
+
programAddress?: TProgramAddress;
|
|
34
|
+
}): CloseClaimStatusInstruction<TProgramAddress, TAccountClaimStatus, TAccountClaimant, TAccountAdmin, TAccountDistributor>;
|
|
35
|
+
export type ParsedCloseClaimStatusInstruction<TProgram extends string = typeof MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS, TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[]> = {
|
|
36
|
+
programAddress: Address<TProgram>;
|
|
37
|
+
accounts: {
|
|
38
|
+
claimStatus: TAccountMetas[0];
|
|
39
|
+
claimant: TAccountMetas[1];
|
|
40
|
+
admin: TAccountMetas[2];
|
|
41
|
+
distributor: TAccountMetas[3];
|
|
42
|
+
};
|
|
43
|
+
data: CloseClaimStatusInstructionData;
|
|
44
|
+
};
|
|
45
|
+
export declare function parseCloseClaimStatusInstruction<TProgram extends string, TAccountMetas extends readonly IAccountMeta[]>(instruction: IInstruction<TProgram> & IInstructionWithAccounts<TAccountMetas> & IInstructionWithData<Uint8Array>): ParsedCloseClaimStatusInstruction<TProgram, TAccountMetas>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
import { 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 CLOSE_CLAIM_STATUS_DISCRIMINATOR = new Uint8Array([
|
|
12
|
+
163, 214, 191, 165, 245, 188, 17, 185,
|
|
13
|
+
]);
|
|
14
|
+
export function getCloseClaimStatusDiscriminatorBytes() {
|
|
15
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(CLOSE_CLAIM_STATUS_DISCRIMINATOR);
|
|
16
|
+
}
|
|
17
|
+
export function getCloseClaimStatusInstructionDataEncoder() {
|
|
18
|
+
return transformEncoder(getStructEncoder([['discriminator', fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({ ...value, discriminator: CLOSE_CLAIM_STATUS_DISCRIMINATOR }));
|
|
19
|
+
}
|
|
20
|
+
export function getCloseClaimStatusInstructionDataDecoder() {
|
|
21
|
+
return getStructDecoder([
|
|
22
|
+
['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
|
|
23
|
+
]);
|
|
24
|
+
}
|
|
25
|
+
export function getCloseClaimStatusInstructionDataCodec() {
|
|
26
|
+
return combineCodec(getCloseClaimStatusInstructionDataEncoder(), getCloseClaimStatusInstructionDataDecoder());
|
|
27
|
+
}
|
|
28
|
+
export function getCloseClaimStatusInstruction(input, config) {
|
|
29
|
+
// Program address.
|
|
30
|
+
const programAddress = config?.programAddress ?? MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS;
|
|
31
|
+
// Original accounts.
|
|
32
|
+
const originalAccounts = {
|
|
33
|
+
claimStatus: { value: input.claimStatus ?? null, isWritable: true },
|
|
34
|
+
claimant: { value: input.claimant ?? null, isWritable: true },
|
|
35
|
+
admin: { value: input.admin ?? null, isWritable: false },
|
|
36
|
+
distributor: { value: input.distributor ?? null, isWritable: false },
|
|
37
|
+
};
|
|
38
|
+
const accounts = originalAccounts;
|
|
39
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
|
|
40
|
+
const instruction = {
|
|
41
|
+
accounts: [
|
|
42
|
+
getAccountMeta(accounts.claimStatus),
|
|
43
|
+
getAccountMeta(accounts.claimant),
|
|
44
|
+
getAccountMeta(accounts.admin),
|
|
45
|
+
getAccountMeta(accounts.distributor),
|
|
46
|
+
],
|
|
47
|
+
programAddress,
|
|
48
|
+
data: getCloseClaimStatusInstructionDataEncoder().encode({}),
|
|
49
|
+
};
|
|
50
|
+
return instruction;
|
|
51
|
+
}
|
|
52
|
+
export function parseCloseClaimStatusInstruction(instruction) {
|
|
53
|
+
if (instruction.accounts.length < 4) {
|
|
54
|
+
// TODO: Coded error.
|
|
55
|
+
throw new Error('Not enough accounts');
|
|
56
|
+
}
|
|
57
|
+
let accountIndex = 0;
|
|
58
|
+
const getNextAccount = () => {
|
|
59
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
60
|
+
accountIndex += 1;
|
|
61
|
+
return accountMeta;
|
|
62
|
+
};
|
|
63
|
+
return {
|
|
64
|
+
programAddress: instruction.programAddress,
|
|
65
|
+
accounts: {
|
|
66
|
+
claimStatus: getNextAccount(),
|
|
67
|
+
claimant: getNextAccount(),
|
|
68
|
+
admin: getNextAccount(),
|
|
69
|
+
distributor: getNextAccount(),
|
|
70
|
+
},
|
|
71
|
+
data: getCloseClaimStatusInstructionDataDecoder().decode(instruction.data),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
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 CLOSE_DISTRIBUTOR_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
|
|
11
|
+
export declare function getCloseDistributorDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
|
+
export type CloseDistributorInstruction<TProgram extends string = typeof MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS, TAccountDistributor extends string | IAccountMeta<string> = string, TAccountTokenVault extends string | IAccountMeta<string> = string, TAccountAdmin extends string | IAccountMeta<string> = string, TAccountDestinationTokenAccount 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
|
+
TAccountTokenVault extends string ? WritableAccount<TAccountTokenVault> : TAccountTokenVault,
|
|
15
|
+
TAccountAdmin extends string ? WritableSignerAccount<TAccountAdmin> & IAccountSignerMeta<TAccountAdmin> : TAccountAdmin,
|
|
16
|
+
TAccountDestinationTokenAccount extends string ? WritableAccount<TAccountDestinationTokenAccount> : TAccountDestinationTokenAccount,
|
|
17
|
+
TAccountTokenProgram extends string ? ReadonlyAccount<TAccountTokenProgram> : TAccountTokenProgram,
|
|
18
|
+
...TRemainingAccounts
|
|
19
|
+
]>;
|
|
20
|
+
export type CloseDistributorInstructionData = {
|
|
21
|
+
discriminator: ReadonlyUint8Array;
|
|
22
|
+
};
|
|
23
|
+
export type CloseDistributorInstructionDataArgs = {};
|
|
24
|
+
export declare function getCloseDistributorInstructionDataEncoder(): Encoder<CloseDistributorInstructionDataArgs>;
|
|
25
|
+
export declare function getCloseDistributorInstructionDataDecoder(): Decoder<CloseDistributorInstructionData>;
|
|
26
|
+
export declare function getCloseDistributorInstructionDataCodec(): Codec<CloseDistributorInstructionDataArgs, CloseDistributorInstructionData>;
|
|
27
|
+
export type CloseDistributorInput<TAccountDistributor extends string = string, TAccountTokenVault extends string = string, TAccountAdmin extends string = string, TAccountDestinationTokenAccount extends string = string, TAccountTokenProgram extends string = string> = {
|
|
28
|
+
/** [MerkleDistributor]. */
|
|
29
|
+
distributor: Address<TAccountDistributor>;
|
|
30
|
+
/** Clawback receiver token account */
|
|
31
|
+
tokenVault: Address<TAccountTokenVault>;
|
|
32
|
+
/**
|
|
33
|
+
* Admin wallet, responsible for creating the distributor and paying for the transaction.
|
|
34
|
+
* Also has the authority to set the clawback receiver and change itself.
|
|
35
|
+
*/
|
|
36
|
+
admin: TransactionSigner<TAccountAdmin>;
|
|
37
|
+
/** account receive token back */
|
|
38
|
+
destinationTokenAccount: Address<TAccountDestinationTokenAccount>;
|
|
39
|
+
/** The [Token] program. */
|
|
40
|
+
tokenProgram?: Address<TAccountTokenProgram>;
|
|
41
|
+
};
|
|
42
|
+
export declare function getCloseDistributorInstruction<TAccountDistributor extends string, TAccountTokenVault extends string, TAccountAdmin extends string, TAccountDestinationTokenAccount extends string, TAccountTokenProgram extends string, TProgramAddress extends Address = typeof MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS>(input: CloseDistributorInput<TAccountDistributor, TAccountTokenVault, TAccountAdmin, TAccountDestinationTokenAccount, TAccountTokenProgram>, config?: {
|
|
43
|
+
programAddress?: TProgramAddress;
|
|
44
|
+
}): CloseDistributorInstruction<TProgramAddress, TAccountDistributor, TAccountTokenVault, TAccountAdmin, TAccountDestinationTokenAccount, TAccountTokenProgram>;
|
|
45
|
+
export type ParsedCloseDistributorInstruction<TProgram extends string = typeof MERKLE_DISTRIBUTOR_PROGRAM_ADDRESS, TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[]> = {
|
|
46
|
+
programAddress: Address<TProgram>;
|
|
47
|
+
accounts: {
|
|
48
|
+
/** [MerkleDistributor]. */
|
|
49
|
+
distributor: TAccountMetas[0];
|
|
50
|
+
/** Clawback receiver token account */
|
|
51
|
+
tokenVault: TAccountMetas[1];
|
|
52
|
+
/**
|
|
53
|
+
* Admin wallet, responsible for creating the distributor and paying for the transaction.
|
|
54
|
+
* Also has the authority to set the clawback receiver and change itself.
|
|
55
|
+
*/
|
|
56
|
+
admin: TAccountMetas[2];
|
|
57
|
+
/** account receive token back */
|
|
58
|
+
destinationTokenAccount: TAccountMetas[3];
|
|
59
|
+
/** The [Token] program. */
|
|
60
|
+
tokenProgram: TAccountMetas[4];
|
|
61
|
+
};
|
|
62
|
+
data: CloseDistributorInstructionData;
|
|
63
|
+
};
|
|
64
|
+
export declare function parseCloseDistributorInstruction<TProgram extends string, TAccountMetas extends readonly IAccountMeta[]>(instruction: IInstruction<TProgram> & IInstructionWithAccounts<TAccountMetas> & IInstructionWithData<Uint8Array>): ParsedCloseDistributorInstruction<TProgram, TAccountMetas>;
|
|
@@ -0,0 +1,84 @@
|
|
|
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 CLOSE_DISTRIBUTOR_DISCRIMINATOR = new Uint8Array([
|
|
12
|
+
202, 56, 180, 143, 46, 104, 106, 112,
|
|
13
|
+
]);
|
|
14
|
+
export function getCloseDistributorDiscriminatorBytes() {
|
|
15
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(CLOSE_DISTRIBUTOR_DISCRIMINATOR);
|
|
16
|
+
}
|
|
17
|
+
export function getCloseDistributorInstructionDataEncoder() {
|
|
18
|
+
return transformEncoder(getStructEncoder([['discriminator', fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({ ...value, discriminator: CLOSE_DISTRIBUTOR_DISCRIMINATOR }));
|
|
19
|
+
}
|
|
20
|
+
export function getCloseDistributorInstructionDataDecoder() {
|
|
21
|
+
return getStructDecoder([
|
|
22
|
+
['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
|
|
23
|
+
]);
|
|
24
|
+
}
|
|
25
|
+
export function getCloseDistributorInstructionDataCodec() {
|
|
26
|
+
return combineCodec(getCloseDistributorInstructionDataEncoder(), getCloseDistributorInstructionDataDecoder());
|
|
27
|
+
}
|
|
28
|
+
export function getCloseDistributorInstruction(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
|
+
tokenVault: { value: input.tokenVault ?? null, isWritable: true },
|
|
35
|
+
admin: { value: input.admin ?? null, isWritable: true },
|
|
36
|
+
destinationTokenAccount: {
|
|
37
|
+
value: input.destinationTokenAccount ?? null,
|
|
38
|
+
isWritable: true,
|
|
39
|
+
},
|
|
40
|
+
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
41
|
+
};
|
|
42
|
+
const accounts = originalAccounts;
|
|
43
|
+
// Resolve default values.
|
|
44
|
+
if (!accounts.tokenProgram.value) {
|
|
45
|
+
accounts.tokenProgram.value =
|
|
46
|
+
'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
|
|
47
|
+
}
|
|
48
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
|
|
49
|
+
const instruction = {
|
|
50
|
+
accounts: [
|
|
51
|
+
getAccountMeta(accounts.distributor),
|
|
52
|
+
getAccountMeta(accounts.tokenVault),
|
|
53
|
+
getAccountMeta(accounts.admin),
|
|
54
|
+
getAccountMeta(accounts.destinationTokenAccount),
|
|
55
|
+
getAccountMeta(accounts.tokenProgram),
|
|
56
|
+
],
|
|
57
|
+
programAddress,
|
|
58
|
+
data: getCloseDistributorInstructionDataEncoder().encode({}),
|
|
59
|
+
};
|
|
60
|
+
return instruction;
|
|
61
|
+
}
|
|
62
|
+
export function parseCloseDistributorInstruction(instruction) {
|
|
63
|
+
if (instruction.accounts.length < 5) {
|
|
64
|
+
// TODO: Coded error.
|
|
65
|
+
throw new Error('Not enough accounts');
|
|
66
|
+
}
|
|
67
|
+
let accountIndex = 0;
|
|
68
|
+
const getNextAccount = () => {
|
|
69
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
70
|
+
accountIndex += 1;
|
|
71
|
+
return accountMeta;
|
|
72
|
+
};
|
|
73
|
+
return {
|
|
74
|
+
programAddress: instruction.programAddress,
|
|
75
|
+
accounts: {
|
|
76
|
+
distributor: getNextAccount(),
|
|
77
|
+
tokenVault: getNextAccount(),
|
|
78
|
+
admin: getNextAccount(),
|
|
79
|
+
destinationTokenAccount: getNextAccount(),
|
|
80
|
+
tokenProgram: getNextAccount(),
|
|
81
|
+
},
|
|
82
|
+
data: getCloseDistributorInstructionDataDecoder().decode(instruction.data),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
export * from './claimLocked';
|
|
9
|
+
export * from './clawback';
|
|
10
|
+
export * from './closeClaimStatus';
|
|
11
|
+
export * from './closeDistributor';
|
|
12
|
+
export * from './newClaim';
|
|
13
|
+
export * from './newDistributor';
|
|
14
|
+
export * from './setAdmin';
|
|
15
|
+
export * from './setClawbackReceiver';
|
|
16
|
+
export * from './setEnableSlot';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
export * from './claimLocked';
|
|
9
|
+
export * from './clawback';
|
|
10
|
+
export * from './closeClaimStatus';
|
|
11
|
+
export * from './closeDistributor';
|
|
12
|
+
export * from './newClaim';
|
|
13
|
+
export * from './newDistributor';
|
|
14
|
+
export * from './setAdmin';
|
|
15
|
+
export * from './setClawbackReceiver';
|
|
16
|
+
export * from './setEnableSlot';
|