diff --git a/packages/protocol-deployments/script/copy-deployed-contracts.ts b/packages/protocol-deployments/script/copy-deployed-contracts.ts index 5b1b79e49..05443d98c 100644 --- a/packages/protocol-deployments/script/copy-deployed-contracts.ts +++ b/packages/protocol-deployments/script/copy-deployed-contracts.ts @@ -1,5 +1,6 @@ import { writeFile, readFile } from "fs/promises"; import esMain from "es-main"; +// @ts-ignore import { glob } from "glob"; type Deploy = { @@ -12,35 +13,40 @@ async function copyEnvironmentRunFiles() { const latestFiles = await glob(`broadcast/**/*run-latest.json`); const allFileContents = await Promise.all( - latestFiles.map(async (file) => { + latestFiles.map(async (file: string) => { const fileParts = file.split("/"); const chainId = fileParts[fileParts.length - 2]; return { chainId, contents: JSON.parse(await readFile(file, "utf-8")) as Deploy, }; - }) + }), ); - const groupedByChainId = allFileContents.reduce((acc, file) => { - const chainId = file.chainId!; - if (isNaN(Number(chainId))) return acc; + const groupedByChainId = allFileContents.reduce( + (acc: any, file: { chainId: string; contents: any }) => { + const chainId = file.chainId!; + if (isNaN(Number(chainId))) return acc; - if (!acc[chainId]) { - acc[chainId] = []; - } - acc[chainId]!.push(file.contents); - return acc; - }, {} as Record); + if (!acc[chainId]) { + acc[chainId] = []; + } + acc[chainId]!.push(file.contents); + return acc; + }, + {} as Record, + ); const withLatest = Object.entries(groupedByChainId).map( - ([chainId, files]) => { - const latest = files.sort((a, b) => b.timestamp! - a.timestamp!)[0]; + ([chainId, files]: any) => { + const latest = files.sort( + (a: any, b: any) => b.timestamp! - a.timestamp!, + )[0]; return { chainId, latest, }; - } + }, ); withLatest.forEach(async ({ chainId, latest }) => { @@ -55,8 +61,8 @@ async function copyEnvironmentRunFiles() { commit: latest!.commit, }, null, - 2 - ) + 2, + ), ); }); } diff --git a/packages/protocol-deployments/script/signDeploymentTransactions.ts b/packages/protocol-deployments/script/signDeploymentTransactions.ts index 4f0ea9ca6..fde6a6c60 100644 --- a/packages/protocol-deployments/script/signDeploymentTransactions.ts +++ b/packages/protocol-deployments/script/signDeploymentTransactions.ts @@ -2,6 +2,7 @@ import { createAccount } from "@turnkey/viem"; import { TurnkeyClient } from "@turnkey/http"; import { Address, encodeFunctionData, parseAbi, LocalAccount, Hex } from "viem"; import { ApiKeyStamper } from "@turnkey/api-key-stamper"; +// @ts-ignore import { glob } from "glob"; import * as path from "path"; import * as dotenv from "dotenv"; @@ -39,11 +40,11 @@ async function signAndSaveSignatures({ }) { const configFolder = path.resolve( __dirname, - `../deterministicConfig/${proxyName}/` + `../deterministicConfig/${proxyName}/`, ); const configFile = path.join(configFolder, "params.json"); const deterministicDeployConfig = JSON.parse( - await readFile(configFile, "utf-8") + await readFile(configFile, "utf-8"), ); const deploymentConfig: DeterministicDeploymentConfig = { @@ -66,19 +67,22 @@ async function signAndSaveSignatures({ deterministicDeploymentConfig: deploymentConfig, }), }; - }) + }), ); // aggregate above to object of key value pair indexed by chain id as number: - const byChainId = signedConfigs.reduce((acc, { chainId, signature }) => { - acc[chainId] = signature; - return acc; - }, {} as { [key: number]: string }); + const byChainId = signedConfigs.reduce( + (acc, { chainId, signature }) => { + acc[chainId] = signature; + return acc; + }, + {} as { [key: number]: string }, + ); // write as json to ../deterministicConfig/factoryDeploySignatures.json: await writeFile( path.join(configFolder, "signatures.json"), - JSON.stringify(byChainId, null, 2) + JSON.stringify(byChainId, null, 2), ); } @@ -96,11 +100,11 @@ async function signAndSaveUpgradeGate({ }) { const configFolder = path.resolve( __dirname, - `../deterministicConfig/${proxyName}/` + `../deterministicConfig/${proxyName}/`, ); const configFile = path.join(configFolder, "params.json"); const deterministicDeployConfig = JSON.parse( - await readFile(configFile, "utf-8") + await readFile(configFile, "utf-8"), ); const deploymentConfig: GenericDeploymentConfiguration = { @@ -135,25 +139,28 @@ async function signAndSaveUpgradeGate({ initCall, }), }; - }) + }), ); // aggregate above to object of key value pair indexed by chain id as number: - const byChainId = signedConfigs.reduce((acc, { chainId, signature }) => { - acc[chainId] = signature; - return acc; - }, {} as { [key: number]: string }); + const byChainId = signedConfigs.reduce( + (acc, { chainId, signature }) => { + acc[chainId] = signature; + return acc; + }, + {} as { [key: number]: string }, + ); // write as json to ../deterministicConfig/factoryDeploySignatures.json: await writeFile( path.join(configFolder, "signatures.json"), - JSON.stringify(byChainId, null, 2) + JSON.stringify(byChainId, null, 2), ); } const getChainConfigs = async () => { const chainConfigsFiles = await glob( - path.resolve(__dirname, "../chainConfigs/*.json") + path.resolve(__dirname, "../chainConfigs/*.json"), ); const chainConfigs = await Promise.all( @@ -167,7 +174,7 @@ const getChainConfigs = async () => { chainId, owner: fileContents["FACTORY_OWNER"]! as Address, }; - }) + }), ); return chainConfigs; @@ -175,7 +182,7 @@ const getChainConfigs = async () => { const getFactoryImplConfigs = async () => { const addresseFiles = await glob( - path.resolve(__dirname, "../addresses/*.json") + path.resolve(__dirname, "../addresses/*.json"), ); const chainConfigs = await Promise.all( @@ -195,7 +202,7 @@ const getFactoryImplConfigs = async () => { implementationAddress: fileContents["FACTORY_IMPL"] as Address, owner: chainConfig["FACTORY_OWNER"] as Address, }; - }) + }), ); return chainConfigs; @@ -203,7 +210,7 @@ const getFactoryImplConfigs = async () => { const getPreminterImplConfigs = async () => { const addresseFiles = await glob( - path.resolve(__dirname, "../addresses/*.json") + path.resolve(__dirname, "../addresses/*.json"), ); const chainConfigs = await Promise.all( @@ -223,7 +230,7 @@ const getPreminterImplConfigs = async () => { implementationAddress: fileContents["PREMINTER_IMPL"] as Address, owner: chainConfig["FACTORY_OWNER"] as Address, }; - }) + }), ); return chainConfigs.filter((x) => x.implementationAddress !== undefined); @@ -240,7 +247,7 @@ async function main() { new ApiKeyStamper({ apiPublicKey: process.env.TURNKEY_API_PUBLIC_KEY!, apiPrivateKey: process.env.TURNKEY_API_PRIVATE_KEY!, - }) + }), ); // Create the Viem custom account diff --git a/packages/protocol-deployments/wagmi.config.ts b/packages/protocol-deployments/wagmi.config.ts index c7c1b8b26..42e67a000 100644 --- a/packages/protocol-deployments/wagmi.config.ts +++ b/packages/protocol-deployments/wagmi.config.ts @@ -43,7 +43,7 @@ const getAddresses = () => { for (const addressesFile of addressesFiles) { const jsonAddress = JSON.parse( - readFileSync(`./addresses/${addressesFile}`, "utf-8") + readFileSync(`./addresses/${addressesFile}`, "utf-8"), ) as { FIXED_PRICE_SALE_STRATEGY: Address; MERKLE_MINT_SALE_STRATEGY: Address; diff --git a/yarn.lock b/yarn.lock index 50d95fc9a..ee3be841c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3237,16 +3237,16 @@ prettier-plugin-solidity@1.1.3: semver "^7.3.8" solidity-comments-extractor "^0.0.7" -prettier@2.8.8, prettier@^2.7.1, prettier@^2.8.1: - version "2.8.8" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" - integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== - prettier@3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.0.3.tgz#432a51f7ba422d1469096c0fdc28e235db8f9643" integrity sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg== +prettier@^2.7.1, prettier@^2.8.1: + version "2.8.8" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" + integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== + pretty-format@^29.5.0: version "29.7.0" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.7.0.tgz#ca42c758310f365bfa71a0bda0a807160b776812"