fix(@wallet): tx history view
fixes #4385 Correctly display the date and if the node is an archival node
This commit is contained in:
parent
5eb582b18c
commit
8889bbdb08
|
@ -59,6 +59,7 @@ method init*[T](self: Controller[T]) =
|
|||
let accounts = self.getWalletAccounts()
|
||||
let addresses = accounts.map(account => account.address)
|
||||
self.delegate.setHistoryFetchState(addresses, false)
|
||||
self.delegate.setIsNonArchivalNode(true)
|
||||
else:
|
||||
echo "Unhandled wallet signal: ", data.eventType
|
||||
|
||||
|
|
|
@ -37,6 +37,9 @@ method setTrxHistoryResult*(self: AccessInterface, transactions: seq[Transaction
|
|||
method setHistoryFetchState*(self: AccessInterface, addresses: seq[string], isFetching: bool) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method setIsNonArchivalNode*(self: AccessInterface, isNonArchivalNode: bool) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
type
|
||||
## Abstract class (concept) which must be implemented by object/s used in this
|
||||
## module.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import strformat
|
||||
import strformat, stint
|
||||
|
||||
type
|
||||
Item* = object
|
||||
|
@ -7,7 +7,7 @@ type
|
|||
address: string
|
||||
blockNumber: string
|
||||
blockHash: string
|
||||
timestamp: string
|
||||
timestamp: UInt256
|
||||
gasPrice: string
|
||||
gasLimit: string
|
||||
gasUsed: string
|
||||
|
@ -23,8 +23,8 @@ proc initItem*(
|
|||
typ,
|
||||
address,
|
||||
blockNumber,
|
||||
blockHash,
|
||||
timestamp,
|
||||
blockHash: string,
|
||||
timestamp: UInt256,
|
||||
gasPrice,
|
||||
gasLimit,
|
||||
gasUsed,
|
||||
|
@ -86,7 +86,7 @@ proc getBlockHash*(self: Item): string =
|
|||
return self.blockHash
|
||||
|
||||
proc getTimestamp*(self: Item): string =
|
||||
return self.timestamp
|
||||
return $self.timestamp
|
||||
|
||||
proc getGasPrice*(self: Item): string =
|
||||
return self.gasPrice
|
||||
|
|
|
@ -76,3 +76,6 @@ method setTrxHistoryResult*[T](self: Module[T], transactions: seq[TransactionDto
|
|||
|
||||
method setHistoryFetchState*[T](self: Module[T], addresses: seq[string], isFetching: bool) =
|
||||
self.view.setHistoryFetchStateForAccounts(addresses, isFetching)
|
||||
|
||||
method setIsNonArchivalNode*[T](self: Module[T], isNonArchivalNode: bool) =
|
||||
self.view.setIsNonArchivalNode(isNonArchivalNode)
|
|
@ -14,6 +14,7 @@ QtObject:
|
|||
model: Model
|
||||
modelVariant: QVariant
|
||||
fetchingHistoryState: Table[string, bool]
|
||||
isNonArchivalNode: bool
|
||||
|
||||
proc delete*(self: View) =
|
||||
self.model.delete
|
||||
|
@ -85,3 +86,17 @@ QtObject:
|
|||
self.model = self.models[walletAccount.address]
|
||||
self.modelVariant = newQVariant(self.model)
|
||||
self.modelChanged()
|
||||
|
||||
proc getIsNonArchivalNode(self: View): QVariant {.slot.} =
|
||||
return newQVariant(self.isNonArchivalNode)
|
||||
|
||||
proc isNonArchivalNodeChanged(self: View) {.signal.}
|
||||
|
||||
proc setIsNonArchivalNode*(self: View, isNonArchivalNode: bool) =
|
||||
self.isNonArchivalNode = isNonArchivalNode
|
||||
self.isNonArchivalNodeChanged()
|
||||
|
||||
QtProperty[QVariant] isNonArchivalNode:
|
||||
read = getIsNonArchivalNode
|
||||
notify = isNonArchivalNodeChanged
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import json, strutils
|
||||
import json, strutils, stint
|
||||
include ../../common/json_utils
|
||||
|
||||
type
|
||||
|
@ -9,7 +9,7 @@ type
|
|||
blockNumber*: string
|
||||
blockHash*: string
|
||||
contract*: string
|
||||
timestamp*: string
|
||||
timestamp*: UInt256
|
||||
gasPrice*: string
|
||||
gasLimit*: string
|
||||
gasUsed*: string
|
||||
|
@ -21,13 +21,13 @@ type
|
|||
|
||||
proc toTransactionDto*(jsonObj: JsonNode): TransactionDto =
|
||||
result = TransactionDto()
|
||||
result.timestamp = stint.fromHex(UInt256, jsonObj{"timestamp"}.getStr)
|
||||
discard jsonObj.getProp("id", result.id)
|
||||
discard jsonObj.getProp("type", result.typeValue)
|
||||
discard jsonObj.getProp("address", result.address)
|
||||
discard jsonObj.getProp("contract", result.contract)
|
||||
discard jsonObj.getProp("blockNumber", result.blockNumber)
|
||||
discard jsonObj.getProp("blockHash", result.blockHash)
|
||||
discard jsonObj.getProp("timestamp", result.timestamp)
|
||||
discard jsonObj.getProp("gasPrice", result.gasPrice)
|
||||
discard jsonObj.getProp("gasLimit", result.gasLimit)
|
||||
discard jsonObj.getProp("gasUsed", result.gasUsed)
|
||||
|
|
|
@ -141,7 +141,7 @@ Rectangle {
|
|||
}
|
||||
StyledText {
|
||||
id: timeValue
|
||||
text: new Date(parseInt(timestamp)).toLocaleString(localAppSettings.locale)
|
||||
text: new Date(parseInt(timestamp)*1000).toLocaleString(localAppSettings.locale)
|
||||
font.pixelSize: Style.current.primaryTextFontSize
|
||||
anchors.rightMargin: Style.current.smallPadding
|
||||
}
|
||||
|
|
|
@ -23,10 +23,8 @@ QtObject {
|
|||
property CollectiblesStore collectiblesStore: CollectiblesStore { }
|
||||
property var collectionList: walletSectionCollectiblesCollections.model
|
||||
|
||||
property var history: walletSectionTransactions
|
||||
property var historyTransactions: walletSectionTransactions.model
|
||||
// property var transactions: walletModel.transactionsView.transactions
|
||||
// property var historyView: walletModel.historyView
|
||||
property var isNonArchivalNode: walletSectionTransactions.isNonArchivalNode
|
||||
|
||||
// This should be exposed to the UI via "walletModule", WalletModule should use
|
||||
// Accounts Service which keeps the info about that (isFirstTimeAccountLogin).
|
||||
|
@ -75,10 +73,6 @@ QtObject {
|
|||
return walletModel.getLatestBlockNumber()
|
||||
}
|
||||
|
||||
function isNonArchivalNode() {
|
||||
return walletModel.isNonArchivalNode
|
||||
}
|
||||
|
||||
function setInitialRange() {
|
||||
walletModel.setInitialRange()
|
||||
}
|
||||
|
@ -143,15 +137,15 @@ QtObject {
|
|||
}
|
||||
|
||||
function checkRecentHistory() {
|
||||
history.checkRecentHistory()
|
||||
walletSectionTransactions.checkRecentHistory()
|
||||
}
|
||||
|
||||
function isFetchingHistory() {
|
||||
return history.isFetchingHistory(walletModel.accountsView.currentAccount.address)
|
||||
return walletSectionTransactions.isFetchingHistory(walletModel.accountsView.currentAccount.address)
|
||||
}
|
||||
|
||||
function loadTransactionsForAccount(pageSize) {
|
||||
history.loadTransactionsForAccount(walletModel.accountsView.currentAccount.address,
|
||||
walletSectionTransactions.loadTransactionsForAccount(walletModel.accountsView.currentAccount.address,
|
||||
historyTransactions.getLastTxBlockNumber(),
|
||||
pageSize, true)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue