diff --git a/consumer/src/events.rs b/consumer/src/events.rs index 5d92493..f5290b5 100644 --- a/consumer/src/events.rs +++ b/consumer/src/events.rs @@ -103,12 +103,12 @@ impl ErrorSource { #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum EventKind { - CreateDrop, - MintDrop, - UpdateDrop, + CreateEditionDrop, + MintEditionDrop, + UpdateEditionDrop, TransferAsset, - RetryCreateDrop, - RetryMintDrop, + RetryCreateEditionDrop, + RetryMintEditionDrop, CreateCollection, RetryCreateCollection, UpdateCollection, @@ -117,17 +117,22 @@ pub enum EventKind { UpdateCollectionMint, RetryUpdateCollectionMint, SwitchMintCollection, + CreateOpenDrop, + MintOpenDrop, + UpdateOpenDrop, + RetryCreateOpenDrop, + RetryMintOpenDrop, } impl EventKind { fn name(self) -> &'static str { match self { - Self::CreateDrop => "drop creation", - Self::MintDrop => "drop mint", - Self::UpdateDrop => "drop update", + Self::CreateEditionDrop => "edition drop creation", + Self::MintEditionDrop => "edition drop mint", + Self::UpdateEditionDrop => "edition drop update", Self::TransferAsset => "asset transfer", - Self::RetryCreateDrop => "drop creation retry", - Self::RetryMintDrop => "drop mint retry", + Self::RetryCreateEditionDrop => "editiondrop creation retry", + Self::RetryMintEditionDrop => "edition drop mint retry", Self::CreateCollection => "collection creation", Self::RetryCreateCollection => "collection creation retry", Self::UpdateCollection => "collection update", @@ -136,17 +141,26 @@ impl EventKind { Self::UpdateCollectionMint => "collection mint update", Self::RetryUpdateCollectionMint => "collection mint update retry", Self::SwitchMintCollection => "switch mint collection", + Self::CreateOpenDrop => "open drop creation", + Self::MintOpenDrop => "open drop mint", + Self::UpdateOpenDrop => "open drop update", + Self::RetryCreateOpenDrop => "open drop creation retry", + Self::RetryMintOpenDrop => "open drop mint retry", } } fn into_sign_request(self, tx: SolanaPendingTransaction) -> SolanaNftEvent { match self { - EventKind::CreateDrop => SolanaNftEvent::CreateDropSigningRequested(tx), - EventKind::MintDrop => SolanaNftEvent::MintDropSigningRequested(tx), - EventKind::UpdateDrop => SolanaNftEvent::UpdateDropSigningRequested(tx), + EventKind::CreateEditionDrop => SolanaNftEvent::CreateEditionDropSigningRequested(tx), + EventKind::MintEditionDrop => SolanaNftEvent::MintEditionDropSigningRequested(tx), + EventKind::UpdateEditionDrop => SolanaNftEvent::UpdateEditionDropSigningRequested(tx), EventKind::TransferAsset => SolanaNftEvent::TransferAssetSigningRequested(tx), - EventKind::RetryCreateDrop => SolanaNftEvent::RetryCreateDropSigningRequested(tx), - EventKind::RetryMintDrop => SolanaNftEvent::RetryMintDropSigningRequested(tx), + EventKind::RetryCreateEditionDrop => { + SolanaNftEvent::RetryCreateEditionDropSigningRequested(tx) + }, + EventKind::RetryMintEditionDrop => { + SolanaNftEvent::RetryMintEditionDropSigningRequested(tx) + }, EventKind::CreateCollection => SolanaNftEvent::CreateCollectionSigningRequested(tx), EventKind::UpdateCollection => SolanaNftEvent::UpdateCollectionSigningRequested(tx), EventKind::RetryCreateCollection => { @@ -165,6 +179,13 @@ impl EventKind { EventKind::SwitchMintCollection => { SolanaNftEvent::SwitchMintCollectionSigningRequested(tx) }, + EventKind::CreateOpenDrop => SolanaNftEvent::CreateOpenDropSigningRequested(tx), + EventKind::MintOpenDrop => SolanaNftEvent::MintOpenDropSigningRequested(tx), + EventKind::UpdateOpenDrop => SolanaNftEvent::UpdateOpenDropSigningRequested(tx), + EventKind::RetryCreateOpenDrop => { + SolanaNftEvent::RetryCreateOpenDropSigningRequested(tx) + }, + EventKind::RetryMintOpenDrop => SolanaNftEvent::RetryMintOpenDropSigningRequested(tx), } } @@ -178,13 +199,13 @@ impl EventKind { let id = || Uuid::parse_str(&key.id); Ok(match self { - Self::CreateDrop => { + Self::CreateEditionDrop => { let id = id()?; let collection = Collection::find_by_id(conn, id) .await? .ok_or(ProcessorErrorKind::RecordNotFound)?; - SolanaNftEvent::CreateDropSubmitted(SolanaCompletedMintTransaction { + SolanaNftEvent::CreateEditionDropSubmitted(SolanaCompletedMintTransaction { signature, address: collection.mint, }) @@ -218,7 +239,7 @@ impl EventKind { signature, }) }, - Self::MintToCollection => { + Self::MintToCollection | Self::MintOpenDrop => { let id = id()?; let collection_mint = CollectionMint::find_by_id(conn, id).await?; @@ -248,49 +269,55 @@ impl EventKind { .ok_or(ProcessorErrorKind::RecordNotFound)? .mint }; + let transaction = SolanaCompletedMintTransaction { signature, address }; - SolanaNftEvent::MintToCollectionSubmitted(SolanaCompletedMintTransaction { - signature, - address, - }) + match self { + Self::MintToCollection => { + SolanaNftEvent::MintToCollectionSubmitted(transaction) + }, + Self::MintOpenDrop => SolanaNftEvent::MintOpenDropSubmitted(transaction), + _ => unreachable!(), + } }, - Self::MintDrop => { + Self::MintEditionDrop => { let id = id()?; let collection_mint = CollectionMint::find_by_id(conn, id) .await? .ok_or(ProcessorErrorKind::RecordNotFound)?; - SolanaNftEvent::MintDropSubmitted(SolanaCompletedMintTransaction { + SolanaNftEvent::MintEditionDropSubmitted(SolanaCompletedMintTransaction { signature, address: collection_mint.mint, }) }, - Self::UpdateDrop => { - SolanaNftEvent::UpdateDropSubmitted(SolanaCompletedUpdateTransaction { signature }) + Self::UpdateEditionDrop => { + SolanaNftEvent::UpdateEditionDropSubmitted(SolanaCompletedUpdateTransaction { + signature, + }) }, Self::TransferAsset => { SolanaNftEvent::TransferAssetSubmitted(SolanaCompletedTransferTransaction { signature, }) }, - Self::RetryCreateDrop => { + Self::RetryCreateEditionDrop => { let id = id()?; let collection = Collection::find_by_id(conn, id) .await? .ok_or(ProcessorErrorKind::RecordNotFound)?; - SolanaNftEvent::RetryCreateDropSubmitted(SolanaCompletedMintTransaction { + SolanaNftEvent::RetryCreateEditionDropSubmitted(SolanaCompletedMintTransaction { signature, address: collection.mint, }) }, - Self::RetryMintDrop => { + Self::RetryMintEditionDrop => { let id = id()?; let collection_mint = CollectionMint::find_by_id(conn, id) .await? .ok_or(ProcessorErrorKind::RecordNotFound)?; - SolanaNftEvent::RetryMintDropSubmitted(SolanaCompletedMintTransaction { + SolanaNftEvent::RetryMintEditionDropSubmitted(SolanaCompletedMintTransaction { signature, address: collection_mint.mint, }) @@ -321,17 +348,55 @@ impl EventKind { signature, }) }, + Self::CreateOpenDrop => { + let id = id()?; + let collection = Collection::find_by_id(conn, id) + .await? + .ok_or(ProcessorErrorKind::RecordNotFound)?; + + SolanaNftEvent::CreateOpenDropSubmitted(SolanaCompletedMintTransaction { + signature, + address: collection.mint, + }) + }, + Self::UpdateOpenDrop => { + SolanaNftEvent::UpdateOpenDropSubmitted(SolanaCompletedUpdateTransaction { + signature, + }) + }, + Self::RetryCreateOpenDrop => { + let id = id()?; + let collection = Collection::find_by_id(conn, id) + .await? + .ok_or(ProcessorErrorKind::RecordNotFound)?; + + SolanaNftEvent::RetryCreateOpenDropSubmitted(SolanaCompletedMintTransaction { + signature, + address: collection.mint, + }) + }, + Self::RetryMintOpenDrop => { + let id = id()?; + let collection_mint = CollectionMint::find_by_id(conn, id) + .await? + .ok_or(ProcessorErrorKind::RecordNotFound)?; + + SolanaNftEvent::RetryMintOpenDropSubmitted(SolanaCompletedMintTransaction { + signature, + address: collection_mint.mint, + }) + }, }) } fn into_failure(self, tx: SolanaFailedTransaction) -> SolanaNftEvent { match self { - Self::CreateDrop => SolanaNftEvent::CreateDropFailed(tx), - Self::MintDrop => SolanaNftEvent::MintDropFailed(tx), - Self::UpdateDrop => SolanaNftEvent::UpdateDropFailed(tx), + Self::CreateEditionDrop => SolanaNftEvent::CreateEditionDropFailed(tx), + Self::MintEditionDrop => SolanaNftEvent::MintEditionDropFailed(tx), + Self::UpdateEditionDrop => SolanaNftEvent::UpdateEditionDropFailed(tx), Self::TransferAsset => SolanaNftEvent::TransferAssetFailed(tx), - Self::RetryCreateDrop => SolanaNftEvent::RetryCreateDropFailed(tx), - Self::RetryMintDrop => SolanaNftEvent::RetryMintDropFailed(tx), + Self::RetryCreateEditionDrop => SolanaNftEvent::RetryCreateEditionDropFailed(tx), + Self::RetryMintEditionDrop => SolanaNftEvent::RetryMintEditionDropFailed(tx), Self::CreateCollection => SolanaNftEvent::CreateCollectionFailed(tx), Self::RetryCreateCollection => SolanaNftEvent::RetryCreateCollectionFailed(tx), Self::UpdateCollection => SolanaNftEvent::UpdateCollectionFailed(tx), @@ -340,6 +405,11 @@ impl EventKind { Self::UpdateCollectionMint => SolanaNftEvent::UpdateCollectionMintFailed(tx), Self::RetryUpdateCollectionMint => SolanaNftEvent::RetryUpdateMintFailed(tx), Self::SwitchMintCollection => SolanaNftEvent::SwitchMintCollectionFailed(tx), + Self::CreateOpenDrop => SolanaNftEvent::CreateOpenDropFailed(tx), + Self::MintOpenDrop => SolanaNftEvent::MintOpenDropFailed(tx), + Self::UpdateOpenDrop => SolanaNftEvent::UpdateOpenDropFailed(tx), + Self::RetryCreateOpenDrop => SolanaNftEvent::RetryCreateOpenDropFailed(tx), + Self::RetryMintOpenDrop => SolanaNftEvent::RetryMintOpenDropFailed(tx), } } } @@ -373,9 +443,9 @@ impl Processor { let key = SolanaNftEventKey::from(key); match msg.event { - Some(NftEvent::SolanaCreateDrop(payload)) => { + Some(NftEvent::SolanaCreateEditionDrop(payload)) => { self.process_nft( - EventKind::CreateDrop, + EventKind::CreateEditionDrop, &key, self.create_collection(&UncompressedRef(self.solana()), &key, payload), ) @@ -389,9 +459,9 @@ impl Processor { ) .await }, - Some(NftEvent::SolanaMintDrop(payload)) => { + Some(NftEvent::SolanaMintEditionDrop(payload)) => { self.process_nft( - EventKind::MintDrop, + EventKind::MintEditionDrop, &key, self.mint_drop(&EditionRef(self.solana()), &key, payload), ) @@ -405,9 +475,9 @@ impl Processor { ) .await }, - Some(NftEvent::SolanaUpdateDrop(payload)) => { + Some(NftEvent::SolanaUpdateEditionDrop(payload)) => { self.process_nft( - EventKind::UpdateDrop, + EventKind::UpdateEditionDrop, &key, self.update_collection(&UncompressedRef(self.solana()), &key, payload), ) @@ -429,9 +499,9 @@ impl Processor { ) .await }, - Some(NftEvent::SolanaRetryDrop(payload)) => { + Some(NftEvent::SolanaRetryEditionDrop(payload)) => { self.process_nft( - EventKind::RetryCreateDrop, + EventKind::RetryCreateEditionDrop, &key, self.retry_create_collection( &UncompressedRef(self.solana()), @@ -453,9 +523,9 @@ impl Processor { ) .await }, - Some(NftEvent::SolanaRetryMintDrop(payload)) => { + Some(NftEvent::SolanaRetryMintEditionDrop(payload)) => { self.process_nft( - EventKind::RetryMintDrop, + EventKind::RetryMintEditionDrop, &key, self.retry_mint_drop(&EditionRef(self.solana()), &key, payload), ) @@ -504,7 +574,54 @@ impl Processor { ) .await }, - + Some(NftEvent::SolanaCreateOpenDrop(payload)) => { + self.process_nft( + EventKind::CreateOpenDrop, + &key, + self.create_collection(&UncompressedRef(self.solana()), &key, payload), + ) + .await + }, + Some(NftEvent::SolanaMintOpenDrop(payload)) => { + self.process_nft( + EventKind::MintOpenDrop, + &key, + self.mint_to_collection(&key, payload), + ) + .await + }, + Some(NftEvent::SolanaUpdateOpenDrop(payload)) => { + self.process_nft( + EventKind::UpdateOpenDrop, + &key, + self.update_collection(&UncompressedRef(self.solana()), &key, payload), + ) + .await + }, + Some(NftEvent::SolanaRetryOpenDrop(payload)) => { + self.process_nft( + EventKind::RetryCreateOpenDrop, + &key, + self.retry_create_collection( + &UncompressedRef(self.solana()), + &key, + payload, + ), + ) + .await + }, + Some(NftEvent::SolanaRetryMintOpenDrop(payload)) => { + self.process_nft( + EventKind::RetryMintOpenDrop, + &key, + self.retry_mint_to_collection( + &UncompressedRef(self.solana()), + &key, + payload, + ), + ) + .await + }, _ => Ok(()), } }, @@ -512,25 +629,28 @@ impl Processor { let key = SolanaNftEventKey::from(key); match msg.event { - Some(TreasuryEvent::SolanaCreateDropSigned(res)) => { - self.process_treasury(EventKind::CreateDrop, key, res).await + Some(TreasuryEvent::SolanaCreateEditionDropSigned(res)) => { + self.process_treasury(EventKind::CreateEditionDrop, key, res) + .await }, - Some(TreasuryEvent::SolanaMintDropSigned(res)) => { - self.process_treasury(EventKind::MintDrop, key, res).await + Some(TreasuryEvent::SolanaMintEditionDropSigned(res)) => { + self.process_treasury(EventKind::MintEditionDrop, key, res) + .await }, - Some(TreasuryEvent::SolanaUpdateDropSigned(res)) => { - self.process_treasury(EventKind::UpdateDrop, key, res).await + Some(TreasuryEvent::SolanaUpdateEditionDropSigned(res)) => { + self.process_treasury(EventKind::UpdateEditionDrop, key, res) + .await }, Some(TreasuryEvent::SolanaTransferAssetSigned(res)) => { self.process_treasury(EventKind::TransferAsset, key, res) .await }, - Some(TreasuryEvent::SolanaRetryCreateDropSigned(res)) => { - self.process_treasury(EventKind::RetryCreateDrop, key, res) + Some(TreasuryEvent::SolanaRetryCreateEditionDropSigned(res)) => { + self.process_treasury(EventKind::RetryCreateEditionDrop, key, res) .await }, - Some(TreasuryEvent::SolanaRetryMintDropSigned(res)) => { - self.process_treasury(EventKind::RetryMintDrop, key, res) + Some(TreasuryEvent::SolanaRetryMintEditionDropSigned(res)) => { + self.process_treasury(EventKind::RetryMintEditionDrop, key, res) .await }, Some(TreasuryEvent::SolanaMintToCollectionSigned(res)) => { @@ -565,6 +685,26 @@ impl Processor { self.process_treasury(EventKind::SwitchMintCollection, key, res) .await }, + Some(TreasuryEvent::SolanaCreateOpenDropSigned(res)) => { + self.process_treasury(EventKind::CreateOpenDrop, key, res) + .await + }, + Some(TreasuryEvent::SolanaMintOpenDropSigned(res)) => { + self.process_treasury(EventKind::MintOpenDrop, key, res) + .await + }, + Some(TreasuryEvent::SolanaUpdateOpenDropSigned(res)) => { + self.process_treasury(EventKind::UpdateOpenDrop, key, res) + .await + }, + Some(TreasuryEvent::SolanaRetryCreateOpenDropSigned(res)) => { + self.process_treasury(EventKind::RetryCreateOpenDrop, key, res) + .await + }, + Some(TreasuryEvent::SolanaRetryMintOpenDropSigned(res)) => { + self.process_treasury(EventKind::RetryMintOpenDrop, key, res) + .await + }, _ => Ok(()), } }, diff --git a/core/proto.lock b/core/proto.lock index 14f6b5d..1c4fe4d 100644 --- a/core/proto.lock +++ b/core/proto.lock @@ -1,14 +1,14 @@ [[schemas]] subject = "nfts" -version = 27 -sha512 = "ec52dffa482eb3beb72b1ae1745f3b8cb1b6d321d20fdc30078f4362c924b0f75ebe3dc53c54e5de92ea55163b64f09fe4e2b749c1bc5bc64d92f8356835eb90" +version = 29 +sha512 = "b3b2136bd6c7a136d317da84395661de5fc056e8270510575a3281d78884d99a0d89f444754ed02cb18ad26dcc7cd65300c1df73b9d74d2edc6bcc8d552465d0" [[schemas]] subject = "solana_nfts" -version = 10 -sha512 = "1bcb166ab5dfdf4841d60caa07a4098dcec03d7e3b0e63adb090ed2f5fe990c1e13826867e8df7521ec631027d5a931a08865fd2cf2daa905807c4b7dca40213" +version = 11 +sha512 = "967fefde938a0f6ce05194e4fca15673e681caac54d8aeec114c5d38418632b9696dbaf5362345a15114e5abb49de55d0af8b9edcc0f2c91f9ef1ccc4ff55d68" [[schemas]] subject = "treasury" -version = 22 -sha512 = "bde788b07f818aa52e684dcbd91e1f1e3db82f242f616ec2a42ab6d412df33a1461677c229f2f9bae345938c2f325e6332a95caef2c7e01a47531af53e39bf03" +version = 23 +sha512 = "0e4d77999767d5971122e720c1cee7a57c3e47ce69f58a582f1762d8e65e031ea3bd9024cfc21bd7da5db6e38a71657151c58cdfa21d9ff643fb2fc657105cf5" diff --git a/core/proto.toml b/core/proto.toml index 5d1fe9f..62864f2 100644 --- a/core/proto.toml +++ b/core/proto.toml @@ -2,6 +2,6 @@ endpoint = "https://schemas.holaplex.tools" [schemas] -nfts = 27 -treasury = 22 -solana_nfts = 10 \ No newline at end of file +nfts = 29 +treasury = 23 +solana_nfts = 11 \ No newline at end of file