Skip to content

Commit

Permalink
fix(secret): send converted id for storing signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
muhammadusmanuet committed Dec 16, 2024
1 parent 5cc3e55 commit 3fd528f
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/handler/lock-listener/lock-listener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import type {
} from "../types";
import {
convertNumbToHexToString,
convertStringToHexToNumb,
fetchHttpOrIpfs,
retry,
useMutexAndRelease,
Expand Down Expand Up @@ -69,9 +70,18 @@ export async function listenEvents(
return;
}

let convertedTokenId = ev.tokenId;
if (ev.sourceChain === "SECRET") {
if (chain.chainIdent === "SECRET") {
convertedTokenId = convertStringToHexToNumb(ev.tokenId);
} else if (ev.destinationChain === "SECRET") {
convertedTokenId = convertNumbToHexToString(ev.tokenId);
}
}

const nftDetails = await sourceChain.nftData(
ev.sourceChain === "SECRET" && ev.destinationChain === "SECRET"
? convertNumbToHexToString(ev.tokenId)
? convertedTokenId
: ev.tokenId,
ev.sourceNftContractAddress,
log,
Expand Down Expand Up @@ -138,7 +148,7 @@ export async function listenEvents(
sourceNftContractAddress: ev.sourceNftContractAddress,
symbol: nftDetails.symbol,
tokenAmount: ev.tokenAmount,
tokenId: ev.tokenId,
tokenId: convertedTokenId,
transactionHash: ev.transactionHash,
lockTxChain: chain.chainIdent,
imgUri: imgUri?.substring(imgUri?.indexOf("https://")) || "",
Expand Down Expand Up @@ -207,7 +217,9 @@ export async function listenEvents(
return await useMutexAndRelease(fetchStorage, async (storage) => {
const feeData = await storageProvider.getFeeData();
log.info(
`Using nonce: ${nonce}, txHash: ${inft.transactionHash} ${new Date().getSeconds()} ${+new Date()}`,
`Using nonce: ${nonce}, txHash: ${
inft.transactionHash
} ${new Date().getSeconds()} ${+new Date()}`,
);
const response = await (
await storage.approveLockNft(
Expand All @@ -224,7 +236,9 @@ export async function listenEvents(
).wait();
used();
log.info(
`Used nonce: ${nonce}, txHash: ${inft.transactionHash} ${new Date().getSeconds()} ${+new Date()}`,
`Used nonce: ${nonce}, txHash: ${
inft.transactionHash
} ${new Date().getSeconds()} ${+new Date()}`,
);
await setTimeout(5 * 1000);
return response;
Expand Down

0 comments on commit 3fd528f

Please sign in to comment.