File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -155,13 +155,20 @@ export class ContractContext {
155155 }
156156
157157 private isArc4 < T extends BaseContract > ( type : IConstructor < T > ) : boolean {
158+ // TODO: uncomment the following line once version puya-ts 1.0.0 is released
159+ // return (type as DeliberateAny as typeof BaseContract).isArc4 ?? false
160+
161+ const result = ( type as DeliberateAny as typeof BaseContract ) . isArc4
162+ if ( result !== undefined && result !== null ) {
163+ return result
164+ }
158165 const proto = Object . getPrototypeOf ( type )
159166 if ( proto === BaseContract ) {
160167 return false
161168 } else if ( proto === Contract ) {
162169 return true
163- } else if ( proto === Object ) {
164- throw new Error ( 'Cannot create a contract for class as it does not extend Contract or BaseContract' )
170+ } else if ( proto === null ) {
171+ return false
165172 }
166173 return this . isArc4 ( proto )
167174 }
You can’t perform that action at this time.
0 commit comments