Skip to content
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

feat: add timestamp in rpc response #90

Merged
merged 2 commits into from
Nov 16, 2021
Merged
Show file tree
Hide file tree
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: 12 additions & 8 deletions mercury/model/common/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,21 @@ type Transaction struct {
Witnesses []hexutil.Bytes `json:"witnesses"`
}

type TransactionWithStatus struct {
Transaction Transaction `json:"transaction"`
TxStatus struct {
BlockHash *types.Hash `json:"block_hash"`
Status types.TransactionStatus `json:"status"`
} `json:"tx_status"`
}

type ExtraType string

const (
Dao ExtraType = "Dao"
CellBase ExtraType = "CellBase"
)

type TransactionWithRichStatus struct {
Transaction Transaction `json:"transaction"`
TxStatus TxRichStatus `json:"tx_status"`
}

type TxRichStatus struct {
Status types.TransactionStatus `json:"status"`
BlockHash string `json:"block_hash"`
Reason string `json:"reason"`
Timestamp uint64 `json:"timestamp"`
}
2 changes: 1 addition & 1 deletion mercury/model/resp/get_spent_transaction_resp.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ type TransactionInfoWrapper struct {
}

type TransactionViewWrapper struct {
TransactionView common.TransactionWithStatus `json:"TransactionView"`
TransactionView common.TransactionWithRichStatus `json:"TransactionView"`
}
9 changes: 5 additions & 4 deletions mercury/model/resp/get_transaction_info_resp.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ type GetTransactionInfoResponse struct {
}

type TransactionInfo struct {
TxHash string `json:"tx_hash"`
Records []Record `json:"records"`
Fee int64 `json:"fee"`
Burn []*BurnInfo `json:"burn"`
TxHash string `json:"tx_hash"`
Records []Record `json:"records"`
Fee int64 `json:"fee"`
Burn []*BurnInfo `json:"burn"`
Timestamp int64 `json:"timestamp"`
}

type BurnInfo struct {
Expand Down
2 changes: 2 additions & 0 deletions types/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const (
TransactionStatusPending TransactionStatus = "pending"
TransactionStatusProposed TransactionStatus = "proposed"
TransactionStatusCommitted TransactionStatus = "committed"
TransactionStatusUnknown TransactionStatus = "unknown"
TransactionStatusRejected TransactionStatus = "rejected"
)

type Epoch struct {
Expand Down