packages/sdk-router/src/constants/addresses.ts
import {
CCTP_SUPPORTED_CHAIN_IDS,
RFQ_SUPPORTED_CHAIN_IDS,
SUPPORTED_CHAIN_IDS,
SupportedChainId,
} from './chainIds'
export type AddressMap = {
[chainId: number]: string
}
/**
* Generates an address map for a given address and list of chain ids.
* Will use the same address for all chain ids unless an exception map is provided.
* In which case, the exception map will be used to override the address for the
* specified chain ids.
*
* @param chainIds list of chain ids
* @param address address to use for all chain ids unless overridden by exception map
* @param exceptionMap optional map of chain ids to addresses to override the address param
* @returns
*/
const generateAddressMap = (
chainIds: number[],
address: string,
exceptionMap?: AddressMap
): AddressMap => {
return Object.fromEntries(
chainIds.map((chainId) => [chainId, exceptionMap?.[chainId] ?? address])
)
}
/**
* SynapseRouter contract address for all chains except ones from ROUTER_EXCEPTION_MAP.
*/
const ROUTER_ADDRESS = '0x7E7A0e201FD38d3ADAA9523Da6C109a07118C96a'
const ROUTER_EXCEPTION_MAP: AddressMap = {
[SupportedChainId.BLAST]: '0x0000000000365b1d5B142732CF4d33BcddED21Fc',
}
export const ROUTER_ADDRESS_MAP: AddressMap = generateAddressMap(
SUPPORTED_CHAIN_IDS,
ROUTER_ADDRESS,
ROUTER_EXCEPTION_MAP
)
/**
* SynapseCCTP contract address for all chains except ones from CCTP_ROUTER_EXCEPTION_MAP.
*/
const CCTP_ROUTER_ADDRESS = '0xd5a597d6e7ddf373a92C8f477DAAA673b0902F48'
const CCTP_ROUTER_EXCEPTION_MAP: AddressMap = {}
export const CCTP_ROUTER_ADDRESS_MAP: AddressMap = generateAddressMap(
CCTP_SUPPORTED_CHAIN_IDS,
CCTP_ROUTER_ADDRESS,
CCTP_ROUTER_EXCEPTION_MAP
)
/**
* FastBridgeRouter contract address for all chains except ones from FAST_BRIDGE_ROUTER_EXCEPTION_MAP.
*/
const FAST_BRIDGE_ROUTER_ADDRESS = '0x00cD000000003f7F682BE4813200893d4e690000'
const FAST_BRIDGE_ROUTER_EXCEPTION_MAP: AddressMap = {}
export const FAST_BRIDGE_ROUTER_ADDRESS_MAP: AddressMap = generateAddressMap(
RFQ_SUPPORTED_CHAIN_IDS,
FAST_BRIDGE_ROUTER_ADDRESS,
FAST_BRIDGE_ROUTER_EXCEPTION_MAP
)