Skip to content

Commit 48b2245

Browse files
Lima operaitons
1 parent a8abdee commit 48b2245

File tree

6 files changed

+90
-2
lines changed

6 files changed

+90
-2
lines changed

node/consts.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ const (
3434
KindEvent = "event"
3535
KindVdfRevelation = "vdf_revelation"
3636
KindIncreasePaidStorage = "Increase_paid_storage"
37+
KindUpdateConsensusKey = "update_consensus_key"
38+
KindDrainDelegate = "drain_delegate"
3739
)
3840

3941
const (

node/operations.go

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ type OperationConstraint interface {
1515
RegisterGlobalConstant | DoublePreendorsementEvidence | SetDepositsLimit |
1616
Preendorsement | Event | VdfRevelation | TxRollupCommit | TxRollupOrigination |
1717
TxRollupDispatchTickets | TxRollupFinalizeCommitment | TxRollupRejection |
18-
TxRollupRemoveCommitment | TxRollupSubmitBatch
18+
TxRollupRemoveCommitment | TxRollupSubmitBatch | UpdateConsensusKey |
19+
DrainDelegate
1920
}
2021

2122
// OperationGroup -
@@ -93,6 +94,10 @@ func (op *Operation) UnmarshalJSON(data []byte) error {
9394
err = parseOperation[TxRollupRemoveCommitment](data, op)
9495
case KindTxRollupSubmitBatch:
9596
err = parseOperation[TxRollupSubmitBatch](data, op)
97+
case KindUpdateConsensusKey:
98+
err = parseOperation[UpdateConsensusKey](data, op)
99+
case KindDrainDelegate:
100+
err = parseOperation[DrainDelegate](data, op)
96101

97102
}
98103
return err
@@ -625,3 +630,24 @@ type TxRollupSubmitBatch struct {
625630
Content string `json:"content"`
626631
Metadata *ManagerOperationMetadata `json:"metadata,omitempty"`
627632
}
633+
634+
// UpdateConsensusKey -
635+
type UpdateConsensusKey struct {
636+
Kind string `json:"kind"`
637+
Source string `json:"source"`
638+
Fee string `json:"fee"`
639+
Counter string `json:"counter"`
640+
GasLimit string `json:"gas_limit"`
641+
StorageLimit string `json:"storage_limit"`
642+
Pk string `json:"pk"`
643+
Metadata *ManagerOperationMetadata `json:"metadata,omitempty"`
644+
}
645+
646+
// DrainDelegate -
647+
type DrainDelegate struct {
648+
Kind string `json:"kind"`
649+
ConsensusKey string `json:"consensus_key"`
650+
Delegate string `json:"delegate"`
651+
Destination string `json:"destination"`
652+
Metadata *ManagerOperationMetadata `json:"metadata,omitempty"`
653+
}

tzkt/api/operations.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,3 +203,15 @@ func (tzkt *API) GetIncreasePaidStorage(ctx context.Context, filters map[string]
203203
err = tzkt.json(ctx, "/v1/operations/increase_paid_storage", filters, false, &operations)
204204
return
205205
}
206+
207+
// GetUpdateConsensusKey -
208+
func (tzkt *API) GetUpdateConsensusKey(ctx context.Context, filters map[string]string) (operations []data.UpdateConsensusKey, err error) {
209+
err = tzkt.json(ctx, "/v1/operations/update_consensus_key", filters, false, &operations)
210+
return
211+
}
212+
213+
// GetDrainDelegates -
214+
func (tzkt *API) GetDrainDelegates(ctx context.Context, filters map[string]string) (operations []data.DrainDelegate, err error) {
215+
err = tzkt.json(ctx, "/v1/operations/drain_delegate", filters, false, &operations)
216+
return
217+
}

tzkt/data/consts.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ const (
3232
KindEndorsingReward = "endorsing_reward"
3333
KindVdfRevelation = "vdf_revelation"
3434
KindIncreasePaidStorage = "increase_paid_storage"
35+
KindUpdateConsensusKey = "update_consensus_key"
36+
KindDrainDelegate = "drain_delegate"
3537
)
3638

3739
// urls

tzkt/data/operations.go

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ type OperationConstraint interface {
1414
Ballot | Proposal | Activation | TransferTicket | TxRollupCommit | TxRollupDispatchTicket |
1515
TxRollupFinalizeCommitment | TxRollupOrigination | TxRollupRejection | TxRollupRemoveCommitment |
1616
TxRollupReturnBond | TxRollupSubmitBatch | NonceRevelation | DoubleBaking | DoubleEndorsing | SetDepositsLimit |
17-
Baking | RevelationPenalty | EndorsingReward | VdfRevelation | IncreasePaidStorage
17+
Baking | RevelationPenalty | EndorsingReward | VdfRevelation | IncreasePaidStorage | DrainDelegate |
18+
UpdateConsensusKey
1819
}
1920

2021
// Operation -
@@ -660,3 +661,40 @@ type IncreasePaidStorage struct {
660661
Contract Account `json:"contract"`
661662
Amount decimal.Decimal `json:"amount"`
662663
}
664+
665+
// UpdateConsensusKey -
666+
type UpdateConsensusKey struct {
667+
Type string `json:"type"`
668+
ID uint64 `json:"id"`
669+
Level uint64 `json:"level"`
670+
Timestamp time.Time `json:"timestamp"`
671+
Block string `json:"block"`
672+
Hash string `json:"hash"`
673+
Sender Account `json:"sender"`
674+
Counter uint64 `json:"counter"`
675+
GasLimit uint64 `json:"gasLimit"`
676+
GasUsed uint64 `json:"gasUsed"`
677+
StorageLimit uint64 `json:"storageLimit"`
678+
BakerFee uint64 `json:"bakerFee"`
679+
Status string `json:"status"`
680+
ActivationCycle uint64 `json:"activationCycle"`
681+
PublicKey string `json:"publicKey"`
682+
PublicKeyHash string `json:"publicKeyHash"`
683+
Errors []Error `json:"errors,omitempty"`
684+
Quote *Quote `json:"quote,omitempty"`
685+
}
686+
687+
// DrainDelegate -
688+
type DrainDelegate struct {
689+
Type string `json:"type"`
690+
ID uint64 `json:"id"`
691+
Level uint64 `json:"level"`
692+
Timestamp time.Time `json:"timestamp"`
693+
Block string `json:"block"`
694+
Hash string `json:"hash"`
695+
Delegate Account `json:"delegate"`
696+
Target Account `json:"target"`
697+
Amount uint64 `json:"amount"`
698+
Fee uint64 `json:"fee"`
699+
Quote *Quote `json:"quote,omitempty"`
700+
}

tzkt/events/tzkt.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,14 @@ func parseOperations(data []byte) (any, error) {
312312
result = append(result, &tzktData.Baking{})
313313
case tzktData.KindDoublePreendorsing:
314314
result = append(result, &tzktData.DoublePreendorsing{})
315+
case tzktData.KindIncreasePaidStorage:
316+
result = append(result, &tzktData.IncreasePaidStorage{})
317+
case tzktData.KindVdfRevelation:
318+
result = append(result, &tzktData.VdfRevelation{})
319+
case tzktData.KindUpdateConsensusKey:
320+
result = append(result, &tzktData.UpdateConsensusKey{})
321+
case tzktData.KindDrainDelegate:
322+
result = append(result, &tzktData.DrainDelegate{})
315323
default:
316324
result = append(result, make(map[string]interface{}))
317325
}

0 commit comments

Comments
 (0)