Skip to content

Commit

Permalink
Update test_file.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
bpolania committed Dec 5, 2024
1 parent 993bc16 commit b4238fe
Show file tree
Hide file tree
Showing 17 changed files with 100 additions and 99 deletions.
20 changes: 10 additions & 10 deletions packages/react-sdk/generator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ 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 &&
ts.isIdentifier(member.name)
) {
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) => {
Expand All @@ -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,
};
Expand Down Expand Up @@ -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);
Expand All @@ -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, {
Expand All @@ -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"));
});
Expand All @@ -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;
Expand All @@ -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!",
);
});
6 changes: 3 additions & 3 deletions packages/react-sdk/src/resources/useDispute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const useDispute = () => {
"raiseDispute",
client.dispute.raiseDispute.bind(client.dispute),
setLoadings,
setErrors
setErrors,
);

/**
Expand All @@ -70,7 +70,7 @@ const useDispute = () => {
"cancelDispute",
client.dispute.cancelDispute.bind(client.dispute),
setLoadings,
setErrors
setErrors,
);

/**
Expand All @@ -91,7 +91,7 @@ const useDispute = () => {
"resolveDispute",
client.dispute.resolveDispute.bind(client.dispute),
setLoadings,
setErrors
setErrors,
);

return {
Expand Down
6 changes: 3 additions & 3 deletions packages/react-sdk/src/resources/useIpAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const useIpAccount = () => {
"execute",
client.ipAccount.execute.bind(client.ipAccount),
setLoadings,
setErrors
setErrors,
);

/** Executes a transaction from the IP Account.
Expand All @@ -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.
Expand All @@ -76,7 +76,7 @@ const useIpAccount = () => {
"getIpAccountNonce",
client.ipAccount.getIpAccountNonce.bind(client.ipAccount),
setLoadings,
setErrors
setErrors,
);

return {
Expand Down
16 changes: 8 additions & 8 deletions packages/react-sdk/src/resources/useIpAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down Expand Up @@ -128,7 +128,7 @@ const useIpAsset = () => {
"register",
client.ipAsset.register.bind(client.ipAsset),
setLoadings,
setErrors
setErrors,
);

/**
Expand All @@ -151,7 +151,7 @@ const useIpAsset = () => {
"registerDerivative",
client.ipAsset.registerDerivative.bind(client.ipAsset),
setLoadings,
setErrors
setErrors,
);

/**
Expand All @@ -172,7 +172,7 @@ const useIpAsset = () => {
"registerDerivativeWithLicenseTokens",
client.ipAsset.registerDerivativeWithLicenseTokens.bind(client.ipAsset),
setLoadings,
setErrors
setErrors,
);

/**
Expand Down Expand Up @@ -201,7 +201,7 @@ const useIpAsset = () => {
"mintAndRegisterIpAssetWithPilTerms",
client.ipAsset.mintAndRegisterIpAssetWithPilTerms.bind(client.ipAsset),
setLoadings,
setErrors
setErrors,
);

/**
Expand Down Expand Up @@ -230,7 +230,7 @@ const useIpAsset = () => {
"registerIpAndAttachPilTerms",
client.ipAsset.registerIpAndAttachPilTerms.bind(client.ipAsset),
setLoadings,
setErrors
setErrors,
);

/**
Expand Down Expand Up @@ -259,7 +259,7 @@ const useIpAsset = () => {
"registerDerivativeIp",
client.ipAsset.registerDerivativeIp.bind(client.ipAsset),
setLoadings,
setErrors
setErrors,
);

/**
Expand Down Expand Up @@ -287,7 +287,7 @@ const useIpAsset = () => {
"mintAndRegisterIpAndMakeDerivative",
client.ipAsset.mintAndRegisterIpAndMakeDerivative.bind(client.ipAsset),
setLoadings,
setErrors
setErrors,
);

return {
Expand Down
12 changes: 6 additions & 6 deletions packages/react-sdk/src/resources/useLicense.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const useLicense = () => {
"registerNonComSocialRemixingPIL",
client.license.registerNonComSocialRemixingPIL.bind(client.license),
setLoadings,
setErrors
setErrors,
);

/**
Expand All @@ -67,7 +67,7 @@ const useLicense = () => {
"registerCommercialUsePIL",
client.license.registerCommercialUsePIL.bind(client.license),
setLoadings,
setErrors
setErrors,
);

/**
Expand All @@ -87,7 +87,7 @@ const useLicense = () => {
"registerCommercialRemixPIL",
client.license.registerCommercialRemixPIL.bind(client.license),
setLoadings,
setErrors
setErrors,
);

/**
Expand All @@ -106,7 +106,7 @@ const useLicense = () => {
"attachLicenseTerms",
client.license.attachLicenseTerms.bind(client.license),
setLoadings,
setErrors
setErrors,
);

/**
Expand Down Expand Up @@ -138,7 +138,7 @@ const useLicense = () => {
"mintLicenseTokens",
client.license.mintLicenseTokens.bind(client.license),
setLoadings,
setErrors
setErrors,
);

/**
Expand All @@ -153,7 +153,7 @@ const useLicense = () => {
"getLicenseTerms",
client.license.getLicenseTerms.bind(client.license),
setLoadings,
setErrors
setErrors,
);

return {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-sdk/src/resources/useNftClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const useNftClient = () => {
"createNFTCollection",
client.nftClient.createNFTCollection.bind(client.nftClient),
setLoadings,
setErrors
setErrors,
);

return {
Expand Down
10 changes: 5 additions & 5 deletions packages/react-sdk/src/resources/usePermission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const usePermission = () => {
"setPermission",
client.permission.setPermission.bind(client.permission),
setLoadings,
setErrors
setErrors,
);

/**
Expand All @@ -78,7 +78,7 @@ const usePermission = () => {
"createSetPermissionSignature",
client.permission.createSetPermissionSignature.bind(client.permission),
setLoadings,
setErrors
setErrors,
);

/**
Expand All @@ -98,7 +98,7 @@ const usePermission = () => {
"setAllPermissions",
client.permission.setAllPermissions.bind(client.permission),
setLoadings,
setErrors
setErrors,
);

/**
Expand All @@ -122,7 +122,7 @@ const usePermission = () => {
"setBatchPermissions",
client.permission.setBatchPermissions.bind(client.permission),
setLoadings,
setErrors
setErrors,
);

/**
Expand All @@ -146,7 +146,7 @@ const usePermission = () => {
"createBatchPermissionSignature",
client.permission.createBatchPermissionSignature.bind(client.permission),
setLoadings,
setErrors
setErrors,
);

return {
Expand Down
12 changes: 6 additions & 6 deletions packages/react-sdk/src/resources/useRoyalty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const useRoyalty = () => {
"collectRoyaltyTokens",
client.royalty.collectRoyaltyTokens.bind(client.royalty),
setLoadings,
setErrors
setErrors,
);

/**
Expand All @@ -71,7 +71,7 @@ const useRoyalty = () => {
"payRoyaltyOnBehalf",
client.royalty.payRoyaltyOnBehalf.bind(client.royalty),
setLoadings,
setErrors
setErrors,
);

/**
Expand All @@ -90,7 +90,7 @@ const useRoyalty = () => {
"claimableRevenue",
client.royalty.claimableRevenue.bind(client.royalty),
setLoadings,
setErrors
setErrors,
);

/**
Expand All @@ -111,7 +111,7 @@ const useRoyalty = () => {
"claimRevenue",
client.royalty.claimRevenue.bind(client.royalty),
setLoadings,
setErrors
setErrors,
);

/**
Expand All @@ -126,7 +126,7 @@ const useRoyalty = () => {
"snapshot",
client.royalty.snapshot.bind(client.royalty),
setLoadings,
setErrors
setErrors,
);

/**
Expand All @@ -138,7 +138,7 @@ const useRoyalty = () => {
"getRoyaltyVaultAddress",
client.royalty.getRoyaltyVaultAddress.bind(client.royalty),
setLoadings,
setErrors
setErrors,
);

return {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-sdk/src/withLoadingErrorHandling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const withLoadingErrorHandling =
actionName: string,
method: AsyncFunction<T, U>,
setLoadings: SetLoadings,
setErrors: SetErrors
setErrors: SetErrors,
) =>
async (request: T): Promise<U> => {
try {
Expand Down
Loading

0 comments on commit b4238fe

Please sign in to comment.