diff --git a/tzkt/api/accounts.go b/tzkt/api/accounts.go index 4993188..64bd730 100644 --- a/tzkt/api/accounts.go +++ b/tzkt/api/accounts.go @@ -10,7 +10,7 @@ func (tzkt *API) AccountCounter(ctx context.Context, address string) (uint64, er return tzkt.count(ctx, fmt.Sprintf("/v1/accounts/%s/counter", address), nil) } -// AccountCounter - Returns a number of accounts. +// AccountsCount - Returns a number of accounts. func (tzkt *API) AccountsCount(ctx context.Context, filters map[string]string) (uint64, error) { return tzkt.count(ctx, "/v1/accounts/count", filters) } diff --git a/tzkt/api/operations.go b/tzkt/api/operations.go index 5d7d48d..523ca90 100644 --- a/tzkt/api/operations.go +++ b/tzkt/api/operations.go @@ -9,9 +9,9 @@ import ( "github.com/pkg/errors" ) -// GetEndorsements - -func (tzkt *API) GetEndorsements(ctx context.Context, filters map[string]string) (operations []data.Endorsement, err error) { - err = tzkt.json(ctx, "/v1/operations/endorsements", filters, false, &operations) +// GetAttestations - +func (tzkt *API) GetAttestations(ctx context.Context, filters map[string]string) (operations []data.Attestation, err error) { + err = tzkt.json(ctx, "/v1/operations/attestations", filters, false, &operations) return } @@ -39,9 +39,9 @@ func (tzkt *API) GetDoubleBakings(ctx context.Context, filters map[string]string return } -// GetDoubleEndorsings - -func (tzkt *API) GetDoubleEndorsings(ctx context.Context, filters map[string]string) (operations []data.DoubleEndorsing, err error) { - err = tzkt.json(ctx, "/v1/operations/double_endorsing", filters, false, &operations) +// GetDoubleConsensus - +func (tzkt *API) GetDoubleConsensus(ctx context.Context, filters map[string]string) (operations []data.DoubleConsensus, err error) { + err = tzkt.json(ctx, "/v1/operations/double_consensus", filters, false, &operations) return } @@ -102,9 +102,9 @@ func (tzkt *API) GetTransactionsByHash(ctx context.Context, hash string, filters return } -// GetPreendorsement - -func (tzkt *API) GetPreendorsement(ctx context.Context, filters map[string]string) (operations []data.Preendorsement, err error) { - err = tzkt.json(ctx, "/v1/operations/preendorsement", filters, false, &operations) +// GetPreattestation - +func (tzkt *API) GetPreattestation(ctx context.Context, filters map[string]string) (operations []data.Preattestation, err error) { + err = tzkt.json(ctx, "/v1/operations/preattestations", filters, false, &operations) return } @@ -174,9 +174,9 @@ func (tzkt *API) GetBakings(ctx context.Context, filters map[string]string) (ope return } -// GetEndorsingRewards - -func (tzkt *API) GetEndorsingRewards(ctx context.Context, filters map[string]string) (operations []data.EndorsingReward, err error) { - err = tzkt.json(ctx, "/v1/operations/endorsing_rewards", filters, false, &operations) +// GetAttestationReward - +func (tzkt *API) GetAttestationReward(ctx context.Context, filters map[string]string) (operations []data.AttestationReward, err error) { + err = tzkt.json(ctx, "/v1/operations/attestation_rewards", filters, false, &operations) return } @@ -186,12 +186,6 @@ func (tzkt *API) GetRevelationPenalties(ctx context.Context, filters map[string] return } -// GetDoublePreendorsings - -func (tzkt *API) GetDoublePreendorsings(ctx context.Context, filters map[string]string) (operations []data.DoublePreendorsing, err error) { - err = tzkt.json(ctx, "/v1/operations/double_preendorsing", filters, false, &operations) - return -} - // GetVdfRevelations - func (tzkt *API) GetVdfRevelations(ctx context.Context, filters map[string]string) (operations []data.VdfRevelation, err error) { err = tzkt.json(ctx, "/v1/operations/vdf_revelations", filters, false, &operations) @@ -204,9 +198,9 @@ func (tzkt *API) GetIncreasePaidStorage(ctx context.Context, filters map[string] return } -// GetUpdateConsensusKey - -func (tzkt *API) GetUpdateConsensusKey(ctx context.Context, filters map[string]string) (operations []data.UpdateConsensusKey, err error) { - err = tzkt.json(ctx, "/v1/operations/update_consensus_key", filters, false, &operations) +// GetUpdateSecondaryKey - +func (tzkt *API) GetUpdateSecondaryKey(ctx context.Context, filters map[string]string) (operations []data.UpdateSecondaryKey, err error) { + err = tzkt.json(ctx, "/v1/operations/update_secondary_key", filters, false, &operations) return } @@ -263,3 +257,9 @@ func (tzkt *API) GetDalPublishCommitment(ctx context.Context, filters map[string err = tzkt.json(ctx, "/v1/operations/dal_publish_commitment", filters, false, &operations) return } + +// GetStaking - +func (tzkt *API) GetStaking(ctx context.Context, filters map[string]string) (operations []data.Staking, err error) { + err = tzkt.json(ctx, "/v1/operations/staking", filters, false, &operations) + return +} diff --git a/tzkt/api/operations_test.go b/tzkt/api/operations_test.go new file mode 100644 index 0000000..eb6523a --- /dev/null +++ b/tzkt/api/operations_test.go @@ -0,0 +1,44 @@ +package api + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestGetBakings(t *testing.T) { + api := New("https://staging.api.tzkt.io") + + bakings, err := api.GetBakings(t.Context(), map[string]string{ + "level": "9935996", + }) + + require.NoError(t, err) + assert.Len(t, bakings, 1) + assert.NotEmpty(t, bakings[0].Level) +} + +func TestGetStaking(t *testing.T) { + api := New("https://staging.api.tzkt.io") + + stakings, err := api.GetStaking(t.Context(), map[string]string{ + "hash": "opEK5fRFrjzyGcXS8Euh9EsxRAATKsEV94m2mejsgWHMHbxTAPo", + }) + + require.NoError(t, err) + assert.Len(t, stakings, 1) + assert.Equal(t, uint64(9967034), stakings[0].Level) +} + +func TestGetDoubleConsensus(t *testing.T) { + api := New("https://staging.api.tzkt.io") + + doubleConsensus, err := api.GetDoubleConsensus(t.Context(), map[string]string{ + "level": "554813", + }) + + require.NoError(t, err) + assert.Len(t, doubleConsensus, 1) + assert.Equal(t, "ooaLQnmRTDFf2JZa5skBcYVKUTUxrE6gtuejs31YFeRKXpxRawR", doubleConsensus[0].Hash) +} diff --git a/tzkt/data/account.go b/tzkt/data/account.go index 2dceb14..a4315b9 100644 --- a/tzkt/data/account.go +++ b/tzkt/data/account.go @@ -9,21 +9,18 @@ type Delegate struct { Address string `json:"address"` PublicKey string `json:"publicKey"` Balance int64 `json:"balance"` - FrozenDeposits int64 `json:"frozenDeposits"` - FrozenRewards int64 `json:"frozenRewards"` - FrozenFees int64 `json:"frozenFees"` Counter int64 `json:"counter"` ActivationLevel int64 `json:"activationLevel"` StakingBalance int64 `json:"stakingBalance"` NumContracts int64 `json:"numContracts"` NumDelegators int64 `json:"numDelegators"` NumBlocks int64 `json:"numBlocks"` - NumEndorsements int64 `json:"numEndorsements"` + NumAttestations int64 `json:"numAttestations"` NumBallots int64 `json:"numBallots"` NumProposals int64 `json:"numProposals"` NumActivations int64 `json:"numActivations"` NumDoubleBaking int64 `json:"numDoubleBaking"` - NumDoubleEndorsing int64 `json:"numDoubleEndorsing"` + NumDoubleConsensus int64 `json:"numDoubleConsensus"` NumNonceRevelations int64 `json:"numNonceRevelations"` NumRevelationPenalties int64 `json:"numRevelationPenalties"` NumDelegations int64 `json:"numDelegations"` diff --git a/tzkt/data/blocks.go b/tzkt/data/blocks.go index 5fdd4ec..247e94f 100644 --- a/tzkt/data/blocks.go +++ b/tzkt/data/blocks.go @@ -8,24 +8,26 @@ import ( // Block - type Block struct { - Cycle int64 `json:"cycle"` - Level uint64 `json:"level"` - Hash string `json:"hash"` - Timestamp time.Time `json:"timestamp"` - Proto int64 `json:"proto"` - Priority int64 `json:"priority"` - Validations int64 `json:"validations"` - BlockRound uint64 `json:"blockRound"` - PayloadRound uint64 `josn:"payloadRound"` - Deposit int64 `json:"deposit"` - Reward int64 `json:"reward"` - Fees int64 `json:"fees"` - Bonus int64 `json:"bonus"` - LbEscapeEma int64 `json:"lbEscapeEma"` - NonceRevealed bool `json:"nonceRevealed"` - LbEscapeVote bool `json:"lbEscapeVote"` - LbToggleEma uint64 `json:"lbToggleEma"` - Baker Address `json:"baker"` + Cycle int64 `json:"cycle"` + Level uint64 `json:"level"` + Hash string `json:"hash"` + Timestamp time.Time `json:"timestamp"` + Proto int64 `json:"proto"` + Validations int64 `json:"validations"` + BlockRound uint64 `json:"blockRound"` + PayloadRound uint64 `json:"payloadRound"` + Deposit int64 `json:"deposit"` + RewardDelegated int64 `json:"rewardDelegated"` + RewardStakedOwn int64 `json:"rewardStakedOwn"` + RewardStakedEdge int64 `json:"rewardStakedEdge"` + RewardStakedShared int64 `json:"rewardStakedShared"` + BonusDelegated int64 `json:"bonusDelegated"` + BonusStakedOwn int64 `json:"bonusStakedOwn"` + BonusStakedEdge int64 `json:"bonusStakedEdge"` + BonusStakedShared int64 `json:"bonusStakedShared"` + Fees int64 `json:"fees"` + NonceRevealed bool `json:"nonceRevealed"` + LbToggleEma uint64 `json:"lbToggleEma"` } // Head - diff --git a/tzkt/data/consts.go b/tzkt/data/consts.go index f178c8e..18eedbf 100644 --- a/tzkt/data/consts.go +++ b/tzkt/data/consts.go @@ -4,13 +4,12 @@ package data const ( KindTransaction = "transaction" KindOrigination = "origination" - KindEndorsement = "endorsement" - KindPreendorsement = "preendorsement" + KindAttestation = "attestation" + KindPreattestations = "preattestations" KindBallot = "ballot" KindProposal = "proposal" KindDoubleBaking = "double_baking" - KindDoubleEndorsing = "double_endorsing" - KindDoublePreendorsing = "double_preendorsing" + KindDoubleConsensus = "double_consensus" KindActivation = "activation" KindMigration = "migration" KindNonceRevelation = "nonce_revelation" @@ -29,10 +28,10 @@ const ( KindSetDepositsLimit = "set_deposits_limit" KindRevelationPenalty = "revelation_penalty" KindBaking = "baking" - KindEndorsingReward = "endorsing_reward" + KindAttestationReward = "attestation_reward " KindVdfRevelation = "vdf_revelation" KindIncreasePaidStorage = "increase_paid_storage" - KindUpdateConsensusKey = "update_consensus_key" + KindUpdateSecondaryKey = "update_secondary_key" KindDrainDelegate = "drain_delegate" KindSrAddMessages = "sr_add_messages" KindSrCement = "sr_cement" @@ -42,6 +41,7 @@ const ( KindSrRecoverBond = "sr_recover_bond" KindSrRefute = "sr_refute" KindDalPublishCommitment = "dal_publish_commitment" + KindStaking = "staking" ) // urls diff --git a/tzkt/data/cylce.go b/tzkt/data/cylce.go index c403a0a..c49cf3e 100644 --- a/tzkt/data/cylce.go +++ b/tzkt/data/cylce.go @@ -4,20 +4,20 @@ import "time" // Cycle - type Cycle struct { - Index uint64 `json:"index"` - FirstLevel uint64 `json:"firstLevel"` - StartTime time.Time `json:"startTime"` - LastLevel uint64 `json:"lastLevel"` - EndTime time.Time `json:"endTime"` - SnapshotIndex uint64 `json:"snapshotIndex"` - SnapshotLevel uint64 `json:"snapshotLevel"` - RandomSeed string `json:"randomSeed,omitempty"` - TotalBakers uint64 `json:"totalBakers"` - TotalStaking uint64 `json:"totalStaking"` - TotalDelegators uint64 `json:"totalDelegators"` - TotalDelegated uint64 `json:"totalDelegated"` - SelectedBakers uint64 `json:"selectedBakers"` - SelectedStake uint64 `json:"selectedStake"` - Quote *Quote `json:"quote,omitempty"` - TotalRolls uint64 `json:"totalRolls"` + Index uint64 `json:"index"` + FirstLevel uint64 `json:"firstLevel"` + StartTime time.Time `json:"startTime"` + LastLevel uint64 `json:"lastLevel"` + EndTime time.Time `json:"endTime"` + SnapshotLevel uint64 `json:"snapshotLevel"` + RandomSeed string `json:"randomSeed,omitempty"` + TotalBakers uint64 `json:"totalBakers"` + TotalBakingPower uint64 `json:"totalBakingPower,omitempty"` + BlockReward uint64 `json:"blockReward,omitempty"` + BlockBonusPerSlot uint64 `json:"blockBonusPerSlot,omitempty"` + AttestationRewardPerSlot uint64 `json:"attestationRewardPerSlot,omitempty"` + NonceRevelationReward uint64 `json:"nonceRevelationReward,omitempty"` + VdfRevelationReward uint64 `json:"vdfRevelationReward,omitempty"` + DalAttestationRewardPerShard uint64 `json:"dalAttestationRewardPerShard,omitempty"` + Quote *Quote `json:"quote,omitempty"` } diff --git a/tzkt/data/general.go b/tzkt/data/general.go index 2d9b569..b33af3d 100644 --- a/tzkt/data/general.go +++ b/tzkt/data/general.go @@ -78,46 +78,48 @@ type Protocol struct { // ProtocolConstants - type ProtocolConstants struct { - RampUpCycles int64 `json:"rampUpCycles"` - NoRewardCycles int64 `json:"noRewardCycles"` - PreservedCycles int64 `json:"preservedCycles"` - BlocksPerCycle int64 `json:"blocksPerCycle"` - BlocksPerCommitment int64 `json:"blocksPerCommitment"` - BlocksPerSnapshot int64 `json:"blocksPerSnapshot"` - BlocksPerVoting int64 `json:"blocksPerVoting"` - TimeBetweenBlocks int64 `json:"timeBetweenBlocks"` - EndorsersPerBlock int64 `json:"endorsersPerBlock"` - HardOperationGasLimit int64 `json:"hardOperationGasLimit"` - HardOperationStorageLimit int64 `json:"hardOperationStorageLimit"` - HardBlockGasLimit int64 `json:"hardBlockGasLimit"` - TokensPerRoll int64 `json:"tokensPerRoll"` - RevelationReward int64 `json:"revelationReward"` - BlockDeposit int64 `json:"blockDeposit"` - BlockReward []int64 `json:"blockReward"` - EndorsementDeposit int64 `json:"endorsementDeposit"` - EndorsementReward []int64 `json:"endorsementReward"` - OriginationSize int64 `json:"originationSize"` - ByteCost int64 `json:"byteCost"` - ProposalQuorum int64 `json:"proposalQuorum"` - BallotQuorumMin int64 `json:"ballotQuorumMin"` - BallotQuorumMax int64 `json:"ballotQuorumMax"` - LbSubsidy int64 `json:"lbSubsidy"` - LbSunsetLevel int64 `json:"lbSunsetLevel"` - LbToggleThreshold int64 `json:"lbToggleThreshold"` - ConsensusThreshold int64 `json:"consensusThreshold"` - MinParticipationNumerator int64 `json:"minParticipationNumerator"` - MinParticipationDenominator int64 `json:"minParticipationDenominator"` - MaxSlashingPeriod int64 `json:"maxSlashingPeriod"` - FrozenDepositsPercentage int64 `json:"frozenDepositsPercentage"` - DoubleBakingPunishment int64 `json:"doubleBakingPunishment"` - DoubleEndorsingPunishmentNumerator int64 `json:"doubleEndorsingPunishmentNumerator"` - DoubleEndorsingPunishmentDenominator int64 `json:"doubleEndorsingPunishmentDenominator"` - TxRollupOriginationSize int64 `json:"txRollupOriginationSize"` - TxRollupCommitmentBond int64 `json:"txRollupCommitmentBond"` - LbEscapeThreshold int64 `json:"lbEscapeThreshold"` + RampUpCycles int64 `json:"rampUpCycles"` + NoRewardCycles int64 `json:"noRewardCycles"` + ConsensusRightsDelay int64 `json:"consensusRightsDelay"` + DelegateParametersActivationDelay int64 `json:"delegateParametersActivationDelay"` + BlocksPerCycle int64 `json:"blocksPerCycle"` + BlocksPerCommitment int64 `json:"blocksPerCommitment"` + BlocksPerSnapshot int64 `json:"blocksPerSnapshot"` + BlocksPerVoting int64 `json:"blocksPerVoting"` + TimeBetweenBlocks int64 `json:"timeBetweenBlocks"` + AttestersPerBlock int64 `json:"attestersPerBlock"` + HardOperationGasLimit int64 `json:"hardOperationGasLimit"` + HardOperationStorageLimit int64 `json:"hardOperationStorageLimit"` + HardBlockGasLimit int64 `json:"hardBlockGasLimit"` + MinimalStake int64 `json:"minimalStake"` + MinimalFrozenStake int64 `json:"minimalFrozenStake"` + BlockDeposit int64 `json:"blockDeposit"` + BlockReward []int64 `json:"blockReward"` + AttestationDeposit int64 `json:"attestationDeposit"` + AttestationReward []int64 `json:"attestationReward"` + OriginationSize int64 `json:"originationSize"` + ByteCost int64 `json:"byteCost"` + ProposalQuorum int64 `json:"proposalQuorum"` + BallotQuorumMin int64 `json:"ballotQuorumMin"` + BallotQuorumMax int64 `json:"ballotQuorumMax"` + LbToggleThreshold int64 `json:"lbToggleThreshold"` + ConsensusThreshold int64 `json:"consensusThreshold"` + MinParticipationNumerator int64 `json:"minParticipationNumerator"` + MinParticipationDenominator int64 `json:"minParticipationDenominator"` + DenunciationPeriod int64 `json:"denunciationPeriod"` + SlashingDelay int64 `json:"slashingDelay"` + MaxDelegatedOverFrozenRatio int64 `json:"maxDelegatedOverFrozenRatio"` + MaxExternalOverOwnStakeRatio int64 `json:"maxExternalOverOwnStakeRatio"` + SmartRollupOriginationSize int64 `json:"smartRollupOriginationSize"` + SmartRollupStakeAmount int64 `json:"smartRollupStakeAmount"` + SmartRollupChallengeWindow int64 `json:"smartRollupChallengeWindow"` + SmartRollupCommitmentPeriod int64 `json:"smartRollupCommitmentPeriod"` + SmartRollupTimeoutPeriod int64 `json:"smartRollupTimeoutPeriod"` + DalNumberOfShards int64 `json:"dalNumberOfShards"` + Dictator string `json:"dictator"` } -// ProtocolConstants - +// ProtocolMetadata - type ProtocolMetadata struct { Docs string `json:"docs"` Alias string `json:"alias"` @@ -137,6 +139,5 @@ type Statistics struct { TotalBanished uint64 `json:"totalBanished"` TotalFrozen uint64 `json:"totalFrozen"` TotalRollupBonds uint64 `json:"totalRollupBonds"` - TotalVested uint64 `json:"totalVested"` Quote *Quote `json:"quote,omitempty"` } diff --git a/tzkt/data/operations.go b/tzkt/data/operations.go index b8e0039..0c7d5a8 100644 --- a/tzkt/data/operations.go +++ b/tzkt/data/operations.go @@ -10,13 +10,13 @@ import ( // OperationConstraint - type OperationConstraint interface { - Transaction | Origination | Delegation | Reveal | RegisterConstant | Endorsement | Preendorsement | + Transaction | Origination | Delegation | Reveal | RegisterConstant | Attestation | Preattestation | Ballot | Proposal | Activation | TransferTicket | TxRollupCommit | TxRollupDispatchTicket | TxRollupFinalizeCommitment | TxRollupOrigination | TxRollupRejection | TxRollupRemoveCommitment | - TxRollupReturnBond | TxRollupSubmitBatch | NonceRevelation | DoubleBaking | DoubleEndorsing | SetDepositsLimit | - DoublePreendorsing | Baking | RevelationPenalty | EndorsingReward | VdfRevelation | IncreasePaidStorage | - DrainDelegate | UpdateConsensusKey | SmartRollupAddMessage | SmartRollupCement | SmartRollupExecute | - SmartRollupOriginate | SmartRollupPublish | SmartRollupRefute | SmartRollupRecoverBond | DalPublishCommitment + TxRollupReturnBond | TxRollupSubmitBatch | NonceRevelation | DoubleBaking | DoubleConsensus | SetDepositsLimit | + Baking | RevelationPenalty | AttestationReward | VdfRevelation | IncreasePaidStorage | DrainDelegate | + UpdateSecondaryKey | SmartRollupAddMessage | SmartRollupCement | SmartRollupExecute | SmartRollupOriginate | + SmartRollupPublish | SmartRollupRefute | SmartRollupRecoverBond | DalPublishCommitment | Staking } // Operation - @@ -133,12 +133,13 @@ type Reveal struct { GasLimit uint64 `json:"gasLimit"` GasUsed uint64 `json:"gasUsed"` BakerFee uint64 `json:"bakerFee"` + PublicKey string `json:"publicKey,omitempty"` Nonce *uint64 `json:"nonce,omitempty"` Quote *Quote `json:"quote,omitempty"` } -// Endorsement - -type Endorsement struct { +// Attestation - +type Attestation struct { Type string `json:"type"` Block string `json:"block"` Hash string `json:"hash"` @@ -152,8 +153,8 @@ type Endorsement struct { Quote *Quote `json:"quote,omitempty"` } -// Preendorsement - -type Preendorsement struct { +// Preattestation - +type Preattestation struct { Type string `json:"type"` Block string `json:"block"` Hash string `json:"hash"` @@ -179,7 +180,6 @@ type Ballot struct { Delegate Address `json:"delegate"` VotingPower int64 `json:"votingPower"` Quote *Quote `json:"quote,omitempty"` - Rolls int `json:"rolls,omitempty"` } // Proposal - @@ -196,7 +196,6 @@ type Proposal struct { VotingPower int64 `json:"votingPower"` Duplicated bool `json:"duplicated"` Quote *Quote `json:"quote,omitempty"` - Rolls int `json:"rolls,omitempty"` } // Activation - @@ -237,20 +236,22 @@ type RegisterConstant struct { // NonceRevelation - type NonceRevelation struct { - Type string `json:"type"` - ID uint64 `json:"id"` - Level uint64 `json:"level"` - Timestamp time.Time `json:"timestamp"` - Block string `json:"block"` - Hash string `json:"hash"` - Baker Address `json:"baker"` - Sender Address `json:"sender"` - RevealedLevel int `json:"revealedLevel"` - RevealedCycle int `json:"revealedCycle"` - Nonce string `json:"nonce"` - Reward int64 `json:"reward"` - Quote *Quote `json:"quote,omitempty"` - BakerRewards int64 `json:"bakerRewards"` + Type string `json:"type"` + ID uint64 `json:"id"` + Level uint64 `json:"level"` + Timestamp time.Time `json:"timestamp"` + Block string `json:"block"` + Hash string `json:"hash"` + Baker Address `json:"baker"` + Sender Address `json:"sender"` + RevealedLevel int `json:"revealedLevel"` + RevealedCycle int `json:"revealedCycle"` + Nonce string `json:"nonce"` + RewardDelegated int64 `json:"rewardDelegated"` + RewardStakedOwn int64 `json:"rewardStakedOwn"` + RewardStakedEdge int64 `json:"rewardStakedEdge"` + RewardStakedShared int64 `json:"rewardStakedShared"` + Quote *Quote `json:"quote,omitempty"` } // ProposalAlias - @@ -512,19 +513,19 @@ type DoubleBaking struct { Block string `json:"block"` Hash string `json:"hash"` AccusedLevel uint64 `json:"accusedLevel"` + SlashedLevel uint64 `json:"slashedLevel"` Accuser *Address `json:"accuser"` - AccuserReward int64 `json:"accuserReward"` + Reward uint64 `json:"reward"` Offender *Address `json:"offender"` - OffenderLoss int64 `json:"offenderLoss"` + LostStaked uint64 `json:"lostStaked"` + LostUnstaked uint64 `json:"lostUnstaked"` + LostExternalStaked uint64 `json:"lostExternalStaked"` + LostExternalUnstaked uint64 `json:"lostExternalUnstaked"` Quote *Quote `json:"quote,omitempty"` - AccuserRewards int64 `json:"accuserRewards,omitempty"` - OffenderLostDeposits int64 `json:"offenderLostDeposits,omitempty"` - OffenderLostRewards int64 `json:"offenderLostRewards,omitempty"` - OffenderLostFees int64 `json:"offenderLostFees,omitempty"` } -// DoubleEndorsing - -type DoubleEndorsing struct { +// DoubleConsensus - +type DoubleConsensus struct { Type string `json:"type"` ID uint64 `json:"id"` Level uint64 `json:"level"` @@ -533,14 +534,13 @@ type DoubleEndorsing struct { Hash string `json:"hash"` AccusedLevel uint64 `json:"accusedLevel"` Accuser *Address `json:"accuser"` - AccuserReward int64 `json:"accuserReward"` + Reward uint64 `json:"reward"` Offender *Address `json:"offender"` - OffenderLoss int64 `json:"offenderLoss"` + LostStaked uint64 `json:"lostStaked"` + LostUnstaked uint64 `json:"lostUnstaked"` + LostExternalStaked uint64 `json:"lostExternalStaked"` + LostExternalUnstaked uint64 `json:"lostExternalUnstaked"` Quote *Quote `json:"quote,omitempty"` - AccuserRewards int64 `json:"accuserRewards,omitempty"` - OffenderLostDeposits int64 `json:"offenderLostDeposits,omitempty"` - OffenderLostRewards int64 `json:"offenderLostRewards,omitempty"` - OffenderLostFees int64 `json:"offenderLostFees,omitempty"` } // Quote - @@ -562,35 +562,42 @@ type Error struct { // Baking - type Baking struct { - Type string `json:"type"` - ID uint64 `json:"id"` - Level uint64 `json:"level"` - Timestamp time.Time `json:"timestamp"` - Block string `json:"block"` - Proposer *Address `json:"proposer"` - Producer *Address `json:"producer"` - PayloadRound int `json:"payloadRound"` - BlockRound int `json:"blockRound"` - Deposit int64 `json:"deposit"` - Reward int64 `json:"reward"` - Bonus int64 `json:"bonus"` - Fees int64 `json:"fees"` - Baker Address `json:"baker"` - Priority int `json:"priority"` - Quote *Quote `json:"quote,omitempty"` -} - -// EndorsingReward - -type EndorsingReward struct { - Type string `json:"type"` - ID uint64 `json:"id"` - Level uint64 `json:"level"` - Timestamp time.Time `json:"timestamp"` - Block string `json:"block"` - Baker *Address `json:"baker"` - Expected int64 `json:"expected"` - Received int64 `json:"received"` - Quote *Quote `json:"quote,omitempty"` + Type string `json:"type"` + ID uint64 `json:"id"` + Level uint64 `json:"level"` + Timestamp time.Time `json:"timestamp"` + Block string `json:"block"` + Proposer *Address `json:"proposer"` + Producer *Address `json:"producer"` + PayloadRound int `json:"payloadRound"` + BlockRound int `json:"blockRound"` + Deposit int64 `json:"deposit"` + RewardDelegated int64 `json:"rewardDelegated"` + RewardStakedOwn int64 `json:"rewardStakedOwn"` + RewardStakedEdge int64 `json:"rewardStakedEdge"` + RewardStakedShared int64 `json:"rewardStakedShared"` + BonusDelegated int64 `json:"bonusDelegated"` + BonusStakedOwn int64 `json:"bonusStakedOwn"` + BonusStakedEdge int64 `json:"bonusStakedEdge"` + BonusStakedShared int64 `json:"bonusStakedShared"` + Fees int64 `json:"fees"` + Quote *Quote `json:"quote,omitempty"` +} + +// AttestationReward - +type AttestationReward struct { + Type string `json:"type"` + ID uint64 `json:"id"` + Level uint64 `json:"level"` + Timestamp time.Time `json:"timestamp"` + Block string `json:"block"` + Baker *Address `json:"baker"` + Expected int64 `json:"expected"` + RewardDelegated int64 `json:"rewardDelegated"` + RewardStakedOwn int64 `json:"rewardStakedOwn"` + RewardStakedEdge int64 `json:"rewardStakedEdge"` + RewardStakedShared int64 `json:"rewardStakedShared"` + Quote *Quote `json:"quote,omitempty"` } // RevelationPenalty - @@ -606,40 +613,23 @@ type RevelationPenalty struct { Quote *Quote `json:"quote,omitempty"` } -// DoublePreendorsing - -type DoublePreendorsing struct { - Type string `json:"type"` - ID uint64 `json:"id"` - Level uint64 `json:"level"` - Timestamp time.Time `json:"timestamp"` - Block string `json:"block"` - Hash string `json:"hash"` - AccusedLevel uint64 `json:"accusedLevel"` - Accuser *Address `json:"accuser"` - AccuserReward int64 `json:"accuserReward"` - Offender *Address `json:"offender"` - OffenderLoss int64 `json:"offenderLoss"` - Quote *Quote `json:"quote,omitempty"` - AccuserRewards int64 `json:"accuserRewards,omitempty"` - OffenderLostDeposits int64 `json:"offenderLostDeposits,omitempty"` - OffenderLostRewards int64 `json:"offenderLostRewards,omitempty"` - OffenderLostFees int64 `json:"offenderLostFees,omitempty"` -} - // VdfRevelation - type VdfRevelation struct { - Type string `json:"type"` - ID uint64 `json:"id"` - Level uint64 `json:"level"` - Timestamp time.Time `json:"timestamp"` - Block string `json:"block"` - Hash string `json:"hash"` - Baker *Address `json:"baker"` - Cycle uint64 `json:"cycle"` - Solution string `json:"solution"` - Proof string `json:"proof"` - Reward uint64 `json:"reward"` - Quote *Quote `json:"quote,omitempty"` + Type string `json:"type"` + ID uint64 `json:"id"` + Level uint64 `json:"level"` + Timestamp time.Time `json:"timestamp"` + Block string `json:"block"` + Hash string `json:"hash"` + Baker *Address `json:"baker"` + Cycle uint64 `json:"cycle"` + Solution string `json:"solution"` + Proof string `json:"proof"` + RewardDelegated int64 `json:"rewardDelegated"` + RewardStakedOwn int64 `json:"rewardStakedOwn"` + RewardStakedEdge int64 `json:"rewardStakedEdge"` + RewardStakedShared int64 `json:"rewardStakedShared"` + Quote *Quote `json:"quote,omitempty"` } // IncreasePaidStorage - @@ -663,8 +653,8 @@ type IncreasePaidStorage struct { Amount decimal.Decimal `json:"amount"` } -// UpdateConsensusKey - -type UpdateConsensusKey struct { +// UpdateSecondaryKey - +type UpdateSecondaryKey struct { Type string `json:"type"` ID uint64 `json:"id"` Level uint64 `json:"level"` @@ -866,6 +856,7 @@ type SrGameInfo struct { OpponentLoss uint64 `json:"opponentLoss"` } +// DalPublishCommitment - type DalPublishCommitment struct { Type string `json:"type"` ID uint64 `json:"id"` @@ -882,3 +873,27 @@ type DalPublishCommitment struct { Commitment string `json:"commitment"` Status string `json:"status"` } + +// Staking - +type Staking struct { + Type string `json:"type"` + ID uint64 `json:"id"` + Level uint64 `json:"level"` + Timestamp time.Time `json:"timestamp"` + Hash string `json:"hash"` + Sender *Address `json:"sender"` + Staker *Address `json:"staker"` + Counter uint64 `json:"counter"` + GasLimit uint64 `json:"gasLimit"` + GasUsed uint64 `json:"gasUsed"` + StorageLimit uint64 `json:"storageLimit"` + BakerFee uint64 `json:"bakerFee"` + Action string `json:"action"` + RequestedAmount uint64 `json:"requestedAmount"` + Amount uint64 `json:"amount"` + Baker *Address `json:"baker"` + StakingUpdatesCount uint64 `json:"stakingUpdatesCount"` + Status string `json:"status"` + Errors []Error `json:"errors,omitempty"` + Quote *Quote `json:"quote,omitempty"` +} diff --git a/tzkt/events/tzkt.go b/tzkt/events/tzkt.go index 19be8c1..d56fafc 100644 --- a/tzkt/events/tzkt.go +++ b/tzkt/events/tzkt.go @@ -187,7 +187,7 @@ func (tzkt *TzKT) listen(ctx context.Context) { for { select { case <-ctx.Done(): - tzkt.log.Debug().Msg("listenning was stopped") + tzkt.log.Debug().Msg("listening was stopped") return case msg := <-tzkt.s.Messages(): switch typ := msg.(type) { @@ -307,16 +307,16 @@ func parseOperations(data []byte) (any, error) { result = append(result, &tzktData.Ballot{}) case tzktData.KindDoubleBaking: result = append(result, &tzktData.DoubleBaking{}) - case tzktData.KindDoubleEndorsing: - result = append(result, &tzktData.DoubleEndorsing{}) - case tzktData.KindEndorsement: - result = append(result, &tzktData.Endorsement{}) + case tzktData.KindDoubleConsensus: + result = append(result, &tzktData.DoubleConsensus{}) + case tzktData.KindAttestation: + result = append(result, &tzktData.Attestation{}) case tzktData.KindNonceRevelation: result = append(result, &tzktData.NonceRevelation{}) case tzktData.KindProposal: result = append(result, &tzktData.Proposal{}) - case tzktData.KindPreendorsement: - result = append(result, &tzktData.Preendorsement{}) + case tzktData.KindPreattestations: + result = append(result, &tzktData.Preattestation{}) case tzktData.KindRegisterGlobalConstant: result = append(result, &tzktData.RegisterConstant{}) case tzktData.KindSetDepositsLimit: @@ -341,18 +341,16 @@ func parseOperations(data []byte) (any, error) { result = append(result, &tzktData.TxRollupRemoveCommitment{}) case tzktData.KindRevelationPenalty: result = append(result, &tzktData.RevelationPenalty{}) - case tzktData.KindEndorsingReward: - result = append(result, &tzktData.EndorsingReward{}) + case tzktData.KindAttestationReward: + result = append(result, &tzktData.AttestationReward{}) case tzktData.KindBaking: result = append(result, &tzktData.Baking{}) - case tzktData.KindDoublePreendorsing: - result = append(result, &tzktData.DoublePreendorsing{}) case tzktData.KindIncreasePaidStorage: result = append(result, &tzktData.IncreasePaidStorage{}) case tzktData.KindVdfRevelation: result = append(result, &tzktData.VdfRevelation{}) - case tzktData.KindUpdateConsensusKey: - result = append(result, &tzktData.UpdateConsensusKey{}) + case tzktData.KindUpdateSecondaryKey: + result = append(result, &tzktData.UpdateSecondaryKey{}) case tzktData.KindDrainDelegate: result = append(result, &tzktData.DrainDelegate{}) case tzktData.KindSrAddMessages: @@ -371,6 +369,8 @@ func parseOperations(data []byte) (any, error) { result = append(result, &tzktData.SmartRollupRefute{}) case tzktData.KindDalPublishCommitment: result = append(result, &tzktData.DalPublishCommitment{}) + case tzktData.KindStaking: + result = append(result, &tzktData.Staking{}) default: result = append(result, make(map[string]interface{})) }