algosdk 2.7.0 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +4 -4
  2. package/dist/browser/algosdk.min.js +1 -1
  3. package/dist/browser/algosdk.min.js.map +1 -1
  4. package/dist/cjs/abi/contract.js +2 -0
  5. package/dist/cjs/abi/contract.js.map +1 -1
  6. package/dist/cjs/abi/event.js +3 -0
  7. package/dist/cjs/abi/event.js.map +1 -0
  8. package/dist/cjs/abi/method.js +4 -0
  9. package/dist/cjs/abi/method.js.map +1 -1
  10. package/dist/cjs/client/v2/algod/models/types.js +194 -7
  11. package/dist/cjs/client/v2/algod/models/types.js.map +1 -1
  12. package/dist/cjs/client/v2/indexer/models/types.js +110 -67
  13. package/dist/cjs/client/v2/indexer/models/types.js.map +1 -1
  14. package/dist/cjs/makeTxn.js +26 -0
  15. package/dist/cjs/makeTxn.js.map +1 -1
  16. package/dist/esm/abi/contract.js +2 -0
  17. package/dist/esm/abi/contract.js.map +1 -1
  18. package/dist/esm/abi/event.js +2 -0
  19. package/dist/esm/abi/event.js.map +1 -0
  20. package/dist/esm/abi/method.js +4 -0
  21. package/dist/esm/abi/method.js.map +1 -1
  22. package/dist/esm/client/v2/algod/models/types.js +188 -5
  23. package/dist/esm/client/v2/algod/models/types.js.map +1 -1
  24. package/dist/esm/client/v2/indexer/models/types.js +110 -67
  25. package/dist/esm/client/v2/indexer/models/types.js.map +1 -1
  26. package/dist/esm/makeTxn.js +26 -0
  27. package/dist/esm/makeTxn.js.map +1 -1
  28. package/dist/types/abi/contract.d.ts +4 -0
  29. package/dist/types/abi/event.d.ts +16 -0
  30. package/dist/types/abi/method.d.ts +7 -0
  31. package/dist/types/client/v2/algod/models/types.d.ts +175 -5
  32. package/dist/types/client/v2/indexer/models/types.d.ts +189 -131
  33. package/dist/types/makeTxn.d.ts +29 -1
  34. package/package.json +2 -2
  35. package/src/abi/contract.ts +6 -0
  36. package/src/abi/event.ts +16 -0
  37. package/src/abi/method.ts +12 -0
  38. package/src/client/v2/algod/models/types.ts +337 -0
  39. package/src/client/v2/indexer/models/types.ts +241 -127
  40. package/src/makeTxn.ts +29 -1
@@ -17,6 +17,8 @@ import { RenameProperties, RenameProperty, Expand } from './types/utils';
17
17
  * genesisHash - string specifies hash genesis block of network in use
18
18
  * genesisID - string specifies genesis ID of network in use
19
19
  * @param rekeyTo - rekeyTo address, optional
20
+ *
21
+ * @deprecated This function will be removed in v3 in favor of {@link makePaymentTxnWithSuggestedParamsFromObject}
20
22
  */
21
23
  export declare function makePaymentTxnWithSuggestedParams(from: PaymentTxn['from'], to: PaymentTxn['to'], amount: PaymentTxn['amount'], closeRemainderTo: PaymentTxn['closeRemainderTo'], note: PaymentTxn['note'], suggestedParams: MustHaveSuggestedParams<PaymentTxn>['suggestedParams'], rekeyTo?: PaymentTxn['reKeyTo']): txnBuilder.Transaction;
22
24
  export declare function makePaymentTxnWithSuggestedParamsFromObject(o: Expand<Pick<RenameProperty<MustHaveSuggestedParams<PaymentTxn>, 'reKeyTo', 'rekeyTo'>, 'from' | 'to' | 'amount' | 'closeRemainderTo' | 'note' | 'suggestedParams' | 'rekeyTo'>>): txnBuilder.Transaction;
@@ -43,9 +45,11 @@ export declare function makePaymentTxnWithSuggestedParamsFromObject(o: Expand<Pi
43
45
  * @param nonParticipation - configure whether the address wants to stop participating. If true,
44
46
  * voteKey, selectionKey, voteFirst, voteLast, and voteKeyDilution must be undefined.
45
47
  * @param stateProofKey - state proof key. for key deregistration, leave undefined
48
+ *
49
+ * @deprecated This function will be removed in v3 in favor of {@link makeKeyRegistrationTxnWithSuggestedParamsFromObject}
46
50
  */
47
51
  export declare function makeKeyRegistrationTxnWithSuggestedParams(from: KeyRegistrationTxn['from'], note: KeyRegistrationTxn['note'], voteKey: KeyRegistrationTxn['voteKey'], selectionKey: KeyRegistrationTxn['selectionKey'], voteFirst: KeyRegistrationTxn['voteFirst'], voteLast: KeyRegistrationTxn['voteLast'], voteKeyDilution: KeyRegistrationTxn['voteKeyDilution'], suggestedParams: MustHaveSuggestedParams<KeyRegistrationTxn>['suggestedParams'], rekeyTo?: KeyRegistrationTxn['reKeyTo'], nonParticipation?: false, stateProofKey?: KeyRegistrationTxn['stateProofKey']): txnBuilder.Transaction;
48
- export declare function makeKeyRegistrationTxnWithSuggestedParams(from: KeyRegistrationTxn['from'], note: KeyRegistrationTxn['note'], voteKey: undefined, selectionKey: undefined, voteFirst: undefined, voteLast: undefined, voteKeyDilution: undefined, suggestedParams: MustHaveSuggestedParams<KeyRegistrationTxn>['suggestedParams'], rekeyTo?: KeyRegistrationTxn['reKeyTo'], nonParticipation?: true, stateProofKey?: undefined): txnBuilder.Transaction;
52
+ export declare function makeKeyRegistrationTxnWithSuggestedParams(from: KeyRegistrationTxn['from'], note: KeyRegistrationTxn['note'], voteKey: undefined, selectionKey: undefined, voteFirst: undefined, voteLast: undefined, voteKeyDilution: undefined, suggestedParams: MustHaveSuggestedParams<KeyRegistrationTxn>['suggestedParams'], rekeyTo?: KeyRegistrationTxn['reKeyTo'], nonParticipation?: boolean, stateProofKey?: undefined): txnBuilder.Transaction;
49
53
  export declare function makeKeyRegistrationTxnWithSuggestedParamsFromObject(o: Expand<Pick<RenameProperty<MustHaveSuggestedParams<KeyRegistrationTxn>, 'reKeyTo', 'rekeyTo'>, 'from' | 'note' | 'voteKey' | 'selectionKey' | 'stateProofKey' | 'voteFirst' | 'voteLast' | 'voteKeyDilution' | 'suggestedParams' | 'rekeyTo'> & {
50
54
  nonParticipation?: false;
51
55
  }>): txnBuilder.Transaction;
@@ -75,6 +79,8 @@ export declare function makeKeyRegistrationTxnWithSuggestedParamsFromObject(o: E
75
79
  * genesisHash - string specifies hash genesis block of network in use
76
80
  * genesisID - string specifies genesis ID of network in use
77
81
  * @param rekeyTo - rekeyTo address, optional
82
+ *
83
+ * @deprecated This function will be removed in v3 in favor of {@link makeAssetCreateTxnWithSuggestedParamsFromObject}
78
84
  */
79
85
  export declare function makeAssetCreateTxnWithSuggestedParams(from: AssetCreateTxn['from'], note: AssetCreateTxn['note'], total: AssetCreateTxn['assetTotal'], decimals: AssetCreateTxn['assetDecimals'], defaultFrozen: AssetCreateTxn['assetDefaultFrozen'], manager: AssetCreateTxn['assetManager'], reserve: AssetCreateTxn['assetReserve'], freeze: AssetCreateTxn['assetFreeze'], clawback: AssetCreateTxn['assetClawback'], unitName: AssetCreateTxn['assetUnitName'], assetName: AssetCreateTxn['assetName'], assetURL: AssetCreateTxn['assetURL'], assetMetadataHash: AssetCreateTxn['assetMetadataHash'] | undefined, suggestedParams: MustHaveSuggestedParams<AssetCreateTxn>['suggestedParams'], rekeyTo?: AssetCreateTxn['reKeyTo']): txnBuilder.Transaction;
80
86
  export declare function makeAssetCreateTxnWithSuggestedParamsFromObject(o: Expand<Pick<RenameProperties<MustHaveSuggestedParams<AssetCreateTxn>, {
@@ -109,6 +115,8 @@ export declare function makeAssetCreateTxnWithSuggestedParamsFromObject(o: Expan
109
115
  * genesisHash - string specifies hash genesis block of network in use
110
116
  * genesisID - string specifies genesis ID of network in use
111
117
  * @param rekeyTo - rekeyTo address, optional
118
+ *
119
+ * @deprecated This function will be removed in v3 in favor of {@link makeAssetConfigTxnWithSuggestedParamsFromObject}
112
120
  */
113
121
  export declare function makeAssetConfigTxnWithSuggestedParams(from: AssetConfigTxn['from'], note: AssetConfigTxn['note'], assetIndex: AssetConfigTxn['assetIndex'], manager: AssetConfigTxn['assetManager'], reserve: AssetConfigTxn['assetReserve'], freeze: AssetConfigTxn['assetFreeze'], clawback: AssetConfigTxn['assetClawback'], suggestedParams: MustHaveSuggestedParams<AssetConfigTxn>['suggestedParams'], strictEmptyAddressChecking?: boolean, rekeyTo?: AssetConfigTxn['reKeyTo']): txnBuilder.Transaction;
114
122
  export declare function makeAssetConfigTxnWithSuggestedParamsFromObject(o: Expand<Pick<RenameProperties<MustHaveSuggestedParams<AssetConfigTxn>, {
@@ -135,6 +143,8 @@ export declare function makeAssetConfigTxnWithSuggestedParamsFromObject(o: Expan
135
143
  * genesisHash - string specifies hash genesis block of network in use
136
144
  * genesisID - string specifies genesis ID of network in use
137
145
  * @param rekeyTo - rekeyTo address, optional
146
+ *
147
+ * @deprecated This function will be removed in v3 in favor of {@link makeAssetDestroyTxnWithSuggestedParamsFromObject}
138
148
  */
139
149
  export declare function makeAssetDestroyTxnWithSuggestedParams(from: AssetDestroyTxn['from'], note: AssetDestroyTxn['note'], assetIndex: AssetDestroyTxn['assetIndex'], suggestedParams: MustHaveSuggestedParams<AssetDestroyTxn>['suggestedParams'], rekeyTo?: AssetDestroyTxn['reKeyTo']): txnBuilder.Transaction;
140
150
  export declare function makeAssetDestroyTxnWithSuggestedParamsFromObject(o: Expand<Pick<RenameProperty<MustHaveSuggestedParams<AssetDestroyTxn>, 'reKeyTo', 'rekeyTo'>, 'from' | 'note' | 'assetIndex' | 'suggestedParams' | 'rekeyTo'>>): txnBuilder.Transaction;
@@ -155,6 +165,8 @@ export declare function makeAssetDestroyTxnWithSuggestedParamsFromObject(o: Expa
155
165
  * genesisHash - string specifies hash genesis block of network in use
156
166
  * genesisID - string specifies genesis ID of network in use
157
167
  * @param rekeyTo - rekeyTo address, optional
168
+ *
169
+ * @deprecated This function will be removed in v3 in favor of {@link makeAssetFreezeTxnWithSuggestedParamsFromObject}
158
170
  */
159
171
  export declare function makeAssetFreezeTxnWithSuggestedParams(from: AssetFreezeTxn['from'], note: AssetFreezeTxn['note'], assetIndex: AssetFreezeTxn['assetIndex'], freezeTarget: AssetFreezeTxn['freezeAccount'], freezeState: AssetFreezeTxn['freezeState'], suggestedParams: MustHaveSuggestedParams<AssetFreezeTxn>['suggestedParams'], rekeyTo?: AssetFreezeTxn['reKeyTo']): txnBuilder.Transaction;
160
172
  export declare function makeAssetFreezeTxnWithSuggestedParamsFromObject(o: Expand<Pick<RenameProperties<MustHaveSuggestedParams<AssetFreezeTxn>, {
@@ -184,6 +196,8 @@ export declare function makeAssetFreezeTxnWithSuggestedParamsFromObject(o: Expan
184
196
  * genesisHash - string specifies hash genesis block of network in use
185
197
  * genesisID - string specifies genesis ID of network in use
186
198
  * @param rekeyTo - rekeyTo address, optional
199
+ *
200
+ * @deprecated This function will be removed in v3 in favor of {@link makeAssetTransferTxnWithSuggestedParamsFromObject}
187
201
  */
188
202
  export declare function makeAssetTransferTxnWithSuggestedParams(from: AssetTransferTxn['from'], to: AssetTransferTxn['to'], closeRemainderTo: AssetTransferTxn['closeRemainderTo'], revocationTarget: AssetTransferTxn['assetRevocationTarget'], amount: AssetTransferTxn['amount'], note: AssetTransferTxn['note'], assetIndex: AssetTransferTxn['assetIndex'], suggestedParams: MustHaveSuggestedParams<AssetTransferTxn>['suggestedParams'], rekeyTo?: AssetTransferTxn['reKeyTo']): txnBuilder.Transaction;
189
203
  export declare function makeAssetTransferTxnWithSuggestedParamsFromObject(o: Expand<Pick<RenameProperties<MustHaveSuggestedParams<AssetTransferTxn>, {
@@ -217,6 +231,8 @@ export declare function makeAssetTransferTxnWithSuggestedParamsFromObject(o: Exp
217
231
  * @param rekeyTo - String representation of the Algorand address that will be used to authorize all future transactions
218
232
  * @param extraPages - integer extra pages of memory to rent on creation of application
219
233
  * @param boxes - Array of BoxReference, app ID and name of box to be accessed
234
+ *
235
+ * @deprecated This function will be removed in v3 in favor of {@link makeApplicationCreateTxnFromObject}
220
236
  */
221
237
  export declare function makeApplicationCreateTxn(from: AppCreateTxn['from'], suggestedParams: MustHaveSuggestedParams<AppCreateTxn>['suggestedParams'], onComplete: AppCreateTxn['appOnComplete'], approvalProgram: AppCreateTxn['appApprovalProgram'], clearProgram: AppCreateTxn['appClearProgram'], numLocalInts: AppCreateTxn['appLocalInts'], numLocalByteSlices: AppCreateTxn['appLocalByteSlices'], numGlobalInts: AppCreateTxn['appGlobalInts'], numGlobalByteSlices: AppCreateTxn['appGlobalByteSlices'], appArgs?: AppCreateTxn['appArgs'], accounts?: AppCreateTxn['appAccounts'], foreignApps?: AppCreateTxn['appForeignApps'], foreignAssets?: AppCreateTxn['appForeignAssets'], note?: AppCreateTxn['note'], lease?: AppCreateTxn['lease'], rekeyTo?: AppCreateTxn['reKeyTo'], extraPages?: AppCreateTxn['extraPages'], boxes?: AppCreateTxn['boxes']): txnBuilder.Transaction;
222
238
  export declare function makeApplicationCreateTxnFromObject(o: Expand<Pick<RenameProperties<MustHaveSuggestedParams<AppCreateTxn>, {
@@ -254,6 +270,8 @@ export declare function makeApplicationCreateTxnFromObject(o: Expand<Pick<Rename
254
270
  * @param lease - Lease a transaction
255
271
  * @param rekeyTo - String representation of the Algorand address that will be used to authorize all future transactions
256
272
  * @param boxes - Array of BoxReference, app ID and name of box to be accessed
273
+ *
274
+ * @deprecated This function will be removed in v3 in favor of {@link makeApplicationUpdateTxnFromObject}
257
275
  */
258
276
  export declare function makeApplicationUpdateTxn(from: AppUpdateTxn['from'], suggestedParams: MustHaveSuggestedParams<AppUpdateTxn>['suggestedParams'], appIndex: AppUpdateTxn['appIndex'], approvalProgram: AppUpdateTxn['appApprovalProgram'], clearProgram: AppUpdateTxn['appClearProgram'], appArgs?: AppUpdateTxn['appArgs'], accounts?: AppUpdateTxn['appAccounts'], foreignApps?: AppUpdateTxn['appForeignApps'], foreignAssets?: AppUpdateTxn['appForeignAssets'], note?: AppUpdateTxn['note'], lease?: AppUpdateTxn['lease'], rekeyTo?: AppUpdateTxn['reKeyTo'], boxes?: AppUpdateTxn['boxes']): txnBuilder.Transaction;
259
277
  export declare function makeApplicationUpdateTxnFromObject(o: Expand<Pick<RenameProperties<MustHaveSuggestedParams<AppUpdateTxn>, {
@@ -284,6 +302,8 @@ export declare function makeApplicationUpdateTxnFromObject(o: Expand<Pick<Rename
284
302
  * @param lease - Lease a transaction
285
303
  * @param rekeyTo - String representation of the Algorand address that will be used to authorize all future transactions
286
304
  * @param boxes - Array of BoxReference, app ID and name of box to be accessed
305
+ *
306
+ * @deprecated This function will be removed in v3 in favor of {@link makeApplicationDeleteTxnFromObject}
287
307
  */
288
308
  export declare function makeApplicationDeleteTxn(from: AppDeleteTxn['from'], suggestedParams: MustHaveSuggestedParams<AppDeleteTxn>['suggestedParams'], appIndex: AppDeleteTxn['appIndex'], appArgs?: AppDeleteTxn['appArgs'], accounts?: AppDeleteTxn['appAccounts'], foreignApps?: AppDeleteTxn['appForeignApps'], foreignAssets?: AppDeleteTxn['appForeignAssets'], note?: AppDeleteTxn['note'], lease?: AppDeleteTxn['lease'], rekeyTo?: AppDeleteTxn['reKeyTo'], boxes?: AppDeleteTxn['boxes']): txnBuilder.Transaction;
289
309
  export declare function makeApplicationDeleteTxnFromObject(o: Expand<Pick<RenameProperties<MustHaveSuggestedParams<AppDeleteTxn>, {
@@ -312,6 +332,8 @@ export declare function makeApplicationDeleteTxnFromObject(o: Expand<Pick<Rename
312
332
  * @param lease - Lease a transaction
313
333
  * @param rekeyTo - String representation of the Algorand address that will be used to authorize all future transactions
314
334
  * @param boxes - Array of BoxReference, app ID and name of box to be accessed
335
+ *
336
+ * @deprecated This function will be removed in v3 in favor of {@link makeApplicationOptInTxnFromObject}
315
337
  */
316
338
  export declare function makeApplicationOptInTxn(from: AppOptInTxn['from'], suggestedParams: MustHaveSuggestedParams<AppOptInTxn>['suggestedParams'], appIndex: AppOptInTxn['appIndex'], appArgs?: AppOptInTxn['appArgs'], accounts?: AppOptInTxn['appAccounts'], foreignApps?: AppOptInTxn['appForeignApps'], foreignAssets?: AppOptInTxn['appForeignAssets'], note?: AppOptInTxn['note'], lease?: AppOptInTxn['lease'], rekeyTo?: AppOptInTxn['reKeyTo'], boxes?: AppOptInTxn['boxes']): txnBuilder.Transaction;
317
339
  export declare function makeApplicationOptInTxnFromObject(o: Expand<Pick<RenameProperties<MustHaveSuggestedParams<AppOptInTxn>, {
@@ -340,6 +362,8 @@ export declare function makeApplicationOptInTxnFromObject(o: Expand<Pick<RenameP
340
362
  * @param lease - Lease a transaction
341
363
  * @param rekeyTo - String representation of the Algorand address that will be used to authorize all future transactions
342
364
  * @param boxes - Array of BoxReference, app ID and name of box to be accessed
365
+ *
366
+ * @deprecated This function will be removed in v3 in favor of {@link makeApplicationCloseOutTxnFromObject}
343
367
  */
344
368
  export declare function makeApplicationCloseOutTxn(from: AppCloseOutTxn['from'], suggestedParams: MustHaveSuggestedParams<AppCloseOutTxn>['suggestedParams'], appIndex: AppCloseOutTxn['appIndex'], appArgs?: AppCloseOutTxn['appArgs'], accounts?: AppCloseOutTxn['appAccounts'], foreignApps?: AppCloseOutTxn['appForeignApps'], foreignAssets?: AppCloseOutTxn['appForeignAssets'], note?: AppCloseOutTxn['note'], lease?: AppCloseOutTxn['lease'], rekeyTo?: AppCloseOutTxn['reKeyTo'], boxes?: AppCloseOutTxn['boxes']): txnBuilder.Transaction;
345
369
  export declare function makeApplicationCloseOutTxnFromObject(o: Expand<Pick<RenameProperties<MustHaveSuggestedParams<AppOptInTxn>, {
@@ -368,6 +392,8 @@ export declare function makeApplicationCloseOutTxnFromObject(o: Expand<Pick<Rena
368
392
  * @param lease - Lease a transaction
369
393
  * @param rekeyTo - String representation of the Algorand address that will be used to authorize all future transactions
370
394
  * @param boxes - Array of BoxReference, app ID and name of box to be accessed
395
+ *
396
+ * @deprecated This function will be removed in v3 in favor of {@link makeApplicationClearStateTxnFromObject}
371
397
  */
372
398
  export declare function makeApplicationClearStateTxn(from: AppClearStateTxn['from'], suggestedParams: MustHaveSuggestedParams<AppClearStateTxn>['suggestedParams'], appIndex: AppClearStateTxn['appIndex'], appArgs?: AppClearStateTxn['appArgs'], accounts?: AppClearStateTxn['appAccounts'], foreignApps?: AppClearStateTxn['appForeignApps'], foreignAssets?: AppClearStateTxn['appForeignAssets'], note?: AppClearStateTxn['note'], lease?: AppClearStateTxn['lease'], rekeyTo?: AppClearStateTxn['reKeyTo'], boxes?: AppClearStateTxn['boxes']): txnBuilder.Transaction;
373
399
  export declare function makeApplicationClearStateTxnFromObject(o: Expand<Pick<RenameProperties<MustHaveSuggestedParams<AppOptInTxn>, {
@@ -396,6 +422,8 @@ export declare function makeApplicationClearStateTxnFromObject(o: Expand<Pick<Re
396
422
  * @param lease - Lease a transaction
397
423
  * @param rekeyTo - String representation of the Algorand address that will be used to authorize all future transactions
398
424
  * @param boxes - Array of BoxReference, app ID and name of box to be accessed
425
+ *
426
+ * @deprecated This function will be removed in v3 in favor of {@link makeApplicationNoOpTxnFromObject}
399
427
  */
400
428
  export declare function makeApplicationNoOpTxn(from: AppNoOpTxn['from'], suggestedParams: MustHaveSuggestedParams<AppNoOpTxn>['suggestedParams'], appIndex: AppNoOpTxn['appIndex'], appArgs?: AppNoOpTxn['appArgs'], accounts?: AppNoOpTxn['appAccounts'], foreignApps?: AppNoOpTxn['appForeignApps'], foreignAssets?: AppNoOpTxn['appForeignAssets'], note?: AppNoOpTxn['note'], lease?: AppNoOpTxn['lease'], rekeyTo?: AppNoOpTxn['reKeyTo'], boxes?: AppNoOpTxn['boxes']): txnBuilder.Transaction;
401
429
  export declare function makeApplicationNoOpTxnFromObject(o: Expand<Pick<RenameProperties<MustHaveSuggestedParams<AppOptInTxn>, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "algosdk",
3
- "version": "2.7.0",
3
+ "version": "2.9.0",
4
4
  "description": "The official JavaScript SDK for Algorand",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -37,7 +37,7 @@
37
37
  "@typescript-eslint/eslint-plugin": "^4.26.1",
38
38
  "@typescript-eslint/parser": "^4.26.1",
39
39
  "assert": "^2.0.0",
40
- "chromedriver": "^116.0.0",
40
+ "chromedriver": "^122.0.3",
41
41
  "concurrently": "^6.2.0",
42
42
  "cucumber": "^5.1.0",
43
43
  "es-abstract": "^1.18.3",
@@ -1,4 +1,5 @@
1
1
  import { ABIMethod, ABIMethodParams, getMethodByName } from './method';
2
+ import { ARC28Event } from './event';
2
3
 
3
4
  export interface ABIContractNetworkInfo {
4
5
  appID: number;
@@ -13,6 +14,7 @@ export interface ABIContractParams {
13
14
  desc?: string;
14
15
  networks?: ABIContractNetworks;
15
16
  methods: ABIMethodParams[];
17
+ events?: ARC28Event[];
16
18
  }
17
19
 
18
20
  export class ABIContract {
@@ -20,6 +22,8 @@ export class ABIContract {
20
22
  public readonly description?: string;
21
23
  public readonly networks: ABIContractNetworks;
22
24
  public readonly methods: ABIMethod[];
25
+ /** [ARC-28](https://arc.algorand.foundation/ARCs/arc-0028) events that MAY be emitted by this contract */
26
+ public readonly events?: ARC28Event[];
23
27
 
24
28
  constructor(params: ABIContractParams) {
25
29
  if (
@@ -34,6 +38,7 @@ export class ABIContract {
34
38
  this.description = params.desc;
35
39
  this.networks = params.networks ? { ...params.networks } : {};
36
40
  this.methods = params.methods.map((method) => new ABIMethod(method));
41
+ this.events = params.events;
37
42
  }
38
43
 
39
44
  toJSON(): ABIContractParams {
@@ -42,6 +47,7 @@ export class ABIContract {
42
47
  desc: this.description,
43
48
  networks: this.networks,
44
49
  methods: this.methods.map((method) => method.toJSON()),
50
+ events: this.events,
45
51
  };
46
52
  }
47
53
 
@@ -0,0 +1,16 @@
1
+ /** [ARC-28](https://arc.algorand.foundation/ARCs/arc-0028) event description */
2
+ export interface ARC28Event {
3
+ /** The name of the event */
4
+ name: string;
5
+ /** Optional, user-friendly description for the event */
6
+ desc?: string;
7
+ /** The arguments of the event, in order */
8
+ args: Array<{
9
+ /** The type of the argument */
10
+ type: string;
11
+ /** Optional, user-friendly name for the argument */
12
+ name?: string;
13
+ /** Optional, user-friendly description for the argument */
14
+ desc?: string;
15
+ }>;
16
+ }
package/src/abi/method.ts CHANGED
@@ -2,6 +2,7 @@ import { genericHash } from '../nacl/naclWrappers';
2
2
  import { ABIType, ABITupleType } from './abi_type';
3
3
  import { ABITransactionType, abiTypeIsTransaction } from './transaction';
4
4
  import { ABIReferenceType, abiTypeIsReference } from './reference';
5
+ import { ARC28Event } from './event';
5
6
 
6
7
  function parseMethodSignature(
7
8
  signature: string
@@ -61,6 +62,10 @@ export interface ABIMethodParams {
61
62
  desc?: string;
62
63
  args: ABIMethodArgParams[];
63
64
  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[];
64
69
  }
65
70
 
66
71
  export type ABIArgumentType = ABIType | ABITransactionType | ABIReferenceType;
@@ -77,6 +82,8 @@ export class ABIMethod {
77
82
  }>;
78
83
 
79
84
  public readonly returns: { type: ABIReturnType; description?: string };
85
+ public readonly events?: ARC28Event[];
86
+ public readonly readonly?: boolean;
80
87
 
81
88
  constructor(params: ABIMethodParams) {
82
89
  if (
@@ -111,6 +118,9 @@ export class ABIMethod {
111
118
  : ABIType.from(params.returns.type),
112
119
  description: params.returns.desc,
113
120
  };
121
+
122
+ this.events = params.events;
123
+ this.readonly = params.readonly;
114
124
  }
115
125
 
116
126
  getSignature(): string {
@@ -147,6 +157,8 @@ export class ABIMethod {
147
157
  type: this.returns.type.toString(),
148
158
  desc: this.returns.description,
149
159
  },
160
+ events: this.events,
161
+ readonly: this.readonly,
150
162
  };
151
163
  }
152
164