feat: add linea chain support

This commit is contained in:
c4605
2024-10-22 17:03:03 +02:00
parent bb5a8b08eb
commit aec596e1cb
5 changed files with 30 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ import {
bsc,
bscTestnet,
coreDao,
linea,
mainnet,
manta,
merlin,
@@ -137,6 +138,12 @@ export const defaultEvmClients: Record<EVMChain, Client> = {
batch: { multicall: true },
}),
[EVMChain.Linea]: createClient({
chain: linea,
transport: http(),
batch: { multicall: true },
}),
[EVMChain.BeraTestnet]: createClient({
chain: berachainTestnet,
transport: http(),

View File

@@ -94,6 +94,12 @@ export const evmContractAddresses: Record<EVMChain, EVMOnChainAddresses> = {
[EVMEndpointContract.BridgeConfig]:
"0xf99f62475F50BE59393dbdc148E6627E4E88Fc24",
},
[EVMChain.Linea]: {
// https://t.me/c/1599543687/61611
// https://t.me/c/1599543687/61734
[EVMEndpointContract.BridgeConfig]:
"0xf99f62475F50BE59393dbdc148E6627E4E88Fc24",
},
// testnet
[EVMChain.Sepolia]: {

View File

@@ -274,6 +274,7 @@ export async function fromCorrespondingStacksCurrency(
case EVMChain.BisonTestnet:
case EVMChain.BitboyTestnet:
case EVMChain.Manta:
case EVMChain.Linea:
case EVMChain.BeraTestnet:
return EVMToken.sUSDT
default:
@@ -317,6 +318,7 @@ export async function fromCorrespondingStacksCurrency(
case EVMChain.BisonTestnet:
case EVMChain.BitboyTestnet:
case EVMChain.Manta:
case EVMChain.Linea:
case EVMChain.BeraTestnet:
return EVMToken.aBTC
default:
@@ -350,6 +352,7 @@ export async function fromCorrespondingStacksCurrency(
case EVMChain.BitboyTestnet:
case EVMChain.Manta:
case EVMChain.BeraTestnet:
case EVMChain.Linea:
return EVMToken.wuBTC
default:
checkNever(toChain)

View File

@@ -50,6 +50,8 @@ export function contractAssignedChainIdFromKnownChain(
return 13n
case KnownChainId.EVM.Manta:
return 14n
case KnownChainId.EVM.Linea:
return 15n
default:
checkNever(chain)
throw new UnsupportedChainError(chain)
@@ -144,6 +146,11 @@ export function contractAssignedChainIdToKnownChain(
}
assertExclude(resPossibilities, KnownChainId.EVM.Manta)
if (chainId === 15n) {
return [KnownChainId.EVM.Linea]
}
assertExclude(resPossibilities, KnownChainId.EVM.Linea)
checkNever(resPossibilities)
throw new UnsupportedContractAssignedChainIdError(chainId)
}

View File

@@ -203,6 +203,12 @@ export namespace KnownChainId {
/** Represents the Manta testnet chain ID. */
// export const MantaTestnet = chainId("evm-manta-testnet")
// Linea
/** Represents the Linea mainnet chain ID. */
export const Linea = chainId("evm-linea")
/** Represents the Linea testnet chain ID. */
// export const LineaTestnet = chainId("evm-linea-testnet")
// Bera
/** Represents the Bera mainnet chain ID. */
// export const Bera = chainId("evm-bera")
@@ -259,6 +265,7 @@ export const _allKnownEVMMainnetChains = [
KnownChainId.EVM.Arbitrum,
KnownChainId.EVM.Aurora,
KnownChainId.EVM.Manta,
KnownChainId.EVM.Linea,
] as const
export const _allKnownEVMTestnetChains = [
KnownChainId.EVM.Sepolia,