2024-11-13 21:10:13 +00:00
|
|
|
package entities
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
type (
|
|
|
|
BlockWithTransactions struct {
|
|
|
|
Id int64 `db:"id"`
|
|
|
|
Hash []byte `db:"hash"`
|
|
|
|
PrevHash []byte `db:"prev_hash"`
|
2024-11-24 14:04:52 +00:00
|
|
|
FinishedAt time.Time `db:"finished_at"`
|
2024-11-13 21:10:13 +00:00
|
|
|
Transactions []Transaction `db:"transactions"`
|
|
|
|
}
|
|
|
|
|
|
|
|
Block struct {
|
|
|
|
Id int64 `db:"id"`
|
|
|
|
Hash []byte `db:"hash"`
|
|
|
|
PrevHash []byte `db:"prev_hash"`
|
|
|
|
FinishedAt *time.Time `db:"finished_at"`
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
type (
|
|
|
|
Transaction struct {
|
|
|
|
Hash []byte `db:"hash"`
|
|
|
|
BlockId int64 `db:"block_id"`
|
|
|
|
SenderPublicKey []byte `db:"sender_public_key"`
|
|
|
|
ReceiverPublicKey []byte `db:"receiver_public_key"`
|
|
|
|
IsReward bool `db:"is_reward"`
|
|
|
|
Amount float64 `db:"amount"`
|
|
|
|
AmountBurned float64 `db:"amount_burned"`
|
|
|
|
Message string `db:"message"`
|
|
|
|
Signature []byte `db:"signature"`
|
|
|
|
CreatedAt time.Time `db:"created_at"`
|
2024-11-17 21:24:19 +00:00
|
|
|
CreatedAtNs int64 `db:"created_at_ns"`
|
2024-11-13 21:10:13 +00:00
|
|
|
AddedAt time.Time `db:"added_at"`
|
|
|
|
}
|
|
|
|
|
|
|
|
NewTransactionOpts struct {
|
2024-11-24 14:04:52 +00:00
|
|
|
Hash []byte `db:"hash"`
|
|
|
|
BlockId int64 `db:"block_id"`
|
|
|
|
SenderPublicKey []byte `db:"sender_public_key"`
|
|
|
|
ReceiverPublicKey []byte `db:"receiver_public_key"`
|
|
|
|
IsReward bool `db:"is_reward"`
|
|
|
|
Amount float64 `db:"amount"`
|
|
|
|
AmountBurned float64 `db:"amount_burned"`
|
|
|
|
Message string `db:"message"`
|
|
|
|
Signature []byte `db:"signature"`
|
|
|
|
CreatedAt int64 `db:"created_at"`
|
|
|
|
CreatedAtNs int64 `db:"created_at_ns"`
|
2024-11-13 21:10:13 +00:00
|
|
|
}
|
|
|
|
)
|