Skip to content

Commit

Permalink
feat(icp): fix locking transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
imsk17 committed Aug 24, 2024
1 parent 774c4ed commit bca5b9a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
10 changes: 5 additions & 5 deletions src/handler/icp/utils/listenForLockEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type { _SERVICE } from "../../../contractsTypes/icp/bridge/bridge.types";
import { Block } from "../../../persistence/entities/block";
import type { LockEventIter, LogInstance } from "../../types";

const CHAIN_IDENT = "SECRET";
const CHAIN_IDENT = "ICP";

export default async function listenForLockEvents(
builder: EventBuilder,
Expand All @@ -24,16 +24,16 @@ export default async function listenForLockEvents(
const latestBlockNumber = Number(latestBlockNumberResponse);

if (latestBlockNumber <= lastBlock) {
logger.trace(`0 TXs after nonce ${lastBlock}. Awaiting 10s`);
logger.info(`0 TXs since Last Nonce: ${lastBlock}. Awaiting 10s`);
await setTimeout(10000);
continue;
}
const newTxNonce = lastBlock + 1;
const [hash] = await bc.get_hash_from_nonce(BigInt(newTxNonce));
logger.info(`Found ${latestBlockNumber - lastBlock} new TXs`);
const [hash] = await bc.get_hash_from_nonce(BigInt(lastBlock));
if (!hash) continue;
const [log] = await bc.get_locked_data(hash);
if (!log) continue;
lastBlock = newTxNonce;
lastBlock = lastBlock + 1;
const {
destination_chain,
destination_user_address,
Expand Down
10 changes: 4 additions & 6 deletions src/handler/icp/utils/nftData.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { Actor, type HttpAgent } from "@dfinity/agent";
import {
type _SERVICE,
idlFactory,
} from "../../../contractsTypes/icp/nft/nft.types";
import { idlFactory } from "../../../contractsTypes/icp/nft/nft";
import type { _SERVICE } from "../../../contractsTypes/icp/nft/nft.types";
import type { LogInstance } from "../../types";

export default async function nftData(
Expand Down Expand Up @@ -36,8 +34,8 @@ export default async function nftData(

return {
metadata,
name,
name: name === "" ? "TICP" : name,
royalty: 0n,
symbol,
symbol: symbol === "" ? "TICP" : symbol,
};
}

0 comments on commit bca5b9a

Please sign in to comment.