carbon-sharky-decoder 2.0.0

Sharky Decoder
Documentation
//! This code was AUTOGENERATED using the Codama library.
pub mod add_liquidity_token_pool_schema;
pub mod close_escrow_value_mint_ata_admin_schema;
pub mod close_nft_list_schema;
pub mod close_order_book_schema;
pub mod close_token_orderbook_schema;
pub mod close_token_pool_schema;
pub mod create_nft_list_schema;
pub mod create_order_book_schema;
pub mod create_program_version_schema;
pub mod create_token_orderbook_schema;
pub mod create_token_pool_schema;
pub mod extend_loan_core_schema;
pub mod extend_loan_v3_compressed_schema;
pub mod extend_loan_v3_schema;
pub mod extend_token_loan_schema;
pub mod foreclose_loan_core_schema;
pub mod foreclose_loan_v3_compressed_schema;
pub mod foreclose_loan_v3_schema;
pub mod foreclose_token_loan_schema;
pub mod offer_loan_schema;
pub mod repay_loan_core_schema;
pub mod repay_loan_v3_compressed_schema;
pub mod repay_loan_v3_schema;
pub mod repay_token_loan_schema;
pub mod rescind_loan_schema;
pub mod take_loan_core_schema;
pub mod take_loan_v3_compressed_schema;
pub mod take_loan_v3_schema;
pub mod take_token_loan_schema;
pub mod update_nft_list_schema;
pub mod update_order_book_schema;
pub mod update_program_version_schema;
pub mod update_token_orderbook_schema;
pub mod update_token_pool_schema;
pub mod withdraw_liquidity_token_pool_schema;

use juniper::GraphQLObject;
pub use {
    add_liquidity_token_pool_schema::*, close_escrow_value_mint_ata_admin_schema::*,
    close_nft_list_schema::*, close_order_book_schema::*, close_token_orderbook_schema::*,
    close_token_pool_schema::*, create_nft_list_schema::*, create_order_book_schema::*,
    create_program_version_schema::*, create_token_orderbook_schema::*,
    create_token_pool_schema::*, extend_loan_core_schema::*, extend_loan_v3_compressed_schema::*,
    extend_loan_v3_schema::*, extend_token_loan_schema::*, foreclose_loan_core_schema::*,
    foreclose_loan_v3_compressed_schema::*, foreclose_loan_v3_schema::*,
    foreclose_token_loan_schema::*, offer_loan_schema::*, repay_loan_core_schema::*,
    repay_loan_v3_compressed_schema::*, repay_loan_v3_schema::*, repay_token_loan_schema::*,
    rescind_loan_schema::*, take_loan_core_schema::*, take_loan_v3_compressed_schema::*,
    take_loan_v3_schema::*, take_token_loan_schema::*, update_nft_list_schema::*,
    update_order_book_schema::*, update_program_version_schema::*,
    update_token_orderbook_schema::*, update_token_pool_schema::*,
    withdraw_liquidity_token_pool_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)),
        }
    }
}