Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create MCC #21

Merged
merged 4 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 17 additions & 30 deletions consumer/src/backend.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
use holaplex_hub_nfts_solana_entity::{collection_mints, collections};

use holaplex_hub_nfts_solana_core::proto::{
MetaplexMasterEditionTransaction, MintMetaplexEditionTransaction, SolanaPendingTransaction,
TransferMetaplexAssetTransaction,
MetaplexMasterEditionTransaction, SolanaPendingTransaction, TransferMetaplexAssetTransaction,
};
use holaplex_hub_nfts_solana_entity::{collection_mints, collections};
use hub_core::prelude::*;
use solana_program::pubkey::Pubkey;

Expand All @@ -27,6 +25,12 @@ pub struct MintEditionAddresses {
pub recipient: Pubkey,
}

#[derive(Clone)]
pub struct MintCompressedMintV1Addresses {
pub owner: Pubkey,
pub recipient: Pubkey,
}

#[derive(Clone)]
pub struct UpdateMasterEditionAddresses {
pub metadata: Pubkey,
Expand Down Expand Up @@ -69,44 +73,27 @@ impl<A> From<TransactionResponse<A>> for SolanaPendingTransaction {
}
}

// TODO: include this in collections::Model
pub enum CollectionType {
Legacy,
Verified,
}

// Legacy, Verified
#[async_trait]
pub trait CollectionBackend {
fn create(
&self,
txn: MetaplexMasterEditionTransaction,
) -> Result<TransactionResponse<MasterEditionAddresses>>;
}

// Uncompressed, Compressed
#[async_trait]
pub trait MintBackend {
fn mint(
&self,
collection_ty: CollectionType,
collection: &collections::Model,
txn: MintMetaplexEditionTransaction,
) -> Result<TransactionResponse<MintEditionAddresses>>;

// TODO: probably better to replace all errors here with an Error enum
fn try_update(
fn update(
&self,
collection_ty: CollectionType,
collection: &collections::Model,
txn: MetaplexMasterEditionTransaction,
) -> Result<Option<TransactionResponse<UpdateMasterEditionAddresses>>>;
) -> Result<TransactionResponse<UpdateMasterEditionAddresses>>;
}

// Right now only this one needs to be async to support hitting the asset
// API for transfer data
pub trait MintBackend<T, R> {
fn mint(&self, collection: &collections::Model, txn: T) -> Result<TransactionResponse<R>>;
}

#[async_trait]
pub trait TransferBackend {
async fn transfer(
&self,
collection_ty: CollectionType,
collection_mint: &collection_mints::Model,
txn: TransferMetaplexAssetTransaction,
) -> Result<TransactionResponse<TransferAssetAddresses>>;
Expand Down
Loading
Loading