diff --git a/api/proto.lock b/api/proto.lock index 50ab138..d5d8369 100644 --- a/api/proto.lock +++ b/api/proto.lock @@ -1,26 +1,26 @@ [[schemas]] subject = "customer" -version = 1 +version = 2 sha512 = "d75800df0d4744c6b0f4d9a9952d3bfd0bb6b24a8babd19104cc11b54a525f85551b3c7375d69aeabbcf629cd826aa0bc6b0c0467add20716c504f5e856ce1c5" [[schemas]] subject = "nfts" -version = 3 +version = 29 sha512 = "b3b2136bd6c7a136d317da84395661de5fc056e8270510575a3281d78884d99a0d89f444754ed02cb18ad26dcc7cd65300c1df73b9d74d2edc6bcc8d552465d0" [[schemas]] subject = "organization" -version = 1 +version = 5 sha512 = "9fb28ac73d9712292297394a5fa53a7dae9deba6847353582987ba749859301c23c05fd49d2ce84a1640f8864c5c04d59fa38907700b280000e5c4afc96654bf" [[schemas]] subject = "polygon_nfts" -version = 1 +version = 6 sha512 = "c5ddf43d2958ec690ee2261d0ff9808b67ce810d2fc4b6077f96f561929a920f03509fc8bd7adbda219250eb019f5f7be8a3f51c554f665ea1881f7a973ef2a6" [[schemas]] subject = "solana_nfts" -version = 4 +version = 11 sha512 = "967fefde938a0f6ce05194e4fca15673e681caac54d8aeec114c5d38418632b9696dbaf5362345a15114e5abb49de55d0af8b9edcc0f2c91f9ef1ccc4ff55d68" [[schemas]] @@ -30,5 +30,5 @@ sha512 = "d167e0a143c813073eef8597f0b237e5a8eaf32abbf709724e8071b2dd73ce0438b82f [[schemas]] subject = "treasury" -version = 1 -sha512 = "03580129f0561b3d153f83b9f2729bd18e27c7d29815c9c3b7493e57e3cad3ea56f6e803e0ec5f19e8c17669de5ef8c0eb1bd59cfbae5f400741d0a73a464ba5" +version = 23 +sha512 = "0e4d77999767d5971122e720c1cee7a57c3e47ce69f58a582f1762d8e65e031ea3bd9024cfc21bd7da5db6e38a71657151c58cdfa21d9ff643fb2fc657105cf5" diff --git a/api/proto.toml b/api/proto.toml index 9326838..e66a353 100644 --- a/api/proto.toml +++ b/api/proto.toml @@ -1,11 +1,11 @@ [registry] -endpoint = "http://localhost:8081" +endpoint = "https://schemas.holaplex.tools" [schemas] -organization = 1 -nfts = 3 -customer = 1 -treasury = 1 -solana_nfts = 4 -polygon_nfts = 1 +organization = 5 +nfts = 29 +customer = 2 +treasury = 23 +solana_nfts = 11 +polygon_nfts = 6 timestamp = 1 \ No newline at end of file diff --git a/api/src/dataloaders/switch_collection_histories.rs b/api/src/dataloaders/switch_collection_histories.rs index c1653bf..ceade5f 100644 --- a/api/src/dataloaders/switch_collection_histories.rs +++ b/api/src/dataloaders/switch_collection_histories.rs @@ -37,11 +37,11 @@ impl DataLoader for SwitchCollectionHistoryLoader { Ok(switch_histories.into_iter().fold( HashMap::new(), |mut acc: HashMap>, switch_history| { - acc.entry(switch_history.collection_mint_id.clone()) + acc.entry(switch_history.collection_mint_id) .or_insert_with(Vec::new); - acc.entry(switch_history.collection_mint_id.clone()) - .and_modify(|switch_histories| switch_histories.push(switch_history.into())); + acc.entry(switch_history.collection_mint_id) + .and_modify(|switch_histories| switch_histories.push(switch_history)); acc }, diff --git a/api/src/events.rs b/api/src/events.rs index 8d5969f..62d4c20 100644 --- a/api/src/events.rs +++ b/api/src/events.rs @@ -159,6 +159,13 @@ impl Processor { } } + #[allow(clippy::too_many_lines)] + + /// Processes incoming messages related to different services like Treasury and Solana. + /// Routes each message to the corresponding handler based on the type of service and the specific event. + + /// # Errors + /// - Returns an error wrapped in `ProcessorError` if any of the operations inside the function fail. pub async fn process(&self, msg: Services) -> Result<()> { match msg { Services::Treasury(TreasuryEventKey { id, .. }, e) => match e.event { diff --git a/api/src/mutations/collection.rs b/api/src/mutations/collection.rs index 02238c8..b8bafbc 100644 --- a/api/src/mutations/collection.rs +++ b/api/src/mutations/collection.rs @@ -577,6 +577,11 @@ impl Mutation { } } +/// Fetches the owner's wallet address for a given project and blockchain. +/// # Returns +/// - Returns a `Result` containing the wallet address of the owner if the operation is successful. +/// # Errors +/// - Returns an error if no project wallet is found for the specified blockchain. pub async fn fetch_owner( conn: &DatabaseConnection, project: Uuid, @@ -634,6 +639,10 @@ impl CreateCollectionInput { } } +/// Validates the Solana creator verification based on project treasury wallet address and the list of creators. +/// # Errors +/// - Returns an error if any of the creators are verified but their address does not match +/// the project treasury wallet address. pub fn validate_solana_creator_verification( project_treasury_wallet_address: &str, creators: &Vec, @@ -695,6 +704,9 @@ pub fn validate_creators(blockchain: BlockchainEnum, creators: &Vec) -> Ok(()) } +/// Validates a Solana address +/// # Errors +/// - Returns an error if the provided address is not a valid Solana address. pub fn validate_solana_address(address: &str) -> Result<()> { if Pubkey::from_str(address).is_err() { return Err(Error::new(format!( @@ -705,6 +717,9 @@ pub fn validate_solana_address(address: &str) -> Result<()> { Ok(()) } +/// Validates an EVM (Ethereum Virtual Machine) address format. +/// # Errors +/// - Returns an error if the provided address does not match the required EVM address format. pub fn validate_evm_address(address: &str) -> Result<()> { let err = Err(Error::new(format!("{address} is not a valid EVM address"))); diff --git a/api/src/mutations/mint.rs b/api/src/mutations/mint.rs index 4c9c087..d85e873 100644 --- a/api/src/mutations/mint.rs +++ b/api/src/mutations/mint.rs @@ -1287,17 +1287,20 @@ pub struct RetryUpdateMintPayload { status: CreationStatus, } +/// Represents input data for `queue_mint_to_drop` mutation #[derive(Debug, Clone, InputObject)] pub struct QueueMintToDropInput { drop: Uuid, metadata_json: MetadataJsonInput, } +/// Represents payload data for `queue_mint_to_drop` mutation #[derive(Debug, Clone, SimpleObject)] pub struct QueueMintToDropPayload { collection_mint: CollectionMint, } +/// Represents input data for `mint_queued` mutation #[derive(Debug, Clone, InputObject)] pub struct MintQueuedInput { mint: Uuid, @@ -1305,11 +1308,13 @@ pub struct MintQueuedInput { compressed: bool, } +/// Represents payload data for `mint_queued` mutation #[derive(Debug, Clone, SimpleObject)] pub struct MintQueuedPayload { collection_mint: CollectionMint, } +/// Represents input data for `mint_random_queued` mutation #[derive(Debug, Clone, InputObject)] pub struct MintRandomQueuedInput { drop: Uuid,