Skip to content

Commit

Permalink
refactor(lib,api): rename getChain -> getChainConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
hbriese committed Aug 22, 2024
1 parent 2a53021 commit a81dee9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions api/src/feat/operations/operations.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Operation, OperationFunction } from './operations.model';
import { OperationsService } from './operations.service';
import { Shape } from '~/core/database';
import { asAddress, asHex } from 'lib';
import { getChain } from 'chains';
import { getChainConfig } from 'chains';

const functionDeps = {
to: true,
Expand All @@ -29,7 +29,7 @@ export class OperationsResolver {
value: deps.value ?? undefined,
data: asHex(deps.data),
},
getChain(deps['<unorderedOperations[is Transaction]']!.account.chain).key,
getChainConfig(deps['<unorderedOperations[is Transaction]']!.account.chain).key,
);
}
}
4 changes: 2 additions & 2 deletions contracts/config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Chain, getChain } from 'chains';
import { Chain, getChainConfig } from 'chains';
import localWallets from './local-wallets.json';
require('dotenv').config({ path: '../.env' });

const chain = getChain(process.env.CHAIN || ('zksync-local' satisfies Chain));
const chain = getChainConfig(process.env.CHAIN || ('zksync-local' satisfies Chain));

export const CONFIG = {
env: process.env.RELEASE_ENV === 'development' ? 'development' : 'production',
Expand Down
8 changes: 4 additions & 4 deletions packages/chains/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ export type NetworkWallet = viem_.WalletClient<viem_.Transport, ChainConfig, vie

export const CHAINS = {
zksync: {
...viemChain.zkSync,
...viemChain.zksync,
key: 'zksync', // EIP155 shortName
name: 'zkSync Era',
layer1: viemChain.mainnet,
verifyUrl: 'https://zksync2-mainnet-explorer.zksync.io/contract_verification',
testnet: false,
} as const,
'zksync-sepolia': {
...viemChain.zkSyncSepoliaTestnet,
...viemChain.zksyncSepoliaTestnet,
key: 'zksync-sepolia',
name: 'zkSync Sepolia',
layer1: viemChain.sepolia,
verifyUrl: 'https://explorer.sepolia.era.zksync.dev/contract_verification',
} as const,
'zksync-local': {
...viemChain.zkSyncSepoliaTestnet,
...viemChain.zksyncSepoliaTestnet,
key: 'zksync-local',
name: 'zkSync Local',
/* era-test-node - https://github.com/matter-labs/era-test-node */
Expand All @@ -44,7 +44,7 @@ export const CHAINS = {
} as const,
};

export function getChain(
export function getChainConfig(
key: Chain | string = 'zksync-local' satisfies Chain,
supportedChains: Partial<typeof CHAINS> = CHAINS,
) {
Expand Down

0 comments on commit a81dee9

Please sign in to comment.