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

add timestamps to marketplace listing related events #923

Merged
merged 3 commits into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 indexer/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ type CreateListingWasmEvent @entity {
numberOfCredits: BigInt!
pricePerCreditAmount: BigInt!
pricePerCreditDenom: String!
timestamp: Date!
}

type UpdateListingWasmEvent @entity {
Expand All @@ -106,12 +107,14 @@ type UpdateListingWasmEvent @entity {
numberOfCredits: BigInt!
pricePerCreditAmount: BigInt!
pricePerCreditDenom: String!
timestamp: Date!
}

type CancelListingWasmEvent @entity {
id: ID!
listingOwner: String!
denom: String!
timestamp: Date!
}

type BuyCreditsWasmEvent @entity {
Expand Down
3 changes: 3 additions & 0 deletions indexer/src/mappings/mappingHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export async function handleCreateListing(event: CosmosEvent): Promise<void> {
numberOfCredits: numberOfCredits,
pricePerCreditAmount: pricePerCreditAmount,
pricePerCreditDenom: pricePerCreditDenom,
timestamp: new Date(event.block.header.time.toISOString()),
});
await createListingWasmEvent.save();
const marketplaceListing = MarketplaceListing.create({
Expand Down Expand Up @@ -64,6 +65,7 @@ export async function handleUpdateListing(event: CosmosEvent): Promise<void> {
numberOfCredits: numberOfCredits,
pricePerCreditAmount: pricePerCreditAmount,
pricePerCreditDenom: pricePerCreditDenom,
timestamp: new Date(event.block.header.time.toISOString()),
});
await updateListingWasmEvent.save();

Expand All @@ -84,6 +86,7 @@ export async function handleCancelListing(event: CosmosEvent): Promise<void> {
id: `${event.tx.hash}-${event.msg.idx}-${event.idx}`,
listingOwner: listingOwner,
denom: denom,
timestamp: new Date(event.block.header.time.toISOString()),
});
await cancelListingWasmEvent.save();

Expand Down