Skip to content

Commit

Permalink
Merge pull request #26 from XP-NETWORK/test
Browse files Browse the repository at this point in the history
Test
  • Loading branch information
D4mph1r authored Dec 17, 2024
2 parents a260e6a + e89fde6 commit 4efd42c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
20 changes: 17 additions & 3 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const bridgeTestChains = [
rpcURL: "https://testnet.hashio.io/api",
nativeCoinSymbol: "HBAR",
intialFund: "50000000000000000",
contractAddress: "0xf33e51DccC7727F1ac62782de7811712420841a0",
contractAddress: "0x0C687Dc235f8e461441d69Dc6aD123EAe7401744",
chainType: "evm",
lastBlock: 6959861,
decimals: 18,
Expand All @@ -62,7 +62,7 @@ export const bridgeTestChains = [
blockChunks: 1000,
chainType: "scrt",
chainId: "secret-4",
contractAddress: "secret1zyd2j3wqkeagcuzhklewfa6u26epn672cuktnm",
contractAddress: "secret1ym9jslryg6r8nlch2036py92gd50vejznwhuvx",
decimals: 6,
intialFund: "10000000",
lastBlock: 16833475,
Expand All @@ -73,7 +73,7 @@ export const bridgeTestChains = [
blockChunks: 1000,
chain: "TEZOS",
chainType: "tezos",
contractAddress: "KT1Fh6VH8BxA9xgJCn8hGZRxoo2vY3hrbqeV",
contractAddress: "KT1CFXpeB7RPAvzgGAVBkKZ5fXsAB61h72rs",
decimals: 9,
intialFund: "100000000",
lastBlock: 7259145,
Expand Down Expand Up @@ -163,6 +163,20 @@ export const bridgeTestChains = [
decimals: 18,
blockChunks: 1000,
},
{
chain: "TERRA",
chainType: "cosmwasm",
blockChunks: 1000,
chainId: "pisco-1",
contractAddress:
"terra1sryye399v0wrq5aap0s9jlqn9s6wm34gmd27pnlmceghd9qsgyqsugalra",
decimals: 6,
intialFund: "1000000",
lastBlock: 14343708,
nativeCoinSymbol: "LUNA",
rpcURL: "https://rpc.testcosmos.directory/terra2testnet",
walletPrefix: "terra",
},
] as const satisfies TChain[];

export const storageTestnetConfig: IEvmChainConfig = {
Expand Down
21 changes: 16 additions & 5 deletions src/handler/lock-listener/lock-listener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ import type {
THandler,
TNftTransferDetailsObject,
} from "../types";
import { fetchHttpOrIpfs, retry, useMutexAndRelease } from "../utils";
import {
convertNumbToHexToString,
fetchHttpOrIpfs,
retry,
useMutexAndRelease,
} from "../utils";
import { unreachable } from "../utils/unreachable";
import { processEventsFailSafe } from "./process-fail-safe";

Expand Down Expand Up @@ -65,7 +70,9 @@ export async function listenEvents(
}

const nftDetails = await sourceChain.nftData(
ev.tokenId,
ev.sourceChain === "SECRET"
? convertNumbToHexToString(ev.tokenId)
: ev.tokenId,
ev.sourceNftContractAddress,
log,
);
Expand All @@ -90,7 +97,7 @@ export async function listenEvents(
// ? ev.metaDataUri
// : nftDetails.metadata || ev.metaDataUri;

if (ev.sourceChain === "CASPER") {
if (ev.sourceChain === "CASPER" || ev.sourceChain === "SECRET") {
metadataUri = ev.metaDataUri;
} else {
metadataUri = nftDetails.metadata || ev.metaDataUri;
Expand Down Expand Up @@ -200,7 +207,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 @@ -217,7 +226,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
Empty file added validator.db-journal
Empty file.

0 comments on commit 4efd42c

Please sign in to comment.