Skip to content

Commit d92df8e

Browse files
TzKT API: Mumbai
1 parent 58d20a9 commit d92df8e

File tree

5 files changed

+222
-7
lines changed

5 files changed

+222
-7
lines changed

.github/workflows/test.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@ jobs:
66
name: lint
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v2
9+
- uses: actions/setup-go@v3
10+
with:
11+
go-version: '1.19'
12+
- uses: actions/checkout@v3
1013
- name: golangci-lint
11-
uses: golangci/golangci-lint-action@v2.3.0
14+
uses: golangci/golangci-lint-action@v3
1215
with:
13-
version: v1.49.0
14-
args: --timeout=2m --go=1.18
16+
version: v1.51.2
17+
args: --timeout=3m
1518
test:
1619
runs-on: ubuntu-latest
1720
steps:

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/dipdup-net/go-lib
22

3-
go 1.18
3+
go 1.19
44

55
require (
66
github.com/dave/jennifer v1.4.1

tzkt/api/operations.go

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,3 +215,45 @@ func (tzkt *API) GetDrainDelegates(ctx context.Context, filters map[string]strin
215215
err = tzkt.json(ctx, "/v1/operations/drain_delegate", filters, false, &operations)
216216
return
217217
}
218+
219+
// GetSmartRollupAddMessages -
220+
func (tzkt *API) GetSmartRollupAddMessages(ctx context.Context, filters map[string]string) (operations []data.SmartRollupAddMessage, err error) {
221+
err = tzkt.json(ctx, "/v1/operations/sr_add_messages", filters, false, &operations)
222+
return
223+
}
224+
225+
// GetSmartRollupCement -
226+
func (tzkt *API) GetSmartRollupCement(ctx context.Context, filters map[string]string) (operations []data.SmartRollupCement, err error) {
227+
err = tzkt.json(ctx, "/v1/operations/sr_cement", filters, false, &operations)
228+
return
229+
}
230+
231+
// GetSmartRollupExecute -
232+
func (tzkt *API) GetSmartRollupExecute(ctx context.Context, filters map[string]string) (operations []data.SmartRollupExecute, err error) {
233+
err = tzkt.json(ctx, "/v1/operations/sr_execute", filters, false, &operations)
234+
return
235+
}
236+
237+
// GetSmartRollupOriginate -
238+
func (tzkt *API) GetSmartRollupOriginate(ctx context.Context, filters map[string]string) (operations []data.SmartRollupOriginate, err error) {
239+
err = tzkt.json(ctx, "/v1/operations/sr_originate", filters, false, &operations)
240+
return
241+
}
242+
243+
// GetSmartRollupPublish -
244+
func (tzkt *API) GetSmartRollupPublish(ctx context.Context, filters map[string]string) (operations []data.SmartRollupPublish, err error) {
245+
err = tzkt.json(ctx, "/v1/operations/sr_publish", filters, false, &operations)
246+
return
247+
}
248+
249+
// GetSmartRollupRecoverBond -
250+
func (tzkt *API) GetSmartRollupRecoverBond(ctx context.Context, filters map[string]string) (operations []data.SmartRollupRecoverBond, err error) {
251+
err = tzkt.json(ctx, "/v1/operations/sr_recover_bond", filters, false, &operations)
252+
return
253+
}
254+
255+
// GetSmartRollupRefute -
256+
func (tzkt *API) GetSmartRollupRefute(ctx context.Context, filters map[string]string) (operations []data.SmartRollupRefute, err error) {
257+
err = tzkt.json(ctx, "/v1/operations/sr_refute", filters, false, &operations)
258+
return
259+
}

tzkt/data/consts.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ const (
3434
KindIncreasePaidStorage = "increase_paid_storage"
3535
KindUpdateConsensusKey = "update_consensus_key"
3636
KindDrainDelegate = "drain_delegate"
37+
KindSrAddMessages = "sr_add_messages"
38+
KindSrCement = "sr_cement"
39+
KindSrExecute = "sr_execute"
40+
KindSrOriginate = "sr_originate"
41+
KindSrPublish = "sr_publish"
42+
KindSrRecoverBond = "sr_recover_bond"
43+
KindSrRefute = "sr_recover_bond"
3744
)
3845

3946
// urls

tzkt/data/operations.go

Lines changed: 165 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ 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 | DrainDelegate |
18-
UpdateConsensusKey
17+
DoublePreendorsing | Baking | RevelationPenalty | EndorsingReward | VdfRevelation | IncreasePaidStorage |
18+
DrainDelegate | UpdateConsensusKey | SmartRollupAddMessage | SmartRollupCement | SmartRollupExecute |
19+
SmartRollupOriginate | SmartRollupPublish | SmartRollupRefute | SmartRollupRecoverBond
1920
}
2021

2122
// Operation -
@@ -698,3 +699,165 @@ type DrainDelegate struct {
698699
Fee uint64 `json:"fee"`
699700
Quote *Quote `json:"quote,omitempty"`
700701
}
702+
703+
// SmartRollupAddMessage -
704+
type SmartRollupAddMessage struct {
705+
Type string `json:"type"`
706+
ID uint64 `json:"id"`
707+
Level uint64 `json:"level"`
708+
Timestamp time.Time `json:"timestamp"`
709+
Hash string `json:"hash"`
710+
Sender *Address `json:"sender,omitempty"`
711+
Counter uint64 `json:"counter"`
712+
GasLimit uint64 `json:"gasLimit"`
713+
GasUsed uint64 `json:"gasUsed"`
714+
StorageLimit uint64 `json:"storageLimit"`
715+
BakerFee uint64 `json:"bakerFee"`
716+
Status string `json:"status"`
717+
MessagesCount uint64 `json:"messagesCount"`
718+
Errors []Error `json:"errors,omitempty"`
719+
Quote *Quote `json:"quote,omitempty"`
720+
}
721+
722+
// SmartRollupCement -
723+
type SmartRollupCement struct {
724+
Type string `json:"type"`
725+
ID uint64 `json:"id"`
726+
Level uint64 `json:"level"`
727+
Timestamp time.Time `json:"timestamp"`
728+
Hash string `json:"hash"`
729+
Sender *Address `json:"sender,omitempty"`
730+
Counter uint64 `json:"counter"`
731+
GasLimit uint64 `json:"gasLimit"`
732+
GasUsed uint64 `json:"gasUsed"`
733+
StorageLimit uint64 `json:"storageLimit"`
734+
BakerFee uint64 `json:"bakerFee"`
735+
Status string `json:"status"`
736+
Rollup *Address `json:"rollup,omitempty"`
737+
Commitment *SrCommitmentInfo `json:"commitment,omitempty"`
738+
Errors []Error `json:"errors,omitempty"`
739+
Quote *Quote `json:"quote,omitempty"`
740+
}
741+
742+
// SrCommitmentInfo -
743+
type SrCommitmentInfo struct {
744+
ID uint64 `json:"id"`
745+
Initiator *Address `json:"initiator,omitempty"`
746+
InboxLevel uint64 `json:"inboxLevel"`
747+
State string `json:"state"`
748+
Hash string `json:"hash"`
749+
Ticks uint64 `json:"ticks"`
750+
FirstLevel uint64 `json:"firstLevel"`
751+
FirstTime string `json:"firstTime"`
752+
}
753+
754+
// SmartRollupExecute -
755+
type SmartRollupExecute struct {
756+
Type string `json:"type"`
757+
ID uint64 `json:"id"`
758+
Level uint64 `json:"level"`
759+
Timestamp time.Time `json:"timestamp"`
760+
Hash string `json:"hash"`
761+
Sender *Address `json:"sender,omitempty"`
762+
Counter uint64 `json:"counter"`
763+
GasLimit uint64 `json:"gasLimit"`
764+
GasUsed uint64 `json:"gasUsed"`
765+
StorageLimit uint64 `json:"storageLimit"`
766+
BakerFee uint64 `json:"bakerFee"`
767+
Status string `json:"status"`
768+
Rollup *Address `json:"rollup,omitempty"`
769+
Commitment *SrCommitmentInfo `json:"commitment,omitempty"`
770+
Errors []Error `json:"errors,omitempty"`
771+
Quote *Quote `json:"quote,omitempty"`
772+
}
773+
774+
// SmartRollupOriginate -
775+
type SmartRollupOriginate struct {
776+
Type string `json:"type"`
777+
ID uint64 `json:"id"`
778+
Level uint64 `json:"level"`
779+
Timestamp time.Time `json:"timestamp"`
780+
Hash string `json:"hash"`
781+
Sender *Address `json:"sender,omitempty"`
782+
Counter uint64 `json:"counter"`
783+
GasLimit uint64 `json:"gasLimit"`
784+
GasUsed uint64 `json:"gasUsed"`
785+
StorageLimit uint64 `json:"storageLimit"`
786+
BakerFee uint64 `json:"bakerFee"`
787+
Status string `json:"status"`
788+
Rollup *Address `json:"rollup,omitempty"`
789+
ParameterType stdJSON.RawMessage `json:"parameterType,omitempty"`
790+
Errors []Error `json:"errors,omitempty"`
791+
Quote *Quote `json:"quote,omitempty"`
792+
}
793+
794+
// SmartRollupPublish -
795+
type SmartRollupPublish struct {
796+
Type string `json:"type"`
797+
ID uint64 `json:"id"`
798+
Level uint64 `json:"level"`
799+
Timestamp time.Time `json:"timestamp"`
800+
Hash string `json:"hash"`
801+
Sender *Address `json:"sender,omitempty"`
802+
Counter uint64 `json:"counter"`
803+
GasLimit uint64 `json:"gasLimit"`
804+
GasUsed uint64 `json:"gasUsed"`
805+
StorageLimit uint64 `json:"storageLimit"`
806+
BakerFee uint64 `json:"bakerFee"`
807+
Status string `json:"status"`
808+
Rollup *Address `json:"rollup,omitempty"`
809+
Commitment *SrCommitmentInfo `json:"commitment,omitempty"`
810+
Bond uint64 `json:"bond"`
811+
}
812+
813+
// SmartRollupRecoverBond -
814+
type SmartRollupRecoverBond struct {
815+
Type string `json:"type"`
816+
ID uint64 `json:"id"`
817+
Level uint64 `json:"level"`
818+
Timestamp time.Time `json:"timestamp"`
819+
Hash string `json:"hash"`
820+
Sender *Address `json:"sender,omitempty"`
821+
Counter uint64 `json:"counter"`
822+
GasLimit uint64 `json:"gasLimit"`
823+
GasUsed uint64 `json:"gasUsed"`
824+
StorageLimit uint64 `json:"storageLimit"`
825+
BakerFee uint64 `json:"bakerFee"`
826+
Status string `json:"status"`
827+
Rollup *Address `json:"rollup,omitempty"`
828+
Staker *Address `json:"staker,omitempty"`
829+
Bond uint64 `json:"bond"`
830+
}
831+
832+
// SmartRollupRefute
833+
type SmartRollupRefute struct {
834+
Type string `json:"type"`
835+
ID uint64 `json:"id"`
836+
Level uint64 `json:"level"`
837+
Timestamp time.Time `json:"timestamp"`
838+
Hash string `json:"hash"`
839+
Sender *Address `json:"sender,omitempty"`
840+
Counter uint64 `json:"counter"`
841+
GasLimit uint64 `json:"gasLimit"`
842+
GasUsed uint64 `json:"gasUsed"`
843+
StorageLimit uint64 `json:"storageLimit"`
844+
BakerFee uint64 `json:"bakerFee"`
845+
Status string `json:"status"`
846+
Rollup *Address `json:"rollup,omitempty"`
847+
Game *SrGameInfo `json:"game"`
848+
Move string `json:"move"`
849+
GameStatus string `json:"gameStatus"`
850+
}
851+
852+
// SrGameInfo -
853+
type SrGameInfo struct {
854+
ID uint64 `json:"id"`
855+
Initiator *Address `json:"initiator,omitempty"`
856+
InitiatorCommitment *SrCommitmentInfo `json:"initiatorCommitment,omitempty"`
857+
Opponent *Address `json:"opponent,omitempty"`
858+
OpponentCommitment *SrCommitmentInfo `json:"opponentCommitment,omitempty"`
859+
InitiatorReward uint64 `json:"initiatorReward"`
860+
InitiatorLoss uint64 `json:"initiatorLoss"`
861+
OpponentReward uint64 `json:"opponentReward"`
862+
OpponentLoss uint64 `json:"opponentLoss"`
863+
}

0 commit comments

Comments
 (0)