fest(@desktop/wallet): Update Desktop UI to correctly call the router and send
fixes #13797
This commit is contained in:
parent
da226b75aa
commit
3118931ab8
|
@ -4,7 +4,8 @@ import options
|
|||
import backend/collectibles as backend
|
||||
import collectible_trait_model
|
||||
import collectible_ownership_model
|
||||
import ../../../app_service/service/community_tokens/dto/community_token
|
||||
import app_service/service/community_tokens/dto/community_token
|
||||
import app_service/common/types
|
||||
|
||||
const invalidTimestamp* = high(int)
|
||||
|
||||
|
@ -28,7 +29,7 @@ QtObject:
|
|||
ownership: OwnershipModel
|
||||
generatedId: string
|
||||
generatedCollectionId: string
|
||||
|
||||
tokenType: TokenType
|
||||
|
||||
proc setup(self: CollectiblesEntry) =
|
||||
self.QObject.setup
|
||||
|
@ -56,7 +57,8 @@ QtObject:
|
|||
traits:{self.traits},
|
||||
ownership:{self.ownership},
|
||||
generatedId:{self.generatedId},
|
||||
generatedCollectionId:{self.generatedCollectionId}
|
||||
generatedCollectionId:{self.generatedCollectionId},
|
||||
tokenType:{self.tokenType}
|
||||
)"""
|
||||
|
||||
proc hasCollectibleData(self: CollectiblesEntry): bool =
|
||||
|
@ -308,6 +310,14 @@ QtObject:
|
|||
QtProperty[string] networkIconUrl:
|
||||
read = getNetworkIconURL
|
||||
|
||||
proc tokenTypeChanged*(self: CollectiblesEntry) {.signal.}
|
||||
proc getTokenType*(self: CollectiblesEntry): int {.slot.} =
|
||||
return self.tokenType.int
|
||||
|
||||
QtProperty[int] tokenType:
|
||||
read = getTokenType
|
||||
notify = tokenTypeChanged
|
||||
|
||||
proc updateDataIfSameID*(self: CollectiblesEntry, update: backend.Collectible): bool =
|
||||
if self.id != update.id:
|
||||
return false
|
||||
|
@ -333,6 +343,14 @@ QtObject:
|
|||
self.communityImageChanged()
|
||||
return true
|
||||
|
||||
proc contractTypeToTokenType(contractType : ContractType): TokenType =
|
||||
case contractType:
|
||||
of ContractType.ContractTypeUnknown: return TokenType.Unknown
|
||||
of ContractType.ContractTypeERC20: return TokenType.ERC20
|
||||
of ContractType.ContractTypeERC721: return TokenType.ERC721
|
||||
of ContractType.ContractTypeERC1155: return TokenType.ERC1155
|
||||
else: return TokenType.Unknown
|
||||
|
||||
proc newCollectibleDetailsFullEntry*(data: backend.Collectible, extradata: ExtraData): CollectiblesEntry =
|
||||
new(result, delete)
|
||||
result.id = data.id
|
||||
|
@ -340,6 +358,7 @@ QtObject:
|
|||
result.extradata = extradata
|
||||
result.generatedId = result.id.toString()
|
||||
result.generatedCollectionId = result.id.contractID.toString()
|
||||
result.tokenType = contractTypeToTokenType(data.contractType.get())
|
||||
result.setup()
|
||||
|
||||
proc newCollectibleDetailsBasicEntry*(id: backend.CollectibleUniqueID, extradata: ExtraData): CollectiblesEntry =
|
||||
|
|
|
@ -27,6 +27,7 @@ type
|
|||
CommunityName
|
||||
CommunityColor
|
||||
CommunityPrivilegesLevel
|
||||
TokenType
|
||||
|
||||
QtObject:
|
||||
type
|
||||
|
@ -147,6 +148,7 @@ QtObject:
|
|||
CollectibleRole.CommunityName.int:"communityName",
|
||||
CollectibleRole.CommunityColor.int:"communityColor",
|
||||
CollectibleRole.CommunityPrivilegesLevel.int:"communityPrivilegesLevel",
|
||||
CollectibleRole.TokenType.int:"tokenType",
|
||||
}.toTable
|
||||
|
||||
method data(self: Model, index: QModelIndex, role: int): QVariant =
|
||||
|
@ -197,6 +199,8 @@ QtObject:
|
|||
result = newQVariant(item.getCommunityColor())
|
||||
of CollectibleRole.CommunityPrivilegesLevel:
|
||||
result = newQVariant(item.getCommunityPrivilegesLevel())
|
||||
of CollectibleRole.TokenType:
|
||||
result = newQVariant(item.getTokenType())
|
||||
|
||||
proc rowData(self: Model, index: int, column: string): string {.slot.} =
|
||||
if (index >= self.items.len):
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import strformat
|
||||
import app_service/common/types
|
||||
|
||||
type
|
||||
Item* = object
|
||||
|
@ -10,6 +11,7 @@ type
|
|||
collectionName: string
|
||||
isCollection: bool
|
||||
communityId: string
|
||||
tokenType: TokenType
|
||||
|
||||
proc initItem*(
|
||||
id: string,
|
||||
|
@ -20,6 +22,7 @@ proc initItem*(
|
|||
collectionName: string,
|
||||
isCollection: bool,
|
||||
communityId: string,
|
||||
tokenType: TokenType
|
||||
): Item =
|
||||
result.id = id
|
||||
result.chainId = chainId
|
||||
|
@ -28,7 +31,7 @@ proc initItem*(
|
|||
result.collectionId = collectionId
|
||||
result.collectionName = collectionName
|
||||
result.isCollection = isCollection
|
||||
result.communityId = communityId
|
||||
result.tokenType = tokenType
|
||||
|
||||
proc `$`*(self: Item): string =
|
||||
result = fmt"""CollectiblesNestedEntry(
|
||||
|
@ -40,6 +43,7 @@ proc `$`*(self: Item): string =
|
|||
collectionName: {self.collectionName},
|
||||
isCollection: {self.isCollection},
|
||||
communityId: {self.communityId},
|
||||
tokenType: {self.tokenType},
|
||||
]"""
|
||||
|
||||
proc getId*(self: Item): string =
|
||||
|
@ -65,3 +69,6 @@ proc getIsCollection*(self: Item): bool =
|
|||
|
||||
proc getCommunityId*(self: Item): string =
|
||||
return self.communityId
|
||||
|
||||
proc getTokenType*(self: Item): int =
|
||||
return self.tokenType.int
|
||||
|
|
|
@ -16,6 +16,7 @@ type
|
|||
CollectionName
|
||||
IsCollection
|
||||
CommunityId
|
||||
TokenType
|
||||
|
||||
QtObject:
|
||||
type
|
||||
|
@ -82,6 +83,7 @@ QtObject:
|
|||
CollectiblesNestedRole.CollectionName.int:"collectionName",
|
||||
CollectiblesNestedRole.IsCollection.int:"isCollection",
|
||||
CollectiblesNestedRole.CommunityId.int:"communityId",
|
||||
CollectiblesNestedRole.TokenType.int:"tokenType",
|
||||
}.toTable
|
||||
|
||||
method data(self: Model, index: QModelIndex, role: int): QVariant =
|
||||
|
@ -111,6 +113,8 @@ QtObject:
|
|||
result = newQVariant(item.getIsCollection())
|
||||
of CollectiblesNestedRole.CommunityId:
|
||||
result = newQVariant(item.getCommunityId())
|
||||
of CollectiblesNestedRole.TokenType:
|
||||
result = newQVariant(item.getTokenType())
|
||||
|
||||
proc rowData(self: Model, index: int, column: string): string {.slot.} =
|
||||
if (index >= self.items.len):
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import ./collectibles_entry as flat_item
|
||||
import ./collectibles_nested_item as nested_item
|
||||
import app_service/common/types
|
||||
|
||||
proc collectibleToCollectibleNestedItem*(flatItem: flat_item.CollectiblesEntry): nested_item.Item =
|
||||
return nested_item.initItem(
|
||||
|
@ -10,7 +11,8 @@ proc collectibleToCollectibleNestedItem*(flatItem: flat_item.CollectiblesEntry):
|
|||
flatItem.getCollectionIDAsString(),
|
||||
flatItem.getCollectionName(),
|
||||
false,
|
||||
flatItem.getCommunityID()
|
||||
flatItem.getCommunityID(),
|
||||
TokenType(flatItem.getTokenType())
|
||||
)
|
||||
|
||||
proc collectibleToCollectionNestedItem*(flatItem: flat_item.CollectiblesEntry): nested_item.Item =
|
||||
|
@ -22,5 +24,6 @@ proc collectibleToCollectionNestedItem*(flatItem: flat_item.CollectiblesEntry):
|
|||
flatItem.getCollectionIDAsString(),
|
||||
flatItem.getCollectionName(),
|
||||
true,
|
||||
flatItem.getCommunityID()
|
||||
flatItem.getCommunityID(),
|
||||
TokenType(flatItem.getTokenType())
|
||||
)
|
||||
|
|
|
@ -67,6 +67,7 @@ type TransactionBridgeDto* = object
|
|||
hopTx*: TransactionDataDto
|
||||
cbridgeTx*: TransactionDataDto
|
||||
eRC721TransferTx*: TransactionDataDto
|
||||
eRC1155TransferTx*: TransactionDataDto
|
||||
|
||||
proc `%`*(x: TransactionBridgeDto): JsonNode =
|
||||
result = newJobject()
|
||||
|
@ -76,3 +77,4 @@ proc `%`*(x: TransactionBridgeDto): JsonNode =
|
|||
result["hopTx"] = %x.hopTx
|
||||
result["cbridgeTx"] = %x.cbridgeTx
|
||||
result["eRC721TransferTx"] = %x.eRC721TransferTx
|
||||
result["eRC1155TransferTx"] = %x.eRC1155TransferTx
|
||||
|
|
|
@ -312,6 +312,13 @@ type
|
|||
totalTokenFees*: float
|
||||
totalTime*: int
|
||||
|
||||
proc `$`*(self: FeesDto): string =
|
||||
return fmt"""FeesDto(
|
||||
totalFeesInEth:{self.totalFeesInEth},
|
||||
totalTokenFees:{self.totalTokenFees},
|
||||
totalTime:{self.totalTime},
|
||||
)"""
|
||||
|
||||
proc convertToFeesDto*(jsonObj: JsonNode): FeesDto =
|
||||
result = FeesDto()
|
||||
discard jsonObj.getProp("totalFeesInEth", result.totalFeesInEth)
|
||||
|
@ -325,6 +332,14 @@ type
|
|||
iconUrl*: string
|
||||
amountOut*: UInt256
|
||||
|
||||
proc `$`*(self: SendToNetwork): string =
|
||||
return fmt"""SendToNetwork(
|
||||
chainId:{self.chainId},
|
||||
chainName:{self.chainName},
|
||||
iconUrl:{self.iconUrl},
|
||||
amountOut:{self.amountOut},
|
||||
)"""
|
||||
|
||||
proc convertSendToNetwork*(jsonObj: JsonNode): SendToNetwork =
|
||||
result = SendToNetwork()
|
||||
discard jsonObj.getProp("chainId", result.chainId)
|
||||
|
@ -339,6 +354,14 @@ type
|
|||
amountToReceive*: UInt256
|
||||
toNetworks*: seq[SendToNetwork]
|
||||
|
||||
proc `$`*(self: SuggestedRoutesDto): string =
|
||||
return fmt"""SuggestedRoutesDto(
|
||||
best:{self.best},
|
||||
gasTimeEstimate:{self.gasTimeEstimate},
|
||||
amountToReceive:{self.amountToReceive},
|
||||
toNetworks:{self.toNetworks},
|
||||
)"""
|
||||
|
||||
proc convertToSuggestedRoutesDto*(jsonObj: JsonNode): SuggestedRoutesDto =
|
||||
result = SuggestedRoutesDto()
|
||||
result.best = jsonObj["suggestedRoutes"]["best"].getElems().map(x => x.convertToTransactionPathDto())
|
||||
|
|
|
@ -52,6 +52,7 @@ const SIGNAL_OWNER_TOKEN_SENT* = "ownerTokenSent"
|
|||
const SIMPLE_TX_BRIDGE_NAME = "Transfer"
|
||||
const HOP_TX_BRIDGE_NAME = "Hop"
|
||||
const ERC721_TRANSFER_NAME = "ERC721Transfer"
|
||||
const ERC1155_TRANSFER_NAME = "ERC1155Transfer"
|
||||
|
||||
type TokenTransferMetadata* = object
|
||||
tokenName*: string
|
||||
|
@ -264,6 +265,7 @@ QtObject:
|
|||
var hopTx = TransactionDataDto()
|
||||
var cbridgeTx = TransactionDataDto()
|
||||
var eRC721TransferTx = TransactionDataDto()
|
||||
var eRC1155TransferTx = TransactionDataDto()
|
||||
|
||||
if(route.bridgeName == SIMPLE_TX_BRIDGE_NAME):
|
||||
path.transferTx = txData
|
||||
|
@ -281,6 +283,13 @@ QtObject:
|
|||
eRC721TransferTx.recipient = parseAddress(to_addr).some
|
||||
eRC721TransferTx.tokenID = stint.u256(tokenSymbol).some
|
||||
path.eRC721TransferTx = eRC721TransferTx
|
||||
elif(route.bridgeName == ERC1155_TRANSFER_NAME):
|
||||
eRC1155TransferTx = txData
|
||||
eRC1155TransferTx.chainID = route.toNetwork.chainId.some
|
||||
eRC1155TransferTx.recipient = parseAddress(to_addr).some
|
||||
eRC1155TransferTx.tokenID = stint.u256(tokenSymbol).some
|
||||
eRC1155TransferTx.amount = route.amountIn.some
|
||||
path.eRC1155TransferTx = eRC1155TransferTx
|
||||
else:
|
||||
cbridgeTx = txData
|
||||
cbridgeTx.chainID = route.toNetwork.chainId.some
|
||||
|
@ -310,6 +319,8 @@ QtObject:
|
|||
let metadata = TokenTransferMetadata(tokenName: tokenName, isOwnerToken: isOwnerToken)
|
||||
self.watchTransaction(hash.getStr, fromAddr, toAddr, $PendingTransactionTypeDto.WalletTransfer, $(%metadata), route.fromNetwork.chainID, track = false)
|
||||
|
||||
proc isCollectiblesTransfer(self: Service, sendType: SendType): bool =
|
||||
return sendType == ERC721Transfer or sendType == ERC1155Transfer
|
||||
|
||||
proc transferEth(
|
||||
self: Service,
|
||||
|
@ -374,7 +385,6 @@ QtObject:
|
|||
isOwnerToken: bool
|
||||
) =
|
||||
try:
|
||||
let isERC721Transfer = sendType == ERC721Transfer
|
||||
var paths: seq[TransactionBridgeDto] = @[]
|
||||
var chainID = 0
|
||||
|
||||
|
@ -385,7 +395,7 @@ QtObject:
|
|||
var tokenSym = tokenSymbol
|
||||
let amountToSend = value.parse(Uint256)
|
||||
|
||||
if isERC721Transfer:
|
||||
if self.isCollectiblesTransfer(sendType):
|
||||
let contract_tokenId = tokenSym.split(":")
|
||||
if contract_tokenId.len == 2:
|
||||
toAddress = parseAddress(contract_tokenId[0])
|
||||
|
@ -468,7 +478,7 @@ QtObject:
|
|||
chainID = selectedRoutes[0].fromNetwork.chainID
|
||||
|
||||
var tokenSymbol = ""
|
||||
if sendType == ERC721Transfer or sendType == ERC1155Transfer:
|
||||
if self.isCollectiblesTransfer(sendType):
|
||||
tokenSymbol = assetKey
|
||||
else:
|
||||
let token = self.tokenService.getTokenBySymbolByTokensKey(assetKey)
|
||||
|
@ -514,7 +524,7 @@ QtObject:
|
|||
proc suggestedRoutes*(self: Service, accountFrom: string, accountTo: string, amount: Uint256, token: string, disabledFromChainIDs,
|
||||
disabledToChainIDs, preferredChainIDs: seq[int], sendType: SendType, lockedInAmounts: string): SuggestedRoutesDto =
|
||||
var tokenId: string = ""
|
||||
if sendType == ERC721Transfer:
|
||||
if self.isCollectiblesTransfer(sendType):
|
||||
tokenId = token
|
||||
else:
|
||||
let token = self.tokenService.getTokenBySymbolByTokensKey(token)
|
||||
|
|
|
@ -4,6 +4,13 @@ import community_tokens_types
|
|||
|
||||
include app_service/common/json_utils
|
||||
|
||||
# follows the ContractType declared in status go status-go/services/wallet/common/const.go
|
||||
type ContractType* {.pure.} = enum
|
||||
ContractTypeUnknown = 0,
|
||||
ContractTypeERC20 = 1,
|
||||
ContractTypeERC721 = 2,
|
||||
ContractTypeERC1155 = 3
|
||||
|
||||
type
|
||||
# Mirrors services/wallet/thirdparty/collectible_types.go ContractID
|
||||
ContractID* = ref object of RootObj
|
||||
|
@ -63,6 +70,7 @@ type
|
|||
isFirst*: Option[bool]
|
||||
latestTxHash*: Option[string]
|
||||
receivedAmount*: Option[float64]
|
||||
contractType*: Option[ContractType]
|
||||
|
||||
# Mirrors services/wallet/thirdparty/collectible_types.go TokenBalance
|
||||
CollectibleBalance* = ref object
|
||||
|
@ -364,6 +372,11 @@ proc fromJson*(t: JsonNode, T: typedesc[Collectible]): Collectible {.inline.} =
|
|||
result.receivedAmount = some(receivedAmountNode.getFloat())
|
||||
else:
|
||||
result.receivedAmount = none(float64)
|
||||
let contractTypeNode = t{"contract_type"}
|
||||
if contractTypeNode != nil and contractTypeNode.kind != JNull:
|
||||
result.contractType = some(ContractType(contractTypeNode.getInt()))
|
||||
else:
|
||||
result.contractType = none(ContractType)
|
||||
|
||||
proc toIds(self: seq[Collectible]): seq[CollectibleUniqueID] =
|
||||
result = @[]
|
||||
|
|
|
@ -38,8 +38,8 @@ ColumnLayout {
|
|||
property bool isUpdating: false // Indicates if the collectibles list is being updated
|
||||
property bool isError: false // Indicates an error occurred while updating/fetching the collectibles list
|
||||
|
||||
signal collectibleClicked(int chainId, string contractAddress, string tokenId, string uid)
|
||||
signal sendRequested(string symbol)
|
||||
signal collectibleClicked(int chainId, string contractAddress, string tokenId, string uid, int tokenType)
|
||||
signal sendRequested(string symbol, int tokenType)
|
||||
signal receiveRequested(string symbol)
|
||||
signal switchToCommunityRequested(string communityId)
|
||||
signal manageTokensRequested()
|
||||
|
@ -462,11 +462,12 @@ ColumnLayout {
|
|||
communityName: model.communityName ?? ""
|
||||
communityImage: model.communityImage ?? ""
|
||||
|
||||
onClicked: root.collectibleClicked(model.chainId, model.contractAddress, model.tokenId, model.symbol)
|
||||
onClicked: root.collectibleClicked(model.chainId, model.contractAddress, model.tokenId, model.symbol, model.tokenType)
|
||||
onRightClicked: {
|
||||
Global.openMenu(tokenContextMenu, this,
|
||||
{symbol: model.symbol, tokenName: model.name, tokenImage: model.imageUrl,
|
||||
communityId: model.communityId, communityName: model.communityName, communityImage: model.communityImage})
|
||||
communityId: model.communityId, communityName: model.communityName,
|
||||
communityImage: model.communityImage, tokenType: model.tokenType})
|
||||
}
|
||||
onSwitchToCommunityRequested: (communityId) => root.switchToCommunityRequested(communityId)
|
||||
}
|
||||
|
@ -483,13 +484,14 @@ ColumnLayout {
|
|||
property string communityId
|
||||
property string communityName
|
||||
property string communityImage
|
||||
property int tokenType
|
||||
|
||||
StatusAction {
|
||||
enabled: root.sendEnabled
|
||||
visibleOnDisabled: true
|
||||
icon.name: "send"
|
||||
text: qsTr("Send")
|
||||
onTriggered: root.sendRequested(symbol)
|
||||
onTriggered: root.sendRequested(symbol, tokenType)
|
||||
}
|
||||
StatusAction {
|
||||
icon.name: "receive"
|
||||
|
|
|
@ -175,7 +175,7 @@ RightTabBaseView {
|
|||
filterVisible: filterButton.checked
|
||||
onCollectibleClicked: {
|
||||
RootStore.collectiblesStore.getDetailedCollectible(chainId, contractAddress, tokenId)
|
||||
RootStore.setCurrentViewedHolding(uid, Constants.TokenType.ERC721)
|
||||
RootStore.setCurrentViewedHolding(uid, tokenType)
|
||||
d.detailedCollectibleActivityController.resetFilter()
|
||||
d.detailedCollectibleActivityController.setFilterAddressesJson(JSON.stringify(RootStore.addressFilters.split(":")), RootStore.showAllAccounts)
|
||||
d.detailedCollectibleActivityController.setFilterChainsJson(JSON.stringify([chainId]), false)
|
||||
|
@ -184,10 +184,12 @@ RightTabBaseView {
|
|||
|
||||
stack.currentIndex = 1
|
||||
}
|
||||
onSendRequested: (symbol) => {
|
||||
root.sendModal.preSelectedSendType = Constants.SendType.Transfer
|
||||
onSendRequested: (symbol, tokenType) => {
|
||||
root.sendModal.preSelectedHoldingID = symbol
|
||||
root.sendModal.preSelectedHoldingType = Constants.TokenType.ERC721
|
||||
root.sendModal.preSelectedHoldingType = tokenType
|
||||
root.sendModal.preSelectedSendType = tokenType === Constants.TokenType.ERC721 ?
|
||||
Constants.SendType.ERC721Transfer:
|
||||
Constants.SendType.ERC1155Transfer
|
||||
root.sendModal.onlyAssets = false
|
||||
root.sendModal.open()
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ StatusDialog {
|
|||
if(!!popup.preSelectedAccount && !!holdingSelector.selectedItem
|
||||
&& recipientLoader.ready && amountToSendInput.inputNumberValid) {
|
||||
popup.isLoading = true
|
||||
popup.store.suggestedRoutes(d.isERC721Transfer ? "1" : amountToSendInput.cryptoValueToSend)
|
||||
popup.store.suggestedRoutes(d.isCollectiblesTransfer ? "1" : amountToSendInput.cryptoValueToSend)
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -73,7 +73,7 @@ StatusDialog {
|
|||
popup.preSelectedSendType === Constants.SendType.StickersBuy
|
||||
|
||||
readonly property var currencyStore: store.currencyStore
|
||||
readonly property int errorType: !amountToSendInput.input.valid && !isERC721Transfer ? Constants.SendAmountExceedsBalance :
|
||||
readonly property int errorType: !amountToSendInput.input.valid && (!isCollectiblesTransfer) ? Constants.SendAmountExceedsBalance :
|
||||
(popup.bestRoutes && popup.bestRoutes.count === 0 &&
|
||||
!!amountToSendInput.input.text && recipientLoader.ready && !popup.isLoading) ?
|
||||
Constants.NoRoute : Constants.NoError
|
||||
|
@ -88,7 +88,8 @@ StatusDialog {
|
|||
property double totalFeesInFiat
|
||||
property double totalAmountToReceive
|
||||
readonly property bool isBridgeTx: store.sendType === Constants.SendType.Bridge
|
||||
readonly property bool isERC721Transfer: store.sendType === Constants.SendType.ERC721Transfer
|
||||
readonly property bool isCollectiblesTransfer: store.sendType === Constants.SendType.ERC721Transfer ||
|
||||
store.sendType === Constants.SendType.ERC1155Transfer
|
||||
property var selectedHolding: null
|
||||
property var selectedHoldingType: Constants.TokenType.Unknown
|
||||
readonly property bool isSelectedHoldingValidAsset: !!selectedHolding && selectedHoldingType === Constants.TokenType.ERC20
|
||||
|
@ -126,8 +127,10 @@ StatusDialog {
|
|||
store.setSendType(Constants.SendType.Transfer)
|
||||
store.setSelectedAssetKey(selectedHolding.tokensKey)
|
||||
store.setSelectedTokenIsOwnerToken(false)
|
||||
} else if (d.selectedHoldingType === Constants.TokenType.ERC721) {
|
||||
store.setSendType(Constants.SendType.ERC721Transfer)
|
||||
} else if (d.selectedHoldingType === Constants.TokenType.ERC721 ||
|
||||
d.selectedHoldingType === Constants.TokenType.ERC1155) {
|
||||
let sendType = d.selectedHoldingType === Constants.TokenType.ERC721 ? Constants.SendType.ERC721Transfer : Constants.SendType.ERC1155Transfer
|
||||
store.setSendType(sendType)
|
||||
amountToSendInput.input.text = 1
|
||||
store.setSelectedAssetKey(selectedHolding.contractAddress+":"+selectedHolding.tokenId)
|
||||
store.setRouteEnabledFromChains(selectedHolding.chainId)
|
||||
|
@ -163,7 +166,7 @@ StatusDialog {
|
|||
store.setSendType(popup.preSelectedSendType)
|
||||
}
|
||||
if ((popup.preSelectedHoldingType > Constants.TokenType.Native) &&
|
||||
(popup.preSelectedHoldingType < Constants.TokenType.ERC1155)) {
|
||||
(popup.preSelectedHoldingType < Constants.TokenType.Unknown)) {
|
||||
tokenListRect.browsingHoldingType = popup.preSelectedHoldingType
|
||||
if (!!popup.preSelectedHoldingID) {
|
||||
d.setSelectedHoldingId(popup.preSelectedHoldingID, popup.preSelectedHoldingType)
|
||||
|
@ -285,7 +288,7 @@ StatusDialog {
|
|||
Layout.maximumWidth: 300
|
||||
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
|
||||
Layout.preferredHeight: 22
|
||||
visible: d.isSelectedHoldingValidAsset || d.isHoveredHoldingValidAsset && !d.isERC721Transfer
|
||||
visible: d.isSelectedHoldingValidAsset || d.isHoveredHoldingValidAsset && !d.isCollectiblesTransfer
|
||||
title: {
|
||||
if(d.isHoveredHoldingValidAsset && !!d.hoveredHolding.symbol) {
|
||||
const input = amountToSendInput.inputIsFiat ? d.hoveredHolding.currentCurrencyBalance : d.hoveredHolding.currentBalance
|
||||
|
@ -314,7 +317,7 @@ StatusDialog {
|
|||
}
|
||||
}
|
||||
RowLayout {
|
||||
visible: d.isSelectedHoldingValidAsset && !d.isERC721Transfer
|
||||
visible: d.isSelectedHoldingValidAsset && !d.isCollectiblesTransfer
|
||||
AmountToSend {
|
||||
id: amountToSendInput
|
||||
|
||||
|
@ -372,7 +375,7 @@ StatusDialog {
|
|||
id: recipientLoader
|
||||
Layout.fillWidth: true
|
||||
store: popup.store
|
||||
isERC721Transfer: d.isERC721Transfer
|
||||
isCollectiblesTransfer: d.isCollectiblesTransfer
|
||||
isBridgeTx: d.isBridgeTx
|
||||
interactive: popup.interactive
|
||||
selectedAsset: d.selectedHolding
|
||||
|
@ -472,7 +475,7 @@ StatusDialog {
|
|||
errorType: d.errorType
|
||||
isLoading: popup.isLoading
|
||||
isBridgeTx: d.isBridgeTx
|
||||
isERC721Transfer: d.isERC721Transfer
|
||||
isCollectiblesTransfer: d.isCollectiblesTransfer
|
||||
bestRoutes: popup.bestRoutes
|
||||
totalFeesInFiat: d.totalFeesInFiat
|
||||
}
|
||||
|
|
|
@ -355,8 +355,8 @@ Item {
|
|||
root.collectiblesModel.currentCollectionUid = collectionUid
|
||||
} else {
|
||||
holdingItemSelector.selectedItem = selectedItem
|
||||
d.currentHoldingType = Constants.TokenType.ERC721
|
||||
root.itemSelected(selectedItem.uid, Constants.TokenType.ERC721)
|
||||
d.currentHoldingType = tokenType
|
||||
root.itemSelected(selectedItem.uid, tokenType)
|
||||
holdingItemSelector.comboBoxControl.popup.close()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ Item {
|
|||
property bool errorMode: advancedNetworkRoutingPage.errorMode
|
||||
property bool interactive: true
|
||||
property bool isBridgeTx: false
|
||||
property bool isERC721Transfer: false
|
||||
property bool isCollectiblesTransfer: false
|
||||
property var toNetworksList
|
||||
property int errorType: Constants.NoError
|
||||
property var bestRoutes
|
||||
|
@ -48,7 +48,7 @@ Item {
|
|||
id: tabBar
|
||||
anchors.top: parent.top
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
visible: !root.isERC721Transfer
|
||||
visible: !root.isCollectiblesTransfer
|
||||
StatusSwitchTabButton {
|
||||
text: qsTr("Simple")
|
||||
}
|
||||
|
@ -62,12 +62,12 @@ Item {
|
|||
|
||||
StackLayout {
|
||||
id: stackLayout
|
||||
anchors.top: !root.isERC721Transfer ? tabBar.bottom: parent.top
|
||||
anchors.topMargin: !root.isERC721Transfer ? Style.current.bigPadding: 0
|
||||
anchors.top: !root.isCollectiblesTransfer ? tabBar.bottom: parent.top
|
||||
anchors.topMargin: !root.isCollectiblesTransfer ? Style.current.bigPadding: 0
|
||||
height: currentIndex == 0 ? networksSimpleRoutingPage.height + networksSimpleRoutingPage.anchors.margins + Style.current.bigPadding:
|
||||
advancedNetworkRoutingPage.height + advancedNetworkRoutingPage.anchors.margins + Style.current.bigPadding
|
||||
width: parent.width
|
||||
currentIndex: root.isERC721Transfer ? 0: tabBar.currentIndex === 0 ? 0 : 1
|
||||
currentIndex: root.isCollectiblesTransfer ? 0: tabBar.currentIndex === 0 ? 0 : 1
|
||||
|
||||
Rectangle {
|
||||
id: simple
|
||||
|
@ -80,7 +80,7 @@ Item {
|
|||
anchors.right: parent.right
|
||||
anchors.margins: Style.current.padding
|
||||
isBridgeTx: root.isBridgeTx
|
||||
isERC721Transfer: root.isERC721Transfer
|
||||
isCollectiblesTransfer: root.isCollectiblesTransfer
|
||||
minReceiveCryptoDecimals: root.minReceiveCryptoDecimals
|
||||
isLoading: root.isLoading
|
||||
store: root.store
|
||||
|
|
|
@ -19,7 +19,7 @@ RowLayout {
|
|||
property int minReceiveCryptoDecimals: 0
|
||||
property bool isLoading: false
|
||||
property bool isBridgeTx: false
|
||||
property bool isERC721Transfer: false
|
||||
property bool isCollectiblesTransfer: false
|
||||
property var selectedAccount
|
||||
property var toNetworksList
|
||||
property var weiToEth: function(wei) {}
|
||||
|
@ -99,7 +99,7 @@ RowLayout {
|
|||
implicitWidth: 410
|
||||
title: model.chainName
|
||||
subTitle: {
|
||||
if(root.isERC721Transfer)
|
||||
if(root.isCollectiblesTransfer)
|
||||
return ""
|
||||
let amountOut = root.weiToEth(model.amountOut)
|
||||
return root.formatCurrencyAmount(amountOut, root.selectedSymbol, {"minDecimals": root.minReceiveCryptoDecimals})
|
||||
|
|
|
@ -16,7 +16,7 @@ Loader {
|
|||
id: root
|
||||
|
||||
property var store
|
||||
property bool isERC721Transfer
|
||||
property bool isCollectiblesTransfer
|
||||
property bool isBridgeTx: false
|
||||
property bool interactive: true
|
||||
property var selectedAsset
|
||||
|
@ -67,7 +67,7 @@ Loader {
|
|||
}
|
||||
|
||||
// set preferred chains
|
||||
if(!isERC721Transfer) {
|
||||
if(!isCollectiblesTransfer) {
|
||||
if(root.isBridgeTx)
|
||||
root.store.setAllNetworksAsRoutePreferredChains()
|
||||
else
|
||||
|
@ -98,7 +98,7 @@ Loader {
|
|||
|
||||
function evaluateAndSetPreferredChains() {
|
||||
let address = !!root.item.input && !!root.store.plainText(root.item.input.text) ? root.store.plainText(root.item.input.text): ""
|
||||
let result = store.splitAndFormatAddressPrefix(address, !root.isBridgeTx && !isERC721Transfer)
|
||||
let result = store.splitAndFormatAddressPrefix(address, !root.isBridgeTx && !isCollectiblesTransfer)
|
||||
if(!!result.address) {
|
||||
root.addressText = result.address
|
||||
if(!!root.item.input)
|
||||
|
|
|
@ -224,7 +224,7 @@ Item {
|
|||
numItems: isCollection ? (!!communityId ?
|
||||
root.collectibles.getNumberOfCollectiblesInCommunity(communityId) :
|
||||
root.collectibles.getNumberOfCollectiblesInCollection(collectionUid)) : 0
|
||||
onItemHovered: root.tokenHovered(selectedItem.uid, Constants.TokenType.ERC721, hovered)
|
||||
onItemHovered: root.tokenHovered(selectedItem.uid, tokenType, hovered)
|
||||
onItemSelected: {
|
||||
if (isCollection) {
|
||||
d.currentBrowsingCollectionName = collectionName
|
||||
|
@ -233,7 +233,7 @@ Item {
|
|||
else
|
||||
root.collectibles.currentCollectionUid = collectionUid
|
||||
} else {
|
||||
root.tokenSelected(selectedItem.uid, Constants.TokenType.ERC721)
|
||||
root.tokenSelected(selectedItem.uid, tokenType)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ QtObject {
|
|||
function getHolding(holdingId, holdingType) {
|
||||
if (holdingType === Constants.TokenType.ERC20) {
|
||||
return getAsset(processedAssetsModel, holdingId)
|
||||
} else if (holdingType === Constants.TokenType.ERC721) {
|
||||
} else if (holdingType === Constants.TokenType.ERC721 || holdingType === Constants.TokenType.ERC1155) {
|
||||
return getCollectible(holdingId)
|
||||
} else {
|
||||
return {}
|
||||
|
@ -145,7 +145,7 @@ QtObject {
|
|||
function getSelectorHolding(holdingId, holdingType) {
|
||||
if (holdingType === Constants.TokenType.ERC20) {
|
||||
return getAsset(processedAssetsModel, holdingId)
|
||||
} else if (holdingType === Constants.TokenType.ERC721) {
|
||||
} else if (holdingType === Constants.TokenType.ERC721 || holdingType === Constants.TokenType.ERC1155) {
|
||||
return getSelectorCollectible(holdingId)
|
||||
} else {
|
||||
return {}
|
||||
|
@ -171,7 +171,7 @@ QtObject {
|
|||
function holdingToSelectorHolding(holding, holdingType) {
|
||||
if (holdingType === Constants.TokenType.ERC20) {
|
||||
return assetToSelectorAsset(holding)
|
||||
} else if (holdingType === Constants.TokenType.ERC721) {
|
||||
} else if (holdingType === Constants.TokenType.ERC721 || holdingType === Constants.TokenType.ERC1155) {
|
||||
return collectibleToSelectorCollectible(holding)
|
||||
} else {
|
||||
return {}
|
||||
|
|
|
@ -1009,6 +1009,7 @@ QtObject {
|
|||
StickersBuy,
|
||||
Bridge,
|
||||
ERC721Transfer,
|
||||
ERC1155Transfer,
|
||||
Unknown
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 571f30777ebe32501df0d25f5eb79dbcbbb277c0
|
||||
Subproject commit 580f697f57757daa2ad0671bf8590fb26381342e
|
Loading…
Reference in New Issue