Skip to content

Commit

Permalink
WIP: partial draft of compressed NFTs
Browse files Browse the repository at this point in the history
  • Loading branch information
ray-kast committed Jun 23, 2023
1 parent c30c889 commit 088b746
Show file tree
Hide file tree
Showing 9 changed files with 969 additions and 304 deletions.
359 changes: 298 additions & 61 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions consumer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,19 @@ build = "build.rs"
[lib]

[dependencies]
anchor-lang = "0.26.0"
bincode = "1.3.3"
prost = "0.11.6"
serde = { version = "1.0.152", features = ["derive"] }
serde_json = "1.0.93"
solana-program = "1.14.8"
solana-client = "1.14.8"
spl-account-compression = "0.1.10"
spl-noop = "0.1.3"
spl-token = "3.5.0"
solana-sdk = "1.14.8"
spl-associated-token-account = "1.1.2"
mpl-bubblegum = "0.8.0"
mpl-token-metadata = "1.8.3"
holaplex-hub-nfts-solana-core = { path = "../core" }
holaplex-hub-nfts-solana-entity = { path = "../entity" }
Expand Down
2 changes: 1 addition & 1 deletion consumer/proto.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sha512 = "67fadd3a6185229df033804be2e598b13ac6cbb0464e4e2c4e91caa85d116527170aaf
[[schemas]]
subject = "solana_nfts"
version = 2
sha512 = "a42cfd38aee98c6fbe445f889430be9fe5a2d84319858063f8f4f9e3d83015f869784246c1b6d5143247c93448560ebad1e225a2769d4743ad6e99bba53ae191"
sha512 = "af3d6037731fafd7aca187e6a858152cfaa225b1f4223ee695fc93f82094d6dc4b75fd432aa10222f7dd943ea7d0e4edccf83c713a4553e5672dc6b908ce2812"

[[schemas]]
subject = "treasury"
Expand Down
79 changes: 79 additions & 0 deletions consumer/src/backend.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
use holaplex_hub_nfts_solana_entity::{collection_mints, collections};

use crate::proto::{
MetaplexMasterEditionTransaction, MintMetaplexEditionTransaction,
TransferMetaplexAssetTransaction,
};
use hub_core::prelude::*;
use solana_program::pubkey::Pubkey;

#[derive(Clone)]
pub struct MasterEditionAddresses {
pub metadata: Pubkey,
pub associated_token_account: Pubkey,
pub owner: Pubkey,
pub master_edition: Pubkey,
pub mint: Pubkey,
pub update_authority: Pubkey,
}

#[derive(Clone)]
pub struct MintEditionAddresses {
pub edition: Pubkey,
pub mint: Pubkey,
pub metadata: Pubkey,
pub owner: Pubkey,
pub associated_token_account: Pubkey,
}

#[derive(Clone)]
pub struct UpdateMasterEditionAddresses {
pub metadata: Pubkey,
pub update_authority: Pubkey,
}

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

/// Represents a response from a transaction on the blockchain. This struct
/// provides the serialized message and the signatures of the signed message.
pub struct TransactionResponse<A> {
/// The serialized version of the message from the transaction.
pub serialized_message: Vec<u8>,

/// The signatures of the signed message or the public keys of wallets that should sign the transaction. Order matters.
pub signatures_or_signers_public_keys: Vec<String>,

/// Addresses that are related to the transaction.
pub addresses: A,
}

pub trait Backend {
fn create(
&self,
txn: MetaplexMasterEditionTransaction,
) -> Result<TransactionResponse<MasterEditionAddresses>>;

fn mint(
&self,
collection: collections::Model,
txn: MintMetaplexEditionTransaction,
) -> Result<TransactionResponse<MintEditionAddresses>>;

fn update(
&self,
collection: collections::Model,
txn: MetaplexMasterEditionTransaction,
) -> Result<TransactionResponse<UpdateMasterEditionAddresses>>;

fn transfer(
&self,
mint: collection_mints::Model,
txn: TransferMetaplexAssetTransaction,
) -> Result<TransactionResponse<TransferAssetAddresses>>;
}
Loading

0 comments on commit 088b746

Please sign in to comment.