Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions clients/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"prepublishOnly": "pnpm build"
},
"dependencies": {
"@solana-program/system": "^0.14.0",
"@solana-program/system": "^0.15.0",
"commander": "^13.0.0",
"pako": "^2.1.0",
"picocolors": "^1.1.1",
Expand All @@ -56,7 +56,7 @@
},
"devDependencies": {
"@solana-config/oxc": "^0.1.1",
"@solana/kit": "^8.0.0",
"@solana/kit": "^8.3.0",
"@solana/kit-plugin-litesvm": "^0.18.0",
"@solana/kit-plugin-rpc": "^0.18.0",
"@solana/kit-plugin-signer": "^0.18.0",
Expand All @@ -72,7 +72,7 @@
"vitest": "^4.0.15"
},
"peerDependencies": {
"@solana/kit": "^8.0.0"
"@solana/kit": "^8.3.0"
},
"devEngines": {
"runtime": {
Expand Down
2,380 changes: 763 additions & 1,617 deletions clients/js/pnpm-lock.yaml

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion clients/js/src/createBuffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
sequentialInstructionPlan,
TransactionSigner,
} from '@solana/kit';
import { type InstructionSignerInput } from '@solana/kit/program-client-core';

import {
Buffer,
Expand Down Expand Up @@ -35,7 +36,7 @@ export async function getCreateBufferInstructionPlan(
client: ClientWithGetMinimumBalance,
input: {
newBuffer: TransactionSigner;
authority: TransactionSigner;
authority: InstructionSignerInput;
Comment thread
lorisleiva marked this conversation as resolved.
payer: TransactionSigner;
sourceBuffer?: Account<Buffer>;
closeSourceBuffer?: Address | boolean;
Expand Down
2 changes: 1 addition & 1 deletion clients/js/src/generated/accounts/buffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import {
type OptionOrNullable,
type ReadonlyUint8Array,
} from '@solana/kit';
import { findMetadataPda, MetadataSeeds } from '../pdas';
import { findMetadataPda, type MetadataSeeds } from '../pdas';
import {
AccountDiscriminator,
getAccountDiscriminatorDecoder,
Expand Down
2 changes: 1 addition & 1 deletion clients/js/src/generated/accounts/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import {
type OptionOrNullable,
type ReadonlyUint8Array,
} from '@solana/kit';
import { findMetadataPda, MetadataSeeds } from '../pdas';
import { findMetadataPda, type MetadataSeeds } from '../pdas';
import {
AccountDiscriminator,
getAccountDiscriminatorDecoder,
Expand Down
74 changes: 41 additions & 33 deletions clients/js/src/generated/instructions/allocate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,16 @@ import {
type ReadonlyAccount,
type ReadonlySignerAccount,
type ReadonlyUint8Array,
type TransactionSigner,
type WritableAccount,
} from '@solana/kit';
import { getAccountMetaFactory, type ResolvedInstructionAccount } from '@solana/kit/program-client-core';
import {
getAccountMetaFactory,
type InstructionAccountInput,
type InstructionAccountInputAddress,
type InstructionSignerInput,
type ResolvedInstructionAccount,
type ResolvedInstructionAccountMeta,
} from '@solana/kit/program-client-core';
import { PROGRAM_METADATA_PROGRAM_ADDRESS } from '../programs';
import { getSeedDecoder, getSeedEncoder, type Seed, type SeedArgs } from '../types';

Expand Down Expand Up @@ -101,53 +107,56 @@ export function getAllocateInstructionDataCodec(): Codec<AllocateInstructionData
}

export type AllocateInput<
TAccountBuffer extends string = string,
TAccountAuthority extends string = string,
TAccountProgram extends string = string,
TAccountProgramData extends string = string,
TAccountSystem extends string = string,
TAccountBuffer extends InstructionAccountInput = InstructionAccountInput,
TAccountAuthority extends InstructionSignerInput = InstructionSignerInput,
TAccountProgram extends InstructionAccountInput = InstructionAccountInput,
TAccountProgramData extends InstructionAccountInput = InstructionAccountInput,
TAccountSystem extends InstructionAccountInput = InstructionAccountInput,
> = {
/** Buffer account to allocate. */
buffer: Address<TAccountBuffer>;
buffer: TAccountBuffer;
/** Authority account. */
authority: TransactionSigner<TAccountAuthority>;
authority: TAccountAuthority;
/** Program account. */
program?: Address<TAccountProgram>;
program?: TAccountProgram;
/** Program data account. */
programData?: Address<TAccountProgramData>;
programData?: TAccountProgramData;
/** System program. */
system?: Address<TAccountSystem>;
system?: TAccountSystem;
seed?: AllocateInstructionDataArgs['seed'];
};

export function getAllocateInstruction<
TAccountBuffer extends string,
TAccountAuthority extends string,
TAccountProgram extends string,
TAccountProgramData extends string,
TAccountSystem extends string,
TAccountBuffer extends InstructionAccountInput,
TAccountAuthority extends InstructionSignerInput,
TAccountProgram extends InstructionAccountInput,
TAccountProgramData extends InstructionAccountInput,
TAccountSystem extends InstructionAccountInput,
TProgramAddress extends Address = typeof PROGRAM_METADATA_PROGRAM_ADDRESS,
>(
input: AllocateInput<TAccountBuffer, TAccountAuthority, TAccountProgram, TAccountProgramData, TAccountSystem>,
config?: { programAddress?: TProgramAddress },
): AllocateInstruction<
TProgramAddress,
TAccountBuffer,
TAccountAuthority,
TAccountProgram,
TAccountProgramData,
TAccountSystem
ResolvedInstructionAccountMeta<TAccountBuffer, InstructionAccountInputAddress<TAccountBuffer>>,
ResolvedInstructionAccountMeta<TAccountAuthority, InstructionAccountInputAddress<TAccountAuthority>>,
ResolvedInstructionAccountMeta<TAccountProgram, InstructionAccountInputAddress<TAccountProgram>>,
ResolvedInstructionAccountMeta<TAccountProgramData, InstructionAccountInputAddress<TAccountProgramData>>,
ResolvedInstructionAccountMeta<TAccountSystem, InstructionAccountInputAddress<TAccountSystem>>
> {
// Program address.
const programAddress = config?.programAddress ?? PROGRAM_METADATA_PROGRAM_ADDRESS;

// Account meta helper.
const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');

// Original accounts.
const originalAccounts = {
buffer: { value: input.buffer ?? null, isWritable: true },
authority: { value: input.authority ?? null, isWritable: false },
program: { value: input.program ?? null, isWritable: false },
programData: { value: input.programData ?? null, isWritable: false },
system: { value: input.system ?? null, isWritable: false },
buffer: { value: input.buffer ?? null, isSigner: false, isWritable: true },
authority: { value: input.authority ?? null, isSigner: true, isWritable: false },
program: { value: input.program ?? null, isSigner: false, isWritable: false },
programData: { value: input.programData ?? null, isSigner: false, isWritable: false },
system: { value: input.system ?? null, isSigner: false, isWritable: false },
};
const accounts = originalAccounts as Record<keyof typeof originalAccounts, ResolvedInstructionAccount>;

Expand All @@ -159,7 +168,6 @@ export function getAllocateInstruction<
accounts.system.value = '11111111111111111111111111111111' as Address<'11111111111111111111111111111111'>;
}

const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
return Object.freeze({
accounts: [
getAccountMeta('buffer', accounts.buffer),
Expand All @@ -172,11 +180,11 @@ export function getAllocateInstruction<
programAddress,
} as AllocateInstruction<
TProgramAddress,
TAccountBuffer,
TAccountAuthority,
TAccountProgram,
TAccountProgramData,
TAccountSystem
ResolvedInstructionAccountMeta<TAccountBuffer, InstructionAccountInputAddress<TAccountBuffer>>,
ResolvedInstructionAccountMeta<TAccountAuthority, InstructionAccountInputAddress<TAccountAuthority>>,
ResolvedInstructionAccountMeta<TAccountProgram, InstructionAccountInputAddress<TAccountProgram>>,
ResolvedInstructionAccountMeta<TAccountProgramData, InstructionAccountInputAddress<TAccountProgramData>>,
ResolvedInstructionAccountMeta<TAccountSystem, InstructionAccountInputAddress<TAccountSystem>>
>);
}

Expand Down
74 changes: 41 additions & 33 deletions clients/js/src/generated/instructions/close.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,16 @@ import {
type ReadonlyAccount,
type ReadonlySignerAccount,
type ReadonlyUint8Array,
type TransactionSigner,
type WritableAccount,
} from '@solana/kit';
import { getAccountMetaFactory, type ResolvedInstructionAccount } from '@solana/kit/program-client-core';
import {
getAccountMetaFactory,
type InstructionAccountInput,
type InstructionAccountInputAddress,
type InstructionSignerInput,
type ResolvedInstructionAccount,
type ResolvedInstructionAccountMeta,
} from '@solana/kit/program-client-core';
import { PROGRAM_METADATA_PROGRAM_ADDRESS } from '../programs';

export const CLOSE_DISCRIMINATOR = 6;
Expand Down Expand Up @@ -82,56 +88,58 @@ export function getCloseInstructionDataCodec(): FixedSizeCodec<CloseInstructionD
}

export type CloseInput<
TAccountAccount extends string = string,
TAccountAuthority extends string = string,
TAccountProgram extends string = string,
TAccountProgramData extends string = string,
TAccountDestination extends string = string,
TAccountAccount extends InstructionAccountInput = InstructionAccountInput,
TAccountAuthority extends InstructionSignerInput = InstructionSignerInput,
TAccountProgram extends InstructionAccountInput = InstructionAccountInput,
TAccountProgramData extends InstructionAccountInput = InstructionAccountInput,
TAccountDestination extends InstructionAccountInput = InstructionAccountInput,
> = {
/** Account to close. */
account: Address<TAccountAccount>;
account: TAccountAccount;
/** Authority account. */
authority: TransactionSigner<TAccountAuthority>;
authority: TAccountAuthority;
/** Program account. */
program?: Address<TAccountProgram>;
program?: TAccountProgram;
/** Program data account. */
programData?: Address<TAccountProgramData>;
programData?: TAccountProgramData;
/** Destination account. */
destination: Address<TAccountDestination>;
destination: TAccountDestination;
};

export function getCloseInstruction<
TAccountAccount extends string,
TAccountAuthority extends string,
TAccountProgram extends string,
TAccountProgramData extends string,
TAccountDestination extends string,
TAccountAccount extends InstructionAccountInput,
TAccountAuthority extends InstructionSignerInput,
TAccountProgram extends InstructionAccountInput,
TAccountProgramData extends InstructionAccountInput,
TAccountDestination extends InstructionAccountInput,
TProgramAddress extends Address = typeof PROGRAM_METADATA_PROGRAM_ADDRESS,
>(
input: CloseInput<TAccountAccount, TAccountAuthority, TAccountProgram, TAccountProgramData, TAccountDestination>,
config?: { programAddress?: TProgramAddress },
): CloseInstruction<
TProgramAddress,
TAccountAccount,
TAccountAuthority,
TAccountProgram,
TAccountProgramData,
TAccountDestination
ResolvedInstructionAccountMeta<TAccountAccount, InstructionAccountInputAddress<TAccountAccount>>,
ResolvedInstructionAccountMeta<TAccountAuthority, InstructionAccountInputAddress<TAccountAuthority>>,
ResolvedInstructionAccountMeta<TAccountProgram, InstructionAccountInputAddress<TAccountProgram>>,
ResolvedInstructionAccountMeta<TAccountProgramData, InstructionAccountInputAddress<TAccountProgramData>>,
ResolvedInstructionAccountMeta<TAccountDestination, InstructionAccountInputAddress<TAccountDestination>>
> {
// Program address.
const programAddress = config?.programAddress ?? PROGRAM_METADATA_PROGRAM_ADDRESS;

// Account meta helper.
const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');

// Original accounts.
const originalAccounts = {
account: { value: input.account ?? null, isWritable: true },
authority: { value: input.authority ?? null, isWritable: false },
program: { value: input.program ?? null, isWritable: false },
programData: { value: input.programData ?? null, isWritable: false },
destination: { value: input.destination ?? null, isWritable: true },
account: { value: input.account ?? null, isSigner: false, isWritable: true },
authority: { value: input.authority ?? null, isSigner: true, isWritable: false },
program: { value: input.program ?? null, isSigner: false, isWritable: false },
programData: { value: input.programData ?? null, isSigner: false, isWritable: false },
destination: { value: input.destination ?? null, isSigner: false, isWritable: true },
};
const accounts = originalAccounts as Record<keyof typeof originalAccounts, ResolvedInstructionAccount>;

const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
return Object.freeze({
accounts: [
getAccountMeta('account', accounts.account),
Expand All @@ -144,11 +152,11 @@ export function getCloseInstruction<
programAddress,
} as CloseInstruction<
TProgramAddress,
TAccountAccount,
TAccountAuthority,
TAccountProgram,
TAccountProgramData,
TAccountDestination
ResolvedInstructionAccountMeta<TAccountAccount, InstructionAccountInputAddress<TAccountAccount>>,
ResolvedInstructionAccountMeta<TAccountAuthority, InstructionAccountInputAddress<TAccountAuthority>>,
ResolvedInstructionAccountMeta<TAccountProgram, InstructionAccountInputAddress<TAccountProgram>>,
ResolvedInstructionAccountMeta<TAccountProgramData, InstructionAccountInputAddress<TAccountProgramData>>,
ResolvedInstructionAccountMeta<TAccountDestination, InstructionAccountInputAddress<TAccountDestination>>
>);
}

Expand Down
Loading
Loading