Skip to content

Commit

Permalink
Use types
Browse files Browse the repository at this point in the history
  • Loading branch information
yagopv committed Sep 24, 2024
1 parent fc42f97 commit b2f5f36
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions packages/protocol-kit/src/contracts/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ type SafeDeploymentsVersions = Record<SafeVersion, contractNames>

export type contractName = keyof contractNames

export type ContractInfo = {
version: string
type: DeploymentType
contractName: contractName
}

export const safeDeploymentsVersions: SafeDeploymentsVersions = {
'1.4.1': {
safeSingletonVersion: '1.4.1',
Expand Down Expand Up @@ -147,12 +153,6 @@ export function getContractDeployment(
return deployment
}

export type ContractInfo = {
version: string
type: DeploymentType
contractName: contractName
}

export function getContractInfo(contractAddress: string): ContractInfo | undefined {
for (const [safeVersion, contracts] of Object.entries(safeDeploymentsVersions)) {
for (const [contractName, contractVersion] of Object.entries(contracts)) {
Expand All @@ -168,11 +168,7 @@ export function getContractInfo(contractAddress: string): ContractInfo | undefin
if (deployment && deployment.networkAddresses) {
for (const [, address] of Object.entries(deployment.networkAddresses)) {
if (address.toLowerCase() === contractAddress.toLowerCase()) {
const types = Object.keys(deployment.deployments) as (
| 'canonical'
| 'eip155'
| 'zksync'
)[]
const types = Object.keys(deployment.deployments) as DeploymentType[]

const type = types.find(
(t) =>
Expand Down

0 comments on commit b2f5f36

Please sign in to comment.