parent
2c769602f4
commit
600793e0de
|
@ -33,7 +33,6 @@ proc toRef*[T](obj: T): ref T =
|
||||||
const FETCH_BATCH_COUNT_DEFAULT = 10
|
const FETCH_BATCH_COUNT_DEFAULT = 10
|
||||||
const FETCH_RECIPIENTS_BATCH_COUNT_DEFAULT = 2000
|
const FETCH_RECIPIENTS_BATCH_COUNT_DEFAULT = 2000
|
||||||
|
|
||||||
# TODO: implement passing of collectibles
|
|
||||||
QtObject:
|
QtObject:
|
||||||
type
|
type
|
||||||
Controller* = ref object of QObject
|
Controller* = ref object of QObject
|
||||||
|
@ -76,18 +75,16 @@ QtObject:
|
||||||
read = getRecipientsModel
|
read = getRecipientsModel
|
||||||
|
|
||||||
proc buildMultiTransactionExtraData(self: Controller, metadata: backend_activity.ActivityEntry, item: MultiTransactionDto): ExtraData =
|
proc buildMultiTransactionExtraData(self: Controller, metadata: backend_activity.ActivityEntry, item: MultiTransactionDto): ExtraData =
|
||||||
# TODO: Use symbols from backendEntry when they're available
|
if metadata.symbolIn.isSome():
|
||||||
result.inSymbol = item.toAsset
|
result.inAmount = self.currencyService.parseCurrencyValue(metadata.symbolIn.get(), metadata.amountIn)
|
||||||
result.inAmount = self.currencyService.parseCurrencyValue(result.inSymbol, metadata.amountIn)
|
if metadata.symbolOut.isSome():
|
||||||
result.outSymbol = item.fromAsset
|
result.outAmount = self.currencyService.parseCurrencyValue(metadata.symbolOut.get(), metadata.amountOut)
|
||||||
result.outAmount = self.currencyService.parseCurrencyValue(result.outSymbol, metadata.amountOut)
|
|
||||||
|
|
||||||
proc buildTransactionExtraData(self: Controller, metadata: backend_activity.ActivityEntry, item: ref TransactionDto): ExtraData =
|
proc buildTransactionExtraData(self: Controller, metadata: backend_activity.ActivityEntry, item: ref TransactionDto): ExtraData =
|
||||||
# TODO: Use symbols from backendEntry when they're available
|
if metadata.symbolIn.isSome():
|
||||||
result.inSymbol = item[].symbol
|
result.inAmount = self.currencyService.parseCurrencyValue(metadata.symbolIn.get(), metadata.amountIn)
|
||||||
result.inAmount = self.currencyService.parseCurrencyValue(result.inSymbol, metadata.amountIn)
|
if metadata.symbolOut.isSome():
|
||||||
result.outSymbol = item[].symbol
|
result.outAmount = self.currencyService.parseCurrencyValue(metadata.symbolOut.get(), metadata.amountOut)
|
||||||
result.outAmount = self.currencyService.parseCurrencyValue(result.outSymbol, metadata.amountOut)
|
|
||||||
|
|
||||||
proc getResolvedSymbol(self: Controller, transaction: TransactionDto): string =
|
proc getResolvedSymbol(self: Controller, transaction: TransactionDto): string =
|
||||||
if transaction.symbol != "":
|
if transaction.symbol != "":
|
||||||
|
|
|
@ -19,9 +19,6 @@ type
|
||||||
ExtraData* = object
|
ExtraData* = object
|
||||||
inAmount*: float64
|
inAmount*: float64
|
||||||
outAmount*: float64
|
outAmount*: float64
|
||||||
# TODO: Fields below should come from the metadata. see #11597
|
|
||||||
inSymbol*: string
|
|
||||||
outSymbol*: string
|
|
||||||
|
|
||||||
AmountToCurrencyConvertor* = proc (amount: UInt256, symbol: string): CurrencyAmount
|
AmountToCurrencyConvertor* = proc (amount: UInt256, symbol: string): CurrencyAmount
|
||||||
|
|
||||||
|
@ -147,13 +144,13 @@ QtObject:
|
||||||
read = getRecipient
|
read = getRecipient
|
||||||
|
|
||||||
proc getInSymbol*(self: ActivityEntry): string {.slot.} =
|
proc getInSymbol*(self: ActivityEntry): string {.slot.} =
|
||||||
return self.extradata.inSymbol
|
return self.metadata.symbolIn.get("")
|
||||||
|
|
||||||
QtProperty[string] inSymbol:
|
QtProperty[string] inSymbol:
|
||||||
read = getInSymbol
|
read = getInSymbol
|
||||||
|
|
||||||
proc getOutSymbol*(self: ActivityEntry): string {.slot.} =
|
proc getOutSymbol*(self: ActivityEntry): string {.slot.} =
|
||||||
return self.extradata.outSymbol
|
return self.metadata.symbolOut.get("")
|
||||||
|
|
||||||
QtProperty[string] outSymbol:
|
QtProperty[string] outSymbol:
|
||||||
read = getOutSymbol
|
read = getOutSymbol
|
||||||
|
|
|
@ -272,6 +272,8 @@ type
|
||||||
|
|
||||||
tokenOut*: Option[Token]
|
tokenOut*: Option[Token]
|
||||||
tokenIn*: Option[Token]
|
tokenIn*: Option[Token]
|
||||||
|
symbolOut*: Option[string]
|
||||||
|
symbolIn*: Option[string]
|
||||||
|
|
||||||
sender*: Option[eth.Address]
|
sender*: Option[eth.Address]
|
||||||
recipient*: Option[eth.Address]
|
recipient*: Option[eth.Address]
|
||||||
|
@ -295,6 +297,8 @@ type
|
||||||
|
|
||||||
tokenOut*: Option[Token]
|
tokenOut*: Option[Token]
|
||||||
tokenIn*: Option[Token]
|
tokenIn*: Option[Token]
|
||||||
|
symbolOut*: Option[string]
|
||||||
|
symbolIn*: Option[string]
|
||||||
|
|
||||||
sender*: Option[eth.Address]
|
sender*: Option[eth.Address]
|
||||||
recipient*: Option[eth.Address]
|
recipient*: Option[eth.Address]
|
||||||
|
@ -331,6 +335,8 @@ proc fromJson*(e: JsonNode, T: typedesc[Data]): Data {.inline.} =
|
||||||
const amountInField = "amountIn"
|
const amountInField = "amountIn"
|
||||||
const tokenOutField = "tokenOut"
|
const tokenOutField = "tokenOut"
|
||||||
const tokenInField = "tokenIn"
|
const tokenInField = "tokenIn"
|
||||||
|
const symbolOutField = "symbolOut"
|
||||||
|
const symbolInField = "symbolIn"
|
||||||
const senderField = "sender"
|
const senderField = "sender"
|
||||||
const recipientField = "recipient"
|
const recipientField = "recipient"
|
||||||
const chainIdOutField = "chainIdOut"
|
const chainIdOutField = "chainIdOut"
|
||||||
|
@ -364,6 +370,14 @@ proc fromJson*(e: JsonNode, T: typedesc[Data]): Data {.inline.} =
|
||||||
some(fromJson(e[tokenInField], Token))
|
some(fromJson(e[tokenInField], Token))
|
||||||
else:
|
else:
|
||||||
none(Token),
|
none(Token),
|
||||||
|
symbolOut: if e.contains(symbolOutField):
|
||||||
|
some(e[symbolOutField].getStr())
|
||||||
|
else:
|
||||||
|
none(string),
|
||||||
|
symbolIn: if e.contains(symbolInField):
|
||||||
|
some(e[symbolInField].getStr())
|
||||||
|
else:
|
||||||
|
none(string),
|
||||||
|
|
||||||
nftName: if e.contains(nftNameField): some(e[nftNameField].getStr()) else: none(string),
|
nftName: if e.contains(nftNameField): some(e[nftNameField].getStr()) else: none(string),
|
||||||
nftUrl: if e.contains(nftUrlField): some(e[nftUrlField].getStr()) else: none(string),
|
nftUrl: if e.contains(nftUrlField): some(e[nftUrlField].getStr()) else: none(string),
|
||||||
|
@ -396,6 +410,8 @@ proc fromJson*(e: JsonNode, T: typedesc[ActivityEntry]): ActivityEntry {.inline.
|
||||||
amountIn: data.amountIn.get(),
|
amountIn: data.amountIn.get(),
|
||||||
tokenOut: data.tokenOut,
|
tokenOut: data.tokenOut,
|
||||||
tokenIn: data.tokenIn,
|
tokenIn: data.tokenIn,
|
||||||
|
symbolOut: data.symbolOut,
|
||||||
|
symbolIn: data.symbolIn,
|
||||||
sender: data.sender,
|
sender: data.sender,
|
||||||
recipient: data.recipient,
|
recipient: data.recipient,
|
||||||
chainIdOut: data.chainIdOut,
|
chainIdOut: data.chainIdOut,
|
||||||
|
@ -417,6 +433,8 @@ proc `$`*(self: ActivityEntry): string =
|
||||||
amountIn* {$self.amountIn},
|
amountIn* {$self.amountIn},
|
||||||
tokenOut* {$self.tokenOut},
|
tokenOut* {$self.tokenOut},
|
||||||
tokenIn* {$self.tokenIn}
|
tokenIn* {$self.tokenIn}
|
||||||
|
symbolOut* {$self.symbolOut}
|
||||||
|
symbolIn* {$self.symbolIn}
|
||||||
sender* {$self.sender}
|
sender* {$self.sender}
|
||||||
recipient* {$self.recipient}
|
recipient* {$self.recipient}
|
||||||
chainIdOut* {$self.chainIdOut}
|
chainIdOut* {$self.chainIdOut}
|
||||||
|
|
Loading…
Reference in New Issue