Skip to content
Draft
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
16 changes: 16 additions & 0 deletions .changeset/kit-v7-upgrade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
"@solana/client": minor
---
Comment on lines +1 to +3

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 The changeset bump level is patch, but this PR bumps a major dependency version (@solana/kit v6 → v7) and introduces a new exported type (SupportedTransactionVersion). Per semver convention, adding new public API surface or a significant dependency upgrade is typically a minor bump so that downstream consumers can see from the version number that something meaningfully changed.

Suggested change
---
"@solana/client": patch
---
---
"@solana/client": minor
---

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!


Upgrade `@solana/kit` and the related `@solana/*` packages to `v7`.

- **Transaction planner default changed:** Kit v7 lowers the default
`maxInstructionsPerTransaction` from 64 to 16. The transaction helpers adopt this
new default, so preparing a transaction whose instructions no longer fit in a single
message (previously up to 64 instructions) will now produce a multi-transaction plan
and throw. Callers relying on the old limit should split their instructions.
- Kit v7 adds transaction version `1` to `TransactionVersion`, which
`createTransactionMessage` does not accept (it only supports
`Exclude<TransactionVersion, 1>`). The transaction helpers now type their `version`
inputs with a new `SupportedTransactionVersion` alias to reflect the versions they
actually support.
2 changes: 1 addition & 1 deletion examples/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"dependencies": {
"@solana/client": "workspace:*",
"@solana/kit": "^6.0.1",
"@solana/kit": "^7.0.0",
"@solana/react-hooks": "workspace:*",
"@solana/connector": "^0.2.3",
"next": "^16.1.5",
Expand Down
2 changes: 1 addition & 1 deletion examples/vite-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@radix-ui/react-slot": "^1.1.0",
"@solana-program/system": "^0.10.0",
"@solana/client": "workspace:*",
"@solana/kit": "^6.0.1",
"@solana/kit": "^7.0.0",
"@solana/react-hooks": "workspace:*",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@changesets/changelog-github": "^0.5.1",
"@changesets/cli": "^2.29.7",
"@size-limit/preset-small-lib": "^12.0.0",
"@solana/codecs-strings": "^6.0.1",
"@solana/codecs-strings": "^7.0.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.1.0",
"@testing-library/user-event": "^14.5.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/client/src/features/sol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ import {
singleTransactionPlan,
type TransactionPlan,
type TransactionSigner,
type TransactionVersion,
} from '@solana/kit';
import { getTransferSolInstruction } from '@solana-program/system';

import { lamportsMath } from '../numeric/lamports';
import type { SolanaClientRuntime } from '../rpc/types';
import { createWalletTransactionSigner, isWalletSession, resolveSignerMode } from '../signers/walletTransactionSigner';
import type { WalletSession } from '../wallet/types';
import type { SupportedTransactionVersion } from './transactions';

/**
* Blockhash and last valid block height for transaction lifetime.
Expand Down Expand Up @@ -79,7 +79,7 @@ export type SolTransferPrepareConfig = Readonly<{
/** Optional pre-fetched blockhash lifetime. If not provided, one will be fetched. */
lifetime?: BlockhashLifetime;
/** Transaction version. Defaults to 0 (legacy). */
transactionVersion?: TransactionVersion;
transactionVersion?: SupportedTransactionVersion;
}>;

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/client/src/features/spl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
singleTransactionPlan,
type TransactionPlan,
type TransactionSigner,
type TransactionVersion,
} from '@solana/kit';
import {
fetchMint as fetchMintStandard,
Expand All @@ -41,6 +40,7 @@ import { createWalletTransactionSigner, isWalletSession, resolveSignerMode } fro
import type { WalletSession } from '../wallet/types';
import type { SolTransferSendOptions } from './sol';
import { detectTokenProgram } from './tokenPrograms';
import type { SupportedTransactionVersion } from './transactions';

/**
* Blockhash and last valid block height for transaction lifetime.
Expand Down Expand Up @@ -151,7 +151,7 @@ export type SplTransferPrepareConfig = Readonly<{
/** Optional: explicit source token account. If not provided, ATA is derived. */
sourceToken?: Address | string;
/** Transaction version. Defaults to 0 (legacy). */
transactionVersion?: TransactionVersion;
transactionVersion?: SupportedTransactionVersion;
}>;

/**
Expand Down
8 changes: 4 additions & 4 deletions packages/client/src/features/stake.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
singleTransactionPlan,
type TransactionPlan,
type TransactionSigner,
type TransactionVersion,
} from '@solana/kit';
import {
getDeactivateInstruction,
Expand All @@ -36,6 +35,7 @@ import { lamportsMath } from '../numeric/lamports';
import type { SolanaClientRuntime } from '../rpc/types';
import { createWalletTransactionSigner, isWalletSession, resolveSignerMode } from '../signers/walletTransactionSigner';
import type { WalletSession } from '../wallet/types';
import type { SupportedTransactionVersion } from './transactions';

/**
* Blockhash and last valid block height for transaction lifetime.
Expand Down Expand Up @@ -150,7 +150,7 @@ export type StakePrepareConfig = Readonly<{
/** Optional pre-fetched blockhash lifetime. */
lifetime?: BlockhashLifetime;
/** Transaction version. Defaults to 0 (legacy). */
transactionVersion?: TransactionVersion;
transactionVersion?: SupportedTransactionVersion;
/** The validator's vote account address to delegate stake to. */
validatorId: Address | string;
}>;
Expand Down Expand Up @@ -201,7 +201,7 @@ export type UnstakePrepareConfig = Readonly<{
/** The stake account address to deactivate. */
stakeAccount: Address | string;
/** Transaction version. Defaults to 0 (legacy). */
transactionVersion?: TransactionVersion;
transactionVersion?: SupportedTransactionVersion;
}>;

/** Options for sending unstake transactions. Same as StakeSendOptions. */
Expand Down Expand Up @@ -235,7 +235,7 @@ export type WithdrawPrepareConfig = Readonly<{
/** The stake account address to withdraw from. */
stakeAccount: Address | string;
/** Transaction version. Defaults to 0 (legacy). */
transactionVersion?: TransactionVersion;
transactionVersion?: SupportedTransactionVersion;
}>;

/** Options for sending withdrawal transactions. Same as StakeSendOptions. */
Expand Down
16 changes: 11 additions & 5 deletions packages/client/src/features/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ type BlockhashLifetime = Readonly<{

type TransactionInstruction = Parameters<typeof appendTransactionMessageInstruction>[0];

/**
* Transaction versions these helpers support. Kit v7 introduced version `1`, which requires the
* dedicated v1 transaction config and is not handled here, so it is excluded.
*/
export type SupportedTransactionVersion = Exclude<TransactionVersion, 1>;

export type TransactionInstructionInput = TransactionInstruction;

type SignableTransactionMessage = Parameters<typeof signTransactionMessageWithSigners>[0];
Expand All @@ -70,7 +76,7 @@ type TransactionRecipeMetadata = Readonly<{
instructions: readonly TransactionInstruction[];
lifetime: BlockhashLifetime;
mode: 'partial' | 'send';
version: TransactionVersion;
version: SupportedTransactionVersion;
}>;

export type TransactionRecipe = TransactionRecipeMetadata &
Expand All @@ -93,7 +99,7 @@ export type TransactionPrepareRequest = Readonly<{
feePayer?: Address | string | TransactionSigner;
instructions: readonly TransactionInstruction[];
lifetime?: BlockhashLifetime;
version?: TransactionVersion | 'auto';
version?: SupportedTransactionVersion | 'auto';
}>;

export type TransactionPrepareAndSendRequest = TransactionPrepareRequest &
Expand All @@ -111,7 +117,7 @@ export type TransactionPrepared = Readonly<{
message: SignableTransactionMessage;
mode: 'partial' | 'send';
plan?: TransactionPlan;
version: TransactionVersion;
version: SupportedTransactionVersion;
}>;

export type TransactionSignOptions = Readonly<{
Expand Down Expand Up @@ -178,9 +184,9 @@ function instructionUsesAddressLookup(instruction: TransactionInstruction): bool
}

function resolveVersion(
requested: TransactionVersion | 'auto' | undefined,
requested: SupportedTransactionVersion | 'auto' | undefined,
instructions: readonly TransactionInstruction[],
): TransactionVersion {
): SupportedTransactionVersion {
if (requested && requested !== 'auto') {
return requested;
}
Expand Down
6 changes: 3 additions & 3 deletions packages/client/src/features/wsol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
singleTransactionPlan,
type TransactionPlan,
type TransactionSigner,
type TransactionVersion,
} from '@solana/kit';
import { getTransferSolInstruction } from '@solana-program/system';
import {
Expand All @@ -38,6 +37,7 @@ import type { SolanaClientRuntime } from '../rpc/types';
import { createWalletTransactionSigner, isWalletSession, resolveSignerMode } from '../signers/walletTransactionSigner';
import type { WalletSession } from '../wallet/types';
import type { SolTransferSendOptions } from './sol';
import type { SupportedTransactionVersion } from './transactions';

/**
* The Wrapped SOL (wSOL) mint address.
Expand Down Expand Up @@ -96,7 +96,7 @@ export type WsolWrapPrepareConfig = Readonly<{
/** Owner of the wSOL account. Defaults to the authority's address. */
owner?: Address | string;
/** Transaction version. Defaults to 0 (legacy). */
transactionVersion?: TransactionVersion;
transactionVersion?: SupportedTransactionVersion;
}>;

/**
Expand All @@ -121,7 +121,7 @@ export type WsolUnwrapPrepareConfig = Readonly<{
/** Owner of the wSOL account. Defaults to the authority's address. */
owner?: Address | string;
/** Transaction version. Defaults to 0 (legacy). */
transactionVersion?: TransactionVersion;
transactionVersion?: SupportedTransactionVersion;
}>;

/**
Expand Down
Loading