-
Notifications
You must be signed in to change notification settings - Fork 7
/
Transaction.go
48 lines (39 loc) · 1.1 KB
/
Transaction.go
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
package zksync
type TransactionType string
type TransactionStatus int
const (
TransactionStatusSent TransactionStatus = iota
TransactionStatusCommitted
TransactionStatusVerified
)
func (t TransactionType) getType() interface{} {
switch t {
case TransactionTypeChangePubKeyOnchain, TransactionTypeChangePubKeyECDSA, TransactionTypeChangePubKeyCREATE2:
// custom object instead of string
return TransactionTypeChangePubKey{ChangePubKey: string(t)}
default:
return string(t)
}
}
type ZksTransaction interface {
getType() string
}
type SignedTransaction struct {
Transaction ZksTransaction `json:"tx"`
EthereumSignature *EthSignature `json:"signature"`
}
type TransactionDetails struct {
Executed bool `json:"executed"`
Success bool `json:"success"`
FailReason string `json:"failReason"`
Block *BlockInfo `json:"block"`
}
type BlockInfo struct {
BlockNumber uint64 `json:"blockNumber"`
Committed bool `json:"committed"`
Verified bool `json:"verified"`
}
type EthOpInfo struct {
Executed bool `json:"executed"`
Block *BlockInfo `json:"block"`
}