Skip to content

Commit

Permalink
chore(tezos): sign tx hash instead of tx id
Browse files Browse the repository at this point in the history
  • Loading branch information
D4mph1r committed Sep 18, 2024
1 parent 77a084c commit 56acae4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/handler/tezos/utils/listenForLockEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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
Expand All @@ -76,7 +83,7 @@ export default async function listenForLockEvents(
tokenAmount,
nftType,
sourceChain,
log.transactionId.toString(),
lockedHash,
CHAIN_IDENT,
metaDataUri,
),
Expand Down
22 changes: 22 additions & 0 deletions src/handler/tezos/utils/operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit 56acae4

Please sign in to comment.