diff --git a/src/handler/tezos/utils/listenForLockEvents.ts b/src/handler/tezos/utils/listenForLockEvents.ts index be24e4f..91a99ef 100644 --- a/src/handler/tezos/utils/listenForLockEvents.ts +++ b/src/handler/tezos/utils/listenForLockEvents.ts @@ -5,6 +5,7 @@ import type { EventBuilder } from "../.."; import { Block } from "../../../persistence/entities/block"; import type { LockEventIter, LogInstance } from "../../types"; import { TezosGetContractOperations } from "./index"; +import { TezosGetTransaction } from "./operations"; const CHAIN_IDENT = "TEZOS"; @@ -58,6 +59,12 @@ export default async function listenForLockEvents( log.payload.source_nft_address, ); + const res = await TezosGetTransaction({ + transactionId: log.transactionId, + restApiURL: restApiUrl, + }); + const lockedHash = res[0].hash; + const { token_id: tokenId, // Unique ID for the NFT transfer dest_chain: destinationChain, // Chain to where the NFT is being transferred @@ -76,7 +83,7 @@ export default async function listenForLockEvents( tokenAmount, nftType, sourceChain, - log.transactionId.toString(), + lockedHash, CHAIN_IDENT, metaDataUri, ), diff --git a/src/handler/tezos/utils/operations.ts b/src/handler/tezos/utils/operations.ts index 60f6460..b209681 100644 --- a/src/handler/tezos/utils/operations.ts +++ b/src/handler/tezos/utils/operations.ts @@ -27,3 +27,25 @@ export default async function TezosGetContractOperations({ console.error(error); } } + +export async function TezosGetTransaction({ + transactionId, + restApiURL, +}: { + transactionId: number; + restApiURL: string; +}) { + try { + const URL = `${restApiURL}/v1/operations/transactions`; + const params = { + id: transactionId, + }; + const response = await axios.get(URL, { + params, + }); + + return response.data; + } catch (error) { + console.error(error); + } +}