Skip to content

Commit b28098a

Browse files
authored
Bump Codama to 1.2.8 and use @solana/kit (#14)
1 parent a5aa458 commit b28098a

18 files changed

+748
-460
lines changed

clients/js/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@
4242
},
4343
"homepage": "https://github.com/solana-program/compute-budget#readme",
4444
"peerDependencies": {
45-
"@solana/web3.js": "^2.0.0"
45+
"@solana/kit": "^2.1.0"
4646
},
4747
"devDependencies": {
4848
"@ava/typescript": "^4.1.0",
4949
"@solana/eslint-config-solana": "^3.0.3",
50-
"@solana/web3.js": "^2.0.0",
50+
"@solana/kit": "^2.1.0",
5151
"@types/node": "^20",
5252
"@typescript-eslint/eslint-plugin": "^7.16.1",
5353
"@typescript-eslint/parser": "^7.16.1",

clients/js/pnpm-lock.yaml

Lines changed: 285 additions & 284 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

clients/js/src/generated/instructions/requestHeapFrame.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
type IInstruction,
2424
type IInstructionWithAccounts,
2525
type IInstructionWithData,
26-
} from '@solana/web3.js';
26+
} from '@solana/kit';
2727
import { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';
2828

2929
export const REQUEST_HEAP_FRAME_DISCRIMINATOR = 1;

clients/js/src/generated/instructions/requestUnits.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
type IInstruction,
2424
type IInstructionWithAccounts,
2525
type IInstructionWithData,
26-
} from '@solana/web3.js';
26+
} from '@solana/kit';
2727
import { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';
2828

2929
export const REQUEST_UNITS_DISCRIMINATOR = 0;

clients/js/src/generated/instructions/setComputeUnitLimit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
type IInstruction,
2424
type IInstructionWithAccounts,
2525
type IInstructionWithData,
26-
} from '@solana/web3.js';
26+
} from '@solana/kit';
2727
import { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';
2828

2929
export const SET_COMPUTE_UNIT_LIMIT_DISCRIMINATOR = 2;

clients/js/src/generated/instructions/setComputeUnitPrice.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
type IInstruction,
2424
type IInstructionWithAccounts,
2525
type IInstructionWithData,
26-
} from '@solana/web3.js';
26+
} from '@solana/kit';
2727
import { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';
2828

2929
export const SET_COMPUTE_UNIT_PRICE_DISCRIMINATOR = 3;

clients/js/src/generated/instructions/setLoadedAccountsDataSizeLimit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
type IInstruction,
2424
type IInstructionWithAccounts,
2525
type IInstructionWithData,
26-
} from '@solana/web3.js';
26+
} from '@solana/kit';
2727
import { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';
2828

2929
export const SET_LOADED_ACCOUNTS_DATA_SIZE_LIMIT_DISCRIMINATOR = 4;

clients/js/src/generated/programs/computeBudget.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
getU8Encoder,
1212
type Address,
1313
type ReadonlyUint8Array,
14-
} from '@solana/web3.js';
14+
} from '@solana/kit';
1515
import {
1616
type ParsedRequestHeapFrameInstruction,
1717
type ParsedRequestUnitsInstruction,

clients/js/src/generated/shared/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
import {
1010
AccountRole,
1111
isProgramDerivedAddress,
12-
isTransactionSigner as web3JsIsTransactionSigner,
12+
isTransactionSigner as kitIsTransactionSigner,
1313
type Address,
1414
type IAccountMeta,
1515
type IAccountSignerMeta,
1616
type ProgramDerivedAddress,
1717
type TransactionSigner,
1818
upgradeRoleToSigner,
19-
} from '@solana/web3.js';
19+
} from '@solana/kit';
2020

2121
/**
2222
* Asserts that the given value is not null or undefined.
@@ -159,6 +159,6 @@ export function isTransactionSigner<TAddress extends string = string>(
159159
!!value &&
160160
typeof value === 'object' &&
161161
'address' in value &&
162-
web3JsIsTransactionSigner(value)
162+
kitIsTransactionSigner(value)
163163
);
164164
}

clients/js/test/_setup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
setTransactionMessageFeePayerSigner,
2020
setTransactionMessageLifetimeUsingBlockhash,
2121
signTransactionMessageWithSigners,
22-
} from '@solana/web3.js';
22+
} from '@solana/kit';
2323

2424
type Client = {
2525
rpc: Rpc<SolanaRpcApi>;

clients/js/test/setComputeUnitLimit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { appendTransactionMessageInstruction, pipe } from '@solana/web3.js';
1+
import { appendTransactionMessageInstruction, pipe } from '@solana/kit';
22
import test from 'ava';
33
import { getSetComputeUnitLimitInstruction } from '../src';
44
import {

clients/rust/src/generated/instructions/request_heap_frame.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use borsh::BorshDeserialize;
99
use borsh::BorshSerialize;
1010

1111
/// Accounts.
12+
#[derive(Debug)]
1213
pub struct RequestHeapFrame {}
1314

1415
impl RequestHeapFrame {
@@ -24,10 +25,10 @@ impl RequestHeapFrame {
2425
args: RequestHeapFrameInstructionArgs,
2526
remaining_accounts: &[solana_program::instruction::AccountMeta],
2627
) -> solana_program::instruction::Instruction {
27-
let mut accounts = Vec::with_capacity(0 + remaining_accounts.len());
28+
let mut accounts = Vec::with_capacity(remaining_accounts.len());
2829
accounts.extend_from_slice(remaining_accounts);
29-
let mut data = RequestHeapFrameInstructionData::new().try_to_vec().unwrap();
30-
let mut args = args.try_to_vec().unwrap();
30+
let mut data = borsh::to_vec(&RequestHeapFrameInstructionData::new()).unwrap();
31+
let mut args = borsh::to_vec(&args).unwrap();
3132
data.append(&mut args);
3233

3334
solana_program::instruction::Instruction {
@@ -38,7 +39,8 @@ impl RequestHeapFrame {
3839
}
3940
}
4041

41-
#[derive(BorshDeserialize, BorshSerialize)]
42+
#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
43+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4244
pub struct RequestHeapFrameInstructionData {
4345
discriminator: u8,
4446
}
@@ -160,24 +162,24 @@ impl<'a, 'b> RequestHeapFrameCpi<'a, 'b> {
160162
bool,
161163
)],
162164
) -> solana_program::entrypoint::ProgramResult {
163-
let mut accounts = Vec::with_capacity(0 + remaining_accounts.len());
165+
let mut accounts = Vec::with_capacity(remaining_accounts.len());
164166
remaining_accounts.iter().for_each(|remaining_account| {
165167
accounts.push(solana_program::instruction::AccountMeta {
166168
pubkey: *remaining_account.0.key,
167169
is_signer: remaining_account.1,
168170
is_writable: remaining_account.2,
169171
})
170172
});
171-
let mut data = RequestHeapFrameInstructionData::new().try_to_vec().unwrap();
172-
let mut args = self.__args.try_to_vec().unwrap();
173+
let mut data = borsh::to_vec(&RequestHeapFrameInstructionData::new()).unwrap();
174+
let mut args = borsh::to_vec(&self.__args).unwrap();
173175
data.append(&mut args);
174176

175177
let instruction = solana_program::instruction::Instruction {
176178
program_id: crate::COMPUTE_BUDGET_ID,
177179
accounts,
178180
data,
179181
};
180-
let mut account_infos = Vec::with_capacity(0 + 1 + remaining_accounts.len());
182+
let mut account_infos = Vec::with_capacity(1 + remaining_accounts.len());
181183
account_infos.push(self.__program.clone());
182184
remaining_accounts
183185
.iter()

clients/rust/src/generated/instructions/request_units.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use borsh::BorshDeserialize;
99
use borsh::BorshSerialize;
1010

1111
/// Accounts.
12+
#[derive(Debug)]
1213
pub struct RequestUnits {}
1314

1415
impl RequestUnits {
@@ -24,10 +25,10 @@ impl RequestUnits {
2425
args: RequestUnitsInstructionArgs,
2526
remaining_accounts: &[solana_program::instruction::AccountMeta],
2627
) -> solana_program::instruction::Instruction {
27-
let mut accounts = Vec::with_capacity(0 + remaining_accounts.len());
28+
let mut accounts = Vec::with_capacity(remaining_accounts.len());
2829
accounts.extend_from_slice(remaining_accounts);
29-
let mut data = RequestUnitsInstructionData::new().try_to_vec().unwrap();
30-
let mut args = args.try_to_vec().unwrap();
30+
let mut data = borsh::to_vec(&RequestUnitsInstructionData::new()).unwrap();
31+
let mut args = borsh::to_vec(&args).unwrap();
3132
data.append(&mut args);
3233

3334
solana_program::instruction::Instruction {
@@ -38,7 +39,8 @@ impl RequestUnits {
3839
}
3940
}
4041

41-
#[derive(BorshDeserialize, BorshSerialize)]
42+
#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
43+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4244
pub struct RequestUnitsInstructionData {
4345
discriminator: u8,
4446
}
@@ -171,24 +173,24 @@ impl<'a, 'b> RequestUnitsCpi<'a, 'b> {
171173
bool,
172174
)],
173175
) -> solana_program::entrypoint::ProgramResult {
174-
let mut accounts = Vec::with_capacity(0 + remaining_accounts.len());
176+
let mut accounts = Vec::with_capacity(remaining_accounts.len());
175177
remaining_accounts.iter().for_each(|remaining_account| {
176178
accounts.push(solana_program::instruction::AccountMeta {
177179
pubkey: *remaining_account.0.key,
178180
is_signer: remaining_account.1,
179181
is_writable: remaining_account.2,
180182
})
181183
});
182-
let mut data = RequestUnitsInstructionData::new().try_to_vec().unwrap();
183-
let mut args = self.__args.try_to_vec().unwrap();
184+
let mut data = borsh::to_vec(&RequestUnitsInstructionData::new()).unwrap();
185+
let mut args = borsh::to_vec(&self.__args).unwrap();
184186
data.append(&mut args);
185187

186188
let instruction = solana_program::instruction::Instruction {
187189
program_id: crate::COMPUTE_BUDGET_ID,
188190
accounts,
189191
data,
190192
};
191-
let mut account_infos = Vec::with_capacity(0 + 1 + remaining_accounts.len());
193+
let mut account_infos = Vec::with_capacity(1 + remaining_accounts.len());
192194
account_infos.push(self.__program.clone());
193195
remaining_accounts
194196
.iter()

clients/rust/src/generated/instructions/set_compute_unit_limit.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use borsh::BorshDeserialize;
99
use borsh::BorshSerialize;
1010

1111
/// Accounts.
12+
#[derive(Debug)]
1213
pub struct SetComputeUnitLimit {}
1314

1415
impl SetComputeUnitLimit {
@@ -24,12 +25,10 @@ impl SetComputeUnitLimit {
2425
args: SetComputeUnitLimitInstructionArgs,
2526
remaining_accounts: &[solana_program::instruction::AccountMeta],
2627
) -> solana_program::instruction::Instruction {
27-
let mut accounts = Vec::with_capacity(0 + remaining_accounts.len());
28+
let mut accounts = Vec::with_capacity(remaining_accounts.len());
2829
accounts.extend_from_slice(remaining_accounts);
29-
let mut data = SetComputeUnitLimitInstructionData::new()
30-
.try_to_vec()
31-
.unwrap();
32-
let mut args = args.try_to_vec().unwrap();
30+
let mut data = borsh::to_vec(&SetComputeUnitLimitInstructionData::new()).unwrap();
31+
let mut args = borsh::to_vec(&args).unwrap();
3332
data.append(&mut args);
3433

3534
solana_program::instruction::Instruction {
@@ -40,7 +39,8 @@ impl SetComputeUnitLimit {
4039
}
4140
}
4241

43-
#[derive(BorshDeserialize, BorshSerialize)]
42+
#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
43+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4444
pub struct SetComputeUnitLimitInstructionData {
4545
discriminator: u8,
4646
}
@@ -162,26 +162,24 @@ impl<'a, 'b> SetComputeUnitLimitCpi<'a, 'b> {
162162
bool,
163163
)],
164164
) -> solana_program::entrypoint::ProgramResult {
165-
let mut accounts = Vec::with_capacity(0 + remaining_accounts.len());
165+
let mut accounts = Vec::with_capacity(remaining_accounts.len());
166166
remaining_accounts.iter().for_each(|remaining_account| {
167167
accounts.push(solana_program::instruction::AccountMeta {
168168
pubkey: *remaining_account.0.key,
169169
is_signer: remaining_account.1,
170170
is_writable: remaining_account.2,
171171
})
172172
});
173-
let mut data = SetComputeUnitLimitInstructionData::new()
174-
.try_to_vec()
175-
.unwrap();
176-
let mut args = self.__args.try_to_vec().unwrap();
173+
let mut data = borsh::to_vec(&SetComputeUnitLimitInstructionData::new()).unwrap();
174+
let mut args = borsh::to_vec(&self.__args).unwrap();
177175
data.append(&mut args);
178176

179177
let instruction = solana_program::instruction::Instruction {
180178
program_id: crate::COMPUTE_BUDGET_ID,
181179
accounts,
182180
data,
183181
};
184-
let mut account_infos = Vec::with_capacity(0 + 1 + remaining_accounts.len());
182+
let mut account_infos = Vec::with_capacity(1 + remaining_accounts.len());
185183
account_infos.push(self.__program.clone());
186184
remaining_accounts
187185
.iter()

clients/rust/src/generated/instructions/set_compute_unit_price.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use borsh::BorshDeserialize;
99
use borsh::BorshSerialize;
1010

1111
/// Accounts.
12+
#[derive(Debug)]
1213
pub struct SetComputeUnitPrice {}
1314

1415
impl SetComputeUnitPrice {
@@ -24,12 +25,10 @@ impl SetComputeUnitPrice {
2425
args: SetComputeUnitPriceInstructionArgs,
2526
remaining_accounts: &[solana_program::instruction::AccountMeta],
2627
) -> solana_program::instruction::Instruction {
27-
let mut accounts = Vec::with_capacity(0 + remaining_accounts.len());
28+
let mut accounts = Vec::with_capacity(remaining_accounts.len());
2829
accounts.extend_from_slice(remaining_accounts);
29-
let mut data = SetComputeUnitPriceInstructionData::new()
30-
.try_to_vec()
31-
.unwrap();
32-
let mut args = args.try_to_vec().unwrap();
30+
let mut data = borsh::to_vec(&SetComputeUnitPriceInstructionData::new()).unwrap();
31+
let mut args = borsh::to_vec(&args).unwrap();
3332
data.append(&mut args);
3433

3534
solana_program::instruction::Instruction {
@@ -40,7 +39,8 @@ impl SetComputeUnitPrice {
4039
}
4140
}
4241

43-
#[derive(BorshDeserialize, BorshSerialize)]
42+
#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
43+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4444
pub struct SetComputeUnitPriceInstructionData {
4545
discriminator: u8,
4646
}
@@ -165,26 +165,24 @@ impl<'a, 'b> SetComputeUnitPriceCpi<'a, 'b> {
165165
bool,
166166
)],
167167
) -> solana_program::entrypoint::ProgramResult {
168-
let mut accounts = Vec::with_capacity(0 + remaining_accounts.len());
168+
let mut accounts = Vec::with_capacity(remaining_accounts.len());
169169
remaining_accounts.iter().for_each(|remaining_account| {
170170
accounts.push(solana_program::instruction::AccountMeta {
171171
pubkey: *remaining_account.0.key,
172172
is_signer: remaining_account.1,
173173
is_writable: remaining_account.2,
174174
})
175175
});
176-
let mut data = SetComputeUnitPriceInstructionData::new()
177-
.try_to_vec()
178-
.unwrap();
179-
let mut args = self.__args.try_to_vec().unwrap();
176+
let mut data = borsh::to_vec(&SetComputeUnitPriceInstructionData::new()).unwrap();
177+
let mut args = borsh::to_vec(&self.__args).unwrap();
180178
data.append(&mut args);
181179

182180
let instruction = solana_program::instruction::Instruction {
183181
program_id: crate::COMPUTE_BUDGET_ID,
184182
accounts,
185183
data,
186184
};
187-
let mut account_infos = Vec::with_capacity(0 + 1 + remaining_accounts.len());
185+
let mut account_infos = Vec::with_capacity(1 + remaining_accounts.len());
188186
account_infos.push(self.__program.clone());
189187
remaining_accounts
190188
.iter()

0 commit comments

Comments
 (0)