Skip to content

Commit

Permalink
Do not delete existing creators in mint_v1
Browse files Browse the repository at this point in the history
  • Loading branch information
danenbm committed Dec 4, 2023
1 parent 2500687 commit fe1d522
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
13 changes: 8 additions & 5 deletions nft_ingester/src/program_transformers/bubblegum/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -599,17 +599,20 @@ pub async fn upsert_creators<T>(
creators: &Vec<Creator>,
slot_updated: i64,
seq: i64,
delete_existing: bool,
) -> Result<(), IngesterError>
where
T: ConnectionTrait + TransactionTrait,
{
let multi_txn = txn.begin().await?;
if creators_should_be_updated(&multi_txn, id.clone(), seq).await? {
// Delete any existing creators.
asset_creators::Entity::delete_many()
.filter(Condition::all().add(asset_creators::Column::AssetId.eq(id.clone())))
.exec(&multi_txn)
.await?;
if delete_existing {
// Delete any existing creators.
asset_creators::Entity::delete_many()
.filter(Condition::all().add(asset_creators::Column::AssetId.eq(id.clone())))
.exec(&multi_txn)
.await?;
}

if !creators.is_empty() {
// Vec to hold base creator information.
Expand Down
1 change: 1 addition & 0 deletions nft_ingester/src/program_transformers/bubblegum/mint_v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ where
&metadata.creators,
slot_i,
seq as i64,
false,
)
.await?;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ where
} else {
&current_metadata.creators
};
upsert_creators(txn, id_bytes.to_vec(), creators, slot_i, seq as i64).await?;
upsert_creators(txn, id_bytes.to_vec(), creators, slot_i, seq as i64, true).await?;

if uri.is_empty() {
warn!(
Expand Down

0 comments on commit fe1d522

Please sign in to comment.