Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Improvement] Return an array of addresses within SingletonDeploymentV2 #808

Open
schmanu opened this issue Sep 25, 2024 · 0 comments
Open

Comments

@schmanu
Copy link
Member

schmanu commented Sep 25, 2024

What is this request about?

The new networkAddresses Record within the SingletonDeploymentV2 type contains either a string or string[].
This makes handling it sub-optimal as both cases either need to be handled in separate branches or a helper function that converts string | string[] into string[] is required.

The proposition is to change the type to:

export interface SingletonDeploymentV2 {
  released: boolean;
  contractName: string;
  version: string;
  deployments: AtLeastOne<Record<AddressType, { address: string; codeHash: string }>>;
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
  abi: any[];
  networkAddresses: Record<string, string[]>;
}

Example usage

There are already some usage examples out there which currently all wrote such functions / have not nicely readable code to check deployments.

Helper functions:

https://github.com/safe-global/safe-wallet-web/blob/epic/multichain-safes/src/services/contracts/deployments.ts#L18

https://github.com/safe-global/safe-client-gateway/blob/multiple-official-deployments/src/domain/common/utils/deployments.ts#L89

Case handling:

https://github.com/safe-global/safe-core-sdk/blob/feat/predict-safe-address-custom-contracts/packages/protocol-kit/src/contracts/config.ts#L171

@schmanu schmanu changed the title [Improvement]Return an array of addresses within SingletonDeploymentV2 [Improvement] Return an array of addresses within SingletonDeploymentV2 Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant