Skip to content

add SuiConsensusCommitPrologueV3 definition #45

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
20 changes: 18 additions & 2 deletions types/transactions.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package types

import (
"encoding/json"

"github.com/coming-chat/go-sui/v2/lib"
"github.com/coming-chat/go-sui/v2/sui_types"
)
Expand Down Expand Up @@ -115,18 +117,24 @@ const (

type SuiTransactionBlockKind = lib.TagJson[TransactionBlockKind]

// https://github.com/MystenLabs/sui/blob/main/crates/sui-types/src/transaction.rs#L279
type TransactionBlockKind struct {
/// A system transaction that will update epoch information on-chain.
ChangeEpoch *SuiChangeEpoch `json:"ChangeEpoch,omitempty"`
/// A system transaction used for initializing the initial state of the chain.
Genesis *SuiGenesisTransaction `json:"Genesis,omitempty"`
/// A system transaction marking the start of a series of transactions scheduled as part of a
/// checkpoint
ConsensusCommitPrologue *SuiConsensusCommitPrologue `json:"ConsensusCommitPrologue,omitempty"`
/// checkpoint (v1 - v3)
ConsensusCommitPrologue *SuiConsensusCommitPrologue `json:"ConsensusCommitPrologue,omitempty"`
ConsensusCommitPrologueV2 *json.RawMessage `json:"ConsensusCommitPrologueV2,omitempty"`
ConsensusCommitPrologueV3 *SuiConsensusCommitPrologueV3 `json:"ConsensusCommitPrologueV3,omitempty"`
/// A series of transactions where the results of one transaction can be used in future
/// transactions
ProgrammableTransaction *SuiProgrammableTransactionBlock `json:"ProgrammableTransaction,omitempty"`
// .. more transaction types go here
AuthenticatorStateUpdate *json.RawMessage `json:"AuthenticatorStateUpdate,omitempty"`
EndOfEpochTransaction *json.RawMessage `json:"EndOfEpochTransaction,omitempty"`
RandomnessStateUpdate *json.RawMessage `json:"RandomnessStateUpdate,omitempty"`
}

func (t TransactionBlockKind) Tag() string {
Expand Down Expand Up @@ -155,6 +163,14 @@ type SuiConsensusCommitPrologue struct {
CommitTimestampMs uint64 `json:"commit_timestamp_ms"`
}

type SuiConsensusCommitPrologueV3 struct {
Epoch *SafeSuiBigInt[uint64] `json:"epoch"`
Round *SafeSuiBigInt[uint64] `json:"round"`
CommitTimestampMs *SafeSuiBigInt[uint64] `json:"commit_timestamp_ms"`
SubDagIndex *SafeSuiBigInt[uint64] `json:"sub_dag_index"`
ConsensusCommitDigest sui_types.ObjectDigest `json:"consensus_commit_digest"`
}

type SuiProgrammableTransactionBlock struct {
Inputs []interface{} `json:"inputs"`
/// The transactions to be executed sequentially. A failure in any transaction will
Expand Down