sememe 0.0.0-stage → 0.4.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +2667 -2
- package/bin/sememe.mjs +556 -0
- package/index.mjs +48 -0
- package/interface/ata-ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL.json +62 -0
- package/interface/native-11111111111111111111111111111111.json +226 -0
- package/interface/native-ComputeBudget111111111111111111111111111111.json +72 -0
- package/interface/raydium-675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8.json +352 -0
- package/interface/token-TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA.json +334 -0
- package/interface/token-TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb.json +535 -0
- package/interface/token-metadata.json +132 -0
- package/package.json +71 -4
- package/src/account-list.mjs +308 -0
- package/src/account-union.mjs +523 -0
- package/src/account.mjs +199 -0
- package/src/acquire.mjs +145 -0
- package/src/adopt.mjs +205 -0
- package/src/ata-interface.mjs +276 -0
- package/src/ata.mjs +223 -0
- package/src/base58.mjs +96 -0
- package/src/canonical.mjs +24 -0
- package/src/cli-surface.mjs +300 -0
- package/src/codec.mjs +1069 -0
- package/src/conformance.mjs +431 -0
- package/src/corpus/harvest-compute-budget-2026-10-31.json +19122 -0
- package/src/corpus/harvest-system-2026-10-31.json +26090 -0
- package/src/decode.mjs +286 -0
- package/src/dialect.mjs +145 -0
- package/src/discriminators.mjs +177 -0
- package/src/drift.mjs +172 -0
- package/src/gap.mjs +205 -0
- package/src/lighthouse.mjs +168 -0
- package/src/lock.mjs +440 -0
- package/src/native-audit.mjs +56 -0
- package/src/native-corpus.mjs +57 -0
- package/src/native-interface.mjs +252 -0
- package/src/native.mjs +324 -0
- package/src/peer.mjs +95 -0
- package/src/program-id.mjs +74 -0
- package/src/pull.mjs +117 -0
- package/src/rawle.mjs +450 -0
- package/src/raydium-interface.mjs +747 -0
- package/src/raydium.mjs +391 -0
- package/src/receipt-digest.mjs +84 -0
- package/src/receipt-name.mjs +128 -0
- package/src/receipt-order.mjs +56 -0
- package/src/shank.mjs +73 -0
- package/src/short-forms.mjs +209 -0
- package/src/store-read.mjs +250 -0
- package/src/store-write.mjs +46 -0
- package/src/token-interface.mjs +394 -0
- package/src/token-metadata-interface.mjs +371 -0
- package/src/token-metadata.mjs +317 -0
- package/src/token.mjs +443 -0
- package/src/union.mjs +428 -0
- package/vendor/anza-solana-sdk/8db406e2edfafa25939ec782b77b5b6f30de164d/LICENSE.txt +201 -0
- package/vendor/anza-solana-sdk/8db406e2edfafa25939ec782b77b5b6f30de164d/compute-budget-interface/src/lib.rs +93 -0
- package/vendor/anza-solana-sdk/8db406e2edfafa25939ec782b77b5b6f30de164d/system-interface/src/instruction.rs +1899 -0
- package/vendor/lighthouse/4c579479c98635e419b1b167f08be02a71604a71/LICENSE +21 -0
- package/vendor/lighthouse/4c579479c98635e419b1b167f08be02a71604a71/lighthouse.json +2769 -0
- package/vendor/raydium-amm/91739d8d9f5cf347e0ce14ebe4d2bb7069fb31b6/LICENSE +201 -0
- package/vendor/raydium-amm/91739d8d9f5cf347e0ce14ebe4d2bb7069fb31b6/program/src/instruction.rs +1189 -0
- package/vendor/raydium-amm/91739d8d9f5cf347e0ce14ebe4d2bb7069fb31b6/program/src/state.rs +1348 -0
- package/vendor/spl-associated-token-account/fbf5379e7398ac8b231c73ee8a9ff677b43dd0ec/LICENSE +201 -0
- package/vendor/spl-associated-token-account/fbf5379e7398ac8b231c73ee8a9ff677b43dd0ec/interface/src/instruction.rs +169 -0
- package/vendor/spl-associated-token-account/fbf5379e7398ac8b231c73ee8a9ff677b43dd0ec/interface/src/lib.rs +12 -0
- package/vendor/spl-associated-token-account/fbf5379e7398ac8b231c73ee8a9ff677b43dd0ec/program/src/processor.rs +308 -0
- package/vendor/spl-token/737788ff5bcc3f1f44cfb222f25483187650be76/LICENSE.txt +176 -0
- package/vendor/spl-token/737788ff5bcc3f1f44cfb222f25483187650be76/interface/src/instruction.rs +1963 -0
- package/vendor/spl-token-2022/5251dcc07ecbcb721d6c4f0231090defadf00311/LICENSE.txt +176 -0
- package/vendor/spl-token-2022/5251dcc07ecbcb721d6c4f0231090defadf00311/interface/src/instruction.rs +2868 -0
- package/vendor/spl-token-metadata-interface/7038969ec74a89f1afdb9bc97c112d4d26fead9a/LICENSE +201 -0
- package/vendor/spl-token-metadata-interface/7038969ec74a89f1afdb9bc97c112d4d26fead9a/interface/src/error.rs +58 -0
- package/vendor/spl-token-metadata-interface/7038969ec74a89f1afdb9bc97c112d4d26fead9a/interface/src/instruction.rs +596 -0
- package/vendor/spl-token-metadata-interface/7038969ec74a89f1afdb9bc97c112d4d26fead9a/interface/src/lib.rs +21 -0
- package/vendor/spl-token-metadata-interface/7038969ec74a89f1afdb9bc97c112d4d26fead9a/interface/src/state.rs +229 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
//! Instructions for the compute budget native program.
|
|
2
|
+
#![cfg_attr(docsrs, feature(doc_cfg))]
|
|
3
|
+
#![cfg_attr(feature = "frozen-abi", feature(min_specialization))]
|
|
4
|
+
|
|
5
|
+
#[cfg(feature = "borsh")]
|
|
6
|
+
use borsh::{BorshDeserialize, BorshSerialize};
|
|
7
|
+
use solana_instruction::Instruction;
|
|
8
|
+
pub use solana_sdk_ids::compute_budget::{check_id, id, ID};
|
|
9
|
+
|
|
10
|
+
/// Compute Budget Instructions
|
|
11
|
+
#[cfg_attr(
|
|
12
|
+
feature = "frozen-abi",
|
|
13
|
+
derive(
|
|
14
|
+
solana_frozen_abi_macro::AbiExample,
|
|
15
|
+
solana_frozen_abi_macro::AbiEnumVisitor
|
|
16
|
+
)
|
|
17
|
+
)]
|
|
18
|
+
#[cfg_attr(feature = "borsh", derive(BorshSerialize, BorshDeserialize))]
|
|
19
|
+
#[cfg_attr(
|
|
20
|
+
feature = "serde",
|
|
21
|
+
derive(serde_derive::Deserialize, serde_derive::Serialize)
|
|
22
|
+
)]
|
|
23
|
+
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
24
|
+
pub enum ComputeBudgetInstruction {
|
|
25
|
+
Unused, // deprecated variant, reserved value.
|
|
26
|
+
/// Request a specific transaction-wide program heap region size in bytes.
|
|
27
|
+
/// The value requested must be a multiple of 1024. This new heap region
|
|
28
|
+
/// size applies to each program executed in the transaction, including all
|
|
29
|
+
/// calls to CPIs.
|
|
30
|
+
RequestHeapFrame(u32),
|
|
31
|
+
/// Set a specific compute unit limit that the transaction is allowed to consume.
|
|
32
|
+
SetComputeUnitLimit(u32),
|
|
33
|
+
/// Set a compute unit price in "micro-lamports" to pay a higher transaction
|
|
34
|
+
/// fee for higher transaction prioritization.
|
|
35
|
+
SetComputeUnitPrice(u64),
|
|
36
|
+
/// Set a specific transaction-wide account data size limit, in bytes, is allowed to load.
|
|
37
|
+
SetLoadedAccountsDataSizeLimit(u32),
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
macro_rules! to_instruction {
|
|
41
|
+
($discriminator: expr, $num: expr, $num_type: ty) => {{
|
|
42
|
+
let mut data = [0u8; ::core::mem::size_of::<$num_type>() + 1];
|
|
43
|
+
data[0] = $discriminator;
|
|
44
|
+
data[1..].copy_from_slice(&$num.to_le_bytes());
|
|
45
|
+
Instruction {
|
|
46
|
+
program_id: id(),
|
|
47
|
+
data: data.to_vec(),
|
|
48
|
+
accounts: vec![],
|
|
49
|
+
}
|
|
50
|
+
}};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
impl ComputeBudgetInstruction {
|
|
54
|
+
/// Create a `ComputeBudgetInstruction::RequestHeapFrame` `Instruction`
|
|
55
|
+
pub fn request_heap_frame(bytes: u32) -> Instruction {
|
|
56
|
+
to_instruction!(1, bytes, u32)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/// Create a `ComputeBudgetInstruction::SetComputeUnitLimit` `Instruction`
|
|
60
|
+
pub fn set_compute_unit_limit(units: u32) -> Instruction {
|
|
61
|
+
to_instruction!(2, units, u32)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/// Create a `ComputeBudgetInstruction::SetComputeUnitPrice` `Instruction`
|
|
65
|
+
pub fn set_compute_unit_price(micro_lamports: u64) -> Instruction {
|
|
66
|
+
to_instruction!(3, micro_lamports, u64)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/// Serialize Instruction using borsh, this is only used in runtime::cost_model::tests but compilation
|
|
70
|
+
/// can't be restricted as it's used across packages
|
|
71
|
+
#[cfg(feature = "dev-context-only-utils")]
|
|
72
|
+
pub fn pack(self) -> Result<Vec<u8>, borsh::io::Error> {
|
|
73
|
+
borsh::to_vec(&self)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/// Create a `ComputeBudgetInstruction::SetLoadedAccountsDataSizeLimit` `Instruction`
|
|
77
|
+
pub fn set_loaded_accounts_data_size_limit(bytes: u32) -> Instruction {
|
|
78
|
+
to_instruction!(4, bytes, u32)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
#[cfg(test)]
|
|
83
|
+
mod tests {
|
|
84
|
+
use super::*;
|
|
85
|
+
|
|
86
|
+
#[test]
|
|
87
|
+
fn test_to_instruction() {
|
|
88
|
+
let ix = ComputeBudgetInstruction::set_compute_unit_limit(257);
|
|
89
|
+
assert_eq!(ix.data, vec![2, 1, 1, 0, 0]);
|
|
90
|
+
let ix = ComputeBudgetInstruction::set_compute_unit_price(u64::MAX);
|
|
91
|
+
assert_eq!(ix.data, vec![3, 255, 255, 255, 255, 255, 255, 255, 255]);
|
|
92
|
+
}
|
|
93
|
+
}
|