Skip to content

Add occurrence param to Spec.findEvent - #1574

Merged
Ryang-21 merged 1 commit into
mainfrom
findevent-occurrence
Jul 29, 2026
Merged

Add occurrence param to Spec.findEvent#1574
Ryang-21 merged 1 commit into
mainfrom
findevent-occurrence

Conversation

@Ryang-21

Copy link
Copy Markdown
Contributor

What

Spec.findEvent now takes an optional occurrence — a 0-based index among
same-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
occurrence throws; an index past the last declaration returns undefined,
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
occurrence param on eventTopicFilter and findEvent, and the new
stellar-sdk bindings warnings 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 threaded
occurrence through the internal findEvent and through
Spec.eventTopicFilter, but not through the public Spec.findEvent. So a
caller could build a filter row for the second transfer declaration but
could not read its spec: findEvent always 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.

Copilot AI review requested due to automatic review settings July 29, 2026 20:42
@github-project-automation github-project-automation Bot moved this to Backlog (Not Ready) in DevX Jul 29, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Exposes duplicate-event selection through the public Spec.findEvent API.

Changes:

  • Adds the optional, validated occurrence parameter.
  • 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.

@Ryang-21
Ryang-21 requested a review from quietbits July 29, 2026 20:45
@Ryang-21
Ryang-21 merged commit 0336c41 into main Jul 29, 2026
13 checks passed
@Ryang-21
Ryang-21 deleted the findevent-occurrence branch July 29, 2026 20:49
@github-project-automation github-project-automation Bot moved this from Backlog (Not Ready) to Done in DevX Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants