@stable-io/cctp-sdk-cctpr-evm
Version:
EVM support for the CCTPR corridor of the CCTP SDK
37 lines • 1.91 kB
JavaScript
// Copyright (c) 2025 Stable Technologies Inc
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
import { enumItem } from "binary-layout";
import { zip, range } from "@stable-io/map-utils";
import { amountItem, domainItem, GenericGasToken, EvmGasToken, Usdc, domainsOf, } from "@stable-io/cctp-sdk-definitions";
import { supportedDomains } from "@stable-io/cctp-sdk-cctpr-definitions";
export const gasDropoffItem = amountItem(4, GenericGasToken, "µGasToken");
export const usdcItem = amountItem(8, Usdc);
export const evmGasTokenItem = amountItem(16, EvmGasToken);
export const evmDomainItem = {
...domainItem(domainsOf("Evm")), size: 1,
};
//we only use a single byte for domains because Circle is using incremental domain ids anyway
export const supportedDomainItem = (network) => ({
...domainItem(supportedDomains(network)), size: 1, //TODO
});
export const timestampItem = {
binary: "uint", size: 4, custom: {
to: (value) => new Date(value * 1000),
from: (value) => Math.floor(value.getTime() / 1000),
},
};
export const corridors = ["v1", "v2Direct", "avaxHop"];
export const corridorItem = enumItem(zip([corridors, range(corridors.length)]));
export const bakedInDomains = [
"Ethereum", "Avalanche", "Optimism", "Arbitrum", "Noble", "Base",
"Solana", "Polygon", "Sui", "Aptos", "Unichain", "Linea",
];
export const extraDomains = (network) => ["Codex", "Sonic", "Worldchain"]; //TODO implement filter method to instead filter out baked in domains
export const domainChainIdPairLayout = (network) => [
{ name: "domain", ...domainItem(extraDomains(network)) },
{ name: "chainId", binary: "uint", size: 2 },
];
export const feeAdjustmentTypes = [...corridors, "gasDropoff"];
//# sourceMappingURL=common.js.map