Skip to Content
Packages@tuwaio/orbit-coreFunctionsformatConnectorChainId()

formatConnectorChainId()

formatConnectorChainId(chainId, connectedAdapter): string | number

Defined in: utils/formatConnectorChainId.ts:17 

Formats a chain ID for use in connector identifiers. String chain IDs (e.g. Solana cluster names) are prefixed with the adapter key; numeric EVM chain IDs are kept as is.

Parameters

chainId

string | number

Numeric EVM chain ID or string chain identifier.

connectedAdapter

OrbitAdapter

Adapter of the connected wallet.

Returns

string | number

"<adapter>:<chainId>" for string chain IDs, otherwise the numeric chain ID unchanged.

Example

formatConnectorChainId('devnet', OrbitAdapter.SOLANA); // "solana:devnet" formatConnectorChainId(1, OrbitAdapter.EVM); // 1
Last updated on