Skip to content

Conversation

@jeremy-babylonlabs
Copy link
Contributor

No description provided.

Copilot AI review requested due to automatic review settings November 21, 2025 09:12
Copilot finished reviewing on behalf of jeremy-babylonlabs November 21, 2025 09:15
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds withdrawal transaction information to the delegation data structures, enabling the API to expose withdrawal transaction details when available.

Key Changes:

  • Added WithdrawalTx struct to the database model layer with transaction details and timestamp
  • Added corresponding WithdrawalInfo struct to the service layer with ISO-formatted timestamp
  • Implemented conditional mapping logic to include withdrawal info in API responses when present

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
internal/indexer/db/model/delegation.go Defines WithdrawalTx struct with BSON tags and adds it as an optional field to IndexerDelegationDetails
internal/v2/service/delegation.go Defines WithdrawalInfo struct with JSON tags, adds it to DelegationPublic, and implements mapping logic in FromDelegationDocument

The implementation is clean and follows established patterns in the codebase. The changes properly handle optional withdrawal data by checking for non-empty transaction hash before mapping, consistent with how unbonding transactions are handled elsewhere. The use of appropriate struct tags (bson for database, json for API) and omitempty flags ensures proper serialization at each layer.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jeremy-babylonlabs jeremy-babylonlabs force-pushed the feat/add-withdrawal-tx-info branch from 3b5d2b8 to 4b05d7d Compare November 21, 2025 09:28
Copy link
Contributor

Choose a reason for hiding this comment

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

what about existing delegations? should we run a migration?

Copy link
Collaborator

Choose a reason for hiding this comment

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

i think it's fine.... until someone ask for it.

}

type WithdrawalTx struct {
TxHash string `bson:"tx_hash"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

optional

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants