diff --git a/packages/core-sdk/src/client.ts b/packages/core-sdk/src/client.ts index 6cd6daad..168f7457 100644 --- a/packages/core-sdk/src/client.ts +++ b/packages/core-sdk/src/client.ts @@ -26,7 +26,7 @@ if (typeof process !== "undefined") { export class StoryClient { private readonly config: StoryConfig & { chainId: SupportedChainIds }; private readonly rpcClient: PublicClient; - private readonly wallet: SimpleWalletClient; + public readonly wallet: SimpleWalletClient; private _ipAsset: IPAssetClient | null = null; private _permission: PermissionClient | null = null; private _license: LicenseClient | null = null; diff --git a/packages/react-sdk/generator/index.js b/packages/react-sdk/generator/index.js index bbe7bf64..530e5675 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,8 +123,29 @@ files.forEach((file, index) => { name: fileName, methodNames: asyncMethods, viemTypes: [...new Set(types.filter((type) => isViemType(type)))], - }) + }), ); + + const returnObjectWithUndefined = asyncMethods.reduce((acc, method) => { + acc[method] = undefined; + return acc; + }, {}); + + sources.push( + ejs.render( + ` + if (!client) { + return { + loadings, + errors, + <%= Object.entries(returnObjectWithUndefined).map(([key, value]) => \`\${key}: \${value}\`).join(',\\n ') %> + }; + } + `, + { returnObjectWithUndefined }, + ), + ); + const methodTemplates = methods.map((method) => { return ejs.render(resourceTemplate.methodTemplate, { method: method, @@ -138,7 +159,7 @@ files.forEach((file, index) => { ejs.render(resourceTemplate.endTemplate, { methodNames, name: fileName, - }) + }), ); fs.writeFileSync(`src/resources/use${fileName}.ts`, sources.join("\n")); }); @@ -151,7 +172,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 +181,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/StoryProtocolContext.tsx b/packages/react-sdk/src/StoryProtocolContext.tsx index efb74c25..57e4b4bf 100644 --- a/packages/react-sdk/src/StoryProtocolContext.tsx +++ b/packages/react-sdk/src/StoryProtocolContext.tsx @@ -11,13 +11,21 @@ const StoryContext = createContext({} as StoryClient); const StoryProvider = ({ config, children }: Props) => { const [client, setClient] = useState(); - if (!client) { + if (!config.wallet) { + setClient( + StoryClient.newClient({ + transport: config.transport, + }), + ); + } else if (!client) { setClient(StoryClient.newClient(config)); } + return ( {children} ); }; + const useStoryContext = (): StoryClient => { return useContext(StoryContext); }; diff --git a/packages/react-sdk/src/resources/useDispute.ts b/packages/react-sdk/src/resources/useDispute.ts index 9ec2a159..cdd2b41a 100644 --- a/packages/react-sdk/src/resources/useDispute.ts +++ b/packages/react-sdk/src/resources/useDispute.ts @@ -24,6 +24,16 @@ const useDispute = () => { resolveDispute: null, }); + if (!client) { + return { + loadings, + errors, + raiseDispute: undefined, + cancelDispute: undefined, + resolveDispute: undefined, + }; + } + /** * Raises a dispute on a given ipId * @param request - The request object containing necessary data to raise a dispute. @@ -47,7 +57,7 @@ const useDispute = () => { "raiseDispute", client.dispute.raiseDispute.bind(client.dispute), setLoadings, - setErrors + setErrors, ); /** @@ -70,7 +80,7 @@ const useDispute = () => { "cancelDispute", client.dispute.cancelDispute.bind(client.dispute), setLoadings, - setErrors + setErrors, ); /** @@ -91,7 +101,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 2f45afec..b372285e 100644 --- a/packages/react-sdk/src/resources/useIpAccount.ts +++ b/packages/react-sdk/src/resources/useIpAccount.ts @@ -27,6 +27,17 @@ const useIpAccount = () => { getToken: null, }); + if (!client) { + return { + loadings, + errors, + execute: undefined, + executeWithSig: undefined, + getIpAccountNonce: undefined, + getToken: undefined, + }; + } + /** Executes a transaction from the IP Account. * @param request - The request object containing necessary data to execute IP Account a transaction. * @param request.ipId The Ip Id to get ip account. @@ -44,7 +55,7 @@ const useIpAccount = () => { "execute", client.ipAccount.execute.bind(client.ipAccount), setLoadings, - setErrors + setErrors, ); /** Executes a transaction from the IP Account. @@ -66,7 +77,7 @@ const useIpAccount = () => { "executeWithSig", client.ipAccount.executeWithSig.bind(client.ipAccount), setLoadings, - setErrors + setErrors, ); /** Returns the IPAccount's internal nonce for transaction ordering. @@ -80,7 +91,7 @@ const useIpAccount = () => { "getIpAccountNonce", client.ipAccount.getIpAccountNonce.bind(client.ipAccount), setLoadings, - setErrors + setErrors, ); /** @@ -91,7 +102,7 @@ const useIpAccount = () => { "getToken", client.ipAccount.getToken.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..dfd33ce5 100644 --- a/packages/react-sdk/src/resources/useIpAsset.ts +++ b/packages/react-sdk/src/resources/useIpAsset.ts @@ -43,6 +43,20 @@ const useIpAsset = () => { mintAndRegisterIpAndMakeDerivative: null, }); + if (!client) { + return { + loadings, + errors, + register: undefined, + registerDerivative: undefined, + registerDerivativeWithLicenseTokens: undefined, + mintAndRegisterIpAssetWithPilTerms: undefined, + registerIpAndAttachPilTerms: undefined, + registerDerivativeIp: undefined, + mintAndRegisterIpAndMakeDerivative: undefined, + }; + } + /** * Create a new `IpCreator` object with the specified details. * @param params - The parameters required to create the `IpCreator` object. @@ -58,7 +72,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 +142,7 @@ const useIpAsset = () => { "register", client.ipAsset.register.bind(client.ipAsset), setLoadings, - setErrors + setErrors, ); /** @@ -151,7 +165,7 @@ const useIpAsset = () => { "registerDerivative", client.ipAsset.registerDerivative.bind(client.ipAsset), setLoadings, - setErrors + setErrors, ); /** @@ -172,7 +186,7 @@ const useIpAsset = () => { "registerDerivativeWithLicenseTokens", client.ipAsset.registerDerivativeWithLicenseTokens.bind(client.ipAsset), setLoadings, - setErrors + setErrors, ); /** @@ -201,7 +215,7 @@ const useIpAsset = () => { "mintAndRegisterIpAssetWithPilTerms", client.ipAsset.mintAndRegisterIpAssetWithPilTerms.bind(client.ipAsset), setLoadings, - setErrors + setErrors, ); /** @@ -230,7 +244,7 @@ const useIpAsset = () => { "registerIpAndAttachPilTerms", client.ipAsset.registerIpAndAttachPilTerms.bind(client.ipAsset), setLoadings, - setErrors + setErrors, ); /** @@ -259,7 +273,7 @@ const useIpAsset = () => { "registerDerivativeIp", client.ipAsset.registerDerivativeIp.bind(client.ipAsset), setLoadings, - setErrors + setErrors, ); /** @@ -287,7 +301,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 8f19620f..6586bcd0 100644 --- a/packages/react-sdk/src/resources/useLicense.ts +++ b/packages/react-sdk/src/resources/useLicense.ts @@ -37,6 +37,20 @@ const useLicense = () => { getLicenseTerms: null, }); + if (!client) { + return { + loadings, + errors, + registerPILTerms: undefined, + registerNonComSocialRemixingPIL: undefined, + registerCommercialUsePIL: undefined, + registerCommercialRemixPIL: undefined, + attachLicenseTerms: undefined, + mintLicenseTokens: undefined, + getLicenseTerms: undefined, + }; + } + /** * Registers new license terms and return the ID of the newly registered license terms. * @param request - The request object that contains all data needed to register a license term. @@ -68,7 +82,7 @@ const useLicense = () => { "registerPILTerms", client.license.registerPILTerms.bind(client.license), setLoadings, - setErrors + setErrors, ); /** @@ -85,7 +99,7 @@ const useLicense = () => { "registerNonComSocialRemixingPIL", client.license.registerNonComSocialRemixingPIL.bind(client.license), setLoadings, - setErrors + setErrors, ); /** @@ -104,7 +118,7 @@ const useLicense = () => { "registerCommercialUsePIL", client.license.registerCommercialUsePIL.bind(client.license), setLoadings, - setErrors + setErrors, ); /** @@ -124,7 +138,7 @@ const useLicense = () => { "registerCommercialRemixPIL", client.license.registerCommercialRemixPIL.bind(client.license), setLoadings, - setErrors + setErrors, ); /** @@ -143,7 +157,7 @@ const useLicense = () => { "attachLicenseTerms", client.license.attachLicenseTerms.bind(client.license), setLoadings, - setErrors + setErrors, ); /** @@ -175,7 +189,7 @@ const useLicense = () => { "mintLicenseTokens", client.license.mintLicenseTokens.bind(client.license), setLoadings, - setErrors + setErrors, ); /** @@ -190,7 +204,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..bbe2113d 100644 --- a/packages/react-sdk/src/resources/useNftClient.ts +++ b/packages/react-sdk/src/resources/useNftClient.ts @@ -16,6 +16,14 @@ const useNftClient = () => { createNFTCollection: null, }); + if (!client) { + return { + loadings, + errors, + createNFTCollection: undefined, + }; + } + /** * Creates a new SPG NFT Collection. * @param request - The request object containing necessary data to create a SPG NFT Collection. @@ -36,7 +44,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..0d2178e5 100644 --- a/packages/react-sdk/src/resources/usePermission.ts +++ b/packages/react-sdk/src/resources/usePermission.ts @@ -28,6 +28,18 @@ const usePermission = () => { createBatchPermissionSignature: null, }); + if (!client) { + return { + loadings, + errors, + setPermission: undefined, + createSetPermissionSignature: undefined, + setAllPermissions: undefined, + setBatchPermissions: undefined, + createBatchPermissionSignature: undefined, + }; + } + /** * Sets the permission for a specific function call * Each policy is represented as a mapping from an IP account address to a signer address to a recipient @@ -55,7 +67,7 @@ const usePermission = () => { "setPermission", client.permission.setPermission.bind(client.permission), setLoadings, - setErrors + setErrors, ); /** @@ -78,7 +90,7 @@ const usePermission = () => { "createSetPermissionSignature", client.permission.createSetPermissionSignature.bind(client.permission), setLoadings, - setErrors + setErrors, ); /** @@ -98,7 +110,7 @@ const usePermission = () => { "setAllPermissions", client.permission.setAllPermissions.bind(client.permission), setLoadings, - setErrors + setErrors, ); /** @@ -122,7 +134,7 @@ const usePermission = () => { "setBatchPermissions", client.permission.setBatchPermissions.bind(client.permission), setLoadings, - setErrors + setErrors, ); /** @@ -146,7 +158,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..b60e28e9 100644 --- a/packages/react-sdk/src/resources/useRoyalty.ts +++ b/packages/react-sdk/src/resources/useRoyalty.ts @@ -35,6 +35,19 @@ const useRoyalty = () => { getRoyaltyVaultAddress: null, }); + if (!client) { + return { + loadings, + errors, + collectRoyaltyTokens: undefined, + payRoyaltyOnBehalf: undefined, + claimableRevenue: undefined, + claimRevenue: undefined, + snapshot: undefined, + getRoyaltyVaultAddress: undefined, + }; + } + /** * Allows ancestors to claim the royalty tokens and any accrued revenue tokens * @param request - The request object that contains all data needed to collect royalty tokens. @@ -51,7 +64,7 @@ const useRoyalty = () => { "collectRoyaltyTokens", client.royalty.collectRoyaltyTokens.bind(client.royalty), setLoadings, - setErrors + setErrors, ); /** @@ -71,7 +84,7 @@ const useRoyalty = () => { "payRoyaltyOnBehalf", client.royalty.payRoyaltyOnBehalf.bind(client.royalty), setLoadings, - setErrors + setErrors, ); /** @@ -90,7 +103,7 @@ const useRoyalty = () => { "claimableRevenue", client.royalty.claimableRevenue.bind(client.royalty), setLoadings, - setErrors + setErrors, ); /** @@ -111,7 +124,7 @@ const useRoyalty = () => { "claimRevenue", client.royalty.claimRevenue.bind(client.royalty), setLoadings, - setErrors + setErrors, ); /** @@ -126,7 +139,7 @@ const useRoyalty = () => { "snapshot", client.royalty.snapshot.bind(client.royalty), setLoadings, - setErrors + setErrors, ); /** @@ -138,7 +151,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 b2620b9d..f0a614ea 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 e50056fc..37a85758 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/packages/react-sdk/test/integration/utils/util.ts b/packages/react-sdk/test/integration/utils/util.ts index eeb80166..51c72975 100644 --- a/packages/react-sdk/test/integration/utils/util.ts +++ b/packages/react-sdk/test/integration/utils/util.ts @@ -47,7 +47,7 @@ export const walletClient = createWalletClient({ }); export const getTokenId = async ( - nftContract?: Address + nftContract?: Address, ): Promise => { const { request } = await publicClient.simulateContract({ abi: [