Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

base is domain 6 #3471

Merged
merged 2 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions sdk/js/src/relayer/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,13 @@ export const getWormscanAPI = (_network: Network) => {
}
};

export const CCTP_DOMAIN_TO_NAME = [
"ethereum",
"avalanche",
"optimism",
"arbitrum",
"base",
];
export const getNameFromCCTPDomain = (
domain: number
): ChainName | undefined => {
if (domain === 0) return "ethereum";
else if (domain === 1) return "avalanche";
else if (domain === 2) return "optimism";
else if (domain === 3) return "arbitrum";
else if (domain === 6) return "base";
else return undefined;
};
8 changes: 4 additions & 4 deletions sdk/js/src/relayer/relayer/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
getWormholeRelayerAddress,
getCircleAPI,
getWormscanAPI,
CCTP_DOMAIN_TO_NAME,
getNameFromCCTPDomain,
} from "../consts";
import {
parseWormholeRelayerPayloadType,
Expand Down Expand Up @@ -82,9 +82,9 @@ export function printChain(chainId: number) {
}

export function printCCTPDomain(domain: number) {
if (domain >= CCTP_DOMAIN_TO_NAME.length)
if (getNameFromCCTPDomain(domain) === undefined)
throw Error(`Invalid cctp domain: ${domain}`);
return `${CCTP_DOMAIN_TO_NAME[domain]} (Domain ${domain})`;
return `${getNameFromCCTPDomain(domain)} (Domain ${domain})`;
}

export const estimatedAttestationTimeInSeconds = (
Expand Down Expand Up @@ -536,7 +536,7 @@ export async function getCCTPMessageLogURL(
);
const MessageSentTopic = ethers.utils.keccak256("MessageSent(bytes)");
try {
if (CCTP_DOMAIN_TO_NAME[cctpKey.domain] === sourceChain) {
if (getNameFromCCTPDomain(cctpKey.domain) === sourceChain) {
const cctpLogFilter = (log: ethers.providers.Log) => {
return (
log.topics[0] === DepositForBurnTopic &&
Expand Down
Loading