fix: buying stickers doesn't work and popup may be misleading for the user
Closes: #15764
This commit is contained in:
parent
e66b0ab0a9
commit
db77654274
|
@ -7,6 +7,10 @@ import app/modules/shared_models/collectibles_nested_model as nested_collectible
|
|||
import app_service/service/network/service as network_service
|
||||
import app_service/service/transaction/dto as transaction_dto
|
||||
|
||||
import app_service/common/utils as common_utils
|
||||
import app_service/service/eth/utils as eth_utils
|
||||
from backend/eth import ExtraKeyPackId
|
||||
|
||||
QtObject:
|
||||
type
|
||||
View* = ref object of QObject
|
||||
|
@ -208,6 +212,11 @@ QtObject:
|
|||
try:
|
||||
if extraParamsJson.len > 0:
|
||||
for key, value in parseJson(extraParamsJson):
|
||||
if key == ExtraKeyPackId:
|
||||
let bigPackId = common_utils.stringToUint256(value.getStr())
|
||||
let packIdHex = "0x" & eth_utils.stripLeadingZeros(bigPackId.toHex)
|
||||
extraParamsTable[key] = packIdHex
|
||||
else:
|
||||
extraParamsTable[key] = value.getStr()
|
||||
except Exception as e:
|
||||
error "Error parsing extraParamsJson: ", msg=e.msg
|
||||
|
|
|
@ -40,6 +40,8 @@ StatusDialog {
|
|||
property alias preSelectedRecipientType: recipientInputLoader.selectedRecipientType
|
||||
|
||||
property string preDefinedAmountToSend
|
||||
property string stickersPackId
|
||||
|
||||
// token symbol
|
||||
property string preSelectedHoldingID
|
||||
property int preSelectedHoldingType: Constants.TokenType.Unknown
|
||||
|
@ -75,13 +77,15 @@ StatusDialog {
|
|||
if(!!popup.selectedAccount && !!popup.selectedAccount.address && !!holdingSelector.selectedItem
|
||||
&& recipientInputLoader.ready && (amountToSend.ready || d.isCollectiblesTransfer)) {
|
||||
popup.isLoading = true
|
||||
popup.store.suggestedRoutes(d.isCollectiblesTransfer ? "1" : amountToSend.amount)
|
||||
popup.store.suggestedRoutes(d.isCollectiblesTransfer ? "1" : amountToSend.amount, "0", d.extraParamsJson)
|
||||
}
|
||||
})
|
||||
|
||||
QtObject {
|
||||
id: d
|
||||
|
||||
property string extraParamsJson: ""
|
||||
|
||||
readonly property WalletAccountsAdaptor accountsAdaptor: WalletAccountsAdaptor {
|
||||
accountsModel: popup.store.accounts
|
||||
flatNetworksModel: popup.store.flatNetworksModel
|
||||
|
@ -240,6 +244,10 @@ StatusDialog {
|
|||
|
||||
amountToSend.setValue(delocalized)
|
||||
}
|
||||
|
||||
if (!!popup.stickersPackId) {
|
||||
d.extraParamsJson = "{\"%1\":\"%2\"}".arg(Constants.suggestedRoutesExtraParamsProperties.packId).arg(popup.stickersPackId)
|
||||
}
|
||||
}
|
||||
|
||||
onClosed: popup.store.resetStoredProperties()
|
||||
|
|
|
@ -209,6 +209,7 @@ Item {
|
|||
preSelectedSendType: Constants.SendType.StickersBuy
|
||||
preSelectedRecipient: root.store.stickersStore.getStickersMarketAddress()
|
||||
preDefinedAmountToSend: LocaleUtils.numberToLocaleString(parseFloat(price))
|
||||
stickersPackId: packId
|
||||
preSelectedHoldingID: {
|
||||
let token = ModelUtils.getByKey(root.walletAssetsStore.groupedAccountAssetsModel, "tokensKey", root.store.stickersStore.getStatusTokenKey())
|
||||
return !!token && !!token.symbol ? token.symbol : ""
|
||||
|
|
|
@ -1022,6 +1022,12 @@ QtObject {
|
|||
|
||||
readonly property int minPasswordLength: 10
|
||||
|
||||
readonly property QtObject suggestedRoutesExtraParamsProperties: QtObject {
|
||||
readonly property string packId: "packID"
|
||||
readonly property string username: "username"
|
||||
readonly property string publicKey: "publicKey"
|
||||
}
|
||||
|
||||
enum SendType {
|
||||
Transfer,
|
||||
ENSRegister,
|
||||
|
|
Loading…
Reference in New Issue