-
Notifications
You must be signed in to change notification settings - Fork 66
[Beginner]: Add operator== to TokenNftTransfer #1299
Description
🐥 Beginner Friendly
This issue is a great fit for contributors who are ready to explore the Hiero C++ codebase a little more and take on slightly more independent work.
Beginner Issues often involve reading existing C++ code, understanding how different parts of the SDK fit together, and making small, thoughtful updates that follow established patterns.
The goal is to support skill growth while keeping the experience approachable, well-scoped, and enjoyable.
👾 Description of the Issue
The TokenNftTransfer class is missing an operator== implementation.
Relevant files:
src/sdk/main/include/TokenNftTransfer.h
src/sdk/main/src/TokenNftTransfer.cc
Without operator==, callers must compare NFT transfer objects field-by-field. Other SDK value types (e.g. NftId, AccountId, PendingAirdropId) already implement operator== as a pattern — TokenNftTransfer should follow suit.
💡 Proposed Solution
Add operator== to TokenNftTransfer following the same pattern used by PendingAirdropId (a recently added, clean example):
- Declare a
[[nodiscard]] friend bool operator==(const TokenNftTransfer&, const TokenNftTransfer&)in the header - Implement it in
TokenNftTransfer.cc, comparing all meaningful member fields:mNftId,mSenderAccountId,mReceiverAccountId,mIsApproval
- Add or extend the unit test file in
src/sdk/tests/unit/TokenNftTransferTest.cc
The change should not affect any existing behavior or public API.
👩💻 Implementation Steps
- Read
src/sdk/main/include/PendingAirdropId.handsrc/sdk/main/src/PendingAirdropId.ccto understand the pattern - Open
src/sdk/main/include/TokenNftTransfer.hand add thefrienddeclaration inside the class body - Open
src/sdk/main/src/TokenNftTransfer.ccand implementoperator==comparing all four member fields - Open
src/sdk/tests/unit/TokenNftTransferTest.ccand add equality tests:- Two default-constructed instances are equal
- Two identically-constructed instances are equal
- Instances differing in each field are not equal
- Build the SDK and confirm all tests pass
✅ Acceptance Criteria
- Scope: Changes are limited to
TokenNftTransfer.h,TokenNftTransfer.cc, and its unit test - Behavior: No other SDK behavior or API changes
- Tests: Existing and new equality tests pass
- Review: All code review feedback addressed
📋 Step-by-Step Contribution Guide
- Comment
/assignto request the issue - Wait for assignment
- Fork the repository and create a branch
- Set up the project using the instructions in
README.md - Make the requested changes
- Sign each commit using
-s -S - Push your branch and open a pull request
Read Workflow Guide for step-by-step workflow guidance. Read README.md for setup instructions.
❗ Pull requests cannot be merged without S and s signed commits. See the Signing Guide.
🤔 Additional Information
Reference implementation to follow:
src/sdk/main/include/PendingAirdropId.hsrc/sdk/main/src/PendingAirdropId.cc
If you have questions while working on this issue, feel free to ask! Hiero-SDK-C++ Discord