Skip to content

Commit 50fb80e

Browse files
authored
Merge pull request #345 from multiversx/timestamp-ms-all-structuress
New timestamp field in all structures
2 parents efa1900 + f4cb56b commit 50fb80e

File tree

160 files changed

+929
-539
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+929
-539
lines changed

data/account.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package data
22

33
import (
4-
"time"
5-
64
"github.com/multiversx/mx-chain-core-go/data/alteredAccount"
75
)
86

@@ -22,7 +20,8 @@ type AccountInfo struct {
2220
DeveloperRewards string `json:"developerRewards,omitempty"`
2321
DeveloperRewardsNum float64 `json:"developerRewardsNum,omitempty"`
2422
Data *TokenMetaData `json:"data,omitempty"`
25-
Timestamp time.Duration `json:"timestamp,omitempty"`
23+
Timestamp uint64 `json:"timestamp,omitempty"`
24+
TimestampMs uint64 `json:"timestampMs,omitempty"`
2625
Type string `json:"type,omitempty"`
2726
CurrentOwner string `json:"currentOwner,omitempty"`
2827
ShardID uint32 `json:"shardID"`
@@ -50,15 +49,16 @@ type TokenMetaData struct {
5049

5150
// AccountBalanceHistory represents an entry in the user accounts balances history
5251
type AccountBalanceHistory struct {
53-
Address string `json:"address"`
54-
Timestamp time.Duration `json:"timestamp"`
55-
Balance string `json:"balance"`
56-
Token string `json:"token,omitempty"`
57-
Identifier string `json:"identifier,omitempty"`
58-
TokenNonce uint64 `json:"tokenNonce,omitempty"`
59-
IsSender bool `json:"isSender,omitempty"`
60-
IsSmartContract bool `json:"isSmartContract,omitempty"`
61-
ShardID uint32 `json:"shardID"`
52+
Address string `json:"address"`
53+
Timestamp uint64 `json:"timestamp"`
54+
TimestampMs uint64 `json:"timestampMs,omitempty"`
55+
Balance string `json:"balance"`
56+
Token string `json:"token,omitempty"`
57+
Identifier string `json:"identifier,omitempty"`
58+
TokenNonce uint64 `json:"tokenNonce,omitempty"`
59+
IsSender bool `json:"isSender,omitempty"`
60+
IsSmartContract bool `json:"isSmartContract,omitempty"`
61+
ShardID uint32 `json:"shardID"`
6262
}
6363

6464
// Account is a structure that is needed for regular accounts

data/block.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package data
22

33
import (
4-
"time"
5-
64
"github.com/multiversx/mx-chain-core-go/data/api"
75
)
86

@@ -24,7 +22,8 @@ type Block struct {
2422
PubKeyBitmap string `json:"pubKeyBitmap"`
2523
Size int64 `json:"size"`
2624
SizeTxs int64 `json:"sizeTxs"`
27-
Timestamp time.Duration `json:"timestamp"`
25+
Timestamp uint64 `json:"timestamp"`
26+
TimestampMs uint64 `json:"timestampMs,omitempty"`
2827
StateRootHash string `json:"stateRootHash"`
2928
PrevHash string `json:"prevHash"`
3029
ShardID uint32 `json:"shardId"`
@@ -104,14 +103,15 @@ type EpochStartShardData struct {
104103

105104
// Miniblock is a structure containing miniblock information
106105
type Miniblock struct {
107-
Hash string `json:"hash,omitempty"`
108-
SenderShardID uint32 `json:"senderShard"`
109-
ReceiverShardID uint32 `json:"receiverShard"`
110-
SenderBlockHash string `json:"senderBlockHash,omitempty"`
111-
ReceiverBlockHash string `json:"receiverBlockHash,omitempty"`
112-
Type string `json:"type"`
113-
ProcessingTypeOnSource string `json:"procTypeS,omitempty"`
114-
ProcessingTypeOnDestination string `json:"procTypeD,omitempty"`
115-
Timestamp time.Duration `json:"timestamp"`
116-
Reserved []byte `json:"reserved,omitempty"`
106+
Hash string `json:"hash,omitempty"`
107+
SenderShardID uint32 `json:"senderShard"`
108+
ReceiverShardID uint32 `json:"receiverShard"`
109+
SenderBlockHash string `json:"senderBlockHash,omitempty"`
110+
ReceiverBlockHash string `json:"receiverBlockHash,omitempty"`
111+
Type string `json:"type"`
112+
ProcessingTypeOnSource string `json:"procTypeS,omitempty"`
113+
ProcessingTypeOnDestination string `json:"procTypeD,omitempty"`
114+
Timestamp uint64 `json:"timestamp"`
115+
TimestampMs uint64 `json:"timestampMs,omitempty"`
116+
Reserved []byte `json:"reserved,omitempty"`
117117
}

data/data.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package data
22

33
import (
44
"encoding/json"
5-
"time"
65
)
76

87
// ValidatorsPublicKeys is a structure containing fields for validators public keys
@@ -24,12 +23,13 @@ type ValidatorRatingInfo struct {
2423

2524
// RoundInfo is a structure containing block signers and shard id
2625
type RoundInfo struct {
27-
Round uint64 `json:"round"`
28-
SignersIndexes []uint64 `json:"signersIndexes"`
29-
BlockWasProposed bool `json:"blockWasProposed"`
30-
ShardId uint32 `json:"shardId"`
31-
Epoch uint32 `json:"epoch"`
32-
Timestamp time.Duration `json:"timestamp"`
26+
Round uint64 `json:"round"`
27+
SignersIndexes []uint64 `json:"signersIndexes"`
28+
BlockWasProposed bool `json:"blockWasProposed"`
29+
ShardId uint32 `json:"shardId"`
30+
Epoch uint32 `json:"epoch"`
31+
Timestamp uint64 `json:"timestamp"`
32+
TimestampMs uint64 `json:"timestampMs,omitempty"`
3333
}
3434

3535
// EpochInfo holds the information about epoch

data/delegators.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
package data
22

3-
import "time"
4-
53
// Delegator is a structure that is needed to store information about a delegator
64
type Delegator struct {
7-
Address string `json:"address"`
8-
Contract string `json:"contract"`
9-
Timestamp time.Duration `json:"timestamp"`
10-
ActiveStake string `json:"activeStake"`
11-
ActiveStakeNum float64 `json:"activeStakeNum"`
12-
ShouldDelete bool `json:"-"`
13-
UnDelegateInfo *UnDelegate `json:"-"`
14-
WithdrawFundIDs []string `json:"-"`
5+
Address string `json:"address"`
6+
Contract string `json:"contract"`
7+
Timestamp uint64 `json:"timestamp"`
8+
TimestampMs uint64 `json:"timestampMs,omitempty"`
9+
ActiveStake string `json:"activeStake"`
10+
ActiveStakeNum float64 `json:"activeStakeNum"`
11+
ShouldDelete bool `json:"-"`
12+
UnDelegateInfo *UnDelegate `json:"-"`
13+
WithdrawFundIDs []string `json:"-"`
1514
}
1615

1716
// UnDelegate is a structure that is needed to store information about user unDelegate position
1817
type UnDelegate struct {
19-
Timestamp time.Duration `json:"timestamp"`
20-
ID string `json:"id"`
21-
Value string `json:"value"`
22-
ValueNum float64 `json:"valueNum"`
18+
Timestamp uint64 `json:"timestamp"`
19+
TimestampMs uint64 `json:"timestampMs,omitempty"`
20+
ID string `json:"id"`
21+
Value string `json:"value"`
22+
ValueNum float64 `json:"valueNum"`
2323
}

data/event.go

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
package data
22

3-
import "time"
4-
53
// LogEvent is the dto for the log event structure
64
type LogEvent struct {
7-
UUID string `json:"uuid"`
8-
ID string `json:"-"`
9-
TxHash string `json:"txHash"`
10-
OriginalTxHash string `json:"originalTxHash,omitempty"`
11-
LogAddress string `json:"logAddress"`
12-
Address string `json:"address"`
13-
Identifier string `json:"identifier"`
14-
Data string `json:"data,omitempty"`
15-
AdditionalData []string `json:"additionalData,omitempty"`
16-
Topics []string `json:"topics"`
17-
Order int `json:"order"`
18-
TxOrder int `json:"txOrder"`
19-
ShardID uint32 `json:"shardID"`
20-
Timestamp time.Duration `json:"timestamp,omitempty"`
5+
UUID string `json:"uuid"`
6+
ID string `json:"-"`
7+
TxHash string `json:"txHash"`
8+
OriginalTxHash string `json:"originalTxHash,omitempty"`
9+
LogAddress string `json:"logAddress"`
10+
Address string `json:"address"`
11+
Identifier string `json:"identifier"`
12+
Data string `json:"data,omitempty"`
13+
AdditionalData []string `json:"additionalData,omitempty"`
14+
Topics []string `json:"topics"`
15+
Order int `json:"order"`
16+
TxOrder int `json:"txOrder"`
17+
ShardID uint32 `json:"shardID"`
18+
Timestamp uint64 `json:"timestamp,omitempty"`
19+
TimestampMs uint64 `json:"timestampMs,omitempty"`
2120
}

data/logs.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
package data
22

33
import (
4-
"time"
5-
64
"github.com/multiversx/mx-chain-core-go/data/outport"
75
"github.com/multiversx/mx-chain-es-indexer-go/process/elasticproc/tokeninfo"
86
)
97

108
// Logs holds all the fields needed for a logs structure
119
type Logs struct {
12-
UUID string `json:"uuid"`
13-
ID string `json:"-"`
14-
OriginalTxHash string `json:"originalTxHash,omitempty"`
15-
Address string `json:"address"`
16-
Events []*Event `json:"events"`
17-
Timestamp time.Duration `json:"timestamp,omitempty"`
10+
UUID string `json:"uuid"`
11+
ID string `json:"-"`
12+
OriginalTxHash string `json:"originalTxHash,omitempty"`
13+
Address string `json:"address"`
14+
Events []*Event `json:"events"`
15+
Timestamp uint64 `json:"timestamp,omitempty"`
16+
TimestampMs uint64 `json:"timestampMs,omitempty"`
1817
}
1918

2019
// Event holds all the fields needed for an event structure

data/scDeploy.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@ type ScDeployInfo struct {
77
CurrentOwner string `json:"currentOwner"`
88
CodeHash []byte `json:"initialCodeHash"`
99
Timestamp uint64 `json:"timestamp"`
10+
TimestampMs uint64 `json:"timestampMs,omitempty"`
1011
Upgrades []*Upgrade `json:"upgrades"`
1112
OwnersHistory []*OwnerData `json:"owners"`
1213
}
1314

1415
// Upgrade is the DTO that holds information about a smart contract upgrade
1516
type Upgrade struct {
16-
TxHash string `json:"upgradeTxHash"`
17-
Upgrader string `json:"upgrader"`
18-
Timestamp uint64 `json:"timestamp"`
19-
CodeHash []byte `json:"codeHash"`
17+
TxHash string `json:"upgradeTxHash"`
18+
Upgrader string `json:"upgrader"`
19+
Timestamp uint64 `json:"timestamp"`
20+
TimestampMs uint64 `json:"timestampMs"`
21+
CodeHash []byte `json:"codeHash"`
2022
}

data/scresult.go

Lines changed: 43 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,48 @@
11
package data
22

3-
import "time"
4-
53
// ScResult is a structure containing all the fields that need to be saved for a smart contract result
64
type ScResult struct {
7-
UUID string `json:"uuid"`
8-
Hash string `json:"-"`
9-
MBHash string `json:"miniBlockHash,omitempty"`
10-
Nonce uint64 `json:"nonce"`
11-
GasLimit uint64 `json:"gasLimit"`
12-
GasPrice uint64 `json:"gasPrice"`
13-
Value string `json:"value"`
14-
ValueNum float64 `json:"valueNum"`
15-
Sender string `json:"sender"`
16-
Receiver string `json:"receiver"`
17-
SenderShard uint32 `json:"senderShard"`
18-
ReceiverShard uint32 `json:"receiverShard"`
19-
RelayerAddr string `json:"relayerAddr,omitempty"`
20-
RelayedValue string `json:"relayedValue,omitempty"`
21-
Code string `json:"code,omitempty"`
22-
Data []byte `json:"data,omitempty"`
23-
PrevTxHash string `json:"prevTxHash"`
24-
OriginalTxHash string `json:"originalTxHash"`
25-
CallType string `json:"callType"`
26-
CodeMetadata []byte `json:"codeMetaData,omitempty"`
27-
ReturnMessage string `json:"returnMessage,omitempty"`
28-
Timestamp time.Duration `json:"timestamp"`
29-
HasOperations bool `json:"hasOperations,omitempty"`
30-
Type string `json:"type,omitempty"`
31-
Status string `json:"status,omitempty"`
32-
Tokens []string `json:"tokens,omitempty"`
33-
ESDTValues []string `json:"esdtValues,omitempty"`
34-
ESDTValuesNum []float64 `json:"esdtValuesNum,omitempty"`
35-
Receivers []string `json:"receivers,omitempty"`
36-
ReceiversShardIDs []uint32 `json:"receiversShardIDs,omitempty"`
37-
Operation string `json:"operation,omitempty"`
38-
Function string `json:"function,omitempty"`
39-
IsRelayed bool `json:"isRelayed,omitempty"`
40-
CanBeIgnored bool `json:"canBeIgnored,omitempty"`
41-
OriginalSender string `json:"originalSender,omitempty"`
42-
HasLogs bool `json:"hasLogs,omitempty"`
43-
Epoch uint32 `json:"epoch"`
44-
ExecutionOrder int `json:"-"`
45-
SenderAddressBytes []byte `json:"-"`
46-
InitialTxGasUsed uint64 `json:"-"`
47-
InitialTxFee string `json:"-"`
48-
GasRefunded uint64 `json:"-"`
5+
UUID string `json:"uuid"`
6+
Hash string `json:"-"`
7+
MBHash string `json:"miniBlockHash,omitempty"`
8+
Nonce uint64 `json:"nonce"`
9+
GasLimit uint64 `json:"gasLimit"`
10+
GasPrice uint64 `json:"gasPrice"`
11+
Value string `json:"value"`
12+
ValueNum float64 `json:"valueNum"`
13+
Sender string `json:"sender"`
14+
Receiver string `json:"receiver"`
15+
SenderShard uint32 `json:"senderShard"`
16+
ReceiverShard uint32 `json:"receiverShard"`
17+
RelayerAddr string `json:"relayerAddr,omitempty"`
18+
RelayedValue string `json:"relayedValue,omitempty"`
19+
Code string `json:"code,omitempty"`
20+
Data []byte `json:"data,omitempty"`
21+
PrevTxHash string `json:"prevTxHash"`
22+
OriginalTxHash string `json:"originalTxHash"`
23+
CallType string `json:"callType"`
24+
CodeMetadata []byte `json:"codeMetaData,omitempty"`
25+
ReturnMessage string `json:"returnMessage,omitempty"`
26+
Timestamp uint64 `json:"timestamp"`
27+
TimestampMs uint64 `json:"timestampMs,omitempty"`
28+
HasOperations bool `json:"hasOperations,omitempty"`
29+
Type string `json:"type,omitempty"`
30+
Status string `json:"status,omitempty"`
31+
Tokens []string `json:"tokens,omitempty"`
32+
ESDTValues []string `json:"esdtValues,omitempty"`
33+
ESDTValuesNum []float64 `json:"esdtValuesNum,omitempty"`
34+
Receivers []string `json:"receivers,omitempty"`
35+
ReceiversShardIDs []uint32 `json:"receiversShardIDs,omitempty"`
36+
Operation string `json:"operation,omitempty"`
37+
Function string `json:"function,omitempty"`
38+
IsRelayed bool `json:"isRelayed,omitempty"`
39+
CanBeIgnored bool `json:"canBeIgnored,omitempty"`
40+
OriginalSender string `json:"originalSender,omitempty"`
41+
HasLogs bool `json:"hasLogs,omitempty"`
42+
Epoch uint32 `json:"epoch"`
43+
ExecutionOrder int `json:"-"`
44+
SenderAddressBytes []byte `json:"-"`
45+
InitialTxGasUsed uint64 `json:"-"`
46+
InitialTxFee string `json:"-"`
47+
GasRefunded uint64 `json:"-"`
4948
}

data/tokens.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package data
22

33
import (
4-
"time"
5-
64
"github.com/multiversx/mx-chain-core-go/core"
75
)
86

@@ -56,7 +54,8 @@ type TokenInfo struct {
5654
NumDecimals uint64 `json:"numDecimals"`
5755
Type string `json:"type,omitempty"`
5856
Nonce uint64 `json:"nonce,omitempty"`
59-
Timestamp time.Duration `json:"timestamp,omitempty"`
57+
Timestamp uint64 `json:"timestamp,omitempty"`
58+
TimestampMs uint64 `json:"timestampMs,omitempty"`
6059
Data *TokenMetaData `json:"data,omitempty"`
6160
OwnersHistory []*OwnerData `json:"ownersHistory,omitempty"`
6261
TransferOwnership bool `json:"-"`
@@ -80,9 +79,10 @@ type TokenProperties struct {
8079

8180
// OwnerData is a structure that is needed to store information about an owner
8281
type OwnerData struct {
83-
TxHash string `json:"txHash,omitempty"`
84-
Address string `json:"address"`
85-
Timestamp time.Duration `json:"timestamp"`
82+
TxHash string `json:"txHash,omitempty"`
83+
Address string `json:"address"`
84+
Timestamp uint64 `json:"timestamp"`
85+
TimestampMs uint64 `json:"timestampMs,omitempty"`
8686
}
8787

8888
// TokensHandler defines the actions that a tokens' handler should do

0 commit comments

Comments
 (0)