diff --git a/packages/react-sdk/generator/index.js b/packages/react-sdk/generator/index.js index bbe7bf64..6a1431ea 100644 --- a/packages/react-sdk/generator/index.js +++ b/packages/react-sdk/generator/index.js @@ -43,7 +43,7 @@ const visit = (file) => { if ( ts.isMethodDeclaration(member) && (member.modifiers?.some( - (m) => m.kind === ts.SyntaxKind.PublicKeyword + (m) => m.kind === ts.SyntaxKind.PublicKeyword, ) ?? true) && member.name && @@ -51,7 +51,7 @@ const visit = (file) => { ) { const requests = []; const isAsync = member.modifiers?.some( - (modifier) => modifier.kind === ts.SyntaxKind.AsyncKeyword + (modifier) => modifier.kind === ts.SyntaxKind.AsyncKeyword, ); program.getTypeChecker().getSignatureFromDeclaration(member); member.parameters.forEach((parameter) => { @@ -72,7 +72,7 @@ const visit = (file) => { ts .getLeadingCommentRanges(sourceFile.text, member.pos) ?.map((range) => - sourceFile.text.substring(range.pos, range.end).trim() + sourceFile.text.substring(range.pos, range.end).trim(), ) || [], defaultValues: undefined, // Get default value, }; @@ -104,16 +104,16 @@ files.forEach((file, index) => { (acc, curr) => acc.concat( curr.requests.map((item) => item.type), - curr.responseType + curr.responseType, ), - [] + [], ); const filteredTypes = [ ...new Set( types .filter((type) => !isPrimitiveType(type)) .filter((type) => !isViemType(type)) - .filter((type) => !isEnclosedInCurlyBraces(type)) + .filter((type) => !isEnclosedInCurlyBraces(type)), ), ]; exportTypes.push(...filteredTypes); @@ -123,7 +123,7 @@ files.forEach((file, index) => { name: fileName, methodNames: asyncMethods, viemTypes: [...new Set(types.filter((type) => isViemType(type)))], - }) + }), ); const methodTemplates = methods.map((method) => { return ejs.render(resourceTemplate.methodTemplate, { @@ -138,7 +138,7 @@ files.forEach((file, index) => { ejs.render(resourceTemplate.endTemplate, { methodNames, name: fileName, - }) + }), ); fs.writeFileSync(`src/resources/use${fileName}.ts`, sources.join("\n")); }); @@ -151,7 +151,7 @@ exec("npm run fix", (error) => { if (error) { console.log( "\x1b[31m%s\x1b[0m", - "\nError occurred while running npm run fix command. Please run `npm run fix` manually." + "\nError occurred while running npm run fix command. Please run `npm run fix` manually.", ); bar.stop(); return; @@ -160,6 +160,6 @@ exec("npm run fix", (error) => { bar.stop(); console.log( "\x1b[32m%s\x1b[0m", - "React SDK templates generated successfully!" + "React SDK templates generated successfully!", ); }); diff --git a/packages/react-sdk/src/resources/useDispute.ts b/packages/react-sdk/src/resources/useDispute.ts index 9ec2a159..696c8c7a 100644 --- a/packages/react-sdk/src/resources/useDispute.ts +++ b/packages/react-sdk/src/resources/useDispute.ts @@ -47,7 +47,7 @@ const useDispute = () => { "raiseDispute", client.dispute.raiseDispute.bind(client.dispute), setLoadings, - setErrors + setErrors, ); /** @@ -70,7 +70,7 @@ const useDispute = () => { "cancelDispute", client.dispute.cancelDispute.bind(client.dispute), setLoadings, - setErrors + setErrors, ); /** @@ -91,7 +91,7 @@ const useDispute = () => { "resolveDispute", client.dispute.resolveDispute.bind(client.dispute), setLoadings, - setErrors + setErrors, ); return { diff --git a/packages/react-sdk/src/resources/useIpAccount.ts b/packages/react-sdk/src/resources/useIpAccount.ts index 9c9a1d66..5daf08e1 100644 --- a/packages/react-sdk/src/resources/useIpAccount.ts +++ b/packages/react-sdk/src/resources/useIpAccount.ts @@ -40,7 +40,7 @@ const useIpAccount = () => { "execute", client.ipAccount.execute.bind(client.ipAccount), setLoadings, - setErrors + setErrors, ); /** Executes a transaction from the IP Account. @@ -62,7 +62,7 @@ const useIpAccount = () => { "executeWithSig", client.ipAccount.executeWithSig.bind(client.ipAccount), setLoadings, - setErrors + setErrors, ); /** Returns the IPAccount's internal nonce for transaction ordering. @@ -76,7 +76,7 @@ const useIpAccount = () => { "getIpAccountNonce", client.ipAccount.getIpAccountNonce.bind(client.ipAccount), setLoadings, - setErrors + setErrors, ); return { diff --git a/packages/react-sdk/src/resources/useIpAsset.ts b/packages/react-sdk/src/resources/useIpAsset.ts index 6e215f5d..d147ace2 100644 --- a/packages/react-sdk/src/resources/useIpAsset.ts +++ b/packages/react-sdk/src/resources/useIpAsset.ts @@ -58,7 +58,7 @@ const useIpAsset = () => { * @returns An `IpCreator` object containing the provided details. */ const generateCreatorMetadata = ( - param: GenerateCreatorMetadataParam + param: GenerateCreatorMetadataParam, ): IpCreator => { return client.ipAsset.generateCreatorMetadata(param); }; @@ -128,7 +128,7 @@ const useIpAsset = () => { "register", client.ipAsset.register.bind(client.ipAsset), setLoadings, - setErrors + setErrors, ); /** @@ -151,7 +151,7 @@ const useIpAsset = () => { "registerDerivative", client.ipAsset.registerDerivative.bind(client.ipAsset), setLoadings, - setErrors + setErrors, ); /** @@ -172,7 +172,7 @@ const useIpAsset = () => { "registerDerivativeWithLicenseTokens", client.ipAsset.registerDerivativeWithLicenseTokens.bind(client.ipAsset), setLoadings, - setErrors + setErrors, ); /** @@ -201,7 +201,7 @@ const useIpAsset = () => { "mintAndRegisterIpAssetWithPilTerms", client.ipAsset.mintAndRegisterIpAssetWithPilTerms.bind(client.ipAsset), setLoadings, - setErrors + setErrors, ); /** @@ -230,7 +230,7 @@ const useIpAsset = () => { "registerIpAndAttachPilTerms", client.ipAsset.registerIpAndAttachPilTerms.bind(client.ipAsset), setLoadings, - setErrors + setErrors, ); /** @@ -259,7 +259,7 @@ const useIpAsset = () => { "registerDerivativeIp", client.ipAsset.registerDerivativeIp.bind(client.ipAsset), setLoadings, - setErrors + setErrors, ); /** @@ -287,7 +287,7 @@ const useIpAsset = () => { "mintAndRegisterIpAndMakeDerivative", client.ipAsset.mintAndRegisterIpAndMakeDerivative.bind(client.ipAsset), setLoadings, - setErrors + setErrors, ); return { diff --git a/packages/react-sdk/src/resources/useLicense.ts b/packages/react-sdk/src/resources/useLicense.ts index 8fa06201..92b3e51c 100644 --- a/packages/react-sdk/src/resources/useLicense.ts +++ b/packages/react-sdk/src/resources/useLicense.ts @@ -48,7 +48,7 @@ const useLicense = () => { "registerNonComSocialRemixingPIL", client.license.registerNonComSocialRemixingPIL.bind(client.license), setLoadings, - setErrors + setErrors, ); /** @@ -67,7 +67,7 @@ const useLicense = () => { "registerCommercialUsePIL", client.license.registerCommercialUsePIL.bind(client.license), setLoadings, - setErrors + setErrors, ); /** @@ -87,7 +87,7 @@ const useLicense = () => { "registerCommercialRemixPIL", client.license.registerCommercialRemixPIL.bind(client.license), setLoadings, - setErrors + setErrors, ); /** @@ -106,7 +106,7 @@ const useLicense = () => { "attachLicenseTerms", client.license.attachLicenseTerms.bind(client.license), setLoadings, - setErrors + setErrors, ); /** @@ -138,7 +138,7 @@ const useLicense = () => { "mintLicenseTokens", client.license.mintLicenseTokens.bind(client.license), setLoadings, - setErrors + setErrors, ); /** @@ -153,7 +153,7 @@ const useLicense = () => { "getLicenseTerms", client.license.getLicenseTerms.bind(client.license), setLoadings, - setErrors + setErrors, ); return { diff --git a/packages/react-sdk/src/resources/useNftClient.ts b/packages/react-sdk/src/resources/useNftClient.ts index 67cd4d85..809ae165 100644 --- a/packages/react-sdk/src/resources/useNftClient.ts +++ b/packages/react-sdk/src/resources/useNftClient.ts @@ -36,7 +36,7 @@ const useNftClient = () => { "createNFTCollection", client.nftClient.createNFTCollection.bind(client.nftClient), setLoadings, - setErrors + setErrors, ); return { diff --git a/packages/react-sdk/src/resources/usePermission.ts b/packages/react-sdk/src/resources/usePermission.ts index 051e196f..3a6df6bc 100644 --- a/packages/react-sdk/src/resources/usePermission.ts +++ b/packages/react-sdk/src/resources/usePermission.ts @@ -55,7 +55,7 @@ const usePermission = () => { "setPermission", client.permission.setPermission.bind(client.permission), setLoadings, - setErrors + setErrors, ); /** @@ -78,7 +78,7 @@ const usePermission = () => { "createSetPermissionSignature", client.permission.createSetPermissionSignature.bind(client.permission), setLoadings, - setErrors + setErrors, ); /** @@ -98,7 +98,7 @@ const usePermission = () => { "setAllPermissions", client.permission.setAllPermissions.bind(client.permission), setLoadings, - setErrors + setErrors, ); /** @@ -122,7 +122,7 @@ const usePermission = () => { "setBatchPermissions", client.permission.setBatchPermissions.bind(client.permission), setLoadings, - setErrors + setErrors, ); /** @@ -146,7 +146,7 @@ const usePermission = () => { "createBatchPermissionSignature", client.permission.createBatchPermissionSignature.bind(client.permission), setLoadings, - setErrors + setErrors, ); return { diff --git a/packages/react-sdk/src/resources/useRoyalty.ts b/packages/react-sdk/src/resources/useRoyalty.ts index 5f2807d2..af77cd6a 100644 --- a/packages/react-sdk/src/resources/useRoyalty.ts +++ b/packages/react-sdk/src/resources/useRoyalty.ts @@ -51,7 +51,7 @@ const useRoyalty = () => { "collectRoyaltyTokens", client.royalty.collectRoyaltyTokens.bind(client.royalty), setLoadings, - setErrors + setErrors, ); /** @@ -71,7 +71,7 @@ const useRoyalty = () => { "payRoyaltyOnBehalf", client.royalty.payRoyaltyOnBehalf.bind(client.royalty), setLoadings, - setErrors + setErrors, ); /** @@ -90,7 +90,7 @@ const useRoyalty = () => { "claimableRevenue", client.royalty.claimableRevenue.bind(client.royalty), setLoadings, - setErrors + setErrors, ); /** @@ -111,7 +111,7 @@ const useRoyalty = () => { "claimRevenue", client.royalty.claimRevenue.bind(client.royalty), setLoadings, - setErrors + setErrors, ); /** @@ -126,7 +126,7 @@ const useRoyalty = () => { "snapshot", client.royalty.snapshot.bind(client.royalty), setLoadings, - setErrors + setErrors, ); /** @@ -138,7 +138,7 @@ const useRoyalty = () => { "getRoyaltyVaultAddress", client.royalty.getRoyaltyVaultAddress.bind(client.royalty), setLoadings, - setErrors + setErrors, ); return { diff --git a/packages/react-sdk/src/withLoadingErrorHandling.ts b/packages/react-sdk/src/withLoadingErrorHandling.ts index 7c52d39a..36aeea2a 100644 --- a/packages/react-sdk/src/withLoadingErrorHandling.ts +++ b/packages/react-sdk/src/withLoadingErrorHandling.ts @@ -12,7 +12,7 @@ export const withLoadingErrorHandling = actionName: string, method: AsyncFunction, setLoadings: SetLoadings, - setErrors: SetErrors + setErrors: SetErrors, ) => async (request: T): Promise => { try { diff --git a/packages/react-sdk/test/integration/useDispute.test.ts b/packages/react-sdk/test/integration/useDispute.test.ts index 69e18746..8a58655b 100644 --- a/packages/react-sdk/test/integration/useDispute.test.ts +++ b/packages/react-sdk/test/integration/useDispute.test.ts @@ -51,7 +51,7 @@ describe("useDispute Functions", () => { expect.objectContaining({ txHash: expect.any(String), disputeId: expect.any(BigInt), - }) + }), ); }); }); @@ -59,11 +59,11 @@ describe("useDispute Functions", () => { it("should success when cancel dispute", async () => { await act(async () => { await expect( - disputeHook.cancelDispute({ disputeId: disputedId }) + disputeHook.cancelDispute({ disputeId: disputedId }), ).resolves.toEqual( expect.objectContaining({ txHash: expect.any(String), - }) + }), ); }); }); diff --git a/packages/react-sdk/test/integration/useIpAccount.test.ts b/packages/react-sdk/test/integration/useIpAccount.test.ts index 09d001a3..7774c50c 100644 --- a/packages/react-sdk/test/integration/useIpAccount.test.ts +++ b/packages/react-sdk/test/integration/useIpAccount.test.ts @@ -92,11 +92,11 @@ describe("useIpAccount Functions", () => { value: 0, data, ipId: ipId, - }) + }), ).resolves.toEqual( expect.objectContaining({ txHash: expect.any(String), - }) + }), ); }); }); diff --git a/packages/react-sdk/test/integration/useIpAsset.test.ts b/packages/react-sdk/test/integration/useIpAsset.test.ts index 0e26d1cd..13b27284 100644 --- a/packages/react-sdk/test/integration/useIpAsset.test.ts +++ b/packages/react-sdk/test/integration/useIpAsset.test.ts @@ -52,7 +52,7 @@ describe("useIpAsset Functions", () => { expect.objectContaining({ ipId: expect.any(String), txHash: expect.any(String), - }) + }), ); }); }); @@ -72,12 +72,12 @@ describe("useIpAsset Functions", () => { txOptions: { waitForTransaction: true, }, - }) + }), ).resolves.toEqual( expect.objectContaining({ ipId: expect.any(String), txHash: expect.any(String), - }) + }), ); }); }); @@ -122,11 +122,11 @@ describe("useIpAsset Functions", () => { txOptions: { waitForTransaction: true, }, - }) + }), ).resolves.toEqual( expect.objectContaining({ txHash: expect.any(String), - }) + }), ); }); }); @@ -165,11 +165,11 @@ describe("useIpAsset Functions", () => { txOptions: { waitForTransaction: true, }, - }) + }), ).resolves.toEqual( expect.objectContaining({ txHash: expect.any(String), - }) + }), ); }); }); @@ -205,12 +205,12 @@ describe("useIpAsset Functions", () => { txOptions: { waitForTransaction: true, }, - }) + }), ).resolves.toEqual( expect.objectContaining({ ipId: expect.any(String), txHash: expect.any(String), - }) + }), ); }); }); @@ -232,12 +232,12 @@ describe("useIpAsset Functions", () => { txOptions: { waitForTransaction: true, }, - }) + }), ).resolves.toEqual( expect.objectContaining({ ipId: expect.any(String), txHash: expect.any(String), - }) + }), ); }); }); @@ -259,12 +259,12 @@ describe("useIpAsset Functions", () => { txOptions: { waitForTransaction: true, }, - }) + }), ).resolves.toEqual( expect.objectContaining({ ipId: expect.any(String), txHash: expect.any(String), - }) + }), ); }); }); @@ -298,12 +298,12 @@ describe("useIpAsset Functions", () => { txOptions: { waitForTransaction: true, }, - }) + }), ).resolves.toEqual( expect.objectContaining({ txHash: expect.any(String), ipId: expect.any(String), - }) + }), ); }); }); @@ -323,12 +323,12 @@ describe("useIpAsset Functions", () => { txOptions: { waitForTransaction: true, }, - }) + }), ).resolves.toEqual( expect.objectContaining({ ipId: expect.any(String), txHash: expect.any(String), - }) + }), ); }); }); diff --git a/packages/react-sdk/test/integration/useLicense.test.ts b/packages/react-sdk/test/integration/useLicense.test.ts index 4e165561..06157785 100644 --- a/packages/react-sdk/test/integration/useLicense.test.ts +++ b/packages/react-sdk/test/integration/useLicense.test.ts @@ -21,11 +21,11 @@ describe("useLicense Functions", () => { txOptions: { waitForTransaction: true, }, - }) + }), ).resolves.toEqual( expect.objectContaining({ licenseTermsId: expect.any(BigInt), - }) + }), ); }); }); @@ -39,11 +39,11 @@ describe("useLicense Functions", () => { txOptions: { waitForTransaction: true, }, - }) + }), ).resolves.toEqual( expect.objectContaining({ licenseTermsId: expect.any(BigInt), - }) + }), ); }); }); @@ -58,11 +58,11 @@ describe("useLicense Functions", () => { txOptions: { waitForTransaction: true, }, - }) + }), ).resolves.toEqual( expect.objectContaining({ licenseTermsId: expect.any(BigInt), - }) + }), ); }); }); @@ -105,12 +105,12 @@ describe("useLicense Functions", () => { txOptions: { waitForTransaction: true, }, - }) + }), ).resolves.toEqual( expect.objectContaining({ txHash: expect.any(String), success: expect.any(Boolean), - }) + }), ); }); }); @@ -124,12 +124,12 @@ describe("useLicense Functions", () => { txOptions: { waitForTransaction: true, }, - }) + }), ).resolves.toEqual( expect.objectContaining({ txHash: expect.any(String), licenseTokenIds: expect.any(Array), - }) + }), ); }); }); @@ -137,7 +137,7 @@ describe("useLicense Functions", () => { it("should success when get license terms", async () => { await act(async () => { await expect(licenseHook.getLicenseTerms(licenseId)).resolves.toEqual( - expect.any(Object) + expect.any(Object), ); }); }); diff --git a/packages/react-sdk/test/integration/useNftClient.test.ts b/packages/react-sdk/test/integration/useNftClient.test.ts index c681adcb..e86adc0a 100644 --- a/packages/react-sdk/test/integration/useNftClient.test.ts +++ b/packages/react-sdk/test/integration/useNftClient.test.ts @@ -19,11 +19,11 @@ describe("useNftClient Functions", () => { txOptions: { waitForTransaction: true, }, - }) + }), ).resolves.toEqual( expect.objectContaining({ nftContract: expect.any(String), - }) + }), ); }); }); diff --git a/packages/react-sdk/test/integration/usePermission.test.ts b/packages/react-sdk/test/integration/usePermission.test.ts index 30706632..4a79e6c5 100644 --- a/packages/react-sdk/test/integration/usePermission.test.ts +++ b/packages/react-sdk/test/integration/usePermission.test.ts @@ -39,12 +39,12 @@ describe("usePermission Functions", () => { txOptions: { waitForTransaction: true, }, - }) + }), ).resolves.toEqual( expect.objectContaining({ txHash: expect.any(String), success: true, - }) + }), ); }); }); @@ -59,12 +59,12 @@ describe("usePermission Functions", () => { txOptions: { waitForTransaction: true, }, - }) + }), ).resolves.toEqual( expect.objectContaining({ txHash: expect.any(String), success: true, - }) + }), ); }); }); @@ -81,12 +81,12 @@ describe("usePermission Functions", () => { txOptions: { waitForTransaction: true, }, - }) + }), ).resolves.toEqual( expect.objectContaining({ txHash: expect.any(String), success: true, - }) + }), ); }); }); @@ -114,12 +114,12 @@ describe("usePermission Functions", () => { txOptions: { waitForTransaction: true, }, - }) + }), ).resolves.toEqual( expect.objectContaining({ txHash: expect.any(String), success: true, - }) + }), ); }); }); @@ -149,12 +149,12 @@ describe("usePermission Functions", () => { txOptions: { waitForTransaction: true, }, - }) + }), ).resolves.toEqual( expect.objectContaining({ txHash: expect.any(String), success: true, - }) + }), ); }); }); diff --git a/packages/react-sdk/test/integration/useRoyalty.test.ts b/packages/react-sdk/test/integration/useRoyalty.test.ts index f7831f58..f578282f 100644 --- a/packages/react-sdk/test/integration/useRoyalty.test.ts +++ b/packages/react-sdk/test/integration/useRoyalty.test.ts @@ -86,12 +86,12 @@ describe("useRoyalty Functions", () => { txOptions: { waitForTransaction: true, }, - }) + }), ).resolves.toEqual( expect.objectContaining({ txHash: expect.any(String), royaltyTokensCollected: expect.any(BigInt), - }) + }), ); }); }); @@ -107,11 +107,11 @@ describe("useRoyalty Functions", () => { txOptions: { waitForTransaction: true, }, - }) + }), ).resolves.toEqual( expect.objectContaining({ txHash: expect.any(String), - }) + }), ); }); }); @@ -124,12 +124,12 @@ describe("useRoyalty Functions", () => { txOptions: { waitForTransaction: true, }, - }) + }), ).resolves.toEqual( expect.objectContaining({ txHash: expect.any(String), snapshotId: expect.any(BigInt), - }) + }), ); }); }); @@ -141,7 +141,7 @@ describe("useRoyalty Functions", () => { account: ipId1, snapshotId: "1", token: mockERC20Address, - }) + }), ).resolves.toEqual(expect.any(BigInt)); }); }); @@ -157,12 +157,12 @@ describe("useRoyalty Functions", () => { txOptions: { waitForTransaction: true, }, - }) + }), ).resolves.toEqual( expect.objectContaining({ txHash: expect.any(String), claimableToken: expect.any(BigInt), - }) + }), ); }); }); @@ -247,12 +247,12 @@ describe("useRoyalty Functions", () => { txOptions: { waitForTransaction: true, }, - }) + }), ).resolves.toEqual( expect.objectContaining({ txHash: expect.any(String), claimableToken: expect.any(BigInt), - }) + }), ); }); }); diff --git a/test_file.txt b/test_file.txt index 473cd51d..0082ccbb 100644 --- a/test_file.txt +++ b/test_file.txt @@ -12,3 +12,4 @@ - This is a change - This is a change - This is a change +- This is a change