carbon-bonkswap-decoder 2.0.0

Carbon BonkSwap Decoder
Documentation
//! This code was AUTOGENERATED using the Codama library.
pub mod add_supply_schema;
pub mod add_tokens_schema;
pub mod close_pool_schema;
pub mod create_dual_farm_schema;
pub mod create_farm_schema;
pub mod create_pool_schema;
pub mod create_provider_schema;
pub mod create_state_schema;
pub mod create_triple_farm_schema;
pub mod reset_farm_schema;
pub mod swap_schema;
pub mod update_fees_schema;
pub mod update_reward_tokens_schema;
pub mod withdraw_buyback_schema;
pub mod withdraw_lp_fee_schema;
pub mod withdraw_mercanti_fee_schema;
pub mod withdraw_project_fee_schema;
pub mod withdraw_rewards_schema;
pub mod withdraw_shares_schema;

use juniper::GraphQLObject;
pub use {
    add_supply_schema::*, add_tokens_schema::*, close_pool_schema::*, create_dual_farm_schema::*,
    create_farm_schema::*, create_pool_schema::*, create_provider_schema::*,
    create_state_schema::*, create_triple_farm_schema::*, reset_farm_schema::*, swap_schema::*,
    update_fees_schema::*, update_reward_tokens_schema::*, withdraw_buyback_schema::*,
    withdraw_lp_fee_schema::*, withdraw_mercanti_fee_schema::*, withdraw_project_fee_schema::*,
    withdraw_rewards_schema::*, withdraw_shares_schema::*,
};

#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "InstructionMetadata")]
pub struct InstructionMetadataGraphQL {
    pub signature: String,
    pub instruction_index: carbon_core::graphql::primitives::U32,
    pub stack_height: carbon_core::graphql::primitives::U32,
    pub slot: Option<carbon_core::graphql::primitives::U64>,
}

impl From<carbon_core::postgres::metadata::InstructionRowMetadata> for InstructionMetadataGraphQL {
    fn from(metadata: carbon_core::postgres::metadata::InstructionRowMetadata) -> Self {
        Self {
            signature: metadata.signature,
            instruction_index: carbon_core::graphql::primitives::U32(
                (*metadata.instruction_index) as u32,
            ),
            stack_height: carbon_core::graphql::primitives::U32((*metadata.stack_height) as u32),
            slot: metadata
                .slot
                .map(|v| carbon_core::graphql::primitives::U64(*v)),
        }
    }
}