Skip to content

Commit

Permalink
old chainid by name
Browse files Browse the repository at this point in the history
  • Loading branch information
estebanmino committed Sep 4, 2024
1 parent 8fc2ab8 commit a54c025
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/state/appSessions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,21 @@ import { Address } from 'viem';

import { Network, ChainId } from '@/networks/types';
import { createRainbowStore } from '../internal/createRainbowStore';
import { chainsIdByName } from '@/networks/chains';

const chainsIdByNetwork: Record<Network, ChainId> = {
[Network.mainnet]: ChainId.mainnet,
[Network.polygon]: ChainId.polygon,
[Network.avalanche]: ChainId.avalanche,
[Network.bsc]: ChainId.bsc,
[Network.arbitrum]: ChainId.arbitrum,
[Network.optimism]: ChainId.optimism,
[Network.zora]: ChainId.zora,
[Network.base]: ChainId.base,
[Network.degen]: ChainId.degen,
[Network.gnosis]: ChainId.gnosis,
[Network.blast]: ChainId.blast,
[Network.goerli]: ChainId.goerli,
};

export interface AppSessionV0 {
activeSessionAddress: Address;
Expand Down Expand Up @@ -176,7 +190,7 @@ export const useAppSessionsStore = createRainbowStore<AppSessionsStore<AppSessio
(acc, addr) => {
const address = addr as Address;
const network = sessions[address];
acc[address] = chainsIdByName[network];
acc[address] = chainsIdByNetwork[network];
return acc as Record<Address, ChainId>;
},
{} as Record<Address, ChainId>
Expand Down

0 comments on commit a54c025

Please sign in to comment.