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

[MET-44] Gapfiller api design #7

Merged
merged 6 commits into from
Dec 22, 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
3 changes: 3 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler

- name: Install Rust specific version
uses: actions-rs/toolchain@v1
with:
Expand Down
103 changes: 103 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ members = [
"rocks-db",
"postgre-client",
"entities",
"grpc",
]

[profile.release]
Expand Down
38 changes: 18 additions & 20 deletions entities/src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,32 +46,32 @@ pub struct CompleteAssetDetails {
pub pubkey: Pubkey,
pub specification_asset_class: SpecificationAssetClass,
pub royalty_target_type: RoyaltyTargetType,
pub created_at: i64,
pub slot_created: u64,

// From AssetDynamicDetails as Tuples
pub is_compressible: (bool, u64, Option<u64>),
pub is_compressed: (bool, u64, Option<u64>),
pub is_frozen: (bool, u64, Option<u64>),
pub supply: (Option<u64>, u64, Option<u64>),
pub seq: (Option<u64>, u64, Option<u64>),
pub is_burnt: (bool, u64, Option<u64>),
pub was_decompressed: (bool, u64, Option<u64>),
pub onchain_data: (Option<ChainDataV1>, u64, Option<u64>), // Serialized ChainDataV1
pub creators: (Vec<Creator>, u64, Option<u64>),
pub royalty_amount: (u16, u64, Option<u64>),
pub is_compressible: Updated<bool>,
pub is_compressed: Updated<bool>,
pub is_frozen: Updated<bool>,
pub supply: Option<Updated<u64>>,
pub seq: Option<Updated<u64>>,
pub is_burnt: Updated<bool>,
pub was_decompressed: Updated<bool>,
pub onchain_data: Option<Updated<ChainDataV1>>,
pub creators: Updated<Vec<Creator>>,
pub royalty_amount: Updated<u16>,

// From AssetAuthority as Tuple
pub authority: (Pubkey, u64, Option<u64>),
pub authority: Updated<Pubkey>,

// From AssetOwner as Tuples
pub owner: (Pubkey, u64, Option<u64>),
pub delegate: (Option<Pubkey>, u64, Option<u64>),
pub owner_type: (OwnerType, u64, Option<u64>),
pub owner_delegate_seq: (Option<u64>, u64, Option<u64>),
pub owner: Updated<Pubkey>,
pub delegate: Option<Updated<Pubkey>>,
pub owner_type: Updated<OwnerType>,
pub owner_delegate_seq: Option<Updated<u64>>,

// Separate fields
pub leaves: Vec<AssetLeaf>,
pub collection: AssetCollection,
pub leaves: Vec<Updated<AssetLeaf>>,
pub collection: Option<Updated<AssetCollection>>,
}

/// Leaf information about compressed asset
Expand All @@ -85,7 +85,6 @@ pub struct AssetLeaf {
pub data_hash: Option<Hash>,
pub creator_hash: Option<Hash>,
pub leaf_seq: Option<u64>,
pub slot_updated: u64,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
Expand Down Expand Up @@ -120,7 +119,6 @@ pub struct AssetCollection {
pub collection: Pubkey,
pub is_collection_verified: bool,
pub collection_seq: Option<u64>,
pub slot_updated: u64,
}

#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq)]
Expand Down
13 changes: 13 additions & 0 deletions grpc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[package]
name = "grpc"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
tonic = "0.10.2"
prost = "0.12.3"

[build-dependencies]
tonic-build = "0.10.2" # Corresponding build tool for tonic
9 changes: 9 additions & 0 deletions grpc/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
tonic_build::configure()
.out_dir("src") // Output directory for the generated Rust code within grpc module
.compile(
&["proto/gap_filler.proto"], // Paths to the .proto files
&["proto"], // Include paths for proto file dependencies
)?;
Ok(())
}
Loading
Loading