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
4 changes: 2 additions & 2 deletions clients/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@
},
"homepage": "https://github.com/solana-program/compute-budget#readme",
"peerDependencies": {
"@solana/web3.js": "^2.0.0"
"@solana/kit": "^2.1.0"
},
"devDependencies": {
"@ava/typescript": "^4.1.0",
"@solana/eslint-config-solana": "^3.0.3",
"@solana/web3.js": "^2.0.0",
"@solana/kit": "^2.1.0",
"@types/node": "^20",
"@typescript-eslint/eslint-plugin": "^7.16.1",
"@typescript-eslint/parser": "^7.16.1",
Expand Down
569 changes: 285 additions & 284 deletions clients/js/pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion clients/js/src/generated/instructions/requestHeapFrame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
type IInstruction,
type IInstructionWithAccounts,
type IInstructionWithData,
} from '@solana/web3.js';
} from '@solana/kit';
import { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';

export const REQUEST_HEAP_FRAME_DISCRIMINATOR = 1;
Expand Down
2 changes: 1 addition & 1 deletion clients/js/src/generated/instructions/requestUnits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
type IInstruction,
type IInstructionWithAccounts,
type IInstructionWithData,
} from '@solana/web3.js';
} from '@solana/kit';
import { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';

export const REQUEST_UNITS_DISCRIMINATOR = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
type IInstruction,
type IInstructionWithAccounts,
type IInstructionWithData,
} from '@solana/web3.js';
} from '@solana/kit';
import { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';

export const SET_COMPUTE_UNIT_LIMIT_DISCRIMINATOR = 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
type IInstruction,
type IInstructionWithAccounts,
type IInstructionWithData,
} from '@solana/web3.js';
} from '@solana/kit';
import { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';

export const SET_COMPUTE_UNIT_PRICE_DISCRIMINATOR = 3;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
type IInstruction,
type IInstructionWithAccounts,
type IInstructionWithData,
} from '@solana/web3.js';
} from '@solana/kit';
import { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';

export const SET_LOADED_ACCOUNTS_DATA_SIZE_LIMIT_DISCRIMINATOR = 4;
Expand Down
2 changes: 1 addition & 1 deletion clients/js/src/generated/programs/computeBudget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
getU8Encoder,
type Address,
type ReadonlyUint8Array,
} from '@solana/web3.js';
} from '@solana/kit';
import {
type ParsedRequestHeapFrameInstruction,
type ParsedRequestUnitsInstruction,
Expand Down
6 changes: 3 additions & 3 deletions clients/js/src/generated/shared/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
import {
AccountRole,
isProgramDerivedAddress,
isTransactionSigner as web3JsIsTransactionSigner,
isTransactionSigner as kitIsTransactionSigner,
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.
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)
);
}
2 changes: 1 addition & 1 deletion clients/js/test/_setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
setTransactionMessageFeePayerSigner,
setTransactionMessageLifetimeUsingBlockhash,
signTransactionMessageWithSigners,
} from '@solana/web3.js';
} from '@solana/kit';

type Client = {
rpc: Rpc<SolanaRpcApi>;
Expand Down
2 changes: 1 addition & 1 deletion clients/js/test/setComputeUnitLimit.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { appendTransactionMessageInstruction, pipe } from '@solana/web3.js';
import { appendTransactionMessageInstruction, pipe } from '@solana/kit';
import test from 'ava';
import { getSetComputeUnitLimitInstruction } from '../src';
import {
Expand Down
18 changes: 10 additions & 8 deletions clients/rust/src/generated/instructions/request_heap_frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use borsh::BorshDeserialize;
use borsh::BorshSerialize;

/// Accounts.
#[derive(Debug)]
pub struct RequestHeapFrame {}

impl RequestHeapFrame {
Expand All @@ -24,10 +25,10 @@ impl RequestHeapFrame {
args: RequestHeapFrameInstructionArgs,
remaining_accounts: &[solana_program::instruction::AccountMeta],
) -> solana_program::instruction::Instruction {
let mut accounts = Vec::with_capacity(0 + remaining_accounts.len());
let mut accounts = Vec::with_capacity(remaining_accounts.len());
accounts.extend_from_slice(remaining_accounts);
let mut data = RequestHeapFrameInstructionData::new().try_to_vec().unwrap();
let mut args = args.try_to_vec().unwrap();
let mut data = borsh::to_vec(&RequestHeapFrameInstructionData::new()).unwrap();
let mut args = borsh::to_vec(&args).unwrap();
data.append(&mut args);

solana_program::instruction::Instruction {
Expand All @@ -38,7 +39,8 @@ impl RequestHeapFrame {
}
}

#[derive(BorshDeserialize, BorshSerialize)]
#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct RequestHeapFrameInstructionData {
discriminator: u8,
}
Expand Down Expand Up @@ -160,24 +162,24 @@ impl<'a, 'b> RequestHeapFrameCpi<'a, 'b> {
bool,
)],
) -> solana_program::entrypoint::ProgramResult {
let mut accounts = Vec::with_capacity(0 + remaining_accounts.len());
let mut accounts = Vec::with_capacity(remaining_accounts.len());
remaining_accounts.iter().for_each(|remaining_account| {
accounts.push(solana_program::instruction::AccountMeta {
pubkey: *remaining_account.0.key,
is_signer: remaining_account.1,
is_writable: remaining_account.2,
})
});
let mut data = RequestHeapFrameInstructionData::new().try_to_vec().unwrap();
let mut args = self.__args.try_to_vec().unwrap();
let mut data = borsh::to_vec(&RequestHeapFrameInstructionData::new()).unwrap();
let mut args = borsh::to_vec(&self.__args).unwrap();
data.append(&mut args);

let instruction = solana_program::instruction::Instruction {
program_id: crate::COMPUTE_BUDGET_ID,
accounts,
data,
};
let mut account_infos = Vec::with_capacity(0 + 1 + remaining_accounts.len());
let mut account_infos = Vec::with_capacity(1 + remaining_accounts.len());
account_infos.push(self.__program.clone());
remaining_accounts
.iter()
Expand Down
18 changes: 10 additions & 8 deletions clients/rust/src/generated/instructions/request_units.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use borsh::BorshDeserialize;
use borsh::BorshSerialize;

/// Accounts.
#[derive(Debug)]
pub struct RequestUnits {}

impl RequestUnits {
Expand All @@ -24,10 +25,10 @@ impl RequestUnits {
args: RequestUnitsInstructionArgs,
remaining_accounts: &[solana_program::instruction::AccountMeta],
) -> solana_program::instruction::Instruction {
let mut accounts = Vec::with_capacity(0 + remaining_accounts.len());
let mut accounts = Vec::with_capacity(remaining_accounts.len());
accounts.extend_from_slice(remaining_accounts);
let mut data = RequestUnitsInstructionData::new().try_to_vec().unwrap();
let mut args = args.try_to_vec().unwrap();
let mut data = borsh::to_vec(&RequestUnitsInstructionData::new()).unwrap();
let mut args = borsh::to_vec(&args).unwrap();
data.append(&mut args);

solana_program::instruction::Instruction {
Expand All @@ -38,7 +39,8 @@ impl RequestUnits {
}
}

#[derive(BorshDeserialize, BorshSerialize)]
#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct RequestUnitsInstructionData {
discriminator: u8,
}
Expand Down Expand Up @@ -171,24 +173,24 @@ impl<'a, 'b> RequestUnitsCpi<'a, 'b> {
bool,
)],
) -> solana_program::entrypoint::ProgramResult {
let mut accounts = Vec::with_capacity(0 + remaining_accounts.len());
let mut accounts = Vec::with_capacity(remaining_accounts.len());
remaining_accounts.iter().for_each(|remaining_account| {
accounts.push(solana_program::instruction::AccountMeta {
pubkey: *remaining_account.0.key,
is_signer: remaining_account.1,
is_writable: remaining_account.2,
})
});
let mut data = RequestUnitsInstructionData::new().try_to_vec().unwrap();
let mut args = self.__args.try_to_vec().unwrap();
let mut data = borsh::to_vec(&RequestUnitsInstructionData::new()).unwrap();
let mut args = borsh::to_vec(&self.__args).unwrap();
data.append(&mut args);

let instruction = solana_program::instruction::Instruction {
program_id: crate::COMPUTE_BUDGET_ID,
accounts,
data,
};
let mut account_infos = Vec::with_capacity(0 + 1 + remaining_accounts.len());
let mut account_infos = Vec::with_capacity(1 + remaining_accounts.len());
account_infos.push(self.__program.clone());
remaining_accounts
.iter()
Expand Down
22 changes: 10 additions & 12 deletions clients/rust/src/generated/instructions/set_compute_unit_limit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use borsh::BorshDeserialize;
use borsh::BorshSerialize;

/// Accounts.
#[derive(Debug)]
pub struct SetComputeUnitLimit {}

impl SetComputeUnitLimit {
Expand All @@ -24,12 +25,10 @@ impl SetComputeUnitLimit {
args: SetComputeUnitLimitInstructionArgs,
remaining_accounts: &[solana_program::instruction::AccountMeta],
) -> solana_program::instruction::Instruction {
let mut accounts = Vec::with_capacity(0 + remaining_accounts.len());
let mut accounts = Vec::with_capacity(remaining_accounts.len());
accounts.extend_from_slice(remaining_accounts);
let mut data = SetComputeUnitLimitInstructionData::new()
.try_to_vec()
.unwrap();
let mut args = args.try_to_vec().unwrap();
let mut data = borsh::to_vec(&SetComputeUnitLimitInstructionData::new()).unwrap();
let mut args = borsh::to_vec(&args).unwrap();
data.append(&mut args);

solana_program::instruction::Instruction {
Expand All @@ -40,7 +39,8 @@ impl SetComputeUnitLimit {
}
}

#[derive(BorshDeserialize, BorshSerialize)]
#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct SetComputeUnitLimitInstructionData {
discriminator: u8,
}
Expand Down Expand Up @@ -162,26 +162,24 @@ impl<'a, 'b> SetComputeUnitLimitCpi<'a, 'b> {
bool,
)],
) -> solana_program::entrypoint::ProgramResult {
let mut accounts = Vec::with_capacity(0 + remaining_accounts.len());
let mut accounts = Vec::with_capacity(remaining_accounts.len());
remaining_accounts.iter().for_each(|remaining_account| {
accounts.push(solana_program::instruction::AccountMeta {
pubkey: *remaining_account.0.key,
is_signer: remaining_account.1,
is_writable: remaining_account.2,
})
});
let mut data = SetComputeUnitLimitInstructionData::new()
.try_to_vec()
.unwrap();
let mut args = self.__args.try_to_vec().unwrap();
let mut data = borsh::to_vec(&SetComputeUnitLimitInstructionData::new()).unwrap();
let mut args = borsh::to_vec(&self.__args).unwrap();
data.append(&mut args);

let instruction = solana_program::instruction::Instruction {
program_id: crate::COMPUTE_BUDGET_ID,
accounts,
data,
};
let mut account_infos = Vec::with_capacity(0 + 1 + remaining_accounts.len());
let mut account_infos = Vec::with_capacity(1 + remaining_accounts.len());
account_infos.push(self.__program.clone());
remaining_accounts
.iter()
Expand Down
22 changes: 10 additions & 12 deletions clients/rust/src/generated/instructions/set_compute_unit_price.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use borsh::BorshDeserialize;
use borsh::BorshSerialize;

/// Accounts.
#[derive(Debug)]
pub struct SetComputeUnitPrice {}

impl SetComputeUnitPrice {
Expand All @@ -24,12 +25,10 @@ impl SetComputeUnitPrice {
args: SetComputeUnitPriceInstructionArgs,
remaining_accounts: &[solana_program::instruction::AccountMeta],
) -> solana_program::instruction::Instruction {
let mut accounts = Vec::with_capacity(0 + remaining_accounts.len());
let mut accounts = Vec::with_capacity(remaining_accounts.len());
accounts.extend_from_slice(remaining_accounts);
let mut data = SetComputeUnitPriceInstructionData::new()
.try_to_vec()
.unwrap();
let mut args = args.try_to_vec().unwrap();
let mut data = borsh::to_vec(&SetComputeUnitPriceInstructionData::new()).unwrap();
let mut args = borsh::to_vec(&args).unwrap();
data.append(&mut args);

solana_program::instruction::Instruction {
Expand All @@ -40,7 +39,8 @@ impl SetComputeUnitPrice {
}
}

#[derive(BorshDeserialize, BorshSerialize)]
#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct SetComputeUnitPriceInstructionData {
discriminator: u8,
}
Expand Down Expand Up @@ -165,26 +165,24 @@ impl<'a, 'b> SetComputeUnitPriceCpi<'a, 'b> {
bool,
)],
) -> solana_program::entrypoint::ProgramResult {
let mut accounts = Vec::with_capacity(0 + remaining_accounts.len());
let mut accounts = Vec::with_capacity(remaining_accounts.len());
remaining_accounts.iter().for_each(|remaining_account| {
accounts.push(solana_program::instruction::AccountMeta {
pubkey: *remaining_account.0.key,
is_signer: remaining_account.1,
is_writable: remaining_account.2,
})
});
let mut data = SetComputeUnitPriceInstructionData::new()
.try_to_vec()
.unwrap();
let mut args = self.__args.try_to_vec().unwrap();
let mut data = borsh::to_vec(&SetComputeUnitPriceInstructionData::new()).unwrap();
let mut args = borsh::to_vec(&self.__args).unwrap();
data.append(&mut args);

let instruction = solana_program::instruction::Instruction {
program_id: crate::COMPUTE_BUDGET_ID,
accounts,
data,
};
let mut account_infos = Vec::with_capacity(0 + 1 + remaining_accounts.len());
let mut account_infos = Vec::with_capacity(1 + remaining_accounts.len());
account_infos.push(self.__program.clone());
remaining_accounts
.iter()
Expand Down
Loading
Loading