Skip to content

Commit

Permalink
feat: add tokenId to marketplace pallet events broadcasted over SNS (#…
Browse files Browse the repository at this point in the history
…1301)

* add tokenId to marketplace pallet events broadcasted over SNS

* add tokenId to marketplace pallet events broadcasted over SNS

* add tokenId to marketplace pallet events broadcasted over SNS

* fix counter removed

---------

Co-authored-by: Raman Shekhawat <ramanshekhawat75@gmail.com>
  • Loading branch information
pawell67 and justraman authored Sep 23, 2024
1 parent 422396d commit fa3451a
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/mappings/marketplace/events/auction_finalized.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export async function auctionFinalized(
amount: listing.amount.toString(),
price: listing.price.toString(),
data: listing.data.toJSON(),
tokenId: listing.makeAssetId.id,
},
winningBid: data.winningBid
? {
Expand Down
1 change: 1 addition & 0 deletions src/mappings/marketplace/events/bid_placed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ export async function bidPlaced(
amount: listing.amount.toString(),
price: listing.price.toString(),
data: listing.data.toJSON(),
tokenId: listing.makeAssetId.id,
},
lastBid: lastBid
? {
Expand Down
1 change: 1 addition & 0 deletions src/mappings/marketplace/events/counter_offer_answered.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export async function counterOfferAnswered(
account: account.id,
listing: listing.id,
extrinsic: item.extrinsic.id,
tokenId: listing.takeAssetId.id,
},
})
}
Expand Down
1 change: 1 addition & 0 deletions src/mappings/marketplace/events/counter_offer_placed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export async function counterOfferPlaced(
account: account.id,
listing: listing.id,
extrinsic: item.extrinsic.id,
tokenId: listing.takeAssetId.id,
},
})
}
Expand Down
9 changes: 5 additions & 4 deletions src/mappings/marketplace/events/counter_offer_removed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ function getEvent(
id: item.id,
name: MarketplaceCounterOfferRemoved.name,
extrinsic: item.extrinsic?.id ? new Extrinsic({ id: item.extrinsic.id }) : null,
collectionId: listing.makeAssetId.collection.id,
tokenId: listing.makeAssetId.id,
collectionId: listing.takeAssetId.collection.id,
tokenId: listing.takeAssetId.id,
data: new MarketplaceCounterOfferRemoved({
listing: listing.id,
creator: data.creator,
Expand All @@ -45,7 +45,7 @@ function getEvent(
event,
new AccountTokenEvent({
id: item.id,
token: new Token({ id: listing.makeAssetId.id }),
token: new Token({ id: listing.takeAssetId.id }),
from: account,
event,
}),
Expand All @@ -64,7 +64,7 @@ export async function counterOfferRemoved(
const listing = await ctx.store.findOneOrFail<Listing>(Listing, {
where: { id: listingId },
relations: {
makeAssetId: {
takeAssetId: {
collection: true,
bestListing: true,
},
Expand All @@ -90,6 +90,7 @@ export async function counterOfferRemoved(
account: account.id,
listing: listing.id,
extrinsic: item.extrinsic.id,
tokenId: listing.takeAssetId.id,
},
})
}
Expand Down
1 change: 1 addition & 0 deletions src/mappings/marketplace/events/listing_cancelled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export async function listingCancelled(
},
data: listing.data.toJSON(),
state: listing.state.toJSON(),
tokenId: listing.makeAssetId.id,
},
extrinsic: item.extrinsic.id,
},
Expand Down
3 changes: 3 additions & 0 deletions src/mappings/marketplace/events/listing_created.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ export async function listingCreated(
},
data: listing.data.toJSON(),
state: listing.state.toJSON(),
type: listing.type.toString(),
makeAssetId: makeAssetId.id,
takeAssetId: takeAssetId.id,
},
extrinsic: item.extrinsic.id,
},
Expand Down
1 change: 1 addition & 0 deletions src/mappings/marketplace/events/listing_filled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ export async function listingFilled(
},
data: listing.data.toJSON(),
state: listing.state.toJSON(),
tokenId: listing.makeAssetId.id,
},
buyer: { id: data.buyer },
amountFilled: data.amountFilled,
Expand Down

0 comments on commit fa3451a

Please sign in to comment.