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 @@ -42,13 +42,13 @@
},
"homepage": "https://github.com/solana-program/system#readme",
"peerDependencies": {
"@solana/kit": "^2.1.0"
"@solana/kit": "^3.0"
},
"devDependencies": {
"@ava/typescript": "^4.1.0",
"@solana/eslint-config-solana": "^3.0.3",
"@solana/kit": "^2.1.0",
"@types/node": "^20",
"@solana/kit": "^3.0",
"@types/node": "^24",
"@typescript-eslint/eslint-plugin": "^7.16.1",
"@typescript-eslint/parser": "^7.16.1",
"ava": "^6.1.3",
Expand Down
691 changes: 366 additions & 325 deletions clients/js/pnpm-lock.yaml

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions clients/js/src/generated/accounts/nonce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ import {
getU64Encoder,
type Account,
type Address,
type Codec,
type Decoder,
type EncodedAccount,
type Encoder,
type FetchAccountConfig,
type FetchAccountsConfig,
type FixedSizeCodec,
type FixedSizeDecoder,
type FixedSizeEncoder,
type MaybeAccount,
type MaybeEncodedAccount,
} from '@solana/kit';
Expand Down Expand Up @@ -57,7 +57,7 @@ export type NonceArgs = {
lamportsPerSignature: number | bigint;
};

export function getNonceEncoder(): Encoder<NonceArgs> {
export function getNonceEncoder(): FixedSizeEncoder<NonceArgs> {
return getStructEncoder([
['version', getNonceVersionEncoder()],
['state', getNonceStateEncoder()],
Expand All @@ -67,7 +67,7 @@ export function getNonceEncoder(): Encoder<NonceArgs> {
]);
}

export function getNonceDecoder(): Decoder<Nonce> {
export function getNonceDecoder(): FixedSizeDecoder<Nonce> {
return getStructDecoder([
['version', getNonceVersionDecoder()],
['state', getNonceStateDecoder()],
Expand All @@ -77,7 +77,7 @@ export function getNonceDecoder(): Decoder<Nonce> {
]);
}

export function getNonceCodec(): Codec<NonceArgs, Nonce> {
export function getNonceCodec(): FixedSizeCodec<NonceArgs, Nonce> {
return combineCodec(getNonceEncoder(), getNonceDecoder());
}

Expand Down
51 changes: 26 additions & 25 deletions clients/js/src/generated/instructions/advanceNonceAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@ import {
getU32Decoder,
getU32Encoder,
transformEncoder,
type AccountMeta,
type AccountSignerMeta,
type Address,
type Codec,
type Decoder,
type Encoder,
type IAccountMeta,
type IAccountSignerMeta,
type IInstruction,
type IInstructionWithAccounts,
type IInstructionWithData,
type FixedSizeCodec,
type FixedSizeDecoder,
type FixedSizeEncoder,
type Instruction,
type InstructionWithAccounts,
type InstructionWithData,
type ReadonlyAccount,
type ReadonlySignerAccount,
type ReadonlyUint8Array,
type TransactionSigner,
type WritableAccount,
} from '@solana/kit';
Expand All @@ -38,15 +39,15 @@ export function getAdvanceNonceAccountDiscriminatorBytes() {

export type AdvanceNonceAccountInstruction<
TProgram extends string = typeof SYSTEM_PROGRAM_ADDRESS,
TAccountNonceAccount extends string | IAccountMeta<string> = string,
TAccountNonceAccount extends string | AccountMeta<string> = string,
TAccountRecentBlockhashesSysvar extends
| string
| IAccountMeta<string> = 'SysvarRecentB1ockHashes11111111111111111111',
TAccountNonceAuthority extends string | IAccountMeta<string> = string,
TRemainingAccounts extends readonly IAccountMeta<string>[] = [],
> = IInstruction<TProgram> &
IInstructionWithData<Uint8Array> &
IInstructionWithAccounts<
| AccountMeta<string> = 'SysvarRecentB1ockHashes11111111111111111111',
TAccountNonceAuthority extends string | AccountMeta<string> = string,
TRemainingAccounts extends readonly AccountMeta<string>[] = [],
> = Instruction<TProgram> &
InstructionWithData<ReadonlyUint8Array> &
InstructionWithAccounts<
[
TAccountNonceAccount extends string
? WritableAccount<TAccountNonceAccount>
Expand All @@ -56,7 +57,7 @@ export type AdvanceNonceAccountInstruction<
: TAccountRecentBlockhashesSysvar,
TAccountNonceAuthority extends string
? ReadonlySignerAccount<TAccountNonceAuthority> &
IAccountSignerMeta<TAccountNonceAuthority>
AccountSignerMeta<TAccountNonceAuthority>
: TAccountNonceAuthority,
...TRemainingAccounts,
]
Expand All @@ -66,7 +67,7 @@ export type AdvanceNonceAccountInstructionData = { discriminator: number };

export type AdvanceNonceAccountInstructionDataArgs = {};

export function getAdvanceNonceAccountInstructionDataEncoder(): Encoder<AdvanceNonceAccountInstructionDataArgs> {
export function getAdvanceNonceAccountInstructionDataEncoder(): FixedSizeEncoder<AdvanceNonceAccountInstructionDataArgs> {
return transformEncoder(
getStructEncoder([['discriminator', getU32Encoder()]]),
(value) => ({
Expand All @@ -76,11 +77,11 @@ export function getAdvanceNonceAccountInstructionDataEncoder(): Encoder<AdvanceN
);
}

export function getAdvanceNonceAccountInstructionDataDecoder(): Decoder<AdvanceNonceAccountInstructionData> {
export function getAdvanceNonceAccountInstructionDataDecoder(): FixedSizeDecoder<AdvanceNonceAccountInstructionData> {
return getStructDecoder([['discriminator', getU32Decoder()]]);
}

export function getAdvanceNonceAccountInstructionDataCodec(): Codec<
export function getAdvanceNonceAccountInstructionDataCodec(): FixedSizeCodec<
AdvanceNonceAccountInstructionDataArgs,
AdvanceNonceAccountInstructionData
> {
Expand Down Expand Up @@ -162,7 +163,7 @@ export function getAdvanceNonceAccountInstruction<

export type ParsedAdvanceNonceAccountInstruction<
TProgram extends string = typeof SYSTEM_PROGRAM_ADDRESS,
TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[],
TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[],
> = {
programAddress: Address<TProgram>;
accounts: {
Expand All @@ -175,19 +176,19 @@ export type ParsedAdvanceNonceAccountInstruction<

export function parseAdvanceNonceAccountInstruction<
TProgram extends string,
TAccountMetas extends readonly IAccountMeta[],
TAccountMetas extends readonly AccountMeta[],
>(
instruction: IInstruction<TProgram> &
IInstructionWithAccounts<TAccountMetas> &
IInstructionWithData<Uint8Array>
instruction: Instruction<TProgram> &
InstructionWithAccounts<TAccountMetas> &
InstructionWithData<ReadonlyUint8Array>
): ParsedAdvanceNonceAccountInstruction<TProgram, TAccountMetas> {
if (instruction.accounts.length < 3) {
// TODO: Coded error.
throw new Error('Not enough accounts');
}
let accountIndex = 0;
const getNextAccount = () => {
const accountMeta = instruction.accounts![accountIndex]!;
const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;
accountIndex += 1;
return accountMeta;
};
Expand Down
47 changes: 24 additions & 23 deletions clients/js/src/generated/instructions/allocate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@ import {
getU64Decoder,
getU64Encoder,
transformEncoder,
type AccountMeta,
type AccountSignerMeta,
type Address,
type Codec,
type Decoder,
type Encoder,
type IAccountMeta,
type IAccountSignerMeta,
type IInstruction,
type IInstructionWithAccounts,
type IInstructionWithData,
type FixedSizeCodec,
type FixedSizeDecoder,
type FixedSizeEncoder,
type Instruction,
type InstructionWithAccounts,
type InstructionWithData,
type ReadonlyUint8Array,
type TransactionSigner,
type WritableSignerAccount,
} from '@solana/kit';
Expand All @@ -38,15 +39,15 @@ export function getAllocateDiscriminatorBytes() {

export type AllocateInstruction<
TProgram extends string = typeof SYSTEM_PROGRAM_ADDRESS,
TAccountNewAccount extends string | IAccountMeta<string> = string,
TRemainingAccounts extends readonly IAccountMeta<string>[] = [],
> = IInstruction<TProgram> &
IInstructionWithData<Uint8Array> &
IInstructionWithAccounts<
TAccountNewAccount extends string | AccountMeta<string> = string,
TRemainingAccounts extends readonly AccountMeta<string>[] = [],
> = Instruction<TProgram> &
InstructionWithData<ReadonlyUint8Array> &
InstructionWithAccounts<
[
TAccountNewAccount extends string
? WritableSignerAccount<TAccountNewAccount> &
IAccountSignerMeta<TAccountNewAccount>
AccountSignerMeta<TAccountNewAccount>
: TAccountNewAccount,
...TRemainingAccounts,
]
Expand All @@ -56,7 +57,7 @@ export type AllocateInstructionData = { discriminator: number; space: bigint };

export type AllocateInstructionDataArgs = { space: number | bigint };

export function getAllocateInstructionDataEncoder(): Encoder<AllocateInstructionDataArgs> {
export function getAllocateInstructionDataEncoder(): FixedSizeEncoder<AllocateInstructionDataArgs> {
return transformEncoder(
getStructEncoder([
['discriminator', getU32Encoder()],
Expand All @@ -66,14 +67,14 @@ export function getAllocateInstructionDataEncoder(): Encoder<AllocateInstruction
);
}

export function getAllocateInstructionDataDecoder(): Decoder<AllocateInstructionData> {
export function getAllocateInstructionDataDecoder(): FixedSizeDecoder<AllocateInstructionData> {
return getStructDecoder([
['discriminator', getU32Decoder()],
['space', getU64Decoder()],
]);
}

export function getAllocateInstructionDataCodec(): Codec<
export function getAllocateInstructionDataCodec(): FixedSizeCodec<
AllocateInstructionDataArgs,
AllocateInstructionData
> {
Expand Down Expand Up @@ -124,7 +125,7 @@ export function getAllocateInstruction<

export type ParsedAllocateInstruction<
TProgram extends string = typeof SYSTEM_PROGRAM_ADDRESS,
TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[],
TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[],
> = {
programAddress: Address<TProgram>;
accounts: {
Expand All @@ -135,19 +136,19 @@ export type ParsedAllocateInstruction<

export function parseAllocateInstruction<
TProgram extends string,
TAccountMetas extends readonly IAccountMeta[],
TAccountMetas extends readonly AccountMeta[],
>(
instruction: IInstruction<TProgram> &
IInstructionWithAccounts<TAccountMetas> &
IInstructionWithData<Uint8Array>
instruction: Instruction<TProgram> &
InstructionWithAccounts<TAccountMetas> &
InstructionWithData<ReadonlyUint8Array>
): ParsedAllocateInstruction<TProgram, TAccountMetas> {
if (instruction.accounts.length < 1) {
// TODO: Coded error.
throw new Error('Not enough accounts');
}
let accountIndex = 0;
const getNextAccount = () => {
const accountMeta = instruction.accounts![accountIndex]!;
const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;
accountIndex += 1;
return accountMeta;
};
Expand Down
37 changes: 19 additions & 18 deletions clients/js/src/generated/instructions/allocateWithSeed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@ import {
getUtf8Decoder,
getUtf8Encoder,
transformEncoder,
type AccountMeta,
type AccountSignerMeta,
type Address,
type Codec,
type Decoder,
type Encoder,
type IAccountMeta,
type IAccountSignerMeta,
type IInstruction,
type IInstructionWithAccounts,
type IInstructionWithData,
type Instruction,
type InstructionWithAccounts,
type InstructionWithData,
type ReadonlySignerAccount,
type ReadonlyUint8Array,
type TransactionSigner,
type WritableAccount,
} from '@solana/kit';
Expand All @@ -45,19 +46,19 @@ export function getAllocateWithSeedDiscriminatorBytes() {

export type AllocateWithSeedInstruction<
TProgram extends string = typeof SYSTEM_PROGRAM_ADDRESS,
TAccountNewAccount extends string | IAccountMeta<string> = string,
TAccountBaseAccount extends string | IAccountMeta<string> = string,
TRemainingAccounts extends readonly IAccountMeta<string>[] = [],
> = IInstruction<TProgram> &
IInstructionWithData<Uint8Array> &
IInstructionWithAccounts<
TAccountNewAccount extends string | AccountMeta<string> = string,
TAccountBaseAccount extends string | AccountMeta<string> = string,
TRemainingAccounts extends readonly AccountMeta<string>[] = [],
> = Instruction<TProgram> &
InstructionWithData<ReadonlyUint8Array> &
InstructionWithAccounts<
[
TAccountNewAccount extends string
? WritableAccount<TAccountNewAccount>
: TAccountNewAccount,
TAccountBaseAccount extends string
? ReadonlySignerAccount<TAccountBaseAccount> &
IAccountSignerMeta<TAccountBaseAccount>
AccountSignerMeta<TAccountBaseAccount>
: TAccountBaseAccount,
...TRemainingAccounts,
]
Expand Down Expand Up @@ -172,7 +173,7 @@ export function getAllocateWithSeedInstruction<

export type ParsedAllocateWithSeedInstruction<
TProgram extends string = typeof SYSTEM_PROGRAM_ADDRESS,
TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[],
TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[],
> = {
programAddress: Address<TProgram>;
accounts: {
Expand All @@ -184,19 +185,19 @@ export type ParsedAllocateWithSeedInstruction<

export function parseAllocateWithSeedInstruction<
TProgram extends string,
TAccountMetas extends readonly IAccountMeta[],
TAccountMetas extends readonly AccountMeta[],
>(
instruction: IInstruction<TProgram> &
IInstructionWithAccounts<TAccountMetas> &
IInstructionWithData<Uint8Array>
instruction: Instruction<TProgram> &
InstructionWithAccounts<TAccountMetas> &
InstructionWithData<ReadonlyUint8Array>
): ParsedAllocateWithSeedInstruction<TProgram, TAccountMetas> {
if (instruction.accounts.length < 2) {
// TODO: Coded error.
throw new Error('Not enough accounts');
}
let accountIndex = 0;
const getNextAccount = () => {
const accountMeta = instruction.accounts![accountIndex]!;
const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;
accountIndex += 1;
return accountMeta;
};
Expand Down
Loading