Skip to content

Commit

Permalink
feat(mapping): add forget object handler
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikssonJoakim committed Aug 4, 2023
1 parent 07fabfc commit 6adeca7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
//Exports all handler functions
export * from "./mappings/handleStoreObject";
export * from "./mappings/handleForgetObject";
12 changes: 12 additions & 0 deletions src/mappings/handleForgetObject.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type { CosmosMessage } from "@subql/types-cosmos";
import type { MsgExecuteContract } from "cosmjs-types/cosmwasm/wasm/v1/tx";
import { ObjectariumObject } from "../types";
import { getObjectariumObjectId } from "../utils/utils";

export const handleForgetObject = async (
msg: CosmosMessage<MsgExecuteContract>
): Promise<void> => {
const objectId = getObjectariumObjectId(msg.tx.tx.events);

objectId && (await ObjectariumObject.remove(objectId));
};

0 comments on commit 6adeca7

Please sign in to comment.