TypeError when Creating application on deploy.js
BeepboyAlgo opened this issue · 2 comments
BeepboyAlgo commented
I am trying to create a DAO on the testnet. On the Create Application part of the deploy.js file I recieve a TypeError because the first argument is null. I debugged my code and any argument retuns me null.
async function run (runtimeEnv, deployer) {
const { creator, proposer, voterA, voterB } = accounts(deployer);
// fund accounts
await fundAccount(deployer, [creator, proposer, voterA, voterB]);
// Create DAO Gov Token
const govToken = await deployer.deployASA('test-token', { creator: creator });
// DAO App initialization parameters
const deposit = 15; // deposit required to make a proposal
const minSupport = 5; // minimum number of yes power votes to validate proposal
const minDuration = 1 * 60; // 1min (minimum voting time in number of seconds)
const maxDuration = 5 * 60; // 5min (maximum voting time in number of seconds)
const url = 'www.my-url.com';
const appArgs = [
`int:${deposit}`,
`int:${minSupport}`,
`int:${minDuration}`,
`int:${maxDuration}`,
`str:${url}`
];
const templateParam = { ARG_GOV_TOKEN: govToken.assetIndex };
// Create Application
const daoAppInfo = await deployer.deployApp(
'dao-app-approval.py',
'dao-app-clear.py', {
sender: creator,
localInts: 9,
localBytes: 7,
globalInts: 4,
globalBytes: 2,
appArgs: appArgs
}, {}, templateParam);
...
Error output:
PyTEAL template parameters: { ARG_GOV_TOKEN: 62330360 }
TEAL replacement parameters: {}
TypeError: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received null
at new NodeError (node:internal/errors:371:5)
at from (node:buffer:322:9)
at Object.MurmurHashV3 [as default] (C:\Users\isica\AppData\Local\Yarn\Data\global\node_modules\murmurhash\murmurhash.js:74:38)
at CompileOp.ensureCompiled (C:\Users\isica\AppData\Local\Yarn\Data\global\node_modules\@algo-builder\algob\src\lib\compile.ts:51:44)
at AlgoOperatorImpl.ensureCompiled (C:\Users\isica\AppData\Local\Yarn\Data\global\node_modules\@algo-builder\algob\src\lib\algo-operator.ts:503:33)
at AlgoOperatorImpl.deployApp (C:\Users\isica\AppData\Local\Yarn\Data\global\node_modules\@algo-builder\algob\src\lib\algo-operator.ts:317:28)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at DeployerDeployMode.deployApp (C:\Users\isica\AppData\Local\Yarn\Data\global\node_modules\@algo-builder\algob\src\internal\deployer.ts:672:17)
at Object.run [as default] (C:\Kernel\projects\my_new_project\dao\scripts\deploy.js:34:22)
at runScript (C:\Users\isica\AppData\Local\Yarn\Data\global\node_modules\@algo-builder\algob\src\internal\util\scripts-runner.ts:75:5) {
code: 'ERR_INVALID_ARG_TYPE'
}
Error ABLDR602: Error while executing script 'scripts/deploy.js': The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Receieceived null
BeepboyAlgo commented
On the line 62 from the class CompileOp the ensurePyTEALCompiled function is returning me null.
class CompileOp {
constructor(algocl) {
this.cacheAssured = false;
this.algocl = algocl;
this.pyCompile = new runtime_1.PyCompileOp();
}
/** Gets the TEAL compiled result from artifacts cache and compiles the code if necessary.
* Will throw an exception if the source file doesn't exists.
* @param filename: name of the TEAL code in `/assets` directory.
* (Examples: `mysc.teal, security/rbac.teal`)
* MUST have a .teal, .lsig or .py extension
* @param force: if true it will force recompilation even if the cache is up to date.
* @param scTmplParams: Smart contract template parameters (used only when compiling PyTEAL to TEAL)
*/
async ensureCompiled(filename, force, scTmplParams) {
const filePath = (0, runtime_1.getPathFromDirRecursive)(project_structure_1.ASSETS_DIR, filename);
if (force === undefined) {
force = false;
}
if (!filename.endsWith(exports.tealExt) && !filename.endsWith(exports.lsigExt) && !filename.endsWith(exports.pyExt)) {
throw new Error(`filename "${filename}" must end with "${exports.tealExt}" or "${exports.lsigExt}" or "${exports.pyExt}"`); // TODO: convert to buildererror
}
let teal;
let thash;
if (filename.endsWith(exports.pyExt)) {
const content = this.pyCompile.ensurePyTEALCompiled(filename, scTmplParams);
console.log(content)
[teal, thash] = [content, murmurhash.v3(content)];
}
else {
[teal, thash] = this.readTealAndHash(filePath);
}
BeepboyAlgo commented
Was a problem with python. Thank you.