diff --git a/typescript/.changeset/pink-mirrors-sneeze.md b/typescript/.changeset/pink-mirrors-sneeze.md new file mode 100644 index 000000000..207dab4e5 --- /dev/null +++ b/typescript/.changeset/pink-mirrors-sneeze.md @@ -0,0 +1,5 @@ +--- +'@hyperlane-xyz/sdk': major +--- + +Refactor testIgpConfig function for clarity and maintainability diff --git a/typescript/sdk/src/test/testUtils.ts b/typescript/sdk/src/test/testUtils.ts index fc498469a..5613d6be6 100644 --- a/typescript/sdk/src/test/testUtils.ts +++ b/typescript/sdk/src/test/testUtils.ts @@ -63,25 +63,30 @@ const TEST_ORACLE_CONFIG = { tokenExchangeRate: ethers.utils.parseUnits('1', 10), }; +const TEST_OVERHEAD_COST = 60000; + export function testIgpConfig( chains: ChainName[], owner = nonZeroAddress, ): ChainMap { return Object.fromEntries( - chains.map((local) => [ - local, - { - owner, - oracleKey: owner, - beneficiary: owner, - // TODO: these should be one map - overhead: Object.fromEntries( - exclude(local, chains).map((remote) => [remote, 60000]), - ), - oracleConfig: Object.fromEntries( - exclude(local, chains).map((remote) => [remote, TEST_ORACLE_CONFIG]), - ), - }, - ]), + chains.map((local) => { + const overhead: IgpConfig['overhead'] = {}; + const oracleConfig: IgpConfig['oracleConfig'] = {}; + exclude(local, chains).map((remote: ChainName) => { + overhead[remote] = TEST_OVERHEAD_COST; + oracleConfig[remote] = TEST_ORACLE_CONFIG; + }); + return [ + local, + { + owner, + oracleKey: owner, + beneficiary: owner, + overhead, + oracleConfig, + }, + ]; + }), ); }