Remove FS dep from sdk (#2896)

pull/2901/head
Yorke Rhodes 1 year ago committed by GitHub
parent 4c49f6179a
commit 09550c3789
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      typescript/sdk/package.json
  2. 42
      typescript/sdk/src/ism/HyperlaneIsmFactory.ts
  3. 8
      yarn.lock

@ -29,7 +29,6 @@
"dotenv": "^10.0.0",
"eslint": "^8.43.0",
"ethereum-waffle": "^3.4.4",
"fs": "0.0.1-security",
"hardhat": "^2.16.1",
"mocha": "^9.2.2",
"prettier": "^2.4.1",

@ -1,7 +1,5 @@
import { debug } from 'debug';
import { ethers } from 'ethers';
import fs from 'fs';
import path from 'path';
import {
DomainRoutingIsm__factory,
@ -18,7 +16,6 @@ import {
import { Address, eqAddress, formatMessage, warn } from '@hyperlane-xyz/utils';
import { HyperlaneApp } from '../app/HyperlaneApp';
import { chainMetadata } from '../consts/chainMetadata';
import {
HyperlaneEnvironment,
hyperlaneEnvironments,
@ -226,20 +223,11 @@ export class HyperlaneIsmFactory extends HyperlaneApp<FactoryFactories> {
}
private async deployOpStackIsm(chain: ChainName, config: OpStackIsmConfig) {
const recoveredIsm = getDeployedIsms(config.origin, chain, config.type);
if (recoveredIsm) {
this.logger('Recovered OpStackIsm from deployedIsms');
return OPStackIsm__factory.connect(
recoveredIsm,
this.multiProvider.getSignerOrProvider(chain),
);
} else {
return await this.multiProvider.handleDeploy(
chain,
new OPStackIsm__factory(),
[config.nativeBridge],
);
}
return await this.multiProvider.handleDeploy(
chain,
new OPStackIsm__factory(),
[config.nativeBridge],
);
}
async deployStaticAddressSet(
@ -570,23 +558,3 @@ export function collectValidators(
return new Set(validators);
}
// recover non-factory ISM deployments
export function getDeployedIsms(
origin: ChainName,
destination: ChainName,
ismType: string,
): Address | null {
// check if mainnet or testnet
const isTestnet =
chainMetadata[origin].isTestnet || chainMetadata[destination].isTestnet;
const file = isTestnet ? 'testnet.json' : 'mainnet.json';
const addresses = fs.readFileSync(
path.resolve(__dirname, `../consts/environments/${file}`),
);
const parsedAddresses = JSON.parse(addresses.toString());
if (ismType in parsedAddresses[destination][origin]) {
return parsedAddresses[destination][origin].opStackIsm;
}
return null;
}

@ -4242,7 +4242,6 @@ __metadata:
eslint: ^8.43.0
ethereum-waffle: ^3.4.4
ethers: ^5.7.2
fs: 0.0.1-security
hardhat: ^2.16.1
mocha: ^9.2.2
prettier: ^2.4.1
@ -11359,13 +11358,6 @@ __metadata:
languageName: node
linkType: hard
"fs@npm:0.0.1-security":
version: 0.0.1-security
resolution: "fs@npm:0.0.1-security"
checksum: 53c6230e1faae9fa32c1df82c16a84b51b1243d20f3da2b64bd110bb472b73b9185169b703e008356e3cdc92d155088b617d9d39a63b5227a30b3621baad7f5d
languageName: node
linkType: hard
"fsevents@npm:~2.1.1":
version: 2.1.3
resolution: "fsevents@npm:2.1.3"

Loading…
Cancel
Save