From 56acae4586a113420bfd375efc2b8c655dba22d6 Mon Sep 17 00:00:00 2001 From: D Date: Wed, 18 Sep 2024 17:23:51 +0500 Subject: [PATCH] chore(tezos): sign tx hash instead of tx id --- .../tezos/utils/listenForLockEvents.ts | 9 +++++++- src/handler/tezos/utils/operations.ts | 22 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/handler/tezos/utils/listenForLockEvents.ts b/src/handler/tezos/utils/listenForLockEvents.ts index be24e4fd..91a99ef1 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 60f64609..b209681d 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); + } +}