Add occurrence param to Spec.findEvent - #1574
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Exposes duplicate-event selection through the public Spec.findEvent API.
Changes:
- Adds the optional, validated
occurrenceparameter. - Adds duplicate-event and validation tests.
- Updates generated reference documentation and the v16.2.0 changelog.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/contract/spec.ts |
Forwards occurrence to the existing implementation. |
test/unit/spec/event_spec.test.ts |
Tests selection, defaults, misses, and invalid indexes. |
docs/reference/contracts-client.md |
Updates generated API reference. |
CHANGELOG.md |
Documents duplicate-event support. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
quietbits
approved these changes
Jul 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Spec.findEventnow takes an optionaloccurrence— a 0-based index amongsame-named events, in declaration order — and passes it through to the
underlying implementation, which already accepted one. Defaults to the first
declaration, so existing calls are unchanged. A non-integer or negative
occurrencethrows; an index past the last declaration returnsundefined,the same as an undeclared name.
Also updates the v16.2.0 changelog entry for events to cover #1572, which
landed after the release commit: duplicate event declarations, the
occurrenceparam oneventTopicFilterandfindEvent, and the newstellar-sdk bindingswarnings for duplicate and renamed generated names.Why
#1572 added support for contracts that declare the same event name more than
once — composed modules each emitting their own
transfer. It threadedoccurrencethrough the internalfindEventand throughSpec.eventTopicFilter, but not through the publicSpec.findEvent. So acaller could build a filter row for the second
transferdeclaration butcould not read its spec:
findEventalways returned the first.v16.2.0 is cut but not tagged, so shipping this now keeps the whole
duplicate-event feature in one version instead of leaving a released API
half-finished.