Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: expose slashing tx #147

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions internal/indexer/db/model/delegation.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ type IndexerDelegationDetails struct {
EndHeight uint32 `bson:"end_height"`
CovenantUnbondingSignatures []CovenantSignature `bson:"covenant_unbonding_signatures"`
BTCDelegationCreatedBbnBlock BTCDelegationCreatedBbnBlock `bson:"btc_delegation_created_bbn_block"`
SlashingTxHex string `bson:"slashing_tx_hex"`
UnbondingSlashingTxHex string `bson:"unbonding_slashing_tx_hex"`
}

func BuildDelegationPaginationToken(d IndexerDelegationDetails) (string, error) {
Expand Down
6 changes: 6 additions & 0 deletions internal/v2/service/delegation.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type DelegationStaking struct {
EndHeight uint32 `json:"end_height,omitempty"`
BbnInceptionHeight int64 `json:"bbn_inception_height"`
BbnInceptionTime int64 `json:"bbn_inception_time"`
SlashingTxHex string `json:"slashing_tx_hex"`
}

type CovenantSignature struct {
Expand All @@ -31,6 +32,7 @@ type DelegationUnbonding struct {
UnbondingTime uint32 `json:"unbonding_time"`
UnbondingTx string `json:"unbonding_tx"`
CovenantUnbondingSignatures []CovenantSignature `json:"covenant_unbonding_signatures"`
SlashingTxHex string `json:"slashing_tx_hex"`
}

type StakerDelegationPublic struct {
Expand Down Expand Up @@ -70,13 +72,15 @@ func (s *V2Service) GetDelegation(ctx context.Context, stakingTxHashHex string)
EndHeight: delegation.EndHeight,
BbnInceptionHeight: delegation.BTCDelegationCreatedBbnBlock.Height,
BbnInceptionTime: delegation.BTCDelegationCreatedBbnBlock.Timestamp,
SlashingTxHex: delegation.SlashingTxHex,
},
DelegationUnbonding: DelegationUnbonding{
UnbondingTime: delegation.UnbondingTime,
UnbondingTx: delegation.UnbondingTx,
CovenantUnbondingSignatures: getUnbondingSignatures(
delegation.CovenantUnbondingSignatures,
),
SlashingTxHex: delegation.UnbondingSlashingTxHex,
},
State: state,
}
Expand Down Expand Up @@ -116,13 +120,15 @@ func (s *V2Service) GetDelegations(ctx context.Context, stakerPkHex string, pagi
EndHeight: delegation.EndHeight,
BbnInceptionHeight: delegation.BTCDelegationCreatedBbnBlock.Height,
BbnInceptionTime: delegation.BTCDelegationCreatedBbnBlock.Timestamp,
SlashingTxHex: delegation.SlashingTxHex,
},
DelegationUnbonding: DelegationUnbonding{
UnbondingTime: delegation.UnbondingTime,
UnbondingTx: delegation.UnbondingTx,
CovenantUnbondingSignatures: getUnbondingSignatures(
delegation.CovenantUnbondingSignatures,
),
SlashingTxHex: delegation.UnbondingSlashingTxHex,
},
State: state,
}
Expand Down
Loading