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 5, 2024
1 parent 7b09d6b commit 55c8f6d
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 55c8f6d

Please sign in to comment.