@@ -2,6 +2,7 @@ import { genericHash } from '../nacl/naclWrappers.js';
22import { ABIType , ABITupleType } from './abi_type.js' ;
33import { ABITransactionType , abiTypeIsTransaction } from './transaction.js' ;
44import { ABIReferenceType , abiTypeIsReference } from './reference.js' ;
5+ import { ARC28Event } from './event.js' ;
56
67function parseMethodSignature ( signature : string ) : {
78 name : string ;
@@ -63,6 +64,10 @@ export interface ABIMethodParams {
6364 desc ?: string ;
6465 args : ABIMethodArgParams [ ] ;
6566 returns : ABIMethodReturnParams ;
67+ /** Optional, is it a read-only method (according to [ARC-22](https://arc.algorand.foundation/ARCs/arc-0022)) */
68+ readonly ?: boolean ;
69+ /** [ARC-28](https://arc.algorand.foundation/ARCs/arc-0028) events that MAY be emitted by this method */
70+ events ?: ARC28Event [ ] ;
6671}
6772
6873export type ABIArgumentType = ABIType | ABITransactionType | ABIReferenceType ;
@@ -79,6 +84,8 @@ export class ABIMethod {
7984 } > ;
8085
8186 public readonly returns : { type : ABIReturnType ; description ?: string } ;
87+ public readonly events ?: ARC28Event [ ] ;
88+ public readonly readonly ?: boolean ;
8289
8390 constructor ( params : ABIMethodParams ) {
8491 if (
@@ -113,6 +120,9 @@ export class ABIMethod {
113120 : ABIType . from ( params . returns . type ) ,
114121 description : params . returns . desc ,
115122 } ;
123+
124+ this . events = params . events ;
125+ this . readonly = params . readonly ;
116126 }
117127
118128 getSignature ( ) : string {
@@ -149,6 +159,8 @@ export class ABIMethod {
149159 type : this . returns . type . toString ( ) ,
150160 desc : this . returns . description ,
151161 } ,
162+ events : this . events ,
163+ readonly : this . readonly ,
152164 } ;
153165 }
154166
0 commit comments