-
Notifications
You must be signed in to change notification settings - Fork 49
Add MIP-11 Support to DAS Indexer #268
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
be82120
5420abb
0f721e3
eb69912
889014d
cb378a6
bc38abd
299e9e7
70a268f
04fcfc4
7310f57
a2a3e13
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| .env |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,8 +26,7 @@ use { | |
| entity::{ActiveValue, ColumnTrait, EntityTrait}, | ||
| prelude::*, | ||
| query::{JsonValue, QueryFilter, QuerySelect, QueryTrait}, | ||
| sea_query::query::OnConflict, | ||
| sea_query::Expr, | ||
| sea_query::{query::OnConflict, Expr}, | ||
| ConnectionTrait, CursorTrait, DbBackend, FromQueryResult, TransactionTrait, | ||
| }, | ||
| serde_json::{value::Value, Map}, | ||
|
|
@@ -367,6 +366,62 @@ pub async fn save_v1_asset<T: ConnectionTrait + TransactionTrait>( | |
| // asset_grouping table | ||
| //----------------------- | ||
|
|
||
| let last_group_slot_updated = asset_grouping::Entity::find() | ||
| .filter( | ||
| asset_grouping::Column::AssetId | ||
| .eq(id_vec.clone()) | ||
| .and(asset_grouping::Column::GroupKey.eq("group".to_string())), | ||
| ) | ||
| .one(&txn) | ||
| .await | ||
| .map_err(|db_err| ProgramTransformerError::AssetIndexError(db_err.to_string()))? | ||
| .map(|model| model.slot_updated.unwrap_or(0)); | ||
|
|
||
| let last_group_slot_updated = last_group_slot_updated.unwrap_or(0); | ||
|
|
||
| // Only perform updates if the last asset_grouping for group plugin slot_updated is less than the current slot for the asset update. | ||
| if last_group_slot_updated < slot_i { | ||
|
||
| // Clear existing groupings for asset under the "group" key. | ||
| let query = asset_grouping::Entity::delete_many() | ||
| .filter( | ||
| asset_grouping::Column::AssetId | ||
| .eq(id_vec.clone()) | ||
| .and(asset_grouping::Column::GroupKey.eq("group".to_string())) | ||
| .and(asset_grouping::Column::SlotUpdated.lt(slot_i)), | ||
| ) | ||
| .build(DbBackend::Postgres); | ||
|
|
||
| txn.execute(query) | ||
| .await | ||
| .map_err(|db_err| ProgramTransformerError::AssetIndexError(db_err.to_string()))?; | ||
|
||
|
|
||
| // Insert new groupings for asset under the "group" key. | ||
| if let Some(groups_plugin) = asset.plugins.get(&PluginType::Groups) { | ||
| if let Plugin::Groups(groups) = &groups_plugin.data { | ||
| // Skip empty groups plugin. | ||
| if !groups.groups.is_empty() { | ||
| let query = | ||
| asset_grouping::Entity::insert_many(groups.groups.iter().map(|group| { | ||
| asset_grouping::ActiveModel { | ||
| asset_id: ActiveValue::Set(id_vec.clone()), | ||
| group_key: ActiveValue::Set("group".to_string()), | ||
| group_value: ActiveValue::Set(Some(group.to_string())), | ||
| verified: ActiveValue::Set(true), | ||
| group_info_seq: ActiveValue::Set(Some(0)), | ||
| slot_updated: ActiveValue::Set(Some(slot_i)), | ||
| ..Default::default() | ||
| } | ||
| })) | ||
| .build(DbBackend::Postgres); | ||
|
|
||
| txn.execute(query).await.map_err(|db_err| { | ||
| ProgramTransformerError::AssetIndexError(db_err.to_string()) | ||
| })?; | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if let UpdateAuthority::Collection(address) = asset.update_authority { | ||
| let model = asset_grouping::ActiveModel { | ||
| asset_id: ActiveValue::Set(id_vec.clone()), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Verify alpha version stability and consider version constraint.
Using an exact-pinned alpha version (
=0.10.1-alpha.2) in the dependency may cause issues:=constraint prevents any updates, even patch fixes. Consider using~for patch-level flexibility once a stable version is available.Verify the stability of this alpha version and check if a stable release is available:
🌐 Web query:
💡 Result:
The latest stable mpl-core crate version is 0.10.1 (checked Sep 30, 2025). [1][2]
Sources:
[1] docs.rs — mpl-core 0.10.1.
[2] lib.rs — mpl-core (shows version 0.10.1 in Cargo features).
Update mpl-core to the stable 0.10.1 release and loosen the version constraint.
Replace the exact alpha pin (
=0.10.1-alpha.2) with a caret requirement (^0.10.1) to use the latest stable release and receive future patch fixes.🤖 Prompt for AI Agents