mirror of
https://github.com/Brotocol-xyz/bro-sdk.git
synced 2026-01-12 14:54:21 +08:00
feat: add linea chain support
This commit is contained in:
@@ -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(),
|
||||
|
||||
@@ -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]: {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user