@@ -2,6 +2,7 @@ import { genericHash } from '../nacl/naclWrappers';
22import { ABIType , ABITupleType } from './abi_type' ;
33import { ABITransactionType , abiTypeIsTransaction } from './transaction' ;
44import { ABIReferenceType , abiTypeIsReference } from './reference' ;
5+ import { ARC28Event } from './event' ;
56
67function parseMethodSignature (
78 signature : string
@@ -61,6 +62,10 @@ export interface ABIMethodParams {
6162 desc ?: string ;
6263 args : ABIMethodArgParams [ ] ;
6364 returns : ABIMethodReturnParams ;
65+ /** Optional, is it a read-only method (according to [ARC-22](https://arc.algorand.foundation/ARCs/arc-0022)) */
66+ readonly ?: boolean ;
67+ /** [ARC-28](https://arc.algorand.foundation/ARCs/arc-0028) events that MAY be emitted by this method */
68+ events ?: ARC28Event [ ] ;
6469}
6570
6671export type ABIArgumentType = ABIType | ABITransactionType | ABIReferenceType ;
@@ -77,6 +82,8 @@ export class ABIMethod {
7782 } > ;
7883
7984 public readonly returns : { type : ABIReturnType ; description ?: string } ;
85+ public readonly events ?: ARC28Event [ ] ;
86+ public readonly readonly ?: boolean ;
8087
8188 constructor ( params : ABIMethodParams ) {
8289 if (
@@ -111,6 +118,9 @@ export class ABIMethod {
111118 : ABIType . from ( params . returns . type ) ,
112119 description : params . returns . desc ,
113120 } ;
121+
122+ this . events = params . events ;
123+ this . readonly = params . readonly ;
114124 }
115125
116126 getSignature ( ) : string {
@@ -147,6 +157,8 @@ export class ABIMethod {
147157 type : this . returns . type . toString ( ) ,
148158 desc : this . returns . description ,
149159 } ,
160+ events : this . events ,
161+ readonly : this . readonly ,
150162 } ;
151163 }
152164
0 commit comments