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

Add migration deployment retrieval #807

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/deployments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,18 @@ import SignMessageLib141 from './assets/v1.4.1/sign_message_lib.json';

const _SIGN_MESSAGE_LIB_DEPLOYMENTS = [SignMessageLib141, SignMessageLib130] as SingletonDeploymentJSON[];

import SafeMigration141 from './assets/v1.4.1/safe_migration.json';

const _SAFE_MIGRATION_DEPLOYMENTS = [SafeMigration141] as SingletonDeploymentJSON[];

import SafeToL2Migration141 from './assets/v1.4.1/safe_to_l2_migration.json';

const _SAFE_TO_L2_MIGRATION_DEPLOYMENTS = [SafeToL2Migration141] as SingletonDeploymentJSON[];

import SafeToL2Setup141 from './assets/v1.4.1/safe_to_l2_setup.json';

const _SAFE_TO_L2_SETUP_DEPLOYMENTS = [SafeToL2Setup141] as SingletonDeploymentJSON[];

export {
_ACCESSOR_DEPLOYMENTS,
_FACTORY_DEPLOYMENTS,
Expand All @@ -87,4 +99,7 @@ export {
_MULTI_SEND_CALL_ONLY_DEPLOYMENTS,
_CREATE_CALL_DEPLOYMENTS,
_SIGN_MESSAGE_LIB_DEPLOYMENTS,
_SAFE_MIGRATION_DEPLOYMENTS,
_SAFE_TO_L2_MIGRATION_DEPLOYMENTS,
_SAFE_TO_L2_SETUP_DEPLOYMENTS,
};
57 changes: 57 additions & 0 deletions src/libs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import {
_MULTI_SEND_CALL_ONLY_DEPLOYMENTS,
_MULTI_SEND_DEPLOYMENTS,
_SIGN_MESSAGE_LIB_DEPLOYMENTS,
_SAFE_MIGRATION_DEPLOYMENTS,
_SAFE_TO_L2_MIGRATION_DEPLOYMENTS,
_SAFE_TO_L2_SETUP_DEPLOYMENTS,
} from './deployments';
import { DeploymentFilter, DeploymentFormats, SingletonDeployment, SingletonDeploymentV2 } from './types';
import { findDeployment } from './utils';
Expand Down Expand Up @@ -78,3 +81,57 @@ export const getSignMessageLibDeployment = (filter?: DeploymentFilter): Singleto
export const getSignMessageLibDeployments = (filter?: DeploymentFilter): SingletonDeploymentV2 | undefined => {
return findDeployment(filter, _SIGN_MESSAGE_LIB_DEPLOYMENTS, DeploymentFormats.MULTIPLE);
};

/**
* Get the SafeMigration deployment based on the provided filter.
* @param {DeploymentFilter} [filter] - The filter criteria for the deployment.
* @returns {SingletonDeployment | undefined} - The matched deployment or undefined if not found.
*/
export const getSafeMigrationDeployment = (filter?: DeploymentFilter): SingletonDeployment | undefined => {
return findDeployment(filter, _SAFE_MIGRATION_DEPLOYMENTS);
};

/**
* Get all SafeMigration deployments based on the provided filter.
* @param {DeploymentFilter} [filter] - The filter criteria for the deployments.
* @returns {SingletonDeploymentV2 | undefined} - The matched deployments or undefined if not found.
*/
export const getSafeMigrationDeployments = (filter?: DeploymentFilter): SingletonDeploymentV2 | undefined => {
return findDeployment(filter, _SAFE_MIGRATION_DEPLOYMENTS, DeploymentFormats.MULTIPLE);
};

/**
* Get the SafeToL2Migration deployment based on the provided filter.
* @param {DeploymentFilter} [filter] - The filter criteria for the deployment.
* @returns {SingletonDeployment | undefined} - The matched deployment or undefined if not found.
*/
export const getSafeToL2MigrationDeployment = (filter?: DeploymentFilter): SingletonDeployment | undefined => {
return findDeployment(filter, _SAFE_TO_L2_MIGRATION_DEPLOYMENTS);
};

/**
* Get all SafeToL2Migration deployments based on the provided filter.
* @param {DeploymentFilter} [filter] - The filter criteria for the deployments.
* @returns {SingletonDeploymentV2 | undefined} - The matched deployments or undefined if not found.
*/
export const getSafeToL2MigrationDeployments = (filter?: DeploymentFilter): SingletonDeploymentV2 | undefined => {
return findDeployment(filter, _SAFE_TO_L2_MIGRATION_DEPLOYMENTS, DeploymentFormats.MULTIPLE);
};

/**
* Get the SafeToL2Setup deployment based on the provided filter.
* @param {DeploymentFilter} [filter] - The filter criteria for the deployment.
* @returns {SingletonDeployment | undefined} - The matched deployment or undefined if not found.
*/
export const getSafeToL2SetupDeployment = (filter?: DeploymentFilter): SingletonDeployment | undefined => {
return findDeployment(filter, _SAFE_TO_L2_SETUP_DEPLOYMENTS);
};

/**
* Get all SafeToL2Setup deployments based on the provided filter.
* @param {DeploymentFilter} [filter] - The filter criteria for the deployments.
* @returns {SingletonDeploymentV2 | undefined} - The matched deployments or undefined if not found.
*/
export const getSafeToL2SetupDeployments = (filter?: DeploymentFilter): SingletonDeploymentV2 | undefined => {
return findDeployment(filter, _SAFE_TO_L2_SETUP_DEPLOYMENTS, DeploymentFormats.MULTIPLE);
};