Skip to content

Commit

Permalink
add buildMultisigIsmConfigs to sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
aroralanuk committed Nov 15, 2023
1 parent cc6d869 commit 8f6bd86
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions typescript/sdk/src/ism/multisig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { objFilter, objMap } from '@hyperlane-xyz/utils';

import { ChainMap, ChainName } from '../types';

import { MultisigConfig, MultisigIsmConfig } from './types';

// build multisigIsmConfig from multisigConfig
// eg. for { sepolia (local), arbitrumsepolia, scrollsepolia }
// arbitrumsepolia => Ism, scrollsepolia => Ism
export const buildMultisigIsmConfigs = (
type: MultisigIsmConfig['type'],
local: ChainName,
chains: ChainName[],
multisigConfigs: ChainMap<MultisigConfig>,
): ChainMap<MultisigIsmConfig> => {
return objMap(
objFilter(
multisigConfigs,
(chain, config): config is MultisigConfig =>
chain !== local && chains.includes(chain),
),
(_, config) => ({
...config,
type,
}),
);
};

0 comments on commit 8f6bd86

Please sign in to comment.