@@ -2,6 +2,7 @@ import { genericHash } from '../nacl/naclWrappers.js';
2
2
import { ABIType , ABITupleType } from './abi_type.js' ;
3
3
import { ABITransactionType , abiTypeIsTransaction } from './transaction.js' ;
4
4
import { ABIReferenceType , abiTypeIsReference } from './reference.js' ;
5
+ import { ARC28Event } from './event.js' ;
5
6
6
7
function parseMethodSignature ( signature : string ) : {
7
8
name : string ;
@@ -63,6 +64,10 @@ export interface ABIMethodParams {
63
64
desc ?: string ;
64
65
args : ABIMethodArgParams [ ] ;
65
66
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 [ ] ;
66
71
}
67
72
68
73
export type ABIArgumentType = ABIType | ABITransactionType | ABIReferenceType ;
@@ -79,6 +84,8 @@ export class ABIMethod {
79
84
} > ;
80
85
81
86
public readonly returns : { type : ABIReturnType ; description ?: string } ;
87
+ public readonly events ?: ARC28Event [ ] ;
88
+ public readonly readonly ?: boolean ;
82
89
83
90
constructor ( params : ABIMethodParams ) {
84
91
if (
@@ -113,6 +120,9 @@ export class ABIMethod {
113
120
: ABIType . from ( params . returns . type ) ,
114
121
description : params . returns . desc ,
115
122
} ;
123
+
124
+ this . events = params . events ;
125
+ this . readonly = params . readonly ;
116
126
}
117
127
118
128
getSignature ( ) : string {
@@ -149,6 +159,8 @@ export class ABIMethod {
149
159
type : this . returns . type . toString ( ) ,
150
160
desc : this . returns . description ,
151
161
} ,
162
+ events : this . events ,
163
+ readonly : this . readonly ,
152
164
} ;
153
165
}
154
166
0 commit comments