From 8bf73562a276473fb18aa431b9cefa130a0c30af Mon Sep 17 00:00:00 2001 From: Dan Oved Date: Tue, 14 Nov 2023 17:11:30 -0800 Subject: [PATCH] Updated prettier formatting in all packages, and formatted code (#360) fixed prettier checks in all projects. formatted incorrectly formatted code --- packages/protocol-deployments/package.json | 1 + packages/protocol-rewards/.prettierignore | 1 + packages/protocol-rewards/package.json | 2 +- packages/protocol-sdk/package.json | 4 +- packages/protocol-sdk/src/anvil.ts | 4 +- .../src/apis/generated/discover-api-types.ts | 60 ++++++++++++++++--- .../src/apis/generated/premint-api-types.ts | 16 ++++- .../src/premint/premint-client.ts | 2 +- .../src/premint/preminter.test.ts | 9 ++- turbo.json | 2 +- 10 files changed, 82 insertions(+), 19 deletions(-) create mode 100644 packages/protocol-rewards/.prettierignore diff --git a/packages/protocol-deployments/package.json b/packages/protocol-deployments/package.json index d88e1783a..9ac454047 100644 --- a/packages/protocol-deployments/package.json +++ b/packages/protocol-deployments/package.json @@ -12,6 +12,7 @@ "build": "yarn wagmi && yarn bundle-configs && tsup", "bundle-configs": "node script/bundle-chainConfigs.mjs && yarn prettier", "prettier": "prettier --write 'package/**/*.ts' 'script/**/*.ts' 'wagmi.config.ts'", + "lint": "prettier --check 'package/**/*.ts' 'script/**/*.ts' 'wagmi.config.ts'", "update-new-deployment-addresses": "node script/copy-deployed-contracts.mjs deploy", "wagmi": "wagmi generate", "unlink-protocol-rewards": "rm -rf ./node_modules/@zoralabs/protocol-rewards && cp -r ../protocol-rewards ./node_modules/@zoralabs/protocol-rewards", diff --git a/packages/protocol-rewards/.prettierignore b/packages/protocol-rewards/.prettierignore new file mode 100644 index 000000000..fda9d7fcc --- /dev/null +++ b/packages/protocol-rewards/.prettierignore @@ -0,0 +1 @@ +src/lib \ No newline at end of file diff --git a/packages/protocol-rewards/package.json b/packages/protocol-rewards/package.json index 176088da9..6dd9f306f 100644 --- a/packages/protocol-rewards/package.json +++ b/packages/protocol-rewards/package.json @@ -14,7 +14,7 @@ "build:contracts": "forge build", "prettier:check": "prettier --check 'src/**/*.sol' 'test/**/*.sol' 'script/**/*.sol'", "prettier": "prettier --write 'src/**/*.sol' 'test/**/*.sol' 'script/**/*.sol'", - "lint": "yarn run prettier" + "lint": "prettier --check 'src/**/*.sol' 'test/**/*.sol' 'script/**/*.sol'" }, "dependencies": { "ds-test": "https://github.com/dapphub/ds-test#cd98eff28324bfac652e63a239a60632a761790b", diff --git a/packages/protocol-sdk/package.json b/packages/protocol-sdk/package.json index 341fa5181..770ed375d 100644 --- a/packages/protocol-sdk/package.json +++ b/packages/protocol-sdk/package.json @@ -10,7 +10,9 @@ "build": "tsup", "prepack": "yarn build", "test:js": "vitest src", - "generate-types": "npx openapi-typescript https://api.zora.co/premint/openapi.json -o src/generated/premint-api-types.ts && npx openapi-typescript https://api.zora.co/discover/openapi.json -o src/generated/discover-api-types.ts" + "generate-types": "npx openapi-typescript https://api.zora.co/premint/openapi.json -o src/generated/premint-api-types.ts && npx openapi-typescript https://api.zora.co/discover/openapi.json -o src/generated/discover-api-types.ts", + "prettier": "prettier --write 'src/**/*.ts'", + "lint": "prettier --check 'src/**/*.ts'" }, "dependencies": { "@zoralabs/protocol-deployments": "*", diff --git a/packages/protocol-sdk/src/anvil.ts b/packages/protocol-sdk/src/anvil.ts index 60e1d8bff..ef65f513e 100644 --- a/packages/protocol-sdk/src/anvil.ts +++ b/packages/protocol-sdk/src/anvil.ts @@ -29,8 +29,8 @@ async function waitForAnvilInit(anvil: any) { } export const anvilTest = test.extend({ - viemClients: async ({task}, use) => { - console.log('setting up clients for ', task.name); + viemClients: async ({ task }, use) => { + console.log("setting up clients for ", task.name); const port = Math.floor(Math.random() * 2000) + 4000; const anvil = spawn( "anvil", diff --git a/packages/protocol-sdk/src/apis/generated/discover-api-types.ts b/packages/protocol-sdk/src/apis/generated/discover-api-types.ts index 23ed51ec8..ee2a76262 100644 --- a/packages/protocol-sdk/src/apis/generated/discover-api-types.ts +++ b/packages/protocol-sdk/src/apis/generated/discover-api-types.ts @@ -3,7 +3,6 @@ * Do not make direct changes to the file. */ - export interface paths { "/": { /** Root */ @@ -148,7 +147,19 @@ export interface components { * @description An enumeration. * @enum {string} */ - ChainName: "ETHEREUM-MAINNET" | "ETHEREUM-ROPSTEN" | "ETHEREUM-RINKEBY" | "ETHEREUM-GOERLI" | "ETHEREUM-SEPOLIA" | "OPTIMISM-MAINNET" | "OPTIMISM-GOERLI" | "ZORA-GOERLI" | "ZORA-MAINNET" | "BASE-MAINNET" | "BASE-GOERLI" | "PGN-MAINNET"; + ChainName: + | "ETHEREUM-MAINNET" + | "ETHEREUM-ROPSTEN" + | "ETHEREUM-RINKEBY" + | "ETHEREUM-GOERLI" + | "ETHEREUM-SEPOLIA" + | "OPTIMISM-MAINNET" + | "OPTIMISM-GOERLI" + | "ZORA-GOERLI" + | "ZORA-MAINNET" + | "BASE-MAINNET" + | "BASE-GOERLI" + | "PGN-MAINNET"; /** Collection */ Collection: { /** Address */ @@ -395,7 +406,12 @@ export interface components { * @description An enumeration. * @enum {string} */ - FeedType: "curated" | "most_recent" | "heuristic" | "trending" | "recommendations"; + FeedType: + | "curated" + | "most_recent" + | "heuristic" + | "trending" + | "recommendations"; /** * FixedPrice * @description ObjectBase extends Pydantic's BaseModel class to support extra functionality @@ -691,7 +707,13 @@ export interface components { /** Token Name */ token_name?: string; /** Mint Context */ - mint_context?: components["schemas"]["ManifoldMintContext"] | components["schemas"]["ZoraCreateMintContext"] | components["schemas"]["FoundationMintContext"] | components["schemas"]["ZoraCreate1155MintContext"] | components["schemas"]["ZoraCreatePremintContext"] | components["schemas"]["InferredMintContext"]; + mint_context?: + | components["schemas"]["ManifoldMintContext"] + | components["schemas"]["ZoraCreateMintContext"] + | components["schemas"]["FoundationMintContext"] + | components["schemas"]["ZoraCreate1155MintContext"] + | components["schemas"]["ZoraCreatePremintContext"] + | components["schemas"]["InferredMintContext"]; /** Is Active */ is_active: boolean; cost: components["schemas"]["zora__collect__feed__models__price_at_time__PriceAtTime"]; @@ -729,13 +751,30 @@ export interface components { * @description An enumeration. * @enum {string} */ - MintableStatus: "ACTIVE" | "BLOCKED" | "EXPIRED" | "INVALID_MEDIA" | "MINTED_OUT" | "DELETED"; + MintableStatus: + | "ACTIVE" + | "BLOCKED" + | "EXPIRED" + | "INVALID_MEDIA" + | "MINTED_OUT" + | "DELETED"; /** * MintableType * @description An enumeration. * @enum {string} */ - MintableType: "FOUNDATION_DROP_COLLECTION" | "FOUNDATION_TIMED_EDITION" | "MANIFOLD_ERC1155" | "MANIFOLD_ERC721" | "ZORA_CREATE" | "ZORA_CREATE_1155" | "ZORA_CREATE_1155_B2R_REDEEM_TOKEN" | "ZORA_CREATE_1155_PREMINT_TOKEN" | "ZORA_EDITION" | "ZORA_DROP" | "INFERRED"; + MintableType: + | "FOUNDATION_DROP_COLLECTION" + | "FOUNDATION_TIMED_EDITION" + | "MANIFOLD_ERC1155" + | "MANIFOLD_ERC721" + | "ZORA_CREATE" + | "ZORA_CREATE_1155" + | "ZORA_CREATE_1155_B2R_REDEEM_TOKEN" + | "ZORA_CREATE_1155_PREMINT_TOKEN" + | "ZORA_EDITION" + | "ZORA_DROP" + | "INFERRED"; /** * Network * @description An enumeration. @@ -743,7 +782,9 @@ export interface components { */ Network: "MAINNET" | "GOERLI"; /** Notification */ - Notification: components["schemas"]["MintNotification"] | components["schemas"]["MintCommentNotification"]; + Notification: + | components["schemas"]["MintNotification"] + | components["schemas"]["MintCommentNotification"]; /** * NotificationsResponse * @description This is a generic model for pagination in an infitite scrolling context. @@ -911,7 +952,9 @@ export interface components { description?: string; entity_type: components["schemas"]["EntityType"]; /** Entity */ - entity: components["schemas"]["SearchCollection"] | components["schemas"]["SearchToken"]; + entity: + | components["schemas"]["SearchCollection"] + | components["schemas"]["SearchToken"]; media?: components["schemas"]["Media"]; /** * Rank @@ -1377,7 +1420,6 @@ export type $defs = Record; export type external = Record; export interface operations { - /** Root */ root__get: { responses: { diff --git a/packages/protocol-sdk/src/apis/generated/premint-api-types.ts b/packages/protocol-sdk/src/apis/generated/premint-api-types.ts index f6ef83fa5..034a32df6 100644 --- a/packages/protocol-sdk/src/apis/generated/premint-api-types.ts +++ b/packages/protocol-sdk/src/apis/generated/premint-api-types.ts @@ -3,7 +3,6 @@ * Do not make direct changes to the file. */ - export interface paths { "/signature": { /** Upsert Premint Signature */ @@ -36,7 +35,19 @@ export interface components { * @description An enumeration. * @enum {string} */ - ChainName: "ETHEREUM-MAINNET" | "ETHEREUM-ROPSTEN" | "ETHEREUM-RINKEBY" | "ETHEREUM-GOERLI" | "ETHEREUM-SEPOLIA" | "OPTIMISM-MAINNET" | "OPTIMISM-GOERLI" | "ZORA-GOERLI" | "ZORA-MAINNET" | "BASE-MAINNET" | "BASE-GOERLI" | "PGN-MAINNET"; + ChainName: + | "ETHEREUM-MAINNET" + | "ETHEREUM-ROPSTEN" + | "ETHEREUM-RINKEBY" + | "ETHEREUM-GOERLI" + | "ETHEREUM-SEPOLIA" + | "OPTIMISM-MAINNET" + | "OPTIMISM-GOERLI" + | "ZORA-GOERLI" + | "ZORA-MAINNET" + | "BASE-MAINNET" + | "BASE-GOERLI" + | "PGN-MAINNET"; /** * CollectionCreationConfig * @description ObjectBase extends Pydantic's BaseModel class to support extra functionality @@ -244,7 +255,6 @@ export type $defs = Record; export type external = Record; export interface operations { - /** Upsert Premint Signature */ upsert_premint_signature_signature_post: { requestBody: { diff --git a/packages/protocol-sdk/src/premint/premint-client.ts b/packages/protocol-sdk/src/premint/premint-client.ts index a56065173..790e58a9e 100644 --- a/packages/protocol-sdk/src/premint/premint-client.ts +++ b/packages/protocol-sdk/src/premint/premint-client.ts @@ -570,7 +570,7 @@ class PremintClient extends ClientBase { quantityToMint: number; mintComment?: string; }; - }): Promise<{request: SimulateContractParameters}> { + }): Promise<{ request: SimulateContractParameters }> { if (mintArguments && mintArguments?.quantityToMint < 1) { throw new Error("Quantity to mint cannot be below 1"); } diff --git a/packages/protocol-sdk/src/premint/preminter.test.ts b/packages/protocol-sdk/src/premint/preminter.test.ts index 574bcae6a..fb760b312 100644 --- a/packages/protocol-sdk/src/premint/preminter.test.ts +++ b/packages/protocol-sdk/src/premint/preminter.test.ts @@ -1,4 +1,11 @@ -import { keccak256, Hex, concat, recoverAddress, hashDomain, Address } from "viem"; +import { + keccak256, + Hex, + concat, + recoverAddress, + hashDomain, + Address, +} from "viem"; import { foundry } from "viem/chains"; import { describe, expect } from "vitest"; import { parseEther } from "viem"; diff --git a/turbo.json b/turbo.json index fb0a342f2..842610fd3 100644 --- a/turbo.json +++ b/turbo.json @@ -21,7 +21,7 @@ "test:fork": { "dependsOn": ["^test:fork"] }, - "format": { + "prettier": { "dependsOn": ["^prettier"] }, "storage-inspect:check": {