Closed 45930 closed 1 month ago
/**
* Finds all classes that extend or implement the 'SmartContract' class from 'o1js'.
*
* @param {string} entryFilePath - The path of the entry file.
* @returns {Array<Object>} - An array of objects containing the class name and file path of the smart contract classes found.
*/
export function findIfClassExtendsOrImplementsSmartContract(entryFilePath) {
const classesMap = buildClassHierarchy(entryFilePath);
const importMappings = resolveImports(entryFilePath);
const smartContractClasses = [];
// Check each class in the class map for inheritance from the o1js `SmartContract`
for (let className of Object.keys(classesMap)) {
const result = checkClassInheritance(
className,
'SmartContract',
classesMap,
new Set(),
importMappings
);
if (result) {
smartContractClasses.push({
className,
filePath: classesMap[className].filePath,
});
}
}
return smartContractClasses;
}
This function should locate the class MyToken
, but returns an empty array instead.
Hey @45930 can you please link the repository you mentioned above?
Clone this project
@shimkiv my bad! Added to the original post. This is the repo: https://github.com/boray/fungible-token-exploration/tree/89321ac39cd13fae73357c70e03e6b20e8dbd7cc
Thanks for adding this issue @45930 .
Hey @45930 can you please try with this zkapp-cli
version (since we now have continuous releases 🎉 ):
npm i https://pkg.pr.new/o1-labs/zkapp-cli@677
@shimkiv I'm facing the same issue and trying your suggested fix does not work at the moment:
npm error code E404
npm error 404 Not Found - GET https://pkg.pr.new/o1-labs/zkapp-cli/zkapp-cli@677
npm error 404
npm error 404 'https://pkg.pr.new/o1-labs/zkapp-cli@677' is not in this registry.
npm error 404 This package name is not valid, because
npm error 404 1. name can only contain URL-friendly characters
npm error 404
npm error 404 Note that you can also install from a
npm error 404 tarball, folder, http url, or git url.
npm error A complete log of this run can be found in: /home/emlautarom1/.npm/_logs/2024-07-11T15_47_56_294Z-debug-0.log
@emlautarom1 we did not release this fix on NPM yet and pkg.pr.new
seems to host releases for a limited time.
You can try this one:
Describe the bug
zk deploy
searches the file system for smart contracts that can be deployed. Any class that extendsSmartContract
should be deployable.When a smart contract extends the
TokenContract
abstract class, which is a smart contract, the token implementation is not recognized as a smart contract.Steps to Reproduce
Clone this project, run
npm i; npm run build; zk deploy
, and you will reproduce the error:System Info