diff --git a/package-lock.json b/package-lock.json index 863d3ea..092b1d8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,8 +9,8 @@ "version": "1.0.0", "hasInstallScript": true, "dependencies": { - "@algorandfoundation/algorand-typescript": "^1.0.0-beta.4", - "@algorandfoundation/puya-ts": "^1.0.0-beta.6", + "@algorandfoundation/algorand-typescript": "^1.0.0-beta.6", + "@algorandfoundation/puya-ts": "^1.0.0-beta.10", "elliptic": "^6.5.7", "js-sha256": "^0.11.0", "js-sha3": "^0.9.3", @@ -73,17 +73,17 @@ } }, "node_modules/@algorandfoundation/algorand-typescript": { - "version": "1.0.0-beta.4", - "resolved": "https://registry.npmjs.org/@algorandfoundation/algorand-typescript/-/algorand-typescript-1.0.0-beta.4.tgz", - "integrity": "sha512-vMCPeXqFuS1/ChQ8SZAdUHG1gvLFoJAxukY3yp0AjRLTJ5PTEwTVvbgEWcnqDhEi8Y+lmch1yTvGPEKC3o/Ipg==", + "version": "1.0.0-beta.6", + "resolved": "https://registry.npmjs.org/@algorandfoundation/algorand-typescript/-/algorand-typescript-1.0.0-beta.6.tgz", + "integrity": "sha512-I6L5PzVIRcy99paTYunq20F+V6Z+9Yl2zxzDZesW+GITEW86E4c27+RNGUKKW/smMipFLzvV8YM1JLza87kXiw==", "peerDependencies": { "tslib": "^2.6.2" } }, "node_modules/@algorandfoundation/puya-ts": { - "version": "1.0.0-beta.6", - "resolved": "https://registry.npmjs.org/@algorandfoundation/puya-ts/-/puya-ts-1.0.0-beta.6.tgz", - "integrity": "sha512-X4QmOirOAxQk+wvfdDJ33qgO0HUP6I17EFYqBZtolNH82eqMbKtSi5nb5RDejW5EBZINrNJDkQksgw2kl/8FmA==", + "version": "1.0.0-beta.10", + "resolved": "https://registry.npmjs.org/@algorandfoundation/puya-ts/-/puya-ts-1.0.0-beta.10.tgz", + "integrity": "sha512-KyBvprnhY/D9+UX0mBgCxTjUChTqqogM/tUfDoTTs+Cl/5BajqCB29MKlLP02BfQjfKzjcx+hOpq6dfpDnXIMg==", "bundleDependencies": [ "typescript" ], @@ -98,6 +98,7 @@ "polytype": "^0.17.0", "typescript": "^5.7.2", "upath": "^2.0.1", + "which": "^5.0.0", "zod": "^3.24.0" }, "bin": { @@ -105,6 +106,15 @@ "puyats": "bin/run-cli.mjs" } }, + "node_modules/@algorandfoundation/puya-ts/node_modules/isexe": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-3.1.1.tgz", + "integrity": "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==", + "license": "ISC", + "engines": { + "node": ">=16" + } + }, "node_modules/@algorandfoundation/puya-ts/node_modules/typescript": { "version": "5.7.3", "inBundle": true, @@ -117,6 +127,21 @@ "node": ">=14.17" } }, + "node_modules/@algorandfoundation/puya-ts/node_modules/which": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/which/-/which-5.0.0.tgz", + "integrity": "sha512-JEdGzHwwkrbWoGOlIHqQ5gtprKGOenpDHpxE9zVR1bWbOtYRyPPHMe9FaP6x61CmNaTThSkb0DAJte5jD+DmzQ==", + "license": "ISC", + "dependencies": { + "isexe": "^3.1.1" + }, + "bin": { + "node-which": "bin/which.js" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, "node_modules/@ampproject/remapping": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", diff --git a/package.json b/package.json index 6d703d2..daf5f23 100644 --- a/package.json +++ b/package.json @@ -63,8 +63,8 @@ "tslib": "^2.6.2" }, "dependencies": { - "@algorandfoundation/algorand-typescript": "^1.0.0-beta.4", - "@algorandfoundation/puya-ts": "^1.0.0-beta.6", + "@algorandfoundation/algorand-typescript": "^1.0.0-beta.6", + "@algorandfoundation/puya-ts": "^1.0.0-beta.10", "elliptic": "^6.5.7", "js-sha256": "^0.11.0", "js-sha3": "^0.9.3", diff --git a/src/subcontexts/contract-context.ts b/src/subcontexts/contract-context.ts index 4603e5b..61ba053 100644 --- a/src/subcontexts/contract-context.ts +++ b/src/subcontexts/contract-context.ts @@ -155,13 +155,20 @@ export class ContractContext { } private isArc4(type: IConstructor): boolean { + // TODO: uncomment the following line once version puya-ts 1.0.0 is released + // return (type as DeliberateAny as typeof BaseContract).isArc4 ?? false + + const result = (type as DeliberateAny as typeof BaseContract).isArc4 + if (result !== undefined && result !== null) { + return result + } const proto = Object.getPrototypeOf(type) if (proto === BaseContract) { return false } else if (proto === Contract) { return true - } else if (proto === Object) { - throw new Error('Cannot create a contract for class as it does not extend Contract or BaseContract') + } else if (proto === null) { + return false } return this.isArc4(proto) }