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
3,073 changes: 598 additions & 2,475 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
RUST_TOOLCHAIN_NIGHTLY = nightly-2025-02-16
SOLANA_CLI_VERSION = 2.3.4
SOLANA_CLI_VERSION = 3.0.0

nightly = +${RUST_TOOLCHAIN_NIGHTLY}

Expand Down Expand Up @@ -33,6 +33,7 @@ spellcheck:
clippy-%:
cargo $(nightly) clippy --manifest-path $(call make-path,$*)/Cargo.toml \
--all-targets \
--all-features \
-- \
--deny=warnings \
--deny=clippy::default_trait_access \
Expand Down
4 changes: 2 additions & 2 deletions clients/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@
},
"license": "MIT",
"peerDependencies": {
"@solana/web3.js": "2.0.0-preview.4"
"@solana/kit": "3.0.0"
},
"devDependencies": {
"@ava/typescript": "^6.0.0",
"@solana/eslint-config-solana": "^3.0.3",
"@solana/web3.js": "2.0.0-preview.4",
"@solana/kit": "3.0.0",
"@solana/webcrypto-ed25519-polyfill": "3.0.3",
"@types/node": "^24",
"@typescript-eslint/eslint-plugin": "^7.16.1",
Expand Down
717 changes: 411 additions & 306 deletions clients/js/pnpm-lock.yaml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions clients/js/src/generated/errors/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* This code was AUTOGENERATED using the codama library.
* This code was AUTOGENERATED using the Codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
* to add features, then rerun Codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
Expand Down
6 changes: 3 additions & 3 deletions clients/js/src/generated/errors/solanaFeatureGate.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* This code was AUTOGENERATED using the codama library.
* This code was AUTOGENERATED using the Codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
* to add features, then rerun Codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
Expand All @@ -11,7 +11,7 @@ import {
type Address,
type SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM,
type SolanaError,
} from '@solana/web3.js';
} from '@solana/kit';
import { SOLANA_FEATURE_GATE_PROGRAM_ADDRESS } from '../programs';

/** FeatureAlreadyActivated: Feature already activated */
Expand Down
4 changes: 2 additions & 2 deletions clients/js/src/generated/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* This code was AUTOGENERATED using the codama library.
* This code was AUTOGENERATED using the Codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
* to add features, then rerun Codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
Expand Down
4 changes: 2 additions & 2 deletions clients/js/src/generated/instructions/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* This code was AUTOGENERATED using the codama library.
* This code was AUTOGENERATED using the Codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
* to add features, then rerun Codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
Expand Down
65 changes: 32 additions & 33 deletions clients/js/src/generated/instructions/revokePendingActivation.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* This code was AUTOGENERATED using the codama library.
* This code was AUTOGENERATED using the Codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
* to add features, then rerun Codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
Expand All @@ -13,20 +13,21 @@ import {
getU8Decoder,
getU8Encoder,
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 ReadonlyUint8Array,
type TransactionSigner,
type WritableAccount,
type WritableSignerAccount,
} from '@solana/web3.js';
} from '@solana/kit';
import { SOLANA_FEATURE_GATE_PROGRAM_ADDRESS } from '../programs';
import { getAccountMetaFactory, type ResolvedAccount } from '../shared';

Expand All @@ -38,19 +39,19 @@ export function getRevokePendingActivationDiscriminatorBytes() {

export type RevokePendingActivationInstruction<
TProgram extends string = typeof SOLANA_FEATURE_GATE_PROGRAM_ADDRESS,
TAccountFeature extends string | IAccountMeta<string> = string,
TAccountIncinerator extends string | IAccountMeta<string> = string,
TAccountFeature extends string | AccountMeta<string> = string,
TAccountIncinerator extends string | AccountMeta<string> = string,
TAccountSystemProgram extends
| string
| IAccountMeta<string> = '11111111111111111111111111111111',
TRemainingAccounts extends readonly IAccountMeta<string>[] = [],
> = IInstruction<TProgram> &
IInstructionWithData<Uint8Array> &
IInstructionWithAccounts<
| AccountMeta<string> = '11111111111111111111111111111111',
TRemainingAccounts extends readonly AccountMeta<string>[] = [],
> = Instruction<TProgram> &
InstructionWithData<ReadonlyUint8Array> &
InstructionWithAccounts<
[
TAccountFeature extends string
? WritableSignerAccount<TAccountFeature> &
IAccountSignerMeta<TAccountFeature>
AccountSignerMeta<TAccountFeature>
: TAccountFeature,
TAccountIncinerator extends string
? WritableAccount<TAccountIncinerator>
Expand All @@ -66,7 +67,7 @@ export type RevokePendingActivationInstructionData = { discriminator: number };

export type RevokePendingActivationInstructionDataArgs = {};

export function getRevokePendingActivationInstructionDataEncoder(): Encoder<RevokePendingActivationInstructionDataArgs> {
export function getRevokePendingActivationInstructionDataEncoder(): FixedSizeEncoder<RevokePendingActivationInstructionDataArgs> {
return transformEncoder(
getStructEncoder([['discriminator', getU8Encoder()]]),
(value) => ({
Expand All @@ -76,11 +77,11 @@ export function getRevokePendingActivationInstructionDataEncoder(): Encoder<Revo
);
}

export function getRevokePendingActivationInstructionDataDecoder(): Decoder<RevokePendingActivationInstructionData> {
export function getRevokePendingActivationInstructionDataDecoder(): FixedSizeDecoder<RevokePendingActivationInstructionData> {
return getStructDecoder([['discriminator', getU8Decoder()]]);
}

export function getRevokePendingActivationInstructionDataCodec(): Codec<
export function getRevokePendingActivationInstructionDataCodec(): FixedSizeCodec<
RevokePendingActivationInstructionDataArgs,
RevokePendingActivationInstructionData
> {
Expand Down Expand Up @@ -143,27 +144,25 @@ export function getRevokePendingActivationInstruction<
}

const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
const instruction = {
return Object.freeze({
accounts: [
getAccountMeta(accounts.feature),
getAccountMeta(accounts.incinerator),
getAccountMeta(accounts.systemProgram),
],
programAddress,
data: getRevokePendingActivationInstructionDataEncoder().encode({}),
programAddress,
} as RevokePendingActivationInstruction<
TProgramAddress,
TAccountFeature,
TAccountIncinerator,
TAccountSystemProgram
>;

return instruction;
>);
}

export type ParsedRevokePendingActivationInstruction<
TProgram extends string = typeof SOLANA_FEATURE_GATE_PROGRAM_ADDRESS,
TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[],
TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[],
> = {
programAddress: Address<TProgram>;
accounts: {
Expand All @@ -179,19 +178,19 @@ export type ParsedRevokePendingActivationInstruction<

export function parseRevokePendingActivationInstruction<
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>
): ParsedRevokePendingActivationInstruction<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
4 changes: 2 additions & 2 deletions clients/js/src/generated/programs/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* This code was AUTOGENERATED using the codama library.
* This code was AUTOGENERATED using the Codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
* to add features, then rerun Codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
Expand Down
6 changes: 3 additions & 3 deletions clients/js/src/generated/programs/solanaFeatureGate.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* This code was AUTOGENERATED using the codama library.
* This code was AUTOGENERATED using the Codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
* to add features, then rerun Codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
Expand All @@ -11,7 +11,7 @@ import {
getU8Encoder,
type Address,
type ReadonlyUint8Array,
} from '@solana/web3.js';
} from '@solana/kit';
import { type ParsedRevokePendingActivationInstruction } from '../instructions';

export const SOLANA_FEATURE_GATE_PROGRAM_ADDRESS =
Expand Down
22 changes: 11 additions & 11 deletions clients/js/src/generated/shared/index.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
/**
* This code was AUTOGENERATED using the codama library.
* This code was AUTOGENERATED using the Codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
* to add features, then rerun Codama to update it.
*
* @see https://github.com/codama-idl/codama
*/

import {
AccountRole,
isProgramDerivedAddress,
isTransactionSigner as web3JsIsTransactionSigner,
isTransactionSigner as kitIsTransactionSigner,
type AccountMeta,
type AccountSignerMeta,
type Address,
type IAccountMeta,
type IAccountSignerMeta,
type ProgramDerivedAddress,
type TransactionSigner,
upgradeRoleToSigner,
} from '@solana/web3.js';
} from '@solana/kit';

/**
* Asserts that the given value is not null or undefined.
* @internal
*/
export function expectSome<T>(value: T | null | undefined): T {
if (value == null) {
if (value === null || value === undefined) {
throw new Error('Expected a value but received null or undefined.');
}
return value;
Expand All @@ -48,7 +48,7 @@ export function expectAddress<T extends string = string>(
return value.address;
}
if (Array.isArray(value)) {
return value[0];
return value[0] as Address<T>;
}
return value as Address<T>;
}
Expand Down Expand Up @@ -113,7 +113,7 @@ export type ResolvedAccount<
* Defines an instruction that stores additional bytes on-chain.
* @internal
*/
export type IInstructionWithByteDelta = {
export type InstructionWithByteDelta = {
byteDelta: number;
};

Expand All @@ -127,7 +127,7 @@ export function getAccountMetaFactory(
) {
return (
account: ResolvedAccount
): IAccountMeta | IAccountSignerMeta | undefined => {
): AccountMeta | AccountSignerMeta | undefined => {
if (!account.value) {
if (optionalAccountStrategy === 'omitted') return;
return Object.freeze({
Expand Down Expand Up @@ -159,6 +159,6 @@ export function isTransactionSigner<TAddress extends string = string>(
!!value &&
typeof value === 'object' &&
'address' in value &&
web3JsIsTransactionSigner(value)
kitIsTransactionSigner(value)
);
}
6 changes: 5 additions & 1 deletion clients/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ num-derive = "0.4"
num-traits = "^0.2"
serde = { version = "^1.0", features = ["derive"], optional = true }
serde_with = { version = "^3.0", optional = true }
solana-program = "^2"
solana-account-info = "^2"
solana-cpi = "^2"
solana-instruction = "^2"
solana-program-error = "^2"
solana-pubkey = "^2"
thiserror = "^2.0"

[dev-dependencies]
12 changes: 3 additions & 9 deletions clients/rust/src/generated/errors/solana_feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,8 @@ pub enum SolanaFeatureGateError {
FeatureAlreadyActivated = 0x0,
}

impl solana_program::program_error::PrintProgramError for SolanaFeatureGateError {
fn print<E>(&self) {
solana_program::msg!(&self.to_string());
}
}

impl<T> solana_program::decode_error::DecodeError<T> for SolanaFeatureGateError {
fn type_of() -> &'static str {
"SolanaFeatureGateError"
impl From<SolanaFeatureGateError> for solana_program_error::ProgramError {
fn from(e: SolanaFeatureGateError) -> Self {
solana_program_error::ProgramError::Custom(e as u32)
}
}
Loading