0.5.1-pre.002
This commit is contained in:
12
ks-lib/src/executor/adapter.rs
Normal file
12
ks-lib/src/executor/adapter.rs
Normal file
@@ -0,0 +1,12 @@
|
||||
// file: ks-lib/src/executor/adapter.rs
|
||||
// version: 4
|
||||
|
||||
//! `adapter` executor family.
|
||||
|
||||
mod saber_decimal_wrapper;
|
||||
mod spl_token_wrap;
|
||||
|
||||
/// Exposes the reserved `adapter/saber_decimal_wrapper` executor.
|
||||
pub use self::saber_decimal_wrapper::ExAdapterSaberDecimalWrapperExecutor;
|
||||
/// Exposes the reserved `adapter/spl_token_wrap` executor.
|
||||
pub use self::spl_token_wrap::ExAdapterSplTokenWrapExecutor;
|
||||
49
ks-lib/src/executor/adapter/saber_decimal_wrapper.rs
Normal file
49
ks-lib/src/executor/adapter/saber_decimal_wrapper.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/adapter/saber_decimal_wrapper.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `adapter_saber_decimal_wrapper`.
|
||||
|
||||
/// Reserved executor for the `adapter_saber_decimal_wrapper` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExAdapterSaberDecimalWrapperExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExAdapterSaberDecimalWrapperExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.adapter.saber_decimal_wrapper";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::ADAPTER_SABER_DECIMAL_WRAPPER_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"adapter_saber_decimal_wrapper"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.adapter.saber_decimal_wrapper".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/adapter/spl_token_wrap.rs
Normal file
49
ks-lib/src/executor/adapter/spl_token_wrap.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/adapter/spl_token_wrap.rs
|
||||
// version: 2
|
||||
|
||||
//! Reserved executor for `adapter_spl_token_wrap`.
|
||||
|
||||
/// Reserved executor for the `adapter_spl_token_wrap` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExAdapterSplTokenWrapExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExAdapterSplTokenWrapExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.adapter.spl_token_wrap";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::ADAPTER_SPL_TOKEN_WRAP_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"adapter_spl_token_wrap"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.adapter.spl_token_wrap".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
78
ks-lib/src/executor/amm.rs
Normal file
78
ks-lib/src/executor/amm.rs
Normal file
@@ -0,0 +1,78 @@
|
||||
// file: ks-lib/src/executor/amm.rs
|
||||
// version: 4
|
||||
|
||||
//! `amm` executor family.
|
||||
|
||||
mod aldrin_v1;
|
||||
mod aldrin_v2;
|
||||
mod alphaq;
|
||||
mod believe;
|
||||
mod bonk_swap;
|
||||
mod fluxbeam;
|
||||
mod goon_fi;
|
||||
mod goosefx_gamma;
|
||||
mod goosefx_v2;
|
||||
mod guac_swap;
|
||||
mod lifinity_swap_v2;
|
||||
mod metadao_v0_5;
|
||||
mod meteora_damm_v1;
|
||||
mod meteora_damm_v2;
|
||||
mod obric_v2;
|
||||
mod one_dex;
|
||||
mod pump_swap;
|
||||
mod raydium_lp_v4;
|
||||
mod solfi;
|
||||
mod solfi_v2;
|
||||
mod vertigo;
|
||||
mod woofi;
|
||||
mod zero_fi;
|
||||
mod zora;
|
||||
|
||||
/// Exposes the reserved `amm/aldrin_v1` executor.
|
||||
pub use self::aldrin_v1::ExAmmAldrinV1Executor;
|
||||
/// Exposes the reserved `amm/aldrin_v2` executor.
|
||||
pub use self::aldrin_v2::ExAmmAldrinV2Executor;
|
||||
/// Exposes the reserved `amm/alphaq` executor.
|
||||
pub use self::alphaq::ExAmmAlphaqExecutor;
|
||||
/// Exposes the reserved `amm/believe` executor.
|
||||
pub use self::believe::ExAmmBelieveExecutor;
|
||||
/// Exposes the reserved `amm/bonk_swap` executor.
|
||||
pub use self::bonk_swap::ExAmmBonkSwapExecutor;
|
||||
/// Exposes the reserved `amm/fluxbeam` executor.
|
||||
pub use self::fluxbeam::ExAmmFluxbeamExecutor;
|
||||
/// Exposes the reserved `amm/goon_fi` executor.
|
||||
pub use self::goon_fi::ExAmmGoonFiExecutor;
|
||||
/// Exposes the reserved `amm/goosefx_gamma` executor.
|
||||
pub use self::goosefx_gamma::ExAmmGoosefxGammaExecutor;
|
||||
/// Exposes the reserved `amm/goosefx_v2` executor.
|
||||
pub use self::goosefx_v2::ExAmmGoosefxV2Executor;
|
||||
/// Exposes the reserved `amm/guac_swap` executor.
|
||||
pub use self::guac_swap::ExAmmGuacSwapExecutor;
|
||||
/// Exposes the reserved `amm/lifinity_swap_v2` executor.
|
||||
pub use self::lifinity_swap_v2::ExAmmLifinitySwapV2Executor;
|
||||
/// Exposes the reserved `amm/metadao_v0_5` executor.
|
||||
pub use self::metadao_v0_5::ExAmmMetadaoV05Executor;
|
||||
/// Exposes the reserved `amm/meteora_damm_v1` executor.
|
||||
pub use self::meteora_damm_v1::ExAmmMeteoraDammV1Executor;
|
||||
/// Exposes the reserved `amm/meteora_damm_v2` executor.
|
||||
pub use self::meteora_damm_v2::ExAmmMeteoraDammV2Executor;
|
||||
/// Exposes the reserved `amm/obric_v2` executor.
|
||||
pub use self::obric_v2::ExAmmObricV2Executor;
|
||||
/// Exposes the reserved `amm/one_dex` executor.
|
||||
pub use self::one_dex::ExAmmOneDexExecutor;
|
||||
/// Exposes the reserved `amm/pump_swap` executor.
|
||||
pub use self::pump_swap::ExAmmPumpSwapExecutor;
|
||||
/// Exposes the reserved `amm/raydium_lp_v4` executor.
|
||||
pub use self::raydium_lp_v4::ExAmmRaydiumLpV4Executor;
|
||||
/// Exposes the reserved `amm/solfi` executor.
|
||||
pub use self::solfi::ExAmmSolfiExecutor;
|
||||
/// Exposes the reserved `amm/solfi_v2` executor.
|
||||
pub use self::solfi_v2::ExAmmSolfiV2Executor;
|
||||
/// Exposes the reserved `amm/vertigo` executor.
|
||||
pub use self::vertigo::ExAmmVertigoExecutor;
|
||||
/// Exposes the reserved `amm/woofi` executor.
|
||||
pub use self::woofi::ExAmmWoofiExecutor;
|
||||
/// Exposes the reserved `amm/zero_fi` executor.
|
||||
pub use self::zero_fi::ExAmmZeroFiExecutor;
|
||||
/// Exposes the reserved `amm/zora` executor.
|
||||
pub use self::zora::ExAmmZoraExecutor;
|
||||
49
ks-lib/src/executor/amm/aldrin_v1.rs
Normal file
49
ks-lib/src/executor/amm/aldrin_v1.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/amm/aldrin_v1.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `amm_aldrin_v1`.
|
||||
|
||||
/// Reserved executor for the `amm_aldrin_v1` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExAmmAldrinV1Executor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExAmmAldrinV1Executor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.amm.aldrin_v1";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::AMM_ALDRIN_V1_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"amm_aldrin_v1"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.amm.aldrin_v1".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/amm/aldrin_v2.rs
Normal file
49
ks-lib/src/executor/amm/aldrin_v2.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/amm/aldrin_v2.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `amm_aldrin_v2`.
|
||||
|
||||
/// Reserved executor for the `amm_aldrin_v2` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExAmmAldrinV2Executor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExAmmAldrinV2Executor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.amm.aldrin_v2";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::AMM_ALDRIN_V2_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"amm_aldrin_v2"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.amm.aldrin_v2".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/amm/alphaq.rs
Normal file
49
ks-lib/src/executor/amm/alphaq.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/amm/alphaq.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `amm_alphaq`.
|
||||
|
||||
/// Reserved executor for the `amm_alphaq` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExAmmAlphaqExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExAmmAlphaqExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.amm.alphaq";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::AMM_ALPHAQ_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"amm_alphaq"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.amm.alphaq".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/amm/believe.rs
Normal file
49
ks-lib/src/executor/amm/believe.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/amm/believe.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `amm_believe`.
|
||||
|
||||
/// Reserved executor for the `amm_believe` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExAmmBelieveExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExAmmBelieveExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.amm.believe";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::AMM_BELIEVE_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"amm_believe"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.amm.believe".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/amm/bonk_swap.rs
Normal file
49
ks-lib/src/executor/amm/bonk_swap.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/amm/bonk_swap.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `amm_bonk_swap`.
|
||||
|
||||
/// Reserved executor for the `amm_bonk_swap` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExAmmBonkSwapExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExAmmBonkSwapExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.amm.bonk_swap";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::AMM_BONK_SWAP_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"amm_bonk_swap"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.amm.bonk_swap".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/amm/fluxbeam.rs
Normal file
49
ks-lib/src/executor/amm/fluxbeam.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/amm/fluxbeam.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `amm_fluxbeam`.
|
||||
|
||||
/// Reserved executor for the `amm_fluxbeam` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExAmmFluxbeamExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExAmmFluxbeamExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.amm.fluxbeam";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::AMM_FLUXBEAM_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"amm_fluxbeam"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.amm.fluxbeam".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/amm/goon_fi.rs
Normal file
49
ks-lib/src/executor/amm/goon_fi.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/amm/goon_fi.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `amm_goon_fi`.
|
||||
|
||||
/// Reserved executor for the `amm_goon_fi` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExAmmGoonFiExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExAmmGoonFiExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.amm.goon_fi";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::AMM_GOON_FI_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"amm_goon_fi"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.amm.goon_fi".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/amm/goosefx_gamma.rs
Normal file
49
ks-lib/src/executor/amm/goosefx_gamma.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/amm/goosefx_gamma.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `amm_goosefx_gamma`.
|
||||
|
||||
/// Reserved executor for the `amm_goosefx_gamma` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExAmmGoosefxGammaExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExAmmGoosefxGammaExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.amm.goosefx_gamma";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::AMM_GOOSEFX_GAMMA_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"amm_goosefx_gamma"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.amm.goosefx_gamma".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/amm/goosefx_v2.rs
Normal file
49
ks-lib/src/executor/amm/goosefx_v2.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/amm/goosefx_v2.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `amm_goosefx_v2`.
|
||||
|
||||
/// Reserved executor for the `amm_goosefx_v2` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExAmmGoosefxV2Executor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExAmmGoosefxV2Executor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.amm.goosefx_v2";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::AMM_GOOSEFX_V2_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"amm_goosefx_v2"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.amm.goosefx_v2".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/amm/guac_swap.rs
Normal file
49
ks-lib/src/executor/amm/guac_swap.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/amm/guac_swap.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `amm_guac_swap`.
|
||||
|
||||
/// Reserved executor for the `amm_guac_swap` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExAmmGuacSwapExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExAmmGuacSwapExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.amm.guac_swap";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::AMM_GUAC_SWAP_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"amm_guac_swap"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.amm.guac_swap".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/amm/lifinity_swap_v2.rs
Normal file
49
ks-lib/src/executor/amm/lifinity_swap_v2.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/amm/lifinity_swap_v2.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `amm_lifinity_swap_v2`.
|
||||
|
||||
/// Reserved executor for the `amm_lifinity_swap_v2` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExAmmLifinitySwapV2Executor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExAmmLifinitySwapV2Executor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.amm.lifinity_swap_v2";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::AMM_LIFINITY_SWAP_V2_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"amm_lifinity_swap_v2"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.amm.lifinity_swap_v2".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/amm/metadao_v0_5.rs
Normal file
49
ks-lib/src/executor/amm/metadao_v0_5.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/amm/metadao_v0_5.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `amm_metadao_v0_5`.
|
||||
|
||||
/// Reserved executor for the `amm_metadao_v0_5` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExAmmMetadaoV05Executor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExAmmMetadaoV05Executor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.amm.metadao_v0_5";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::AMM_METADAO_V0_5_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"amm_metadao_v0_5"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.amm.metadao_v0_5".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/amm/meteora_damm_v1.rs
Normal file
49
ks-lib/src/executor/amm/meteora_damm_v1.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/amm/meteora_damm_v1.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `amm_meteora_damm_v1`.
|
||||
|
||||
/// Reserved executor for the `amm_meteora_damm_v1` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExAmmMeteoraDammV1Executor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExAmmMeteoraDammV1Executor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.amm.meteora_damm_v1";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::AMM_METEORA_DAMM_V1_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"amm_meteora_damm_v1"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.amm.meteora_damm_v1".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/amm/meteora_damm_v2.rs
Normal file
49
ks-lib/src/executor/amm/meteora_damm_v2.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/amm/meteora_damm_v2.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `amm_meteora_damm_v2`.
|
||||
|
||||
/// Reserved executor for the `amm_meteora_damm_v2` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExAmmMeteoraDammV2Executor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExAmmMeteoraDammV2Executor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.amm.meteora_damm_v2";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::AMM_METEORA_DAMM_V2_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"amm_meteora_damm_v2"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.amm.meteora_damm_v2".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/amm/obric_v2.rs
Normal file
49
ks-lib/src/executor/amm/obric_v2.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/amm/obric_v2.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `amm_obric_v2`.
|
||||
|
||||
/// Reserved executor for the `amm_obric_v2` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExAmmObricV2Executor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExAmmObricV2Executor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.amm.obric_v2";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::AMM_OBRIC_V2_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"amm_obric_v2"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.amm.obric_v2".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/amm/one_dex.rs
Normal file
49
ks-lib/src/executor/amm/one_dex.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/amm/one_dex.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `amm_one_dex`.
|
||||
|
||||
/// Reserved executor for the `amm_one_dex` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExAmmOneDexExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExAmmOneDexExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.amm.one_dex";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::AMM_ONE_DEX_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"amm_one_dex"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.amm.one_dex".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/amm/pump_swap.rs
Normal file
49
ks-lib/src/executor/amm/pump_swap.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/amm/pump_swap.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `amm_pump_swap`.
|
||||
|
||||
/// Reserved executor for the `amm_pump_swap` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExAmmPumpSwapExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExAmmPumpSwapExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.amm.pump_swap";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::AMM_PUMP_SWAP_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"amm_pump_swap"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.amm.pump_swap".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/amm/raydium_lp_v4.rs
Normal file
49
ks-lib/src/executor/amm/raydium_lp_v4.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/amm/raydium_lp_v4.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `amm_raydium_lp_v4`.
|
||||
|
||||
/// Reserved executor for the `amm_raydium_lp_v4` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExAmmRaydiumLpV4Executor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExAmmRaydiumLpV4Executor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.amm.raydium_lp_v4";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::AMM_RAYDIUM_LP_V4_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"amm_raydium_lp_v4"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.amm.raydium_lp_v4".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/amm/solfi.rs
Normal file
49
ks-lib/src/executor/amm/solfi.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/amm/solfi.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `amm_solfi`.
|
||||
|
||||
/// Reserved executor for the `amm_solfi` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExAmmSolfiExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExAmmSolfiExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.amm.solfi";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::AMM_SOLFI_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"amm_solfi"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.amm.solfi".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/amm/solfi_v2.rs
Normal file
49
ks-lib/src/executor/amm/solfi_v2.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/amm/solfi_v2.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `amm_solfi_v2`.
|
||||
|
||||
/// Reserved executor for the `amm_solfi_v2` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExAmmSolfiV2Executor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExAmmSolfiV2Executor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.amm.solfi_v2";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::AMM_SOLFI_V2_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"amm_solfi_v2"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.amm.solfi_v2".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/amm/vertigo.rs
Normal file
49
ks-lib/src/executor/amm/vertigo.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/amm/vertigo.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `amm_vertigo`.
|
||||
|
||||
/// Reserved executor for the `amm_vertigo` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExAmmVertigoExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExAmmVertigoExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.amm.vertigo";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::AMM_VERTIGO_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"amm_vertigo"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.amm.vertigo".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/amm/woofi.rs
Normal file
49
ks-lib/src/executor/amm/woofi.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/amm/woofi.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `amm_woofi`.
|
||||
|
||||
/// Reserved executor for the `amm_woofi` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExAmmWoofiExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExAmmWoofiExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.amm.woofi";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::AMM_WOOFI_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"amm_woofi"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.amm.woofi".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/amm/zero_fi.rs
Normal file
49
ks-lib/src/executor/amm/zero_fi.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/amm/zero_fi.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `amm_zero_fi`.
|
||||
|
||||
/// Reserved executor for the `amm_zero_fi` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExAmmZeroFiExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExAmmZeroFiExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.amm.zero_fi";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::AMM_ZERO_FI_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"amm_zero_fi"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.amm.zero_fi".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/amm/zora.rs
Normal file
49
ks-lib/src/executor/amm/zora.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/amm/zora.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `amm_zora`.
|
||||
|
||||
/// Reserved executor for the `amm_zora` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExAmmZoraExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExAmmZoraExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.amm.zora";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::AMM_ZORA_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"amm_zora"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.amm.zora".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
57
ks-lib/src/executor/api.rs
Normal file
57
ks-lib/src/executor/api.rs
Normal file
@@ -0,0 +1,57 @@
|
||||
// file: ks-lib/src/executor/api.rs
|
||||
// version: 4
|
||||
|
||||
//! Executor contracts.
|
||||
|
||||
mod execution;
|
||||
mod executor;
|
||||
/// Exposes the blockhash policy kind.
|
||||
pub use self::execution::ExApiExecutionBlockhashKind;
|
||||
/// Exposes the blockhash policy.
|
||||
pub use self::execution::ExApiExecutionBlockhashPolicy;
|
||||
/// Exposes the exact execution capability result.
|
||||
pub use self::execution::ExApiExecutionCapability;
|
||||
/// Exposes supported Solana clusters.
|
||||
pub use self::execution::ExApiExecutionCluster;
|
||||
/// Exposes cluster restrictions.
|
||||
pub use self::execution::ExApiExecutionClusterPolicy;
|
||||
/// Exposes the result of waiting for transaction confirmation.
|
||||
pub use self::execution::ExApiExecutionConfirmationResult;
|
||||
/// Exposes transaction confirmation states.
|
||||
pub use self::execution::ExApiExecutionConfirmationStatus;
|
||||
/// Exposes explicit execution cost ceilings.
|
||||
pub use self::execution::ExApiExecutionCostLimit;
|
||||
/// Exposes the complete execution policy.
|
||||
pub use self::execution::ExApiExecutionPolicy;
|
||||
/// Exposes the result of a transaction send adapter.
|
||||
pub use self::execution::ExApiExecutionSendResult;
|
||||
/// Exposes the simulation policy.
|
||||
pub use self::execution::ExApiExecutionSimulationPolicy;
|
||||
/// Exposes the simulation result contract.
|
||||
pub use self::execution::ExApiExecutionSimulationResult;
|
||||
/// Exposes one planned instruction account.
|
||||
pub use self::execution::ExApiPlannedAccount;
|
||||
/// Exposes one encoded planned instruction.
|
||||
pub use self::execution::ExApiPlannedInstruction;
|
||||
/// Exposes post-execution replay diagnostics.
|
||||
pub use self::execution::ExApiPostExecutionDiagnostic;
|
||||
/// Exposes post-execution validation requirements.
|
||||
pub use self::execution::ExApiPostExecutionValidationPolicy;
|
||||
/// Exposes a typed execution plan.
|
||||
pub use self::execution::ExApiPreparedExecutionPlan;
|
||||
/// Exposes one required signer.
|
||||
pub use self::execution::ExApiRequiredSigner;
|
||||
/// Exposes the typed executor contract.
|
||||
pub use self::execution::ExApiTypedInstructionExecutor;
|
||||
/// Exposes the legacy common execution plan type.
|
||||
pub use self::executor::ExApiExecutionPlan;
|
||||
/// Exposes the legacy common execution request type.
|
||||
pub use self::executor::ExApiExecutionRequest;
|
||||
/// Exposes the legacy common execution support enum.
|
||||
pub use self::executor::ExApiExecutionSupport;
|
||||
/// Exposes the legacy common instruction executor trait.
|
||||
pub use self::executor::ExApiInstructionExecutor;
|
||||
/// Exposes the compact JSON payload serializer.
|
||||
pub use self::executor::executor_api_serialize_payload_json;
|
||||
/// Exposes the pretty JSON payload serializer.
|
||||
pub use self::executor::executor_api_serialize_payload_json_pretty;
|
||||
499
ks-lib/src/executor/api/execution.rs
Normal file
499
ks-lib/src/executor/api/execution.rs
Normal file
@@ -0,0 +1,499 @@
|
||||
// file: ks-lib/src/executor/api/execution.rs
|
||||
// version: 10
|
||||
|
||||
//! Typed execution plans, policies and result contracts.
|
||||
|
||||
use ts_rs::TS; // rust-rules: derive-import
|
||||
|
||||
/// Exact capability returned for one program operation.
|
||||
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)]
|
||||
#[serde(tag = "status", rename_all = "snake_case")]
|
||||
#[ts(
|
||||
export,
|
||||
export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/ExecutionCapability.ts"
|
||||
)]
|
||||
pub enum ExApiExecutionCapability {
|
||||
/// The operation is implemented by the executor.
|
||||
Supported {
|
||||
/// Stable operation code implemented by the executor.
|
||||
operation_code: std::string::String,
|
||||
},
|
||||
/// The operation is not implemented or is rejected by design.
|
||||
Unsupported {
|
||||
/// Stable reason code.
|
||||
reason_code: std::string::String,
|
||||
/// Human-readable reason.
|
||||
reason: std::string::String,
|
||||
},
|
||||
}
|
||||
|
||||
impl crate::ExApiExecutionCapability {
|
||||
/// Creates a supported capability value.
|
||||
pub fn supported(operation_code: impl std::convert::Into<std::string::String>) -> Self {
|
||||
return Self::Supported { operation_code: operation_code.into() };
|
||||
}
|
||||
|
||||
/// Creates an unsupported capability value.
|
||||
pub fn unsupported(
|
||||
reason_code: impl std::convert::Into<std::string::String>,
|
||||
reason: impl std::convert::Into<std::string::String>,
|
||||
) -> Self {
|
||||
return Self::Unsupported {
|
||||
reason_code: reason_code.into(),
|
||||
reason: reason.into(),
|
||||
};
|
||||
}
|
||||
|
||||
/// Returns whether the capability is explicitly supported.
|
||||
pub fn is_supported(&self) -> bool {
|
||||
return matches!(self, Self::Supported { operation_code: _ });
|
||||
}
|
||||
}
|
||||
|
||||
/// Solana cluster expected by an execution plan.
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Serialize, TS)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[ts(
|
||||
export,
|
||||
export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/ExecutionCluster.ts"
|
||||
)]
|
||||
pub enum ExApiExecutionCluster {
|
||||
/// Local validator cluster.
|
||||
Localnet,
|
||||
/// Public development cluster.
|
||||
Devnet,
|
||||
/// Public test cluster.
|
||||
Testnet,
|
||||
/// Public production cluster.
|
||||
///
|
||||
/// RPC URLs and CLI aliases may still use `mainnet-beta`.
|
||||
Mainnet,
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
enum ExecutionClusterWire {
|
||||
Localnet,
|
||||
Devnet,
|
||||
Testnet,
|
||||
#[serde(alias = "mainnet_beta")]
|
||||
Mainnet,
|
||||
}
|
||||
|
||||
impl<'de> serde::Deserialize<'de> for crate::ExApiExecutionCluster {
|
||||
fn deserialize<Deserializer>(
|
||||
deserializer: Deserializer,
|
||||
) -> std::result::Result<Self, Deserializer::Error>
|
||||
where
|
||||
Deserializer: serde::Deserializer<'de>,
|
||||
{
|
||||
let wire = match <ExecutionClusterWire as serde::Deserialize>::deserialize(deserializer) {
|
||||
std::result::Result::Ok(wire) => wire,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(match wire {
|
||||
ExecutionClusterWire::Localnet => Self::Localnet,
|
||||
ExecutionClusterWire::Devnet => Self::Devnet,
|
||||
ExecutionClusterWire::Testnet => Self::Testnet,
|
||||
ExecutionClusterWire::Mainnet => Self::Mainnet,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// Cluster restrictions attached to an execution plan.
|
||||
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)]
|
||||
#[ts(
|
||||
export,
|
||||
export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/ExecutionClusterPolicy.ts"
|
||||
)]
|
||||
pub struct ExApiExecutionClusterPolicy {
|
||||
/// Cluster that the RPC endpoint must report.
|
||||
pub expected_cluster: crate::ExApiExecutionCluster,
|
||||
/// Whether production execution may proceed after all other checks.
|
||||
pub allow_mainnet: bool,
|
||||
/// Whether the operator explicitly confirmed this production execution.
|
||||
pub mainnet_confirmation: bool,
|
||||
}
|
||||
|
||||
impl std::default::Default for crate::ExApiExecutionClusterPolicy {
|
||||
fn default() -> Self {
|
||||
return Self {
|
||||
expected_cluster: crate::ExApiExecutionCluster::Devnet,
|
||||
allow_mainnet: false,
|
||||
mainnet_confirmation: false,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// Simulation requirement attached to an execution plan.
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[ts(
|
||||
export,
|
||||
export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/ExecutionSimulationPolicy.ts"
|
||||
)]
|
||||
pub enum ExApiExecutionSimulationPolicy {
|
||||
/// Simulation must succeed before signing or sending.
|
||||
Required,
|
||||
/// Simulation is not required. Safety policy rejects this mode by default.
|
||||
Optional,
|
||||
}
|
||||
|
||||
/// Blockhash source required when a transaction is assembled.
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[ts(
|
||||
export,
|
||||
export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/ExecutionBlockhashKind.ts"
|
||||
)]
|
||||
pub enum ExApiExecutionBlockhashKind {
|
||||
/// Fetch a recent blockhash and enforce a bounded age.
|
||||
Latest,
|
||||
/// Use a durable nonce account and authority.
|
||||
DurableNonce,
|
||||
}
|
||||
|
||||
/// Blockhash or durable nonce policy attached to an execution plan.
|
||||
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)]
|
||||
#[ts(
|
||||
export,
|
||||
export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/ExecutionBlockhashPolicy.ts"
|
||||
)]
|
||||
pub struct ExApiExecutionBlockhashPolicy {
|
||||
/// Selected blockhash source.
|
||||
pub kind: crate::ExApiExecutionBlockhashKind,
|
||||
/// Maximum accepted age for a recent blockhash, in slots.
|
||||
pub max_age_slots: std::option::Option<u64>,
|
||||
/// Durable nonce account when `kind` is `DurableNonce`.
|
||||
pub nonce_account: std::option::Option<crate::MdPubkey>,
|
||||
/// Durable nonce authority when `kind` is `DurableNonce`.
|
||||
pub nonce_authority: std::option::Option<crate::MdPubkey>,
|
||||
}
|
||||
|
||||
impl std::default::Default for crate::ExApiExecutionBlockhashPolicy {
|
||||
fn default() -> Self {
|
||||
return Self {
|
||||
kind: crate::ExApiExecutionBlockhashKind::Latest,
|
||||
max_age_slots: std::option::Option::Some(150),
|
||||
nonce_account: std::option::Option::None,
|
||||
nonce_authority: std::option::Option::None,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// Explicit cost ceilings attached to an execution plan.
|
||||
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)]
|
||||
#[ts(
|
||||
export,
|
||||
export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/ExecutionCostLimit.ts"
|
||||
)]
|
||||
pub struct ExApiExecutionCostLimit {
|
||||
/// Maximum lamports that operation instructions may transfer or lock.
|
||||
pub max_spend_lamports: std::option::Option<u64>,
|
||||
/// Maximum total transaction fee accepted after simulation.
|
||||
pub max_fee_lamports: std::option::Option<u64>,
|
||||
/// Maximum compute-unit price accepted, in micro-lamports per compute unit.
|
||||
pub max_compute_unit_price_micro_lamports: std::option::Option<u64>,
|
||||
}
|
||||
|
||||
impl std::default::Default for crate::ExApiExecutionCostLimit {
|
||||
fn default() -> Self {
|
||||
return Self {
|
||||
max_spend_lamports: std::option::Option::None,
|
||||
max_fee_lamports: std::option::Option::None,
|
||||
max_compute_unit_price_micro_lamports: std::option::Option::None,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// Post-execution replay validation policy.
|
||||
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)]
|
||||
#[ts(
|
||||
export,
|
||||
export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/PostExecutionValidationPolicy.ts"
|
||||
)]
|
||||
pub struct ExApiPostExecutionValidationPolicy {
|
||||
/// Whether the sent signature must be inserted into canonical storage.
|
||||
pub canonical_insert_required: bool,
|
||||
/// Whether core extraction must complete.
|
||||
pub core_extraction_required: bool,
|
||||
/// Whether contextual decode replay must complete.
|
||||
pub decode_replay_required: bool,
|
||||
/// Whether compatible materializers must run.
|
||||
pub materialization_required: bool,
|
||||
}
|
||||
|
||||
impl std::default::Default for crate::ExApiPostExecutionValidationPolicy {
|
||||
fn default() -> Self {
|
||||
return Self {
|
||||
canonical_insert_required: true,
|
||||
core_extraction_required: true,
|
||||
decode_replay_required: true,
|
||||
materialization_required: false,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// Conservative policy carried from intent creation to transaction assembly.
|
||||
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)]
|
||||
#[ts(
|
||||
export,
|
||||
export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/ExecutionPolicy.ts"
|
||||
)]
|
||||
pub struct ExApiExecutionPolicy {
|
||||
/// Cluster restrictions.
|
||||
pub cluster: crate::ExApiExecutionClusterPolicy,
|
||||
/// Simulation requirement.
|
||||
pub simulation: crate::ExApiExecutionSimulationPolicy,
|
||||
/// Blockhash source restrictions.
|
||||
pub blockhash: crate::ExApiExecutionBlockhashPolicy,
|
||||
/// Explicit operation and fee ceilings.
|
||||
pub cost_limit: crate::ExApiExecutionCostLimit,
|
||||
/// Public keys authorized to sign this plan.
|
||||
pub authorized_signers: std::vec::Vec<crate::MdPubkey>,
|
||||
/// Whether the operation is restricted to plan construction and simulation.
|
||||
pub dry_run: bool,
|
||||
/// Required post-execution validation steps.
|
||||
pub post_execution_validation: crate::ExApiPostExecutionValidationPolicy,
|
||||
}
|
||||
|
||||
impl std::default::Default for crate::ExApiExecutionPolicy {
|
||||
fn default() -> Self {
|
||||
return Self {
|
||||
cluster: crate::ExApiExecutionClusterPolicy::default(),
|
||||
simulation: crate::ExApiExecutionSimulationPolicy::Required,
|
||||
blockhash: crate::ExApiExecutionBlockhashPolicy::default(),
|
||||
cost_limit: crate::ExApiExecutionCostLimit::default(),
|
||||
authorized_signers: std::vec::Vec::new(),
|
||||
dry_run: true,
|
||||
post_execution_validation: crate::ExApiPostExecutionValidationPolicy::default(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// One account required by a planned instruction.
|
||||
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)]
|
||||
#[ts(
|
||||
export,
|
||||
export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/PlannedAccount.ts"
|
||||
)]
|
||||
pub struct ExApiPlannedAccount {
|
||||
/// Account public key.
|
||||
pub pubkey: crate::MdPubkey,
|
||||
/// Whether the account must sign the transaction.
|
||||
pub is_signer: bool,
|
||||
/// Whether the account must be writable.
|
||||
pub is_writable: bool,
|
||||
}
|
||||
|
||||
/// One fully encoded instruction in an execution plan.
|
||||
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)]
|
||||
#[ts(
|
||||
export,
|
||||
export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/PlannedInstruction.ts"
|
||||
)]
|
||||
pub struct ExApiPlannedInstruction {
|
||||
/// Target program id.
|
||||
pub program_id: crate::MdProgramId,
|
||||
/// Stable operation code represented by the instruction.
|
||||
pub operation_code: std::string::String,
|
||||
/// Ordered account metadata.
|
||||
pub accounts: std::vec::Vec<crate::ExApiPlannedAccount>,
|
||||
/// Exact encoded instruction payload.
|
||||
pub data: std::vec::Vec<u8>,
|
||||
}
|
||||
|
||||
/// Signer required before transaction assembly.
|
||||
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)]
|
||||
#[ts(
|
||||
export,
|
||||
export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/RequiredSigner.ts"
|
||||
)]
|
||||
pub struct ExApiRequiredSigner {
|
||||
/// Signer public key.
|
||||
pub pubkey: crate::MdPubkey,
|
||||
/// Stable signer role such as `fee_payer`, `funding_account` or `new_account`.
|
||||
pub role: std::string::String,
|
||||
}
|
||||
|
||||
/// Typed execution plan produced before transaction assembly.
|
||||
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)]
|
||||
#[ts(
|
||||
export,
|
||||
export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/PreparedExecutionPlan.ts"
|
||||
)]
|
||||
pub struct ExApiPreparedExecutionPlan {
|
||||
/// Stable executor crate name.
|
||||
pub executor_name: std::string::String,
|
||||
/// Executor package version.
|
||||
pub executor_version: std::string::String,
|
||||
/// Caller-provided intent identifier.
|
||||
pub intent_id: std::string::String,
|
||||
/// Stable operation code.
|
||||
pub operation_code: std::string::String,
|
||||
/// Transaction fee payer.
|
||||
pub fee_payer: crate::MdPubkey,
|
||||
/// Ordered instructions to place in the transaction message.
|
||||
pub instructions: std::vec::Vec<crate::ExApiPlannedInstruction>,
|
||||
/// Deduplicated signers required by the fee payer and instruction metas.
|
||||
pub required_signers: std::vec::Vec<crate::ExApiRequiredSigner>,
|
||||
/// Explicit policy to evaluate before simulation, signing and sending.
|
||||
pub policy: crate::ExApiExecutionPolicy,
|
||||
/// Lamports explicitly transferred or locked by planned instructions.
|
||||
pub requested_spend_lamports: u64,
|
||||
/// Requested compute-unit price, when present.
|
||||
pub requested_compute_unit_price_micro_lamports: std::option::Option<u64>,
|
||||
}
|
||||
|
||||
/// Result returned by a transaction simulation adapter.
|
||||
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)]
|
||||
#[ts(
|
||||
export,
|
||||
export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/ExecutionSimulationResult.ts"
|
||||
)]
|
||||
pub struct ExApiExecutionSimulationResult {
|
||||
/// Whether an RPC simulation call was actually performed.
|
||||
pub simulated: bool,
|
||||
/// Whether the simulated transaction completed successfully.
|
||||
pub success: bool,
|
||||
/// Cluster reported by the simulation adapter.
|
||||
pub cluster: crate::ExApiExecutionCluster,
|
||||
/// Blockhash source used by the simulated transaction.
|
||||
pub blockhash_kind: crate::ExApiExecutionBlockhashKind,
|
||||
/// Observed recent blockhash age, in slots.
|
||||
pub blockhash_age_slots: std::option::Option<u64>,
|
||||
/// Replacement blockhash returned by the node, if replacement was requested.
|
||||
#[serde(default)]
|
||||
pub replacement_blockhash: std::option::Option<std::string::String>,
|
||||
/// Last valid block height associated with the replacement blockhash.
|
||||
#[serde(default)]
|
||||
pub replacement_last_valid_block_height: std::option::Option<u64>,
|
||||
/// Durable nonce account used by the simulated transaction.
|
||||
pub nonce_account: std::option::Option<crate::MdPubkey>,
|
||||
/// Durable nonce authority used by the simulated transaction.
|
||||
pub nonce_authority: std::option::Option<crate::MdPubkey>,
|
||||
/// Compute units consumed when reported by the RPC endpoint.
|
||||
pub units_consumed: std::option::Option<u64>,
|
||||
/// Estimated transaction fee in lamports when available.
|
||||
pub estimated_fee_lamports: std::option::Option<u64>,
|
||||
/// Simulation logs in runtime order.
|
||||
pub logs: std::vec::Vec<std::string::String>,
|
||||
/// Program return data retained as provider-neutral JSON when reported.
|
||||
#[serde(default)]
|
||||
pub return_data: std::option::Option<serde_json::Value>,
|
||||
/// Stable or provider error text when simulation failed.
|
||||
pub error: std::option::Option<std::string::String>,
|
||||
}
|
||||
|
||||
/// Result returned after an adapter submits a signed transaction.
|
||||
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)]
|
||||
#[ts(
|
||||
export,
|
||||
export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/ExecutionSendResult.ts"
|
||||
)]
|
||||
pub struct ExApiExecutionSendResult {
|
||||
/// Cluster used for submission.
|
||||
pub cluster: crate::ExApiExecutionCluster,
|
||||
/// Signature returned by the RPC endpoint.
|
||||
pub signature: crate::MdSignature,
|
||||
/// Whether submission was accepted by the RPC endpoint.
|
||||
pub submitted: bool,
|
||||
}
|
||||
|
||||
/// Confirmation state returned by an execution confirmation adapter.
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[ts(
|
||||
export,
|
||||
export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/ExecutionConfirmationStatus.ts"
|
||||
)]
|
||||
pub enum ExApiExecutionConfirmationStatus {
|
||||
/// The transaction was observed at processed commitment.
|
||||
Processed,
|
||||
/// The transaction reached confirmed commitment.
|
||||
Confirmed,
|
||||
/// The transaction reached finalized commitment.
|
||||
Finalized,
|
||||
/// The transaction was confirmed with a runtime error.
|
||||
Failed,
|
||||
/// The transaction was not confirmed before its blockhash expired.
|
||||
Expired,
|
||||
/// The bounded confirmation poll ended before reaching the requested commitment.
|
||||
TimedOut,
|
||||
}
|
||||
|
||||
/// Result returned after waiting for transaction confirmation.
|
||||
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)]
|
||||
#[ts(
|
||||
export,
|
||||
export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/ExecutionConfirmationResult.ts"
|
||||
)]
|
||||
pub struct ExApiExecutionConfirmationResult {
|
||||
/// Cluster queried for confirmation.
|
||||
pub cluster: crate::ExApiExecutionCluster,
|
||||
/// Submitted transaction signature.
|
||||
pub signature: crate::MdSignature,
|
||||
/// Highest confirmation state reached.
|
||||
pub status: crate::ExApiExecutionConfirmationStatus,
|
||||
/// Slot that reported the transaction when available.
|
||||
pub slot: std::option::Option<u64>,
|
||||
/// Number of status polling attempts performed.
|
||||
pub attempts: u32,
|
||||
/// Last block height observed while checking recent-blockhash expiration.
|
||||
pub last_observed_block_height: std::option::Option<u64>,
|
||||
/// Stable or provider error text when confirmation failed.
|
||||
pub error: std::option::Option<std::string::String>,
|
||||
}
|
||||
|
||||
/// Diagnostic produced by post-execution canonical replay validation.
|
||||
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)]
|
||||
#[ts(
|
||||
export,
|
||||
export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/PostExecutionDiagnostic.ts"
|
||||
)]
|
||||
pub struct ExApiPostExecutionDiagnostic {
|
||||
/// Executed transaction signature.
|
||||
pub signature: crate::MdSignature,
|
||||
/// Whether canonical insertion completed.
|
||||
pub canonical_inserted: bool,
|
||||
/// Whether core extraction completed.
|
||||
pub core_extracted: bool,
|
||||
/// Whether contextual decode replay completed.
|
||||
pub decode_replayed: bool,
|
||||
/// Whether requested materialization completed.
|
||||
pub materialized: bool,
|
||||
/// Diagnostic messages from orchestration layers.
|
||||
pub diagnostics: std::vec::Vec<std::string::String>,
|
||||
}
|
||||
|
||||
/// Contract implemented by executors that expose typed intents and exact plans.
|
||||
pub trait ExApiTypedInstructionExecutor {
|
||||
/// Protocol-specific typed intent.
|
||||
type Intent;
|
||||
|
||||
/// Returns the exact capability for one program and operation code.
|
||||
fn capability(
|
||||
&self,
|
||||
program_id: &crate::MdProgramId,
|
||||
operation_code: &str,
|
||||
) -> crate::ExApiExecutionCapability;
|
||||
|
||||
/// Builds a typed execution plan without signing, sending or performing I/O.
|
||||
fn build_prepared_plan(
|
||||
&self,
|
||||
intent: &Self::Intent,
|
||||
) -> ks_core::Result<crate::ExApiPreparedExecutionPlan>;
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[test]
|
||||
fn mainnet_cluster_serializes_with_current_name() {
|
||||
let serialized = serde_json::to_string(&crate::ExApiExecutionCluster::Mainnet)
|
||||
.unwrap_or_else(|error| panic!("unexpected serialization error: {error}"));
|
||||
assert_eq!(serialized, "\"mainnet\"");
|
||||
let legacy = serde_json::from_str::<crate::ExApiExecutionCluster>("\"mainnet_beta\"")
|
||||
.unwrap_or_else(|error| panic!("unexpected deserialization error: {error}"));
|
||||
assert_eq!(legacy, crate::ExApiExecutionCluster::Mainnet);
|
||||
}
|
||||
}
|
||||
109
ks-lib/src/executor/api/executor.rs
Normal file
109
ks-lib/src/executor/api/executor.rs
Normal file
@@ -0,0 +1,109 @@
|
||||
// file: ks-lib/src/executor/api/executor.rs
|
||||
// version: 5
|
||||
|
||||
//! Shared execution contract and neutral request models.
|
||||
|
||||
use ts_rs::TS; // rust-rules: derive-import
|
||||
|
||||
/// Support level returned by an executor for a requested operation.
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, TS)]
|
||||
#[ts(
|
||||
export,
|
||||
export_to = "../frontend/ts/bindings/ks_lib/executor/api/executor/ExecutionSupport.ts"
|
||||
)]
|
||||
pub enum ExApiExecutionSupport {
|
||||
/// The executor cannot handle the request.
|
||||
No,
|
||||
/// The executor may handle the request after account and payload validation.
|
||||
Maybe,
|
||||
/// The executor explicitly supports the request.
|
||||
Yes,
|
||||
}
|
||||
|
||||
/// Generic request used before protocol-specific execution models are introduced.
|
||||
#[derive(Clone, Debug, Eq, PartialEq, TS)]
|
||||
#[ts(
|
||||
export,
|
||||
export_to = "../frontend/ts/bindings/ks_lib/executor/api/executor/ExecutionRequest.ts"
|
||||
)]
|
||||
pub struct ExApiExecutionRequest {
|
||||
/// Target program id.
|
||||
pub program_id: crate::MdProgramId,
|
||||
/// Stable operation code such as buy, sell, transfer or route.
|
||||
pub operation_code: std::string::String,
|
||||
/// Serialized JSON payload reserved for protocol-specific arguments.
|
||||
pub payload_json: std::string::String,
|
||||
}
|
||||
|
||||
/// Neutral execution plan placeholder produced by executor crates.
|
||||
#[derive(Clone, Debug, Eq, PartialEq, TS)]
|
||||
#[ts(
|
||||
export,
|
||||
export_to = "../frontend/ts/bindings/ks_lib/executor/api/executor/ExecutionPlan.ts"
|
||||
)]
|
||||
pub struct ExApiExecutionPlan {
|
||||
/// Stable executor crate name.
|
||||
pub executor_name: std::string::String,
|
||||
/// Number of instructions that would be produced by the final implementation.
|
||||
pub instruction_count: usize,
|
||||
/// Serialized JSON payload reserved for future instruction data and account metadata.
|
||||
pub payload_json: std::string::String,
|
||||
}
|
||||
|
||||
/// Serializes a JSON payload to its compact string representation.
|
||||
pub fn executor_api_serialize_payload_json(
|
||||
value: &serde_json::Value,
|
||||
) -> ks_core::Result<std::string::String> {
|
||||
return match serde_json::to_string(value) {
|
||||
std::result::Result::Ok(serialized) => std::result::Result::Ok(serialized),
|
||||
std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::new(
|
||||
"execution_payload_json_serialize_failed",
|
||||
error.to_string(),
|
||||
)),
|
||||
};
|
||||
}
|
||||
|
||||
/// Serializes a JSON payload to its pretty string representation.
|
||||
pub fn executor_api_serialize_payload_json_pretty(
|
||||
value: &serde_json::Value,
|
||||
) -> ks_core::Result<std::string::String> {
|
||||
return match serde_json::to_string_pretty(value) {
|
||||
std::result::Result::Ok(serialized) => std::result::Result::Ok(serialized),
|
||||
std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::new(
|
||||
"execution_payload_json_pretty_serialize_failed",
|
||||
error.to_string(),
|
||||
)),
|
||||
};
|
||||
}
|
||||
|
||||
/// Common contract implemented by all execution crates.
|
||||
pub trait ExApiInstructionExecutor {
|
||||
/// Returns the stable executor name.
|
||||
fn executor_name(&self) -> &'static str;
|
||||
|
||||
/// Returns the executor version.
|
||||
fn executor_version(&self) -> &'static str;
|
||||
|
||||
/// Returns the program ids handled by this executor.
|
||||
fn program_ids(&self) -> &'static [&'static str];
|
||||
|
||||
/// Tests whether this executor owns a program id.
|
||||
fn handles_program_id(&self, program_id: &crate::MdProgramId) -> bool {
|
||||
return self
|
||||
.program_ids()
|
||||
.iter()
|
||||
.any(|candidate| return *candidate == program_id.0.as_str());
|
||||
}
|
||||
|
||||
/// Tests whether this executor supports a request.
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport;
|
||||
|
||||
/// Builds a neutral execution plan placeholder.
|
||||
fn build_plan(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan>;
|
||||
}
|
||||
17
ks-lib/src/executor/bridge.rs
Normal file
17
ks-lib/src/executor/bridge.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
// file: ks-lib/src/executor/bridge.rs
|
||||
// version: 3
|
||||
|
||||
//! `bridge` executor family.
|
||||
|
||||
mod circle_cctp_token_messenger_minter;
|
||||
mod circle_cctp_token_messenger_minter_v2;
|
||||
mod layer_zero_endpoint;
|
||||
mod layer_zero_executor;
|
||||
/// Exposes the reserved `bridge/circle_cctp_token_messenger_minter` executor.
|
||||
pub use self::circle_cctp_token_messenger_minter::ExBridgeCircleCctpTokenMessengerMinterExecutor;
|
||||
/// Exposes the reserved `bridge/circle_cctp_token_messenger_minter_v2` executor.
|
||||
pub use self::circle_cctp_token_messenger_minter_v2::ExBridgeCircleCctpTokenMessengerMinterV2Executor;
|
||||
/// Exposes the reserved `bridge/layer_zero_endpoint` executor.
|
||||
pub use self::layer_zero_endpoint::ExBridgeLayerZeroEndpointExecutor;
|
||||
/// Exposes the reserved `bridge/layer_zero_executor` executor.
|
||||
pub use self::layer_zero_executor::ExBridgeLayerZeroExecutorExecutor;
|
||||
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/bridge/circle_cctp_token_messenger_minter.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `bridge_circle_cctp_token_messenger_minter`.
|
||||
|
||||
/// Reserved executor for the `bridge_circle_cctp_token_messenger_minter` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExBridgeCircleCctpTokenMessengerMinterExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExBridgeCircleCctpTokenMessengerMinterExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.bridge.circle_cctp_token_messenger_minter";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::BRIDGE_CIRCLE_CCTP_TOKEN_MESSENGER_MINTER_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"bridge_circle_cctp_token_messenger_minter"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.bridge.circle_cctp_token_messenger_minter".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
// file: ks-lib/src/executor/bridge/circle_cctp_token_messenger_minter_v2.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `bridge_circle_cctp_token_messenger_minter_v2`.
|
||||
|
||||
/// Reserved executor for the `bridge_circle_cctp_token_messenger_minter_v2` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExBridgeCircleCctpTokenMessengerMinterV2Executor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExBridgeCircleCctpTokenMessengerMinterV2Executor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.bridge.circle_cctp_token_messenger_minter_v2";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::BRIDGE_CIRCLE_CCTP_TOKEN_MESSENGER_MINTER_V2_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"bridge_circle_cctp_token_messenger_minter_v2"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.bridge.circle_cctp_token_messenger_minter_v2"
|
||||
.to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/bridge/layer_zero_endpoint.rs
Normal file
49
ks-lib/src/executor/bridge/layer_zero_endpoint.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/bridge/layer_zero_endpoint.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `bridge_layer_zero_endpoint`.
|
||||
|
||||
/// Reserved executor for the `bridge_layer_zero_endpoint` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExBridgeLayerZeroEndpointExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExBridgeLayerZeroEndpointExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.bridge.layer_zero_endpoint";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::BRIDGE_LAYER_ZERO_ENDPOINT_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"bridge_layer_zero_endpoint"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.bridge.layer_zero_endpoint".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/bridge/layer_zero_executor.rs
Normal file
49
ks-lib/src/executor/bridge/layer_zero_executor.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/bridge/layer_zero_executor.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `bridge_layer_zero_executor`.
|
||||
|
||||
/// Reserved executor for the `bridge_layer_zero_executor` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExBridgeLayerZeroExecutorExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExBridgeLayerZeroExecutorExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.bridge.layer_zero_executor";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::BRIDGE_LAYER_ZERO_EXECUTOR_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"bridge_layer_zero_executor"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.bridge.layer_zero_executor".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
23
ks-lib/src/executor/clmm.rs
Normal file
23
ks-lib/src/executor/clmm.rs
Normal file
@@ -0,0 +1,23 @@
|
||||
// file: ks-lib/src/executor/clmm.rs
|
||||
// version: 3
|
||||
|
||||
//! `clmm` executor family.
|
||||
|
||||
mod byreal;
|
||||
mod fusion;
|
||||
mod orca_whirlpool;
|
||||
mod pancake_swap;
|
||||
mod raydium;
|
||||
mod stabble;
|
||||
/// Exposes the reserved `clmm/byreal` executor.
|
||||
pub use self::byreal::ExClmmByrealExecutor;
|
||||
/// Exposes the reserved `clmm/fusion` executor.
|
||||
pub use self::fusion::ExClmmFusionExecutor;
|
||||
/// Exposes the reserved `clmm/orca_whirlpool` executor.
|
||||
pub use self::orca_whirlpool::ExClmmOrcaWhirlpoolExecutor;
|
||||
/// Exposes the reserved `clmm/pancake_swap` executor.
|
||||
pub use self::pancake_swap::ExClmmPancakeSwapExecutor;
|
||||
/// Exposes the reserved `clmm/raydium` executor.
|
||||
pub use self::raydium::ExClmmRaydiumExecutor;
|
||||
/// Exposes the reserved `clmm/stabble` executor.
|
||||
pub use self::stabble::ExClmmStabbleExecutor;
|
||||
49
ks-lib/src/executor/clmm/byreal.rs
Normal file
49
ks-lib/src/executor/clmm/byreal.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/clmm/byreal.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `clmm_byreal`.
|
||||
|
||||
/// Reserved executor for the `clmm_byreal` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExClmmByrealExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExClmmByrealExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.clmm.byreal";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::CLMM_BYREAL_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"clmm_byreal"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.clmm.byreal".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/clmm/fusion.rs
Normal file
49
ks-lib/src/executor/clmm/fusion.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/clmm/fusion.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `clmm_fusion`.
|
||||
|
||||
/// Reserved executor for the `clmm_fusion` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExClmmFusionExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExClmmFusionExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.clmm.fusion";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::CLMM_FUSION_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"clmm_fusion"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.clmm.fusion".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/clmm/orca_whirlpool.rs
Normal file
49
ks-lib/src/executor/clmm/orca_whirlpool.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/clmm/orca_whirlpool.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `clmm_orca_whirlpool`.
|
||||
|
||||
/// Reserved executor for the `clmm_orca_whirlpool` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExClmmOrcaWhirlpoolExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExClmmOrcaWhirlpoolExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.clmm.orca_whirlpool";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::CLMM_ORCA_WHIRLPOOL_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"clmm_orca_whirlpool"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.clmm.orca_whirlpool".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/clmm/pancake_swap.rs
Normal file
49
ks-lib/src/executor/clmm/pancake_swap.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/clmm/pancake_swap.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `clmm_pancake_swap`.
|
||||
|
||||
/// Reserved executor for the `clmm_pancake_swap` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExClmmPancakeSwapExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExClmmPancakeSwapExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.clmm.pancake_swap";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::CLMM_PANCAKE_SWAP_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"clmm_pancake_swap"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.clmm.pancake_swap".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/clmm/raydium.rs
Normal file
49
ks-lib/src/executor/clmm/raydium.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/clmm/raydium.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `clmm_raydium`.
|
||||
|
||||
/// Reserved executor for the `clmm_raydium` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExClmmRaydiumExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExClmmRaydiumExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.clmm.raydium";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::CLMM_RAYDIUM_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"clmm_raydium"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.clmm.raydium".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/clmm/stabble.rs
Normal file
49
ks-lib/src/executor/clmm/stabble.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/clmm/stabble.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `clmm_stabble`.
|
||||
|
||||
/// Reserved executor for the `clmm_stabble` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExClmmStabbleExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExClmmStabbleExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.clmm.stabble";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::CLMM_STABBLE_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"clmm_stabble"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.clmm.stabble".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
8
ks-lib/src/executor/cpmm.rs
Normal file
8
ks-lib/src/executor/cpmm.rs
Normal file
@@ -0,0 +1,8 @@
|
||||
// file: ks-lib/src/executor/cpmm.rs
|
||||
// version: 3
|
||||
|
||||
//! `cpmm` executor family.
|
||||
|
||||
mod raydium;
|
||||
/// Exposes the reserved `cpmm/raydium` executor.
|
||||
pub use self::raydium::ExCpmmRaydiumExecutor;
|
||||
49
ks-lib/src/executor/cpmm/raydium.rs
Normal file
49
ks-lib/src/executor/cpmm/raydium.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/cpmm/raydium.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `cpmm_raydium`.
|
||||
|
||||
/// Reserved executor for the `cpmm_raydium` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExCpmmRaydiumExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExCpmmRaydiumExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.cpmm.raydium";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::CPMM_RAYDIUM_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"cpmm_raydium"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.cpmm.raydium".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
8
ks-lib/src/executor/dlmm.rs
Normal file
8
ks-lib/src/executor/dlmm.rs
Normal file
@@ -0,0 +1,8 @@
|
||||
// file: ks-lib/src/executor/dlmm.rs
|
||||
// version: 3
|
||||
|
||||
//! `dlmm` executor family.
|
||||
|
||||
mod meteora;
|
||||
/// Exposes the reserved `dlmm/meteora` executor.
|
||||
pub use self::meteora::ExDlmmMeteoraExecutor;
|
||||
49
ks-lib/src/executor/dlmm/meteora.rs
Normal file
49
ks-lib/src/executor/dlmm/meteora.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/dlmm/meteora.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `dlmm_meteora`.
|
||||
|
||||
/// Reserved executor for the `dlmm_meteora` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExDlmmMeteoraExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExDlmmMeteoraExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.dlmm.meteora";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::DLMM_METEORA_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"dlmm_meteora"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.dlmm.meteora".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
15
ks-lib/src/executor/fees.rs
Normal file
15
ks-lib/src/executor/fees.rs
Normal file
@@ -0,0 +1,15 @@
|
||||
// file: ks-lib/src/executor/fees.rs
|
||||
// version: 4
|
||||
|
||||
//! `fees` executor family.
|
||||
|
||||
mod bags_fee_share_v1;
|
||||
mod bags_fee_share_v2;
|
||||
mod pump_fees;
|
||||
|
||||
/// Exposes the reserved `fees/bags_fee_share_v1` executor.
|
||||
pub use self::bags_fee_share_v1::ExFeesBagsFeeShareV1Executor;
|
||||
/// Exposes the reserved `fees/bags_fee_share_v2` executor.
|
||||
pub use self::bags_fee_share_v2::ExFeesBagsFeeShareV2Executor;
|
||||
/// Exposes the reserved `fees/pump_fees` executor.
|
||||
pub use self::pump_fees::ExFeesPumpFeesExecutor;
|
||||
49
ks-lib/src/executor/fees/bags_fee_share_v1.rs
Normal file
49
ks-lib/src/executor/fees/bags_fee_share_v1.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/fees/bags_fee_share_v1.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `fees_bags_fee_share_v1`.
|
||||
|
||||
/// Reserved executor for the `fees_bags_fee_share_v1` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExFeesBagsFeeShareV1Executor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExFeesBagsFeeShareV1Executor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.fees.bags_fee_share_v1";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::FEES_BAGS_FEE_SHARE_V1_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"fees_bags_fee_share_v1"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.fees.bags_fee_share_v1".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/fees/bags_fee_share_v2.rs
Normal file
49
ks-lib/src/executor/fees/bags_fee_share_v2.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/fees/bags_fee_share_v2.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `fees_bags_fee_share_v2`.
|
||||
|
||||
/// Reserved executor for the `fees_bags_fee_share_v2` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExFeesBagsFeeShareV2Executor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExFeesBagsFeeShareV2Executor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.fees.bags_fee_share_v2";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::FEES_BAGS_FEE_SHARE_V2_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"fees_bags_fee_share_v2"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.fees.bags_fee_share_v2".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/fees/pump_fees.rs
Normal file
49
ks-lib/src/executor/fees/pump_fees.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/fees/pump_fees.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `fees_pump_fees`.
|
||||
|
||||
/// Reserved executor for the `fees_pump_fees` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExFeesPumpFeesExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExFeesPumpFeesExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.fees.pump_fees";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::FEES_PUMP_FEES_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"fees_pump_fees"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.fees.pump_fees".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
15
ks-lib/src/executor/governance.rs
Normal file
15
ks-lib/src/executor/governance.rs
Normal file
@@ -0,0 +1,15 @@
|
||||
// file: ks-lib/src/executor/governance.rs
|
||||
// version: 4
|
||||
|
||||
//! `governance` executor family.
|
||||
|
||||
mod metadao_bid_wall;
|
||||
mod metadao_futarchy;
|
||||
mod squads_multisig;
|
||||
|
||||
/// Exposes the reserved `governance/metadao_bid_wall` executor.
|
||||
pub use self::metadao_bid_wall::ExGovernanceMetadaoBidWallExecutor;
|
||||
/// Exposes the reserved `governance/metadao_futarchy` executor.
|
||||
pub use self::metadao_futarchy::ExGovernanceMetadaoFutarchyExecutor;
|
||||
/// Exposes the reserved `governance/squads_multisig` executor.
|
||||
pub use self::squads_multisig::ExGovernanceSquadsMultisigExecutor;
|
||||
49
ks-lib/src/executor/governance/metadao_bid_wall.rs
Normal file
49
ks-lib/src/executor/governance/metadao_bid_wall.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/governance/metadao_bid_wall.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `governance_metadao_bid_wall`.
|
||||
|
||||
/// Reserved executor for the `governance_metadao_bid_wall` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExGovernanceMetadaoBidWallExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExGovernanceMetadaoBidWallExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.governance.metadao_bid_wall";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::GOVERNANCE_METADAO_BID_WALL_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"governance_metadao_bid_wall"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.governance.metadao_bid_wall".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/governance/metadao_futarchy.rs
Normal file
49
ks-lib/src/executor/governance/metadao_futarchy.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/governance/metadao_futarchy.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `governance_metadao_futarchy`.
|
||||
|
||||
/// Reserved executor for the `governance_metadao_futarchy` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExGovernanceMetadaoFutarchyExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExGovernanceMetadaoFutarchyExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.governance.metadao_futarchy";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::GOVERNANCE_METADAO_FUTARCHY_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"governance_metadao_futarchy"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.governance.metadao_futarchy".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/governance/squads_multisig.rs
Normal file
49
ks-lib/src/executor/governance/squads_multisig.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/governance/squads_multisig.rs
|
||||
// version: 2
|
||||
|
||||
//! Reserved executor for `governance_squads_multisig`.
|
||||
|
||||
/// Reserved executor for the `governance_squads_multisig` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExGovernanceSquadsMultisigExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExGovernanceSquadsMultisigExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.governance.squads_multisig";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::GOVERNANCE_SQUADS_MULTISIG_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"governance_squads_multisig"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.governance.squads_multisig".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
36
ks-lib/src/executor/launchpad.rs
Normal file
36
ks-lib/src/executor/launchpad.rs
Normal file
@@ -0,0 +1,36 @@
|
||||
// file: ks-lib/src/executor/launchpad.rs
|
||||
// version: 4
|
||||
|
||||
//! `launchpad` executor family.
|
||||
|
||||
mod boop_fun;
|
||||
mod metadao_ico;
|
||||
mod meteora_dbc;
|
||||
mod moonit;
|
||||
mod orca_wavebreak;
|
||||
mod printr;
|
||||
mod pump_fun;
|
||||
mod pump_pumpup_ai;
|
||||
mod raydium_launchlab;
|
||||
mod virtuals;
|
||||
|
||||
/// Exposes the reserved `launchpad/boop_fun` executor.
|
||||
pub use self::boop_fun::ExLaunchpadBoopFunExecutor;
|
||||
/// Exposes the reserved `launchpad/metadao_ico` executor.
|
||||
pub use self::metadao_ico::ExLaunchpadMetadaoIcoExecutor;
|
||||
/// Exposes the reserved `launchpad/meteora_dbc` executor.
|
||||
pub use self::meteora_dbc::ExLaunchpadMeteoraDbcExecutor;
|
||||
/// Exposes the reserved `launchpad/moonit` executor.
|
||||
pub use self::moonit::ExLaunchpadMoonitExecutor;
|
||||
/// Exposes the reserved `launchpad/orca_wavebreak` executor.
|
||||
pub use self::orca_wavebreak::ExLaunchpadOrcaWavebreakExecutor;
|
||||
/// Exposes the reserved `launchpad/printr` executor.
|
||||
pub use self::printr::ExLaunchpadPrintrExecutor;
|
||||
/// Exposes the reserved `launchpad/pump_fun` executor.
|
||||
pub use self::pump_fun::ExLaunchpadPumpFunExecutor;
|
||||
/// Exposes the reserved `launchpad/pump_pumpup_ai` executor.
|
||||
pub use self::pump_pumpup_ai::ExLaunchpadPumpPumpupAiExecutor;
|
||||
/// Exposes the reserved `launchpad/raydium_launchlab` executor.
|
||||
pub use self::raydium_launchlab::ExLaunchpadRaydiumLaunchlabExecutor;
|
||||
/// Exposes the reserved `launchpad/virtuals` executor.
|
||||
pub use self::virtuals::ExLaunchpadVirtualsExecutor;
|
||||
49
ks-lib/src/executor/launchpad/boop_fun.rs
Normal file
49
ks-lib/src/executor/launchpad/boop_fun.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/launchpad/boop_fun.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `launchpad_boop_fun`.
|
||||
|
||||
/// Reserved executor for the `launchpad_boop_fun` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExLaunchpadBoopFunExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExLaunchpadBoopFunExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.launchpad.boop_fun";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::LAUNCHPAD_BOOP_FUN_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"launchpad_boop_fun"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.launchpad.boop_fun".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/launchpad/metadao_ico.rs
Normal file
49
ks-lib/src/executor/launchpad/metadao_ico.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/launchpad/metadao_ico.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `launchpad_metadao_ico`.
|
||||
|
||||
/// Reserved executor for the `launchpad_metadao_ico` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExLaunchpadMetadaoIcoExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExLaunchpadMetadaoIcoExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.launchpad.metadao_ico";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::LAUNCHPAD_METADAO_ICO_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"launchpad_metadao_ico"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.launchpad.metadao_ico".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/launchpad/meteora_dbc.rs
Normal file
49
ks-lib/src/executor/launchpad/meteora_dbc.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/launchpad/meteora_dbc.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `launchpad_meteora_dbc`.
|
||||
|
||||
/// Reserved executor for the `launchpad_meteora_dbc` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExLaunchpadMeteoraDbcExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExLaunchpadMeteoraDbcExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.launchpad.meteora_dbc";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::LAUNCHPAD_METEORA_DBC_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"launchpad_meteora_dbc"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.launchpad.meteora_dbc".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/launchpad/moonit.rs
Normal file
49
ks-lib/src/executor/launchpad/moonit.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/launchpad/moonit.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `launchpad_moonit`.
|
||||
|
||||
/// Reserved executor for the `launchpad_moonit` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExLaunchpadMoonitExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExLaunchpadMoonitExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.launchpad.moonit";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::LAUNCHPAD_MOONIT_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"launchpad_moonit"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.launchpad.moonit".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/launchpad/orca_wavebreak.rs
Normal file
49
ks-lib/src/executor/launchpad/orca_wavebreak.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/launchpad/orca_wavebreak.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `launchpad_orca_wavebreak`.
|
||||
|
||||
/// Reserved executor for the `launchpad_orca_wavebreak` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExLaunchpadOrcaWavebreakExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExLaunchpadOrcaWavebreakExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.launchpad.orca_wavebreak";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::LAUNCHPAD_ORCA_WAVEBREAK_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"launchpad_orca_wavebreak"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.launchpad.orca_wavebreak".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/launchpad/printr.rs
Normal file
49
ks-lib/src/executor/launchpad/printr.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/launchpad/printr.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `launchpad_printr`.
|
||||
|
||||
/// Reserved executor for the `launchpad_printr` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExLaunchpadPrintrExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExLaunchpadPrintrExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.launchpad.printr";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::LAUNCHPAD_PRINTR_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"launchpad_printr"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.launchpad.printr".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/launchpad/pump_fun.rs
Normal file
49
ks-lib/src/executor/launchpad/pump_fun.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/launchpad/pump_fun.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `launchpad_pump_fun`.
|
||||
|
||||
/// Reserved executor for the `launchpad_pump_fun` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExLaunchpadPumpFunExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExLaunchpadPumpFunExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.launchpad.pump_fun";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::LAUNCHPAD_PUMP_FUN_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"launchpad_pump_fun"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.launchpad.pump_fun".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/launchpad/pump_pumpup_ai.rs
Normal file
49
ks-lib/src/executor/launchpad/pump_pumpup_ai.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/launchpad/pump_pumpup_ai.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `launchpad_pump_pumpup_ai`.
|
||||
|
||||
/// Reserved executor for the `launchpad_pump_pumpup_ai` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExLaunchpadPumpPumpupAiExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExLaunchpadPumpPumpupAiExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.launchpad.pump_pumpup_ai";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::LAUNCHPAD_PUMP_PUMPUP_AI_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"launchpad_pump_pumpup_ai"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.launchpad.pump_pumpup_ai".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/launchpad/raydium_launchlab.rs
Normal file
49
ks-lib/src/executor/launchpad/raydium_launchlab.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/launchpad/raydium_launchlab.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `launchpad_raydium_launchlab`.
|
||||
|
||||
/// Reserved executor for the `launchpad_raydium_launchlab` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExLaunchpadRaydiumLaunchlabExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExLaunchpadRaydiumLaunchlabExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.launchpad.raydium_launchlab";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::LAUNCHPAD_RAYDIUM_LAUNCHLAB_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"launchpad_raydium_launchlab"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.launchpad.raydium_launchlab".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/launchpad/virtuals.rs
Normal file
49
ks-lib/src/executor/launchpad/virtuals.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/launchpad/virtuals.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `launchpad_virtuals`.
|
||||
|
||||
/// Reserved executor for the `launchpad_virtuals` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExLaunchpadVirtualsExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExLaunchpadVirtualsExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.launchpad.virtuals";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::LAUNCHPAD_VIRTUALS_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"launchpad_virtuals"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.launchpad.virtuals".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
26
ks-lib/src/executor/lending.rs
Normal file
26
ks-lib/src/executor/lending.rs
Normal file
@@ -0,0 +1,26 @@
|
||||
// file: ks-lib/src/executor/lending.rs
|
||||
// version: 3
|
||||
|
||||
//! `lending` executor family.
|
||||
|
||||
mod clone;
|
||||
mod jupiter_lend_borrow;
|
||||
mod jupiter_lend_earn;
|
||||
mod jupiter_lend_flash_loan;
|
||||
mod jupiter_lend_liquidity;
|
||||
mod kamino;
|
||||
mod marginfi_v2;
|
||||
/// Exposes the reserved `lending/clone` executor.
|
||||
pub use self::clone::ExLendingCloneExecutor;
|
||||
/// Exposes the reserved `lending/jupiter_lend_borrow` executor.
|
||||
pub use self::jupiter_lend_borrow::ExLendingJupiterLendBorrowExecutor;
|
||||
/// Exposes the reserved `lending/jupiter_lend_earn` executor.
|
||||
pub use self::jupiter_lend_earn::ExLendingJupiterLendEarnExecutor;
|
||||
/// Exposes the reserved `lending/jupiter_lend_flash_loan` executor.
|
||||
pub use self::jupiter_lend_flash_loan::ExLendingJupiterLendFlashLoanExecutor;
|
||||
/// Exposes the reserved `lending/jupiter_lend_liquidity` executor.
|
||||
pub use self::jupiter_lend_liquidity::ExLendingJupiterLendLiquidityExecutor;
|
||||
/// Exposes the reserved `lending/kamino` executor.
|
||||
pub use self::kamino::ExLendingKaminoExecutor;
|
||||
/// Exposes the reserved `lending/marginfi_v2` executor.
|
||||
pub use self::marginfi_v2::ExLendingMarginfiV2Executor;
|
||||
49
ks-lib/src/executor/lending/clone.rs
Normal file
49
ks-lib/src/executor/lending/clone.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/lending/clone.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `lending_clone`.
|
||||
|
||||
/// Reserved executor for the `lending_clone` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExLendingCloneExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExLendingCloneExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.lending.clone";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::LENDING_CLONE_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"lending_clone"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.lending.clone".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/lending/jupiter_lend_borrow.rs
Normal file
49
ks-lib/src/executor/lending/jupiter_lend_borrow.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/lending/jupiter_lend_borrow.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `lending_jupiter_lend_borrow`.
|
||||
|
||||
/// Reserved executor for the `lending_jupiter_lend_borrow` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExLendingJupiterLendBorrowExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExLendingJupiterLendBorrowExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.lending.jupiter_lend_borrow";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::LENDING_JUPITER_LEND_BORROW_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"lending_jupiter_lend_borrow"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.lending.jupiter_lend_borrow".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/lending/jupiter_lend_earn.rs
Normal file
49
ks-lib/src/executor/lending/jupiter_lend_earn.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/lending/jupiter_lend_earn.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `lending_jupiter_lend_earn`.
|
||||
|
||||
/// Reserved executor for the `lending_jupiter_lend_earn` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExLendingJupiterLendEarnExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExLendingJupiterLendEarnExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.lending.jupiter_lend_earn";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::LENDING_JUPITER_LEND_EARN_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"lending_jupiter_lend_earn"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.lending.jupiter_lend_earn".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/lending/jupiter_lend_flash_loan.rs
Normal file
49
ks-lib/src/executor/lending/jupiter_lend_flash_loan.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/lending/jupiter_lend_flash_loan.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `lending_jupiter_lend_flash_loan`.
|
||||
|
||||
/// Reserved executor for the `lending_jupiter_lend_flash_loan` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExLendingJupiterLendFlashLoanExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExLendingJupiterLendFlashLoanExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.lending.jupiter_lend_flash_loan";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::LENDING_JUPITER_LEND_FLASH_LOAN_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"lending_jupiter_lend_flash_loan"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.lending.jupiter_lend_flash_loan".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/lending/jupiter_lend_liquidity.rs
Normal file
49
ks-lib/src/executor/lending/jupiter_lend_liquidity.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/lending/jupiter_lend_liquidity.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `lending_jupiter_lend_liquidity`.
|
||||
|
||||
/// Reserved executor for the `lending_jupiter_lend_liquidity` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExLendingJupiterLendLiquidityExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExLendingJupiterLendLiquidityExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.lending.jupiter_lend_liquidity";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::LENDING_JUPITER_LEND_LIQUIDITY_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"lending_jupiter_lend_liquidity"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.lending.jupiter_lend_liquidity".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/lending/kamino.rs
Normal file
49
ks-lib/src/executor/lending/kamino.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/lending/kamino.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `lending_kamino`.
|
||||
|
||||
/// Reserved executor for the `lending_kamino` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExLendingKaminoExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExLendingKaminoExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.lending.kamino";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::LENDING_KAMINO_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"lending_kamino"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.lending.kamino".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/lending/marginfi_v2.rs
Normal file
49
ks-lib/src/executor/lending/marginfi_v2.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/lending/marginfi_v2.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `lending_marginfi_v2`.
|
||||
|
||||
/// Reserved executor for the `lending_marginfi_v2` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExLendingMarginfiV2Executor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExLendingMarginfiV2Executor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.lending.marginfi_v2";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::LENDING_MARGINFI_V2_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"lending_marginfi_v2"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.lending.marginfi_v2".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
8
ks-lib/src/executor/lock.rs
Normal file
8
ks-lib/src/executor/lock.rs
Normal file
@@ -0,0 +1,8 @@
|
||||
// file: ks-lib/src/executor/lock.rs
|
||||
// version: 3
|
||||
|
||||
//! `lock` executor family.
|
||||
|
||||
mod raydium_lp;
|
||||
/// Exposes the reserved `lock/raydium_lp` executor.
|
||||
pub use self::raydium_lp::ExLockRaydiumLpExecutor;
|
||||
49
ks-lib/src/executor/lock/raydium_lp.rs
Normal file
49
ks-lib/src/executor/lock/raydium_lp.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/lock/raydium_lp.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `lock_raydium_lp`.
|
||||
|
||||
/// Reserved executor for the `lock_raydium_lp` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExLockRaydiumLpExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExLockRaydiumLpExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.lock.raydium_lp";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::LOCK_RAYDIUM_LP_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"lock_raydium_lp"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.lock.raydium_lp".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
147
ks-lib/src/executor/metadata.rs
Normal file
147
ks-lib/src/executor/metadata.rs
Normal file
@@ -0,0 +1,147 @@
|
||||
// file: ks-lib/src/executor/metadata.rs
|
||||
// version: 10
|
||||
|
||||
//! `metadata` executor family.
|
||||
|
||||
mod metaplex_token_metadata;
|
||||
mod solana_program_metadata;
|
||||
mod spl_name_service;
|
||||
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_APPROVE_USE_AUTHORITY_OPERATION`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_APPROVE_USE_AUTHORITY_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_BURN_OPERATION`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_BURN_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_CLOSE_ACCOUNTS_OPERATION`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_CLOSE_ACCOUNTS_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_CLOSE_ESCROW_ACCOUNT_OPERATION`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_CLOSE_ESCROW_ACCOUNT_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_COLLECT_OPERATION`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_COLLECT_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_CONVERT_MASTER_EDITION_V1_TO_V2_OPERATION`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_CONVERT_MASTER_EDITION_V1_TO_V2_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_CREATE_ESCROW_ACCOUNT_OPERATION`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_CREATE_ESCROW_ACCOUNT_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_CREATE_OPERATION`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_CREATE_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_DELEGATE_OPERATION`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_DELEGATE_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_DEPRECATED_CREATE_MASTER_EDITION_OPERATION`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_DEPRECATED_CREATE_MASTER_EDITION_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_DEPRECATED_CREATE_RESERVATION_LIST_OPERATION`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_DEPRECATED_CREATE_RESERVATION_LIST_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_DEPRECATED_MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_PRINTING_TOKEN_OPERATION`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_DEPRECATED_MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_PRINTING_TOKEN_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_DEPRECATED_MINT_PRINTING_TOKENS_OPERATION`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_DEPRECATED_MINT_PRINTING_TOKENS_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_DEPRECATED_MINT_PRINTING_TOKENS_VIA_TOKEN_OPERATION`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_DEPRECATED_MINT_PRINTING_TOKENS_VIA_TOKEN_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_DEPRECATED_OPERATION_CODES`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_DEPRECATED_OPERATION_CODES;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_DEPRECATED_SET_RESERVATION_LIST_OPERATION`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_DEPRECATED_SET_RESERVATION_LIST_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_LOCK_OPERATION`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_LOCK_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_MIGRATE_OPERATION`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_MIGRATE_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_VAULT_PROXY_OPERATION`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_VAULT_PROXY_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_MINT_OPERATION`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_MINT_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_PRINT_OPERATION`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_PRINT_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_PUFF_METADATA_OPERATION`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_PUFF_METADATA_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_RESIZE_OPERATION`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_RESIZE_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_REVOKE_OPERATION`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_REVOKE_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_REVOKE_USE_AUTHORITY_OPERATION`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_REVOKE_USE_AUTHORITY_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_SET_COLLECTION_SIZE_OPERATION`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_SET_COLLECTION_SIZE_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_SET_TOKEN_STANDARD_OPERATION`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_SET_TOKEN_STANDARD_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_SUPPORTED_OPERATION_CODES`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_SUPPORTED_OPERATION_CODES;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_TRANSFER_OPERATION`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_TRANSFER_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_TRANSFER_OUT_OF_ESCROW_OPERATION`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_TRANSFER_OUT_OF_ESCROW_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_UNLOCK_OPERATION`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_UNLOCK_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_UNVERIFY_OPERATION`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_UNVERIFY_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_UPDATE_OPERATION`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_UPDATE_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_UPDATE_PRIMARY_SALE_HAPPENED_VIA_TOKEN_OPERATION`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_UPDATE_PRIMARY_SALE_HAPPENED_VIA_TOKEN_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_USE_OPERATION`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_USE_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_UTILIZE_OPERATION`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_UTILIZE_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_VERIFY_OPERATION`.
|
||||
pub use self::metaplex_token_metadata::EX_METAPLEX_TOKEN_METADATA_VERIFY_OPERATION;
|
||||
/// Exposes the Metaplex Token Metadata executor.
|
||||
pub use self::metaplex_token_metadata::ExMetadataMetaplexTokenMetadataExecutor;
|
||||
/// Exposes the complete Metaplex Token Metadata execution intent.
|
||||
pub use self::metaplex_token_metadata::ExMetaplexTokenMetadataExecutionIntent;
|
||||
/// Exposes the Metaplex Token Metadata operation intent.
|
||||
pub use self::metaplex_token_metadata::ExMetaplexTokenMetadataOperation;
|
||||
/// Stable Solana Program Metadata `Allocate` operation code.
|
||||
pub use self::solana_program_metadata::EX_METADATA_SPM_ALLOCATE_OPERATION;
|
||||
/// Stable Solana Program Metadata `Close` operation code.
|
||||
pub use self::solana_program_metadata::EX_METADATA_SPM_CLOSE_OPERATION;
|
||||
/// Solana Program Metadata operations requiring explicit destructive approval.
|
||||
pub use self::solana_program_metadata::EX_METADATA_SPM_DESTRUCTIVE_OPERATION_CODES;
|
||||
/// Stable Solana Program Metadata `Extend` operation code.
|
||||
pub use self::solana_program_metadata::EX_METADATA_SPM_EXTEND_OPERATION;
|
||||
/// Stable Solana Program Metadata `Initialize` operation code.
|
||||
pub use self::solana_program_metadata::EX_METADATA_SPM_INITIALIZE_OPERATION;
|
||||
/// Conservative maximum inline Solana Program Metadata content size.
|
||||
pub use self::solana_program_metadata::EX_METADATA_SPM_MAX_INLINE_DATA_BYTES;
|
||||
/// Stable Solana Program Metadata `SetAuthority` operation code.
|
||||
pub use self::solana_program_metadata::EX_METADATA_SPM_SET_AUTHORITY_OPERATION;
|
||||
/// Stable Solana Program Metadata `SetData` operation code.
|
||||
pub use self::solana_program_metadata::EX_METADATA_SPM_SET_DATA_OPERATION;
|
||||
/// Stable Solana Program Metadata `SetImmutable` operation code.
|
||||
pub use self::solana_program_metadata::EX_METADATA_SPM_SET_IMMUTABLE_OPERATION;
|
||||
/// Exact Solana Program Metadata operation inventory.
|
||||
pub use self::solana_program_metadata::EX_METADATA_SPM_SUPPORTED_OPERATION_CODES;
|
||||
/// Stable Solana Program Metadata `Trim` operation code.
|
||||
pub use self::solana_program_metadata::EX_METADATA_SPM_TRIM_OPERATION;
|
||||
/// Stable Solana Program Metadata `Write` operation code.
|
||||
pub use self::solana_program_metadata::EX_METADATA_SPM_WRITE_OPERATION;
|
||||
/// Typed Solana Program Metadata executor.
|
||||
pub use self::solana_program_metadata::ExMetadataSolanaProgramMetadataExecutor;
|
||||
/// Solana Program Metadata compression intent.
|
||||
pub use self::solana_program_metadata::ExMetadataSpmCompression;
|
||||
/// Solana Program Metadata inline data intent.
|
||||
pub use self::solana_program_metadata::ExMetadataSpmDataInput;
|
||||
/// Solana Program Metadata data-source intent.
|
||||
pub use self::solana_program_metadata::ExMetadataSpmDataSource;
|
||||
/// Solana Program Metadata encoding intent.
|
||||
pub use self::solana_program_metadata::ExMetadataSpmEncoding;
|
||||
/// Complete Solana Program Metadata execution intent.
|
||||
pub use self::solana_program_metadata::ExMetadataSpmExecutionIntent;
|
||||
/// Solana Program Metadata format intent.
|
||||
pub use self::solana_program_metadata::ExMetadataSpmFormat;
|
||||
/// One Solana Program Metadata operation.
|
||||
pub use self::solana_program_metadata::ExMetadataSpmOperation;
|
||||
/// Optional Solana Program Metadata program context.
|
||||
pub use self::solana_program_metadata::ExMetadataSpmProgramContext;
|
||||
/// Solana Program Metadata `SetData` source intent.
|
||||
pub use self::solana_program_metadata::ExMetadataSpmSetDataSource;
|
||||
/// Solana Program Metadata `Write` source intent.
|
||||
pub use self::solana_program_metadata::ExMetadataSpmWriteSource;
|
||||
/// Derives the canonical Solana Program Metadata PDA.
|
||||
pub use self::solana_program_metadata::executor_metadata_solana_program_metadata_derive_canonical_pda;
|
||||
/// Derives the non-canonical Solana Program Metadata PDA.
|
||||
pub use self::solana_program_metadata::executor_metadata_solana_program_metadata_derive_non_canonical_pda;
|
||||
/// Exposes the reserved `metadata/spl_name_service` executor.
|
||||
pub use self::spl_name_service::ExMetadataSplNameServiceExecutor;
|
||||
|
||||
pub(crate) use self::metaplex_token_metadata::executor_metaplex_token_metadata_build_prepared_plan;
|
||||
/// Stable Solana Program Metadata executor name.
|
||||
pub(crate) use self::solana_program_metadata::EX_METADATA_SPM_EXECUTOR_NAME;
|
||||
/// Internal Solana Program Metadata prepared-plan builder.
|
||||
pub(crate) use self::solana_program_metadata::executor_metadata_solana_program_metadata_build_prepared_plan;
|
||||
91
ks-lib/src/executor/metadata/metaplex_token_metadata.rs
Normal file
91
ks-lib/src/executor/metadata/metaplex_token_metadata.rs
Normal file
@@ -0,0 +1,91 @@
|
||||
// file: ks-lib/src/executor/metadata/metaplex_token_metadata.rs
|
||||
// version: 11
|
||||
|
||||
//! Metaplex Token Metadata typed execution surface.
|
||||
|
||||
mod builder;
|
||||
mod executor;
|
||||
mod intent;
|
||||
|
||||
/// Exposes the Metaplex Token Metadata executor.
|
||||
pub use self::executor::ExMetadataMetaplexTokenMetadataExecutor;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_APPROVE_USE_AUTHORITY_OPERATION`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_APPROVE_USE_AUTHORITY_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_BURN_OPERATION`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_BURN_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_CLOSE_ACCOUNTS_OPERATION`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_CLOSE_ACCOUNTS_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_CLOSE_ESCROW_ACCOUNT_OPERATION`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_CLOSE_ESCROW_ACCOUNT_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_COLLECT_OPERATION`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_COLLECT_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_CONVERT_MASTER_EDITION_V1_TO_V2_OPERATION`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_CONVERT_MASTER_EDITION_V1_TO_V2_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_CREATE_ESCROW_ACCOUNT_OPERATION`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_CREATE_ESCROW_ACCOUNT_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_CREATE_OPERATION`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_CREATE_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_DELEGATE_OPERATION`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_DELEGATE_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_DEPRECATED_CREATE_MASTER_EDITION_OPERATION`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_DEPRECATED_CREATE_MASTER_EDITION_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_DEPRECATED_CREATE_RESERVATION_LIST_OPERATION`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_DEPRECATED_CREATE_RESERVATION_LIST_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_DEPRECATED_MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_PRINTING_TOKEN_OPERATION`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_DEPRECATED_MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_PRINTING_TOKEN_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_DEPRECATED_MINT_PRINTING_TOKENS_OPERATION`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_DEPRECATED_MINT_PRINTING_TOKENS_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_DEPRECATED_MINT_PRINTING_TOKENS_VIA_TOKEN_OPERATION`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_DEPRECATED_MINT_PRINTING_TOKENS_VIA_TOKEN_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_DEPRECATED_OPERATION_CODES`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_DEPRECATED_OPERATION_CODES;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_DEPRECATED_SET_RESERVATION_LIST_OPERATION`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_DEPRECATED_SET_RESERVATION_LIST_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_LOCK_OPERATION`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_LOCK_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_MIGRATE_OPERATION`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_MIGRATE_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_VAULT_PROXY_OPERATION`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_VAULT_PROXY_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_MINT_OPERATION`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_MINT_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_PRINT_OPERATION`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_PRINT_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_PUFF_METADATA_OPERATION`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_PUFF_METADATA_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_RESIZE_OPERATION`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_RESIZE_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_REVOKE_OPERATION`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_REVOKE_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_REVOKE_USE_AUTHORITY_OPERATION`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_REVOKE_USE_AUTHORITY_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_SET_COLLECTION_SIZE_OPERATION`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_SET_COLLECTION_SIZE_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_SET_TOKEN_STANDARD_OPERATION`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_SET_TOKEN_STANDARD_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_SUPPORTED_OPERATION_CODES`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_SUPPORTED_OPERATION_CODES;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_TRANSFER_OPERATION`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_TRANSFER_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_TRANSFER_OUT_OF_ESCROW_OPERATION`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_TRANSFER_OUT_OF_ESCROW_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_UNLOCK_OPERATION`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_UNLOCK_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_UNVERIFY_OPERATION`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_UNVERIFY_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_UPDATE_OPERATION`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_UPDATE_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_UPDATE_PRIMARY_SALE_HAPPENED_VIA_TOKEN_OPERATION`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_UPDATE_PRIMARY_SALE_HAPPENED_VIA_TOKEN_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_USE_OPERATION`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_USE_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_UTILIZE_OPERATION`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_UTILIZE_OPERATION;
|
||||
/// Exposes `EX_METAPLEX_TOKEN_METADATA_VERIFY_OPERATION`.
|
||||
pub use self::intent::EX_METAPLEX_TOKEN_METADATA_VERIFY_OPERATION;
|
||||
/// Exposes the complete Metaplex Token Metadata execution intent.
|
||||
pub use self::intent::ExMetaplexTokenMetadataExecutionIntent;
|
||||
/// Exposes the current and deprecated Metaplex Token Metadata operation intent.
|
||||
pub use self::intent::ExMetaplexTokenMetadataOperation;
|
||||
|
||||
pub(crate) use self::builder::executor_metaplex_token_metadata_build_prepared_plan;
|
||||
1964
ks-lib/src/executor/metadata/metaplex_token_metadata/builder.rs
Normal file
1964
ks-lib/src/executor/metadata/metaplex_token_metadata/builder.rs
Normal file
File diff suppressed because it is too large
Load Diff
264
ks-lib/src/executor/metadata/metaplex_token_metadata/executor.rs
Normal file
264
ks-lib/src/executor/metadata/metaplex_token_metadata/executor.rs
Normal file
@@ -0,0 +1,264 @@
|
||||
// file: ks-lib/src/executor/metadata/metaplex_token_metadata/executor.rs
|
||||
// version: 7
|
||||
|
||||
//! Exact Metaplex Token Metadata capability dispatch.
|
||||
|
||||
/// Metaplex Token Metadata executor implementation.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExMetadataMetaplexTokenMetadataExecutor;
|
||||
|
||||
impl crate::ExMetadataMetaplexTokenMetadataExecutor {
|
||||
fn exact_capability(
|
||||
&self,
|
||||
program_id: &crate::MdProgramId,
|
||||
operation_code: &str,
|
||||
) -> crate::ExApiExecutionCapability {
|
||||
if program_id.0 != ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID {
|
||||
return crate::ExApiExecutionCapability::unsupported(
|
||||
"execution_metaplex_program_not_owned",
|
||||
format!("program {} is not Metaplex Token Metadata", program_id.0),
|
||||
);
|
||||
}
|
||||
if crate::EX_METAPLEX_TOKEN_METADATA_SUPPORTED_OPERATION_CODES.contains(&operation_code) {
|
||||
return crate::ExApiExecutionCapability::supported(operation_code);
|
||||
}
|
||||
return crate::ExApiExecutionCapability::unsupported(
|
||||
"execution_metaplex_operation_unsupported",
|
||||
format!("Metaplex Token Metadata operation {operation_code} is not enabled"),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
impl crate::ExApiTypedInstructionExecutor for crate::ExMetadataMetaplexTokenMetadataExecutor {
|
||||
type Intent = crate::ExMetaplexTokenMetadataExecutionIntent;
|
||||
|
||||
fn capability(
|
||||
&self,
|
||||
program_id: &crate::MdProgramId,
|
||||
operation_code: &str,
|
||||
) -> crate::ExApiExecutionCapability {
|
||||
return self.exact_capability(program_id, operation_code);
|
||||
}
|
||||
|
||||
fn build_prepared_plan(
|
||||
&self,
|
||||
intent: &Self::Intent,
|
||||
) -> ks_core::Result<crate::ExApiPreparedExecutionPlan> {
|
||||
return crate::executor_metaplex_token_metadata_build_prepared_plan(intent);
|
||||
}
|
||||
}
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExMetadataMetaplexTokenMetadataExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.metadata.metaplex_token_metadata";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
return match self.exact_capability(&request.program_id, &request.operation_code) {
|
||||
crate::ExApiExecutionCapability::Supported { operation_code: _ } => {
|
||||
crate::ExApiExecutionSupport::Yes
|
||||
},
|
||||
crate::ExApiExecutionCapability::Unsupported { reason_code: _, reason: _ } => {
|
||||
crate::ExApiExecutionSupport::No
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
match self.exact_capability(&request.program_id, &request.operation_code) {
|
||||
crate::ExApiExecutionCapability::Supported { operation_code: _ } => {},
|
||||
crate::ExApiExecutionCapability::Unsupported { reason_code, reason } => {
|
||||
return std::result::Result::Err(ks_core::Error::new(reason_code, reason));
|
||||
},
|
||||
}
|
||||
let intent = match serde_json::from_str::<crate::ExMetaplexTokenMetadataExecutionIntent>(
|
||||
&request.payload_json,
|
||||
) {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => {
|
||||
return std::result::Result::Err(ks_core::Error::new(
|
||||
"execution_metaplex_intent_deserialize_failed",
|
||||
error.to_string(),
|
||||
));
|
||||
},
|
||||
};
|
||||
if intent.operation.operation_code() != request.operation_code {
|
||||
return std::result::Result::Err(ks_core::Error::new(
|
||||
"execution_operation_code_mismatch",
|
||||
"request operation code does not match the typed Metaplex intent",
|
||||
));
|
||||
}
|
||||
let prepared = match crate::executor_metaplex_token_metadata_build_prepared_plan(&intent) {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let payload_value = match serde_json::to_value(&prepared) {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => {
|
||||
return std::result::Result::Err(ks_core::Error::new(
|
||||
"execution_metaplex_plan_serialize_failed",
|
||||
error.to_string(),
|
||||
));
|
||||
},
|
||||
};
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(&payload_value) {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: self.executor_name().to_string(),
|
||||
instruction_count: prepared.instructions.len(),
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[allow(deprecated)]
|
||||
fn approved_puff_intent() -> crate::ExMetaplexTokenMetadataExecutionIntent {
|
||||
let fee_payer = crate::MdPubkey("11111111111111111111111111111111".to_string());
|
||||
let mut policy = crate::ExApiExecutionPolicy::default();
|
||||
policy.cost_limit.max_fee_lamports = std::option::Option::Some(5_000);
|
||||
policy.cost_limit.max_spend_lamports = std::option::Option::Some(10_000);
|
||||
policy.authorized_signers = vec![fee_payer.clone()];
|
||||
return crate::ExMetaplexTokenMetadataExecutionIntent {
|
||||
intent_id: "metaplex-executor-test".to_string(),
|
||||
fee_payer,
|
||||
max_rent_lamports: 10_000,
|
||||
policy,
|
||||
allow_deprecated_operation: true,
|
||||
operation: crate::ExMetaplexTokenMetadataOperation::PuffMetadata {
|
||||
metadata: crate::MdPubkey(
|
||||
"SysvarRent111111111111111111111111111111111".to_string(),
|
||||
),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn capability_is_exact_for_program_and_operation() {
|
||||
let executor = crate::ExMetadataMetaplexTokenMetadataExecutor;
|
||||
let program_id = crate::MdProgramId(
|
||||
ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID.to_string(),
|
||||
);
|
||||
let supported = <crate::ExMetadataMetaplexTokenMetadataExecutor as crate::ExApiTypedInstructionExecutor>::capability(
|
||||
&executor,
|
||||
&program_id,
|
||||
crate::EX_METAPLEX_TOKEN_METADATA_VERIFY_OPERATION,
|
||||
);
|
||||
assert!(matches!(supported, crate::ExApiExecutionCapability::Supported { .. }));
|
||||
let transfer = <crate::ExMetadataMetaplexTokenMetadataExecutor as crate::ExApiTypedInstructionExecutor>::capability(
|
||||
&executor,
|
||||
&program_id,
|
||||
crate::EX_METAPLEX_TOKEN_METADATA_TRANSFER_OPERATION,
|
||||
);
|
||||
assert!(matches!(transfer, crate::ExApiExecutionCapability::Supported { .. }));
|
||||
let collect = <crate::ExMetadataMetaplexTokenMetadataExecutor as crate::ExApiTypedInstructionExecutor>::capability(
|
||||
&executor,
|
||||
&program_id,
|
||||
crate::EX_METAPLEX_TOKEN_METADATA_COLLECT_OPERATION,
|
||||
);
|
||||
assert!(matches!(collect, crate::ExApiExecutionCapability::Supported { .. }));
|
||||
let unknown = <crate::ExMetadataMetaplexTokenMetadataExecutor as crate::ExApiTypedInstructionExecutor>::capability(
|
||||
&executor,
|
||||
&program_id,
|
||||
"metadata.metaplex_token_metadata.unknown",
|
||||
);
|
||||
assert!(matches!(unknown, crate::ExApiExecutionCapability::Unsupported { .. }));
|
||||
let foreign = <crate::ExMetadataMetaplexTokenMetadataExecutor as crate::ExApiTypedInstructionExecutor>::capability(
|
||||
&executor,
|
||||
&crate::MdProgramId(ks_program_ids::SYSTEM_PROGRAM_ID.to_string()),
|
||||
crate::EX_METAPLEX_TOKEN_METADATA_CREATE_OPERATION,
|
||||
);
|
||||
assert!(matches!(foreign, crate::ExApiExecutionCapability::Unsupported { .. }));
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[allow(deprecated)]
|
||||
fn generic_dispatch_rejects_operation_code_mismatch() {
|
||||
let executor = crate::ExMetadataMetaplexTokenMetadataExecutor;
|
||||
let intent = approved_puff_intent();
|
||||
let payload_result = serde_json::to_string(&intent);
|
||||
assert!(payload_result.is_ok());
|
||||
let payload_json = match payload_result {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(_) => return,
|
||||
};
|
||||
let request = crate::ExApiExecutionRequest {
|
||||
program_id: crate::MdProgramId(
|
||||
ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID.to_string(),
|
||||
),
|
||||
operation_code: crate::EX_METAPLEX_TOKEN_METADATA_CREATE_OPERATION.to_string(),
|
||||
payload_json,
|
||||
};
|
||||
let result = <crate::ExMetadataMetaplexTokenMetadataExecutor as crate::ExApiInstructionExecutor>::build_plan(
|
||||
&executor,
|
||||
&request,
|
||||
);
|
||||
assert_eq!(
|
||||
result.as_ref().err().map(ks_core::Error::code),
|
||||
std::option::Option::Some("execution_operation_code_mismatch"),
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[allow(deprecated)]
|
||||
fn typed_and_generic_dispatch_build_the_same_single_instruction_plan() {
|
||||
let executor = crate::ExMetadataMetaplexTokenMetadataExecutor;
|
||||
let intent = approved_puff_intent();
|
||||
let typed_result = <crate::ExMetadataMetaplexTokenMetadataExecutor as crate::ExApiTypedInstructionExecutor>::build_prepared_plan(
|
||||
&executor,
|
||||
&intent,
|
||||
);
|
||||
assert!(typed_result.is_ok());
|
||||
let typed = match typed_result {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(_) => return,
|
||||
};
|
||||
let payload_result = serde_json::to_string(&intent);
|
||||
assert!(payload_result.is_ok());
|
||||
let payload_json = match payload_result {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(_) => return,
|
||||
};
|
||||
let request = crate::ExApiExecutionRequest {
|
||||
program_id: crate::MdProgramId(
|
||||
ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID.to_string(),
|
||||
),
|
||||
operation_code: crate::EX_METAPLEX_TOKEN_METADATA_PUFF_METADATA_OPERATION.to_string(),
|
||||
payload_json,
|
||||
};
|
||||
let generic_result = <crate::ExMetadataMetaplexTokenMetadataExecutor as crate::ExApiInstructionExecutor>::build_plan(
|
||||
&executor,
|
||||
&request,
|
||||
);
|
||||
assert!(generic_result.is_ok());
|
||||
let generic = match generic_result {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(_) => return,
|
||||
};
|
||||
assert_eq!(typed.instructions.len(), 1);
|
||||
assert_eq!(generic.instruction_count, typed.instructions.len());
|
||||
assert_eq!(generic.executor_name, "kb-lib.executor.metadata.metaplex_token_metadata",);
|
||||
assert!(
|
||||
generic
|
||||
.payload_json
|
||||
.contains(crate::EX_METAPLEX_TOKEN_METADATA_PUFF_METADATA_OPERATION)
|
||||
);
|
||||
}
|
||||
}
|
||||
1110
ks-lib/src/executor/metadata/metaplex_token_metadata/intent.rs
Normal file
1110
ks-lib/src/executor/metadata/metaplex_token_metadata/intent.rs
Normal file
File diff suppressed because it is too large
Load Diff
65
ks-lib/src/executor/metadata/solana_program_metadata.rs
Normal file
65
ks-lib/src/executor/metadata/solana_program_metadata.rs
Normal file
@@ -0,0 +1,65 @@
|
||||
// file: ks-lib/src/executor/metadata/solana_program_metadata.rs
|
||||
// version: 3
|
||||
|
||||
//! Typed executor for Solana Program Metadata.
|
||||
|
||||
mod builder;
|
||||
mod constants;
|
||||
mod executor;
|
||||
mod intent;
|
||||
|
||||
/// Derives the canonical Metadata PDA for one program and seed.
|
||||
pub use self::builder::executor_metadata_solana_program_metadata_derive_canonical_pda;
|
||||
/// Derives the non-canonical Metadata PDA for one program, authority and seed.
|
||||
pub use self::builder::executor_metadata_solana_program_metadata_derive_non_canonical_pda;
|
||||
/// Stable operation code for `Allocate`.
|
||||
pub use self::constants::EX_METADATA_SPM_ALLOCATE_OPERATION;
|
||||
/// Stable operation code for `Close`.
|
||||
pub use self::constants::EX_METADATA_SPM_CLOSE_OPERATION;
|
||||
/// Operations requiring explicit destructive-operation approval.
|
||||
pub use self::constants::EX_METADATA_SPM_DESTRUCTIVE_OPERATION_CODES;
|
||||
/// Stable operation code for `Extend`.
|
||||
pub use self::constants::EX_METADATA_SPM_EXTEND_OPERATION;
|
||||
/// Stable operation code for `Initialize`.
|
||||
pub use self::constants::EX_METADATA_SPM_INITIALIZE_OPERATION;
|
||||
/// Conservative maximum inline content accepted by Solana Program Metadata builders.
|
||||
pub use self::constants::EX_METADATA_SPM_MAX_INLINE_DATA_BYTES;
|
||||
/// Stable operation code for `SetAuthority`.
|
||||
pub use self::constants::EX_METADATA_SPM_SET_AUTHORITY_OPERATION;
|
||||
/// Stable operation code for `SetData`.
|
||||
pub use self::constants::EX_METADATA_SPM_SET_DATA_OPERATION;
|
||||
/// Stable operation code for `SetImmutable`.
|
||||
pub use self::constants::EX_METADATA_SPM_SET_IMMUTABLE_OPERATION;
|
||||
/// Exact current operation inventory implemented by the executor.
|
||||
pub use self::constants::EX_METADATA_SPM_SUPPORTED_OPERATION_CODES;
|
||||
/// Stable operation code for `Trim`.
|
||||
pub use self::constants::EX_METADATA_SPM_TRIM_OPERATION;
|
||||
/// Stable operation code for `Write`.
|
||||
pub use self::constants::EX_METADATA_SPM_WRITE_OPERATION;
|
||||
/// Typed Solana Program Metadata executor.
|
||||
pub use self::executor::ExMetadataSolanaProgramMetadataExecutor;
|
||||
/// Compression written by execution intents.
|
||||
pub use self::intent::ExMetadataSpmCompression;
|
||||
/// Exact inline content accepted by metadata instructions.
|
||||
pub use self::intent::ExMetadataSpmDataInput;
|
||||
/// On-chain data-source discriminator.
|
||||
pub use self::intent::ExMetadataSpmDataSource;
|
||||
/// Encoding written by execution intents.
|
||||
pub use self::intent::ExMetadataSpmEncoding;
|
||||
/// Complete Solana Program Metadata execution intent.
|
||||
pub use self::intent::ExMetadataSpmExecutionIntent;
|
||||
/// Structured content format written by execution intents.
|
||||
pub use self::intent::ExMetadataSpmFormat;
|
||||
/// One exact Solana Program Metadata operation.
|
||||
pub use self::intent::ExMetadataSpmOperation;
|
||||
/// Optional program-upgrade-authority validation context.
|
||||
pub use self::intent::ExMetadataSpmProgramContext;
|
||||
/// Source used by `SetData`.
|
||||
pub use self::intent::ExMetadataSpmSetDataSource;
|
||||
/// Source used by `Write`.
|
||||
pub use self::intent::ExMetadataSpmWriteSource;
|
||||
|
||||
/// Crate-root access to the exact prepared-plan builder.
|
||||
pub(crate) use self::builder::executor_metadata_solana_program_metadata_build_prepared_plan;
|
||||
/// Stable executor name.
|
||||
pub(crate) use self::constants::EX_METADATA_SPM_EXECUTOR_NAME;
|
||||
1270
ks-lib/src/executor/metadata/solana_program_metadata/builder.rs
Normal file
1270
ks-lib/src/executor/metadata/solana_program_metadata/builder.rs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,55 @@
|
||||
// file: ks-lib/src/executor/metadata/solana_program_metadata/constants.rs
|
||||
// version: 2
|
||||
|
||||
//! Stable Solana Program Metadata executor constants.
|
||||
|
||||
/// Stable executor name.
|
||||
pub(crate) const EX_METADATA_SPM_EXECUTOR_NAME: &str =
|
||||
"kb-lib.executor.metadata.solana_program_metadata";
|
||||
/// Conservative maximum inline content accepted by one instruction builder.
|
||||
///
|
||||
/// Larger payloads must use a pre-funded Buffer account so the final transaction remains within
|
||||
/// the Solana packet boundary after signatures, account keys and message framing are included.
|
||||
pub const EX_METADATA_SPM_MAX_INLINE_DATA_BYTES: usize = 1_024;
|
||||
/// Stable operation code for `Write`.
|
||||
pub const EX_METADATA_SPM_WRITE_OPERATION: &str = "metadata.solana_program_metadata.write";
|
||||
/// Stable operation code for `Initialize`.
|
||||
pub const EX_METADATA_SPM_INITIALIZE_OPERATION: &str =
|
||||
"metadata.solana_program_metadata.initialize";
|
||||
/// Stable operation code for `SetAuthority`.
|
||||
pub const EX_METADATA_SPM_SET_AUTHORITY_OPERATION: &str =
|
||||
"metadata.solana_program_metadata.set_authority";
|
||||
/// Stable operation code for `SetData`.
|
||||
pub const EX_METADATA_SPM_SET_DATA_OPERATION: &str = "metadata.solana_program_metadata.set_data";
|
||||
/// Stable operation code for `SetImmutable`.
|
||||
pub const EX_METADATA_SPM_SET_IMMUTABLE_OPERATION: &str =
|
||||
"metadata.solana_program_metadata.set_immutable";
|
||||
/// Stable operation code for `Trim`.
|
||||
pub const EX_METADATA_SPM_TRIM_OPERATION: &str = "metadata.solana_program_metadata.trim";
|
||||
/// Stable operation code for `Close`.
|
||||
pub const EX_METADATA_SPM_CLOSE_OPERATION: &str = "metadata.solana_program_metadata.close";
|
||||
/// Stable operation code for `Allocate`.
|
||||
pub const EX_METADATA_SPM_ALLOCATE_OPERATION: &str = "metadata.solana_program_metadata.allocate";
|
||||
/// Stable operation code for `Extend`.
|
||||
pub const EX_METADATA_SPM_EXTEND_OPERATION: &str = "metadata.solana_program_metadata.extend";
|
||||
/// Exact current operation inventory implemented by the executor.
|
||||
pub const EX_METADATA_SPM_SUPPORTED_OPERATION_CODES: &[&str] = &[
|
||||
crate::EX_METADATA_SPM_WRITE_OPERATION,
|
||||
crate::EX_METADATA_SPM_INITIALIZE_OPERATION,
|
||||
crate::EX_METADATA_SPM_SET_AUTHORITY_OPERATION,
|
||||
crate::EX_METADATA_SPM_SET_DATA_OPERATION,
|
||||
crate::EX_METADATA_SPM_SET_IMMUTABLE_OPERATION,
|
||||
crate::EX_METADATA_SPM_TRIM_OPERATION,
|
||||
crate::EX_METADATA_SPM_CLOSE_OPERATION,
|
||||
crate::EX_METADATA_SPM_ALLOCATE_OPERATION,
|
||||
crate::EX_METADATA_SPM_EXTEND_OPERATION,
|
||||
];
|
||||
/// Operations that require explicit operator approval before plan construction.
|
||||
pub const EX_METADATA_SPM_DESTRUCTIVE_OPERATION_CODES: &[&str] = &[
|
||||
crate::EX_METADATA_SPM_WRITE_OPERATION,
|
||||
crate::EX_METADATA_SPM_SET_AUTHORITY_OPERATION,
|
||||
crate::EX_METADATA_SPM_SET_DATA_OPERATION,
|
||||
crate::EX_METADATA_SPM_SET_IMMUTABLE_OPERATION,
|
||||
crate::EX_METADATA_SPM_TRIM_OPERATION,
|
||||
crate::EX_METADATA_SPM_CLOSE_OPERATION,
|
||||
];
|
||||
224
ks-lib/src/executor/metadata/solana_program_metadata/executor.rs
Normal file
224
ks-lib/src/executor/metadata/solana_program_metadata/executor.rs
Normal file
@@ -0,0 +1,224 @@
|
||||
// file: ks-lib/src/executor/metadata/solana_program_metadata/executor.rs
|
||||
// version: 2
|
||||
|
||||
//! Exact capability dispatch for Solana Program Metadata.
|
||||
|
||||
/// Typed Solana Program Metadata executor.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExMetadataSolanaProgramMetadataExecutor;
|
||||
|
||||
impl crate::ExMetadataSolanaProgramMetadataExecutor {
|
||||
fn exact_capability(
|
||||
&self,
|
||||
program_id: &crate::MdProgramId,
|
||||
operation_code: &str,
|
||||
) -> crate::ExApiExecutionCapability {
|
||||
if program_id.0 != ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID {
|
||||
return crate::ExApiExecutionCapability::unsupported(
|
||||
"execution_metadata_spm_program_not_owned",
|
||||
format!("program {} is not Solana Program Metadata", program_id.0),
|
||||
);
|
||||
}
|
||||
if crate::EX_METADATA_SPM_SUPPORTED_OPERATION_CODES
|
||||
.iter()
|
||||
.any(|candidate| return *candidate == operation_code)
|
||||
{
|
||||
return crate::ExApiExecutionCapability::supported(operation_code);
|
||||
}
|
||||
return crate::ExApiExecutionCapability::unsupported(
|
||||
"execution_metadata_spm_operation_unsupported",
|
||||
format!("Solana Program Metadata operation {operation_code} is not implemented"),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
impl crate::ExApiTypedInstructionExecutor for crate::ExMetadataSolanaProgramMetadataExecutor {
|
||||
type Intent = crate::ExMetadataSpmExecutionIntent;
|
||||
|
||||
fn capability(
|
||||
&self,
|
||||
program_id: &crate::MdProgramId,
|
||||
operation_code: &str,
|
||||
) -> crate::ExApiExecutionCapability {
|
||||
return self.exact_capability(program_id, operation_code);
|
||||
}
|
||||
|
||||
fn build_prepared_plan(
|
||||
&self,
|
||||
intent: &Self::Intent,
|
||||
) -> ks_core::Result<crate::ExApiPreparedExecutionPlan> {
|
||||
let program_id = crate::MdProgramId(
|
||||
ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID.to_string(),
|
||||
);
|
||||
return match self.exact_capability(&program_id, intent.operation.operation_code()) {
|
||||
crate::ExApiExecutionCapability::Supported { operation_code: _ } => {
|
||||
crate::executor_metadata_solana_program_metadata_build_prepared_plan(intent)
|
||||
},
|
||||
crate::ExApiExecutionCapability::Unsupported { reason_code, reason } => {
|
||||
std::result::Result::Err(ks_core::Error::new(reason_code, reason))
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExMetadataSolanaProgramMetadataExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return crate::EX_METADATA_SPM_EXECUTOR_NAME;
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
return if self
|
||||
.exact_capability(&request.program_id, &request.operation_code)
|
||||
.is_supported()
|
||||
{
|
||||
crate::ExApiExecutionSupport::Yes
|
||||
} else {
|
||||
crate::ExApiExecutionSupport::No
|
||||
};
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
match self.exact_capability(&request.program_id, &request.operation_code) {
|
||||
crate::ExApiExecutionCapability::Supported { operation_code: _ } => {},
|
||||
crate::ExApiExecutionCapability::Unsupported { reason_code, reason } => {
|
||||
return std::result::Result::Err(ks_core::Error::new(reason_code, reason));
|
||||
},
|
||||
}
|
||||
let intent = match serde_json::from_str::<crate::ExMetadataSpmExecutionIntent>(
|
||||
&request.payload_json,
|
||||
) {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => {
|
||||
return std::result::Result::Err(ks_core::Error::new(
|
||||
"execution_metadata_spm_intent_deserialize_failed",
|
||||
error.to_string(),
|
||||
));
|
||||
},
|
||||
};
|
||||
if intent.operation.operation_code() != request.operation_code {
|
||||
return std::result::Result::Err(ks_core::Error::new(
|
||||
"execution_operation_code_mismatch",
|
||||
"request and typed Solana Program Metadata intent operations differ",
|
||||
));
|
||||
}
|
||||
let prepared =
|
||||
match crate::ExApiTypedInstructionExecutor::build_prepared_plan(self, &intent) {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let payload = match serde_json::to_value(&prepared) {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => {
|
||||
return std::result::Result::Err(ks_core::Error::new(
|
||||
"execution_metadata_spm_plan_serialize_failed",
|
||||
error.to_string(),
|
||||
));
|
||||
},
|
||||
};
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(&payload) {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: crate::EX_METADATA_SPM_EXECUTOR_NAME.to_string(),
|
||||
instruction_count: prepared.instructions.len(),
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[test]
|
||||
fn executor_matrix_matches_the_compiled_capability_inventory() {
|
||||
let parsed = serde_json::from_str::<serde_json::Value>(include_str!(
|
||||
"../../../../../test-fixtures/contract-matrices/SOLANA_PROGRAM_METADATA_EXECUTOR_MATRIX.json"
|
||||
));
|
||||
assert!(parsed.is_ok());
|
||||
let matrix = match parsed {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(_) => return,
|
||||
};
|
||||
let operations = match matrix.get("operations").and_then(serde_json::Value::as_array) {
|
||||
std::option::Option::Some(value) => value,
|
||||
std::option::Option::None => return,
|
||||
};
|
||||
assert_eq!(
|
||||
matrix.get("maxInlineContentBytes").and_then(serde_json::Value::as_u64),
|
||||
std::option::Option::Some(crate::EX_METADATA_SPM_MAX_INLINE_DATA_BYTES as u64)
|
||||
);
|
||||
assert_eq!(
|
||||
matrix.get("canonicitySelection").and_then(serde_json::Value::as_str),
|
||||
std::option::Option::Some(
|
||||
"explicit_intent_flag_not_inferred_from_program_data_presence"
|
||||
)
|
||||
);
|
||||
assert_eq!(operations.len(), crate::EX_METADATA_SPM_SUPPORTED_OPERATION_CODES.len());
|
||||
for (position, row) in operations.iter().enumerate() {
|
||||
assert_eq!(
|
||||
row.get("tag").and_then(serde_json::Value::as_u64),
|
||||
std::option::Option::Some(position as u64)
|
||||
);
|
||||
assert_eq!(
|
||||
row.get("operationCode").and_then(serde_json::Value::as_str),
|
||||
std::option::Option::Some(
|
||||
crate::EX_METADATA_SPM_SUPPORTED_OPERATION_CODES[position]
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
row.get("requiresExplicitApproval").and_then(serde_json::Value::as_bool),
|
||||
std::option::Option::Some(
|
||||
crate::EX_METADATA_SPM_DESTRUCTIVE_OPERATION_CODES
|
||||
.contains(&crate::EX_METADATA_SPM_SUPPORTED_OPERATION_CODES[position])
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
row.get("deprecated").and_then(serde_json::Value::as_bool),
|
||||
std::option::Option::Some(false)
|
||||
);
|
||||
assert_eq!(
|
||||
row.get("replaced").and_then(serde_json::Value::as_bool),
|
||||
std::option::Option::Some(false)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn capabilities_cover_exactly_the_nine_stable_operations() {
|
||||
let executor = crate::ExMetadataSolanaProgramMetadataExecutor;
|
||||
let program_id = crate::MdProgramId(
|
||||
ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID.to_string(),
|
||||
);
|
||||
for operation in crate::EX_METADATA_SPM_SUPPORTED_OPERATION_CODES {
|
||||
let capability =
|
||||
crate::ExApiTypedInstructionExecutor::capability(&executor, &program_id, operation);
|
||||
assert!(capability.is_supported());
|
||||
}
|
||||
let unknown = crate::ExApiTypedInstructionExecutor::capability(
|
||||
&executor,
|
||||
&program_id,
|
||||
"metadata.solana_program_metadata.unknown",
|
||||
);
|
||||
assert!(!unknown.is_supported());
|
||||
let foreign = crate::ExApiTypedInstructionExecutor::capability(
|
||||
&executor,
|
||||
&crate::MdProgramId(ks_program_ids::SYSTEM_PROGRAM_ID.to_string()),
|
||||
crate::EX_METADATA_SPM_WRITE_OPERATION,
|
||||
);
|
||||
assert!(!foreign.is_supported());
|
||||
}
|
||||
}
|
||||
471
ks-lib/src/executor/metadata/solana_program_metadata/intent.rs
Normal file
471
ks-lib/src/executor/metadata/solana_program_metadata/intent.rs
Normal file
@@ -0,0 +1,471 @@
|
||||
// file: ks-lib/src/executor/metadata/solana_program_metadata/intent.rs
|
||||
// version: 2
|
||||
|
||||
//! Typed intents for the Solana Program Metadata executor.
|
||||
|
||||
use ts_rs::TS; // rust-rules: derive-import
|
||||
|
||||
/// Encoding written to a Solana Program Metadata account.
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)]
|
||||
#[repr(u8)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[ts(
|
||||
export,
|
||||
export_to = "../frontend/ts/bindings/ks_lib/executor/metadata/solana_program_metadata/intent/ExMetadataSpmEncoding.ts"
|
||||
)]
|
||||
pub enum ExMetadataSpmEncoding {
|
||||
/// No encoding declaration.
|
||||
None = 0,
|
||||
/// UTF-8 encoding.
|
||||
Utf8 = 1,
|
||||
/// Base58 encoding.
|
||||
Base58 = 2,
|
||||
/// Base64 encoding.
|
||||
Base64 = 3,
|
||||
}
|
||||
|
||||
impl crate::ExMetadataSpmEncoding {
|
||||
/// Returns the exact wire value.
|
||||
pub const fn wire_value(self) -> u8 {
|
||||
return self as u8;
|
||||
}
|
||||
}
|
||||
|
||||
/// Compression written to a Solana Program Metadata account.
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)]
|
||||
#[repr(u8)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[ts(
|
||||
export,
|
||||
export_to = "../frontend/ts/bindings/ks_lib/executor/metadata/solana_program_metadata/intent/ExMetadataSpmCompression.ts"
|
||||
)]
|
||||
pub enum ExMetadataSpmCompression {
|
||||
/// No compression declaration.
|
||||
None = 0,
|
||||
/// Gzip compression.
|
||||
Gzip = 1,
|
||||
/// Zlib compression.
|
||||
Zlib = 2,
|
||||
}
|
||||
|
||||
impl crate::ExMetadataSpmCompression {
|
||||
/// Returns the exact wire value.
|
||||
pub const fn wire_value(self) -> u8 {
|
||||
return self as u8;
|
||||
}
|
||||
}
|
||||
|
||||
/// Structured format written to a Solana Program Metadata account.
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)]
|
||||
#[repr(u8)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[ts(
|
||||
export,
|
||||
export_to = "../frontend/ts/bindings/ks_lib/executor/metadata/solana_program_metadata/intent/ExMetadataSpmFormat.ts"
|
||||
)]
|
||||
pub enum ExMetadataSpmFormat {
|
||||
/// No structured format declaration.
|
||||
None = 0,
|
||||
/// JSON format.
|
||||
Json = 1,
|
||||
/// YAML format.
|
||||
Yaml = 2,
|
||||
/// TOML format.
|
||||
Toml = 3,
|
||||
}
|
||||
|
||||
impl crate::ExMetadataSpmFormat {
|
||||
/// Returns the exact wire value.
|
||||
pub const fn wire_value(self) -> u8 {
|
||||
return self as u8;
|
||||
}
|
||||
}
|
||||
|
||||
/// On-chain data source written to a Solana Program Metadata account.
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)]
|
||||
#[repr(u8)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[ts(
|
||||
export,
|
||||
export_to = "../frontend/ts/bindings/ks_lib/executor/metadata/solana_program_metadata/intent/ExMetadataSpmDataSource.ts"
|
||||
)]
|
||||
pub enum ExMetadataSpmDataSource {
|
||||
/// Direct on-chain bytes.
|
||||
Direct = 0,
|
||||
/// UTF-8 URL stored on-chain without fetching it.
|
||||
Url = 1,
|
||||
/// Fixed reference to another Solana account.
|
||||
External = 2,
|
||||
}
|
||||
|
||||
impl crate::ExMetadataSpmDataSource {
|
||||
/// Returns the exact wire value.
|
||||
pub const fn wire_value(self) -> u8 {
|
||||
return self as u8;
|
||||
}
|
||||
}
|
||||
|
||||
/// Exact inline content accepted by `Initialize` and `SetData`.
|
||||
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)]
|
||||
#[serde(tag = "source", rename_all = "snake_case")]
|
||||
#[ts(
|
||||
export,
|
||||
export_to = "../frontend/ts/bindings/ks_lib/executor/metadata/solana_program_metadata/intent/ExMetadataSpmDataInput.ts"
|
||||
)]
|
||||
pub enum ExMetadataSpmDataInput {
|
||||
/// Direct on-chain bytes.
|
||||
Direct {
|
||||
/// Exact bytes to store.
|
||||
bytes: std::vec::Vec<u8>,
|
||||
},
|
||||
/// UTF-8 URL retained on-chain without remote resolution.
|
||||
Url {
|
||||
/// URL text to store.
|
||||
url: std::string::String,
|
||||
},
|
||||
/// Fixed reference to another account's data.
|
||||
External {
|
||||
/// Referenced account.
|
||||
address: crate::MdPubkey,
|
||||
/// Byte offset inside the referenced account.
|
||||
offset: u32,
|
||||
/// Optional non-zero length; `None` means the remainder of the account.
|
||||
length: std::option::Option<u32>,
|
||||
},
|
||||
}
|
||||
|
||||
impl crate::ExMetadataSpmDataInput {
|
||||
/// Returns the exact data-source discriminator.
|
||||
pub const fn data_source(&self) -> crate::ExMetadataSpmDataSource {
|
||||
return match self {
|
||||
Self::Direct { bytes: _ } => crate::ExMetadataSpmDataSource::Direct,
|
||||
Self::Url { url: _ } => crate::ExMetadataSpmDataSource::Url,
|
||||
Self::External { address: _, offset: _, length: _ } => {
|
||||
crate::ExMetadataSpmDataSource::External
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// Source used by the `Write` instruction.
|
||||
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)]
|
||||
#[serde(tag = "source", rename_all = "snake_case")]
|
||||
#[ts(
|
||||
export,
|
||||
export_to = "../frontend/ts/bindings/ks_lib/executor/metadata/solana_program_metadata/intent/ExMetadataSpmWriteSource.ts"
|
||||
)]
|
||||
pub enum ExMetadataSpmWriteSource {
|
||||
/// Inline bytes placed after the offset argument.
|
||||
Inline {
|
||||
/// Exact bytes to write.
|
||||
data: std::vec::Vec<u8>,
|
||||
},
|
||||
/// Copy all data from another Buffer account.
|
||||
Buffer {
|
||||
/// Source Buffer account.
|
||||
source_buffer: crate::MdPubkey,
|
||||
},
|
||||
}
|
||||
|
||||
/// Source used by the `SetData` instruction.
|
||||
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)]
|
||||
#[serde(tag = "source", rename_all = "snake_case")]
|
||||
#[ts(
|
||||
export,
|
||||
export_to = "../frontend/ts/bindings/ks_lib/executor/metadata/solana_program_metadata/intent/ExMetadataSpmSetDataSource.ts"
|
||||
)]
|
||||
pub enum ExMetadataSpmSetDataSource {
|
||||
/// Runtime-supported three-byte variant that preserves current data bytes.
|
||||
PreserveExisting,
|
||||
/// Replace data with inline content.
|
||||
Inline {
|
||||
/// Exact inline content.
|
||||
data: crate::ExMetadataSpmDataInput,
|
||||
},
|
||||
/// Copy data from one Buffer account.
|
||||
Buffer {
|
||||
/// Source Buffer account.
|
||||
buffer: crate::MdPubkey,
|
||||
/// Source discriminator that the resulting metadata account must declare.
|
||||
data_source: crate::ExMetadataSpmDataSource,
|
||||
},
|
||||
}
|
||||
|
||||
/// Optional program-upgrade-authority validation context.
|
||||
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)]
|
||||
#[ts(
|
||||
export,
|
||||
export_to = "../frontend/ts/bindings/ks_lib/executor/metadata/solana_program_metadata/intent/ExMetadataSpmProgramContext.ts"
|
||||
)]
|
||||
pub struct ExMetadataSpmProgramContext {
|
||||
/// Executable program account.
|
||||
pub program: crate::MdPubkey,
|
||||
/// Optional upgradeable-loader ProgramData account used when the runtime must validate it.
|
||||
pub program_data: std::option::Option<crate::MdPubkey>,
|
||||
}
|
||||
|
||||
/// One exact Solana Program Metadata operation.
|
||||
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)]
|
||||
#[serde(tag = "operation", rename_all = "snake_case")]
|
||||
#[ts(
|
||||
export,
|
||||
export_to = "../frontend/ts/bindings/ks_lib/executor/metadata/solana_program_metadata/intent/ExMetadataSpmOperation.ts"
|
||||
)]
|
||||
pub enum ExMetadataSpmOperation {
|
||||
/// Write bytes to a Buffer account.
|
||||
Write {
|
||||
/// Buffer account to mutate.
|
||||
buffer: crate::MdPubkey,
|
||||
/// Current Buffer authority.
|
||||
authority: crate::MdPubkey,
|
||||
/// Byte offset inside the Buffer payload.
|
||||
offset: u32,
|
||||
/// Inline or Buffer source.
|
||||
source: crate::ExMetadataSpmWriteSource,
|
||||
},
|
||||
/// Initialize one canonical or non-canonical Metadata PDA.
|
||||
Initialize {
|
||||
/// Metadata PDA to initialize.
|
||||
metadata: crate::MdPubkey,
|
||||
/// Authority signing the initialization.
|
||||
authority: crate::MdPubkey,
|
||||
/// Program described by this metadata account.
|
||||
program: crate::MdPubkey,
|
||||
/// Optional ProgramData account used for an upgradeable program.
|
||||
program_data: std::option::Option<crate::MdPubkey>,
|
||||
/// Whether the Metadata PDA uses the canonical `[program, seed]` derivation.
|
||||
canonical: bool,
|
||||
/// Exact fixed-size seed bytes.
|
||||
seed: std::vec::Vec<u8>,
|
||||
/// Content encoding.
|
||||
encoding: crate::ExMetadataSpmEncoding,
|
||||
/// Content compression.
|
||||
compression: crate::ExMetadataSpmCompression,
|
||||
/// Structured content format.
|
||||
format: crate::ExMetadataSpmFormat,
|
||||
/// Declared data source when using a preallocated Buffer.
|
||||
data_source: crate::ExMetadataSpmDataSource,
|
||||
/// Optional inline content; absent means the Metadata account is a preallocated Buffer.
|
||||
data: std::option::Option<crate::ExMetadataSpmDataInput>,
|
||||
/// Whether the instruction may invoke the System Program to allocate the PDA.
|
||||
allocate_account: bool,
|
||||
},
|
||||
/// Change or remove one Buffer or Metadata authority.
|
||||
SetAuthority {
|
||||
/// Buffer or Metadata account.
|
||||
account: crate::MdPubkey,
|
||||
/// Current authority.
|
||||
authority: crate::MdPubkey,
|
||||
/// New authority, or `None` to remove a Metadata authority.
|
||||
new_authority: std::option::Option<crate::MdPubkey>,
|
||||
/// Optional upgrade-authority validation context.
|
||||
program_context: std::option::Option<crate::ExMetadataSpmProgramContext>,
|
||||
},
|
||||
/// Change Metadata content descriptors and data.
|
||||
SetData {
|
||||
/// Metadata account.
|
||||
metadata: crate::MdPubkey,
|
||||
/// Current authority.
|
||||
authority: crate::MdPubkey,
|
||||
/// Content encoding.
|
||||
encoding: crate::ExMetadataSpmEncoding,
|
||||
/// Content compression.
|
||||
compression: crate::ExMetadataSpmCompression,
|
||||
/// Structured content format.
|
||||
format: crate::ExMetadataSpmFormat,
|
||||
/// Inline, Buffer or preserve-existing source.
|
||||
source: crate::ExMetadataSpmSetDataSource,
|
||||
/// Optional upgrade-authority validation context.
|
||||
program_context: std::option::Option<crate::ExMetadataSpmProgramContext>,
|
||||
},
|
||||
/// Permanently make one Metadata account immutable.
|
||||
SetImmutable {
|
||||
/// Metadata account.
|
||||
metadata: crate::MdPubkey,
|
||||
/// Current authority.
|
||||
authority: crate::MdPubkey,
|
||||
/// Optional upgrade-authority validation context.
|
||||
program_context: std::option::Option<crate::ExMetadataSpmProgramContext>,
|
||||
},
|
||||
/// Resize one Buffer or Metadata account to its logical minimum and refund excess lamports.
|
||||
Trim {
|
||||
/// Buffer or Metadata account.
|
||||
account: crate::MdPubkey,
|
||||
/// Current authority.
|
||||
authority: crate::MdPubkey,
|
||||
/// Lamport destination.
|
||||
destination: crate::MdPubkey,
|
||||
/// Optional upgrade-authority validation context.
|
||||
program_context: std::option::Option<crate::ExMetadataSpmProgramContext>,
|
||||
},
|
||||
/// Close one mutable Buffer or Metadata account.
|
||||
Close {
|
||||
/// Buffer or Metadata account.
|
||||
account: crate::MdPubkey,
|
||||
/// Current authority.
|
||||
authority: crate::MdPubkey,
|
||||
/// Lamport destination.
|
||||
destination: crate::MdPubkey,
|
||||
/// Optional upgrade-authority validation context.
|
||||
program_context: std::option::Option<crate::ExMetadataSpmProgramContext>,
|
||||
},
|
||||
/// Allocate one pre-funded Buffer account.
|
||||
Allocate {
|
||||
/// Buffer account.
|
||||
buffer: crate::MdPubkey,
|
||||
/// Authority signing the allocation.
|
||||
authority: crate::MdPubkey,
|
||||
/// Optional seed for a PDA Buffer; absent selects a pre-created keypair account.
|
||||
seed: std::option::Option<std::vec::Vec<u8>>,
|
||||
/// Optional upgrade-authority validation context.
|
||||
program_context: std::option::Option<crate::ExMetadataSpmProgramContext>,
|
||||
/// Whether a PDA Buffer uses the canonical `[program, seed]` derivation.
|
||||
canonical: bool,
|
||||
/// Whether the instruction may invoke the System Program to allocate the account.
|
||||
allocate_account: bool,
|
||||
},
|
||||
/// Extend one pre-funded Buffer or Metadata account.
|
||||
Extend {
|
||||
/// Buffer or Metadata account.
|
||||
account: crate::MdPubkey,
|
||||
/// Current authority.
|
||||
authority: crate::MdPubkey,
|
||||
/// Number of bytes to append to account capacity.
|
||||
length: u16,
|
||||
/// Optional upgrade-authority validation context.
|
||||
program_context: std::option::Option<crate::ExMetadataSpmProgramContext>,
|
||||
},
|
||||
}
|
||||
|
||||
impl crate::ExMetadataSpmOperation {
|
||||
/// Returns the stable operation code.
|
||||
pub const fn operation_code(&self) -> &'static str {
|
||||
return match self {
|
||||
Self::Write {
|
||||
buffer: _,
|
||||
authority: _,
|
||||
offset: _,
|
||||
source: _,
|
||||
} => crate::EX_METADATA_SPM_WRITE_OPERATION,
|
||||
Self::Initialize {
|
||||
metadata: _,
|
||||
authority: _,
|
||||
program: _,
|
||||
program_data: _,
|
||||
canonical: _,
|
||||
seed: _,
|
||||
encoding: _,
|
||||
compression: _,
|
||||
format: _,
|
||||
data_source: _,
|
||||
data: _,
|
||||
allocate_account: _,
|
||||
} => crate::EX_METADATA_SPM_INITIALIZE_OPERATION,
|
||||
Self::SetAuthority {
|
||||
account: _,
|
||||
authority: _,
|
||||
new_authority: _,
|
||||
program_context: _,
|
||||
} => crate::EX_METADATA_SPM_SET_AUTHORITY_OPERATION,
|
||||
Self::SetData {
|
||||
metadata: _,
|
||||
authority: _,
|
||||
encoding: _,
|
||||
compression: _,
|
||||
format: _,
|
||||
source: _,
|
||||
program_context: _,
|
||||
} => crate::EX_METADATA_SPM_SET_DATA_OPERATION,
|
||||
Self::SetImmutable {
|
||||
metadata: _,
|
||||
authority: _,
|
||||
program_context: _,
|
||||
} => crate::EX_METADATA_SPM_SET_IMMUTABLE_OPERATION,
|
||||
Self::Trim {
|
||||
account: _,
|
||||
authority: _,
|
||||
destination: _,
|
||||
program_context: _,
|
||||
} => crate::EX_METADATA_SPM_TRIM_OPERATION,
|
||||
Self::Close {
|
||||
account: _,
|
||||
authority: _,
|
||||
destination: _,
|
||||
program_context: _,
|
||||
} => crate::EX_METADATA_SPM_CLOSE_OPERATION,
|
||||
Self::Allocate {
|
||||
buffer: _,
|
||||
authority: _,
|
||||
seed: _,
|
||||
program_context: _,
|
||||
canonical: _,
|
||||
allocate_account: _,
|
||||
} => crate::EX_METADATA_SPM_ALLOCATE_OPERATION,
|
||||
Self::Extend {
|
||||
account: _,
|
||||
authority: _,
|
||||
length: _,
|
||||
program_context: _,
|
||||
} => crate::EX_METADATA_SPM_EXTEND_OPERATION,
|
||||
};
|
||||
}
|
||||
|
||||
/// Returns whether the operation can overwrite, destroy or irreversibly constrain state.
|
||||
pub const fn requires_explicit_approval(&self) -> bool {
|
||||
return matches!(
|
||||
self,
|
||||
Self::Write {
|
||||
buffer: _,
|
||||
authority: _,
|
||||
offset: _,
|
||||
source: _
|
||||
} | Self::SetAuthority {
|
||||
account: _,
|
||||
authority: _,
|
||||
new_authority: _,
|
||||
program_context: _,
|
||||
} | Self::SetData {
|
||||
metadata: _,
|
||||
authority: _,
|
||||
encoding: _,
|
||||
compression: _,
|
||||
format: _,
|
||||
source: _,
|
||||
program_context: _,
|
||||
} | Self::SetImmutable {
|
||||
metadata: _,
|
||||
authority: _,
|
||||
program_context: _
|
||||
} | Self::Trim {
|
||||
account: _,
|
||||
authority: _,
|
||||
destination: _,
|
||||
program_context: _
|
||||
} | Self::Close {
|
||||
account: _,
|
||||
authority: _,
|
||||
destination: _,
|
||||
program_context: _
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Complete Solana Program Metadata execution intent.
|
||||
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)]
|
||||
#[ts(
|
||||
export,
|
||||
export_to = "../frontend/ts/bindings/ks_lib/executor/metadata/solana_program_metadata/intent/ExMetadataSpmExecutionIntent.ts"
|
||||
)]
|
||||
pub struct ExMetadataSpmExecutionIntent {
|
||||
/// Caller-provided correlation identifier.
|
||||
pub intent_id: std::string::String,
|
||||
/// Transaction fee payer.
|
||||
pub fee_payer: crate::MdPubkey,
|
||||
/// Conservative common execution policy.
|
||||
pub policy: crate::ExApiExecutionPolicy,
|
||||
/// Explicit approval for overwrite, destructive or irreversible operations.
|
||||
pub allow_destructive_operation: bool,
|
||||
/// Exact operation to build.
|
||||
pub operation: crate::ExMetadataSpmOperation,
|
||||
}
|
||||
49
ks-lib/src/executor/metadata/spl_name_service.rs
Normal file
49
ks-lib/src/executor/metadata/spl_name_service.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/metadata/spl_name_service.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `metadata_spl_name_service`.
|
||||
|
||||
/// Reserved executor for the `metadata_spl_name_service` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExMetadataSplNameServiceExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExMetadataSplNameServiceExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.metadata.spl_name_service";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::METADATA_SPL_NAME_SERVICE_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"metadata_spl_name_service"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.metadata.spl_name_service".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
12
ks-lib/src/executor/nft.rs
Normal file
12
ks-lib/src/executor/nft.rs
Normal file
@@ -0,0 +1,12 @@
|
||||
// file: ks-lib/src/executor/nft.rs
|
||||
// version: 4
|
||||
|
||||
//! `nft` executor family.
|
||||
|
||||
mod metaplex_bubblegum;
|
||||
mod tensor_cnft;
|
||||
|
||||
/// Exposes the reserved `nft/metaplex_bubblegum` executor.
|
||||
pub use self::metaplex_bubblegum::ExNftMetaplexBubblegumExecutor;
|
||||
/// Exposes the reserved `nft/tensor_cnft` executor.
|
||||
pub use self::tensor_cnft::ExNftTensorCnftExecutor;
|
||||
49
ks-lib/src/executor/nft/metaplex_bubblegum.rs
Normal file
49
ks-lib/src/executor/nft/metaplex_bubblegum.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/nft/metaplex_bubblegum.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `nft_metaplex_bubblegum`.
|
||||
|
||||
/// Reserved executor for the `nft_metaplex_bubblegum` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExNftMetaplexBubblegumExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExNftMetaplexBubblegumExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.nft.metaplex_bubblegum";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::NFT_METAPLEX_BUBBLEGUM_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"nft_metaplex_bubblegum"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.nft.metaplex_bubblegum".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/nft/tensor_cnft.rs
Normal file
49
ks-lib/src/executor/nft/tensor_cnft.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/nft/tensor_cnft.rs
|
||||
// version: 2
|
||||
|
||||
//! Reserved executor for `nft_tensor_cnft`.
|
||||
|
||||
/// Reserved executor for the `nft_tensor_cnft` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExNftTensorCnftExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExNftTensorCnftExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.nft.tensor_cnft";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::NFT_TENSOR_CNFT_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"nft_tensor_cnft"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.nft.tensor_cnft".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
14
ks-lib/src/executor/orderbook.rs
Normal file
14
ks-lib/src/executor/orderbook.rs
Normal file
@@ -0,0 +1,14 @@
|
||||
// file: ks-lib/src/executor/orderbook.rs
|
||||
// version: 3
|
||||
|
||||
//! `orderbook` executor family.
|
||||
|
||||
mod jupiter_limit_order;
|
||||
mod jupiter_limit_order_v2;
|
||||
mod openbook_v2;
|
||||
/// Exposes the reserved `orderbook/jupiter_limit_order` executor.
|
||||
pub use self::jupiter_limit_order::ExOrderbookJupiterLimitOrderExecutor;
|
||||
/// Exposes the reserved `orderbook/jupiter_limit_order_v2` executor.
|
||||
pub use self::jupiter_limit_order_v2::ExOrderbookJupiterLimitOrderV2Executor;
|
||||
/// Exposes the reserved `orderbook/openbook_v2` executor.
|
||||
pub use self::openbook_v2::ExOrderbookOpenbookV2Executor;
|
||||
49
ks-lib/src/executor/orderbook/jupiter_limit_order.rs
Normal file
49
ks-lib/src/executor/orderbook/jupiter_limit_order.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/orderbook/jupiter_limit_order.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `orderbook_jupiter_limit_order`.
|
||||
|
||||
/// Reserved executor for the `orderbook_jupiter_limit_order` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExOrderbookJupiterLimitOrderExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExOrderbookJupiterLimitOrderExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.orderbook.jupiter_limit_order";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::ORDERBOOK_JUPITER_LIMIT_ORDER_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"orderbook_jupiter_limit_order"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.orderbook.jupiter_limit_order".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/orderbook/jupiter_limit_order_v2.rs
Normal file
49
ks-lib/src/executor/orderbook/jupiter_limit_order_v2.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/orderbook/jupiter_limit_order_v2.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `orderbook_jupiter_limit_order_v2`.
|
||||
|
||||
/// Reserved executor for the `orderbook_jupiter_limit_order_v2` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExOrderbookJupiterLimitOrderV2Executor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExOrderbookJupiterLimitOrderV2Executor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.orderbook.jupiter_limit_order_v2";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::ORDERBOOK_JUPITER_LIMIT_ORDER_V2_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"orderbook_jupiter_limit_order_v2"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.orderbook.jupiter_limit_order_v2".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/orderbook/openbook_v2.rs
Normal file
49
ks-lib/src/executor/orderbook/openbook_v2.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/orderbook/openbook_v2.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `orderbook_openbook_v2`.
|
||||
|
||||
/// Reserved executor for the `orderbook_openbook_v2` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExOrderbookOpenbookV2Executor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExOrderbookOpenbookV2Executor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.orderbook.openbook_v2";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::ORDERBOOK_OPENBOOK_V2_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"orderbook_openbook_v2"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.orderbook.openbook_v2".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
18
ks-lib/src/executor/perpetuals.rs
Normal file
18
ks-lib/src/executor/perpetuals.rs
Normal file
@@ -0,0 +1,18 @@
|
||||
// file: ks-lib/src/executor/perpetuals.rs
|
||||
// version: 4
|
||||
|
||||
//! `perpetuals` executor family.
|
||||
|
||||
mod drift_v2;
|
||||
mod jupiter;
|
||||
mod phoenix_eternal;
|
||||
mod zeta;
|
||||
|
||||
/// Exposes the reserved `perpetuals/drift_v2` executor.
|
||||
pub use self::drift_v2::ExPerpetualsDriftV2Executor;
|
||||
/// Exposes the reserved `perpetuals/jupiter` executor.
|
||||
pub use self::jupiter::ExPerpetualsJupiterExecutor;
|
||||
/// Exposes the reserved `perpetuals/phoenix_eternal` executor.
|
||||
pub use self::phoenix_eternal::ExPerpetualsPhoenixEternalExecutor;
|
||||
/// Exposes the reserved `perpetuals/zeta` executor.
|
||||
pub use self::zeta::ExPerpetualsZetaExecutor;
|
||||
49
ks-lib/src/executor/perpetuals/drift_v2.rs
Normal file
49
ks-lib/src/executor/perpetuals/drift_v2.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/perpetuals/drift_v2.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `perpetuals_drift_v2`.
|
||||
|
||||
/// Reserved executor for the `perpetuals_drift_v2` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExPerpetualsDriftV2Executor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExPerpetualsDriftV2Executor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.perpetuals.drift_v2";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::PERPETUALS_DRIFT_V2_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"perpetuals_drift_v2"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.perpetuals.drift_v2".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/perpetuals/jupiter.rs
Normal file
49
ks-lib/src/executor/perpetuals/jupiter.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/perpetuals/jupiter.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `perpetuals_jupiter`.
|
||||
|
||||
/// Reserved executor for the `perpetuals_jupiter` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExPerpetualsJupiterExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExPerpetualsJupiterExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.perpetuals.jupiter";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::PERPETUALS_JUPITER_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"perpetuals_jupiter"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.perpetuals.jupiter".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/perpetuals/phoenix_eternal.rs
Normal file
49
ks-lib/src/executor/perpetuals/phoenix_eternal.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/perpetuals/phoenix_eternal.rs
|
||||
// version: 2
|
||||
|
||||
//! Reserved executor for `perpetuals_phoenix_eternal`.
|
||||
|
||||
/// Reserved executor for the `perpetuals_phoenix_eternal` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExPerpetualsPhoenixEternalExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExPerpetualsPhoenixEternalExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.perpetuals.phoenix_eternal";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::PERPETUALS_PHOENIX_ETERNAL_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"perpetuals_phoenix_eternal"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.perpetuals.phoenix_eternal".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
49
ks-lib/src/executor/perpetuals/zeta.rs
Normal file
49
ks-lib/src/executor/perpetuals/zeta.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// file: ks-lib/src/executor/perpetuals/zeta.rs
|
||||
// version: 4
|
||||
|
||||
//! Reserved executor for `perpetuals_zeta`.
|
||||
|
||||
/// Reserved executor for the `perpetuals_zeta` program surface.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExPerpetualsZetaExecutor;
|
||||
|
||||
impl crate::ExApiInstructionExecutor for crate::ExPerpetualsZetaExecutor {
|
||||
fn executor_name(&self) -> &'static str {
|
||||
return "kb-lib.executor.perpetuals.zeta";
|
||||
}
|
||||
|
||||
fn executor_version(&self) -> &'static str {
|
||||
return env!("CARGO_PKG_VERSION");
|
||||
}
|
||||
|
||||
fn program_ids(&self) -> &'static [&'static str] {
|
||||
return &[ks_program_ids::PERPETUALS_ZETA_PROGRAM_ID];
|
||||
}
|
||||
|
||||
fn supports_request(
|
||||
&self,
|
||||
request: &crate::ExApiExecutionRequest,
|
||||
) -> crate::ExApiExecutionSupport {
|
||||
if crate::ExApiInstructionExecutor::handles_program_id(self, &request.program_id) {
|
||||
return crate::ExApiExecutionSupport::Maybe;
|
||||
}
|
||||
return crate::ExApiExecutionSupport::No;
|
||||
}
|
||||
|
||||
fn build_plan(
|
||||
&self,
|
||||
_request: &crate::ExApiExecutionRequest,
|
||||
) -> ks_core::Result<crate::ExApiExecutionPlan> {
|
||||
let payload_json = match crate::executor_api_serialize_payload_json(
|
||||
&serde_json::json!({"status":"reserved_executor","surface":"perpetuals_zeta"}),
|
||||
) {
|
||||
std::result::Result::Ok(serialized) => serialized,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::ExApiExecutionPlan {
|
||||
executor_name: "kb-lib.executor.perpetuals.zeta".to_string(),
|
||||
instruction_count: 0,
|
||||
payload_json,
|
||||
});
|
||||
}
|
||||
}
|
||||
21
ks-lib/src/executor/router.rs
Normal file
21
ks-lib/src/executor/router.rs
Normal file
@@ -0,0 +1,21 @@
|
||||
// file: ks-lib/src/executor/router.rs
|
||||
// version: 4
|
||||
|
||||
//! `router` executor family.
|
||||
|
||||
mod dflow_aggregator_v4;
|
||||
mod jupiter_aggregator_v4;
|
||||
mod jupiter_aggregator_v6;
|
||||
mod okx_labs_v1;
|
||||
mod okx_labs_v2;
|
||||
|
||||
/// Exposes the reserved `router/dflow_aggregator_v4` executor.
|
||||
pub use self::dflow_aggregator_v4::ExRouterDflowAggregatorV4Executor;
|
||||
/// Exposes the reserved `router/jupiter_aggregator_v4` executor.
|
||||
pub use self::jupiter_aggregator_v4::ExRouterJupiterAggregatorV4Executor;
|
||||
/// Exposes the reserved `router/jupiter_aggregator_v6` executor.
|
||||
pub use self::jupiter_aggregator_v6::ExRouterJupiterAggregatorV6Executor;
|
||||
/// Exposes the reserved `router/okx_labs_v1` executor.
|
||||
pub use self::okx_labs_v1::ExRouterOkxLabsV1Executor;
|
||||
/// Exposes the reserved `router/okx_labs_v2` executor.
|
||||
pub use self::okx_labs_v2::ExRouterOkxLabsV2Executor;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user