Chains
Actions
setChains
: Action to set the entire chains state, including chain details, contract ABIs, and other related settings.
Hooks
Custom hooks for accessing various pieces of chain-related information from the state:
useCollateralAddress
: Fetches collateral addresses.useCollateralSymbol
: Fetches collateral symbols.useCollateralDecimal
: Fetches collateral decimals.useDiamondAddress
: Fetches diamond contract addresses.useMultiAccountAddress
: Fetches multi-account addresses.useTpSlWalletAddress
: Fetches TP/SL wallet addresses.useTpSlAvailable
: Checks if TP/SL is available.useAllMultiAccountAddresses
: Fetches all multi-account addresses.useSignatureStoreAddress
: Fetches signature store addresses.usePartyBWhitelistAddress
: Fetches Party B whitelist addresses.useMultiCallAddress
: Fetches multicall contract addresses.useUSDCAddress
: Fetches USDC addresses.useV3Ids
: Fetches V3 chain IDs.useFallbackChainId
: Fetches fallback chain ID.useHedgerAddress
: Fetches hedger addresses.useAppName
: Fetches the application name.useOrderHistorySubgraphAddress
: Fetches order history subgraph addresses.useAnalyticsSubgraphAddress
: Fetches analytics subgraph addresses.useFundingRateSubgraphAddress
: Fetches funding rate subgraph addresses.useMuonData
: Fetches Muon data.useWagmiConfig
: Fetches WAGMI configuration.useSetSdkConfig
: Dispatches the setChains action to update the chains state.
Utility Functions
compatibleWithLegacyStructure
: Filters and restructures chains data based on chain IDs and a parameter name.getValuesByName
: Retrieves specific values from an input object based on a name.
Reducer
Defines the ChainsState and handles actions to update the state:
State Structure: Includes information about chains, V3 chain IDs, fallback chain ID, contract ABIs, hedgers, application name, and Muon data.
Reducer Logic: Responds to
setChains
action to update the state with provided chains information.
Reducer Details
Chains Information: Stores details for each chain, including addresses for collateral, diamond contract, multicall contract, etc.
V3 Chain IDs: An array of V3 chain IDs.
Fallback Chain ID: The default chain ID to use if no other chain is selected or available.
Contract ABIs: Storage for contract ABIs used across the application.
Hedgers: Information about hedger contracts across chains.
Application Name and Muon Data: Stores the application name and Muon-specific data like URLs.
Last updated