-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtransaction.go
More file actions
64 lines (49 loc) · 1.83 KB
/
Copy pathtransaction.go
File metadata and controls
64 lines (49 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// internal/daemon/types/transaction.go
package types
import "encoding/json"
// Transaction phase constants.
const (
TxPhasePending = "Pending"
TxPhaseBuilding = "Building"
TxPhaseSigning = "Signing"
TxPhaseSubmitted = "Submitted"
TxPhaseConfirmed = "Confirmed"
TxPhaseFailed = "Failed"
)
// Transaction represents a blockchain transaction operation.
type Transaction struct {
Metadata ResourceMeta `json:"metadata"`
Spec TransactionSpec `json:"spec"`
Status TransactionStatus `json:"status"`
}
// TransactionSpec defines the desired transaction.
type TransactionSpec struct {
// DevnetRef is the name of the target Devnet.
DevnetRef string `json:"devnetRef"`
// TxType is the transaction type (e.g., "gov/vote", "staking/delegate").
TxType string `json:"txType"`
// Signer identifies who signs the tx (e.g., "validator:0", "account:alice").
Signer string `json:"signer"`
// Payload is the transaction-specific data (JSON).
Payload json.RawMessage `json:"payload"`
// SDKVersion overrides auto-detected SDK version.
SDKVersion string `json:"sdkVersion,omitempty"`
// GasLimit sets the gas limit for the transaction.
// If not specified, defaults to 200000.
GasLimit uint64 `json:"gasLimit,omitempty"`
}
// TransactionStatus defines the observed state of a Transaction.
type TransactionStatus struct {
// Phase is the current phase.
Phase string `json:"phase"`
// Message is a human-readable status message.
Message string `json:"message,omitempty"`
// TxHash is the transaction hash.
TxHash string `json:"txHash,omitempty"`
// Height is the block height where tx was included.
Height int64 `json:"height,omitempty"`
// GasUsed is the gas consumed by the transaction.
GasUsed int64 `json:"gasUsed,omitempty"`
// Error contains error details if phase is Failed.
Error string `json:"error,omitempty"`
}