From 71dfef989469a9113d0d8c5b99b575b37bf67892 Mon Sep 17 00:00:00 2001 From: Dan Oved Date: Mon, 27 Nov 2023 08:56:01 -0800 Subject: [PATCH] fix prettier formatting --- packages/protocol-sdk/src/anvil.ts | 2 +- .../protocol-sdk/src/apis/http-api-base.ts | 6 +++--- .../src/create/1155-create-helper.test.ts | 17 ++++++++--------- .../src/create/1155-create-helper.ts | 10 +++++----- .../protocol-sdk/src/mint/mint-api-client.ts | 4 ++-- .../protocol-sdk/src/mint/mint-client.test.ts | 4 ++-- packages/protocol-sdk/src/mint/mint-client.ts | 8 ++++---- .../src/premint/premint-api-client.ts | 16 ++++++++-------- .../src/premint/premint-client.test.ts | 11 +++++------ .../protocol-sdk/src/premint/premint-client.ts | 6 +++--- .../protocol-sdk/src/premint/preminter.test.ts | 18 +++++++++--------- packages/protocol-sdk/src/premint/preminter.ts | 2 +- 12 files changed, 51 insertions(+), 53 deletions(-) diff --git a/packages/protocol-sdk/src/anvil.ts b/packages/protocol-sdk/src/anvil.ts index 49160dbb0..78a78ca7c 100644 --- a/packages/protocol-sdk/src/anvil.ts +++ b/packages/protocol-sdk/src/anvil.ts @@ -56,7 +56,7 @@ export const makeAnvilTest = ({ { cwd: join(__dirname, ".."), killSignal: "SIGINT", - } + }, ); const anvilHost = `http://0.0.0.0:${port}`; await waitForAnvilInit(anvil); diff --git a/packages/protocol-sdk/src/apis/http-api-base.ts b/packages/protocol-sdk/src/apis/http-api-base.ts index 3e9e50639..bb2df588d 100644 --- a/packages/protocol-sdk/src/apis/http-api-base.ts +++ b/packages/protocol-sdk/src/apis/http-api-base.ts @@ -33,7 +33,7 @@ export const get = async (url: string) => { throw new BadResponseError( `Invalid response, status ${response.status}`, response.status, - json + json, ); } return (await response.json()) as T; @@ -65,7 +65,7 @@ export const post = async (url: string, data: any) => { throw new BadResponseError( `Bad response: ${response.status}`, response.status, - json + json, ); } return (await response.json()) as T; @@ -75,7 +75,7 @@ export const retries = async ( tryFn: () => T, maxTries: number = 3, atTry: number = 1, - linearBackoffMS: number = 200 + linearBackoffMS: number = 200, ): Promise => { try { return await tryFn(); diff --git a/packages/protocol-sdk/src/create/1155-create-helper.test.ts b/packages/protocol-sdk/src/create/1155-create-helper.test.ts index 874aa68f9..a8ae366e1 100644 --- a/packages/protocol-sdk/src/create/1155-create-helper.test.ts +++ b/packages/protocol-sdk/src/create/1155-create-helper.test.ts @@ -39,7 +39,7 @@ describe("create-helper", () => { expect(receipt.to).to.equal("0x777777c338d93e2c7adf08d102d45ca7cc4ed021"); expect(getTokenIdFromCreateReceipt(receipt)).to.be.equal(1n); }, - 20 * 1000 + 20 * 1000, ); anvilTest( "creates a new contract, than creates a new token on this existing contract", @@ -62,12 +62,11 @@ describe("create-helper", () => { mintToCreatorCount: 1, }); expect(contractAddress).to.be.equal( - "0xb1A8928dF830C21eD682949Aa8A83C1C215194d3" + "0xb1A8928dF830C21eD682949Aa8A83C1C215194d3", ); expect(contractExists).to.be.false; - const { request: simulateResponse } = await publicClient.simulateContract( - request - ); + const { request: simulateResponse } = + await publicClient.simulateContract(request); const hash = await walletClient.writeContract(simulateResponse); const receipt = await publicClient.waitForTransactionReceipt({ hash }); const firstTokenId = getTokenIdFromCreateReceipt(receipt); @@ -83,14 +82,14 @@ describe("create-helper", () => { tokenMetadataURI: demoTokenMetadataURI, account: creatorAccount, mintToCreatorCount: 1, - } + }, ); expect(newTokenOnExistingContract.contractAddress).to.be.equal( - "0xb1A8928dF830C21eD682949Aa8A83C1C215194d3" + "0xb1A8928dF830C21eD682949Aa8A83C1C215194d3", ); expect(newTokenOnExistingContract.contractExists).to.be.true; const { request: simulateRequest } = await publicClient.simulateContract( - newTokenOnExistingContract.request + newTokenOnExistingContract.request, ); const newHash = await walletClient.writeContract(simulateRequest); const newReceipt = await publicClient.waitForTransactionReceipt({ @@ -100,6 +99,6 @@ describe("create-helper", () => { expect(tokenId).to.be.equal(2n); expect(newReceipt).not.toBeNull(); }, - 20 * 1000 + 20 * 1000, ); }); diff --git a/packages/protocol-sdk/src/create/1155-create-helper.ts b/packages/protocol-sdk/src/create/1155-create-helper.ts index 7c0f20008..84f9b276d 100644 --- a/packages/protocol-sdk/src/create/1155-create-helper.ts +++ b/packages/protocol-sdk/src/create/1155-create-helper.ts @@ -143,7 +143,7 @@ export function create1155TokenSetupArgs({ abi: zoraCreator1155ImplABI, functionName: "adminMint", args: [account, nextTokenId, mintToCreatorCount, "0x"], - }) + }), ); } @@ -160,7 +160,7 @@ export function create1155TokenSetupArgs({ royaltyRecipient: royaltySettings?.royaltyRecipient || account, }, ], - }) + }), ); } @@ -168,7 +168,7 @@ export function create1155TokenSetupArgs({ } export const getTokenIdFromCreateReceipt = ( - receipt: TransactionReceipt + receipt: TransactionReceipt, ): bigint | undefined => { for (const data of receipt.logs) { try { @@ -188,7 +188,7 @@ async function getContractExists( publicClient: PublicClient, contract: ContractType, // Account that is the creator of the contract - account: Address + account: Address, ) { let contractAddress; let contractExists = false; @@ -266,7 +266,7 @@ export function create1155CreatorClient({ const { contractExists, contractAddress } = await getContractExists( publicClient, contract, - account + account, ); // Assume the next token id is the first token available for a new contract. diff --git a/packages/protocol-sdk/src/mint/mint-api-client.ts b/packages/protocol-sdk/src/mint/mint-api-client.ts index 110484269..3918ab3e2 100644 --- a/packages/protocol-sdk/src/mint/mint-api-client.ts +++ b/packages/protocol-sdk/src/mint/mint-api-client.ts @@ -17,13 +17,13 @@ function encodeQueryParameters(params: Record) { const getMintable = async ( path: MintableGetTokenPathParameters, - query: MintableGetTokenGetQueryParameters + query: MintableGetTokenGetQueryParameters, ): Promise => retries(() => { return get( `${ZORA_API_BASE}discover/mintables/${path.chain_name}/${ path.collection_address - }${query?.token_id ? `?${encodeQueryParameters(query)}` : ""}` + }${query?.token_id ? `?${encodeQueryParameters(query)}` : ""}`, ); }); diff --git a/packages/protocol-sdk/src/mint/mint-client.test.ts b/packages/protocol-sdk/src/mint/mint-client.test.ts index f3c9adfd7..696e5ac0a 100644 --- a/packages/protocol-sdk/src/mint/mint-client.test.ts +++ b/packages/protocol-sdk/src/mint/mint-client.test.ts @@ -58,7 +58,7 @@ describe("mint-helper", () => { expect(oldBalance).to.be.equal(0n); expect(newBalance).to.be.equal(1n); }, - 12 * 1000 + 12 * 1000, ); anvilTest( @@ -112,6 +112,6 @@ describe("mint-helper", () => { expect(oldBalance).to.be.equal(0n); expect(newBalance).to.be.equal(1n); }, - 12 * 1000 + 12 * 1000, ); }); diff --git a/packages/protocol-sdk/src/mint/mint-client.ts b/packages/protocol-sdk/src/mint/mint-client.ts index 6f72b2414..c56b27fb4 100644 --- a/packages/protocol-sdk/src/mint/mint-client.ts +++ b/packages/protocol-sdk/src/mint/mint-client.ts @@ -66,7 +66,7 @@ class MintClient extends ClientBase { chain_name: this.network.zoraBackendChainName, collection_address: tokenContract, }, - { token_id: tokenId?.toString() } + { token_id: tokenId?.toString() }, ); } @@ -95,11 +95,11 @@ class MintClient extends ClientBase { if ( !["zora_create", "zora_create_1155"].includes( - mintable.mint_context?.mint_context_type! + mintable.mint_context?.mint_context_type!, ) ) { throw new MintError( - `Mintable type ${mintable.mint_context.mint_context_type} is currently unsupported.` + `Mintable type ${mintable.mint_context.mint_context_type} is currently unsupported.`, ); } @@ -150,7 +150,7 @@ class MintClient extends ClientBase { contractAddress: mintable.contract_address, tokenId: mintable.token_id!, subgraphUrl: this.network.subgraphUrl, - } + }, ); const result: SimulateContractParameters< diff --git a/packages/protocol-sdk/src/premint/premint-api-client.ts b/packages/protocol-sdk/src/premint/premint-api-client.ts index 89c0e9a08..c4be78df2 100644 --- a/packages/protocol-sdk/src/premint/premint-api-client.ts +++ b/packages/protocol-sdk/src/premint/premint-api-client.ts @@ -25,28 +25,28 @@ export type PremintSignatureGetResponse = export type BackendChainNames = components["schemas"]["ChainName"]; const postSignature = async ( - data: PremintSignatureRequestBody + data: PremintSignatureRequestBody, ): Promise => retries(() => - post(`${ZORA_API_BASE}premint/signature`, data) + post(`${ZORA_API_BASE}premint/signature`, data), ); const getNextUID = async ( - path: PremintNextUIDGetPathParameters + path: PremintNextUIDGetPathParameters, ): Promise => retries(() => get( - `${ZORA_API_BASE}premint/signature/${path.chain_name}/${path.collection_address}/next_uid` - ) + `${ZORA_API_BASE}premint/signature/${path.chain_name}/${path.collection_address}/next_uid`, + ), ); const getSignature = async ( - path: PremintSignatureGetPathParameters + path: PremintSignatureGetPathParameters, ): Promise => retries(() => get( - `${ZORA_API_BASE}premint/signature/${path.chain_name}/${path.collection_address}/${path.uid}` - ) + `${ZORA_API_BASE}premint/signature/${path.chain_name}/${path.collection_address}/${path.uid}`, + ), ); export const PremintAPIClient = { diff --git a/packages/protocol-sdk/src/premint/premint-client.test.ts b/packages/protocol-sdk/src/premint/premint-client.test.ts index 791e411d4..7a5a53fc3 100644 --- a/packages/protocol-sdk/src/premint/premint-client.test.ts +++ b/packages/protocol-sdk/src/premint/premint-client.test.ts @@ -68,7 +68,7 @@ describe("ZoraCreator1155Premint", () => { "0x588d19641de9ba1dade4d2bb5387c8dc96f4a990fef69787534b60caead759e6334975a6be10a796da948cd7d1d4f5580b3f84d49d9fa4e0b41c97759507975a1c", }); }, - 20 * 1000 + 20 * 1000, ); anvilTest.skip( @@ -112,7 +112,7 @@ describe("ZoraCreator1155Premint", () => { publicClient, }); expect(signatureValid.isValid).toBe(true); - } + }, ); anvilTest( @@ -163,9 +163,8 @@ describe("ZoraCreator1155Premint", () => { mintComment: "", }, }); - const { request: simulateRequest } = await publicClient.simulateContract( - request - ); + const { request: simulateRequest } = + await publicClient.simulateContract(request); const hash = await walletClient.writeContract(simulateRequest); const receipt = await publicClient.waitForTransactionReceipt({ hash }); const { premintedLog, urls } = @@ -208,6 +207,6 @@ describe("ZoraCreator1155Premint", () => { uid: 3, }); }, - 20 * 1000 + 20 * 1000, ); }); diff --git a/packages/protocol-sdk/src/premint/premint-client.ts b/packages/protocol-sdk/src/premint/premint-client.ts index 92da39c59..bc10a9c91 100644 --- a/packages/protocol-sdk/src/premint/premint-client.ts +++ b/packages/protocol-sdk/src/premint/premint-client.ts @@ -81,7 +81,7 @@ export const DefaultMintArguments = { * @returns Premint event arguments */ export function getPremintedLogFromReceipt( - receipt: TransactionReceipt + receipt: TransactionReceipt, ): PremintedLogType | undefined { for (const data of receipt.logs) { try { @@ -104,7 +104,7 @@ export function getPremintedLogFromReceipt( * @returns Viem type-compatible premint object */ export const convertPremint = ( - premint: PremintSignatureGetResponse["premint"] + premint: PremintSignatureGetResponse["premint"], ) => ({ ...premint, tokenConfig: { @@ -120,7 +120,7 @@ export const convertPremint = ( }); export const convertCollection = ( - collection: PremintSignatureGetResponse["collection"] + collection: PremintSignatureGetResponse["collection"], ) => ({ ...collection, contractAdmin: collection.contractAdmin as Address, diff --git a/packages/protocol-sdk/src/premint/preminter.test.ts b/packages/protocol-sdk/src/premint/preminter.test.ts index 537d2037e..0df9c6dc7 100644 --- a/packages/protocol-sdk/src/premint/preminter.test.ts +++ b/packages/protocol-sdk/src/premint/preminter.test.ts @@ -37,7 +37,7 @@ const defaultContractConfig = ({ const defaultTokenConfigV1 = ( fixedPriceMinterAddress: Address, - creatorAccount: Address + creatorAccount: Address, ): TokenCreationConfigV1 => ({ tokenURI: "ipfs://tokenIpfsId0", maxSupply: 100n, @@ -54,7 +54,7 @@ const defaultTokenConfigV1 = ( const defaultTokenConfigV2 = ( fixedPriceMinterAddress: Address, creatorAccount: Address, - createReferral: Address + createReferral: Address, ): TokenCreationConfigV2 => ({ tokenURI: "ipfs://tokenIpfsId0", maxSupply: 100n, @@ -93,7 +93,7 @@ const defaultPremintConfigV2 = ({ tokenConfig: defaultTokenConfigV2( fixedPriceMinter, creatorAccount, - createReferral + createReferral, ), deleted: false, uid: 106, @@ -182,7 +182,7 @@ describe("ZoraCreator1155Preminter", () => { contractAddress, }); }, - 20 * 1000 + 20 * 1000, ); anvilTest( "can sign and recover a v1 premint config signature", @@ -236,7 +236,7 @@ describe("ZoraCreator1155Preminter", () => { expect(recoveredAddress).to.equal(creatorAccount); }, - 20 * 1000 + 20 * 1000, ); makeAnvilTest({ forkUrl: forkUrls.zoraSepoli, @@ -294,7 +294,7 @@ describe("ZoraCreator1155Preminter", () => { expect(recoveredAddress).to.equal(creatorAccount); }, - 20 * 1000 + 20 * 1000, ); anvilTest( "can sign and mint multiple tokens", @@ -456,7 +456,7 @@ describe("ZoraCreator1155Preminter", () => { // now have the collector execute the second signed message. // it should create a new token against the existing contract const mintHash2 = await viemClients.walletClient.writeContract( - simulationResult.request + simulationResult.request, ); const premintV2Receipt = @@ -487,7 +487,7 @@ describe("ZoraCreator1155Preminter", () => { expect(tokenBalance2).toBe(quantityToMint2); }, // 10 second timeout - 40 * 1000 + 40 * 1000, ); anvilTest( @@ -594,6 +594,6 @@ describe("ZoraCreator1155Preminter", () => { expect(creatorFromEvent).toBe(creatorAccount); expect(recoveredSigner).toBe(creatorFromEvent); - } + }, ); }); diff --git a/packages/protocol-sdk/src/premint/preminter.ts b/packages/protocol-sdk/src/premint/preminter.ts index d11239a03..981141128 100644 --- a/packages/protocol-sdk/src/premint/preminter.ts +++ b/packages/protocol-sdk/src/premint/preminter.ts @@ -359,7 +359,7 @@ export const recoverCreatorFromCreatorAttribution = async ({ export const supportsPremintVersion = async ( version: PremintConfigVersion, tokenContract: Address, - publicClient: PublicClient + publicClient: PublicClient, ) => { const supportedPremintSignatureVersions = await publicClient.readContract({ abi: preminterAbi,