Utilities
Module: chain
Table of contents
Chain Functions
Chain Functions
toEnvironmentName
▸ toEnvironmentName(chainNameOrId
): SpaceportChainType
Helper function to safely convert a chain name from utils/chain to a valid environment name
Parameters
Name | Type |
---|---|
chainNameOrId | string | number |
Returns
getChainId
▸ getChainId(chain
): number
Get the numeric chain ID from a SpaceportChainType name
Parameters
Name | Type | Description |
---|---|---|
chain | number | SpaceportChainType | Chain name |
Returns
number
Chain ID as a number
getChainName
▸ getChainName(chainId
): string
Get the chain name from a chain ID
Parameters
Name | Type | Description |
---|---|---|
chainId | number | Chain ID |
Returns
string
Chain name
createChainConfig
▸ createChainConfig(chainName
): Object
Create a chain configuration for the given environment
Parameters
Name | Type | Description |
---|---|---|
chainName | SpaceportChainType | Chain name |
Returns
Object
Chain configuration
Name | Type |
---|---|
id | number |
name | string |
network | string |
nativeCurrency | { name : string ; symbol : string ; decimals : number } |
nativeCurrency.name | string |
nativeCurrency.symbol | string |
nativeCurrency.decimals | number |
rpcUrls | { default : { http : string [] } } |
rpcUrls.default | { http : string [] } |
rpcUrls.default.http | string [] |