fix(@desktop/wallet): Move selected recipient and send type to nim

fixes #12206
This commit is contained in:
Khushboo Mehta 2023-09-20 18:07:09 +02:00 committed by Khushboo-dev-cpp
parent c8c9c706d9
commit 76615b0bf7
17 changed files with 111 additions and 86 deletions

View File

@ -88,12 +88,12 @@ proc authenticateUser*(self: Controller, keyUid = "") =
keyUid: keyUid)
self.events.emit(SIGNAL_SHARED_KEYCARD_MODULE_AUTHENTICATE_USER, data)
proc suggestedRoutes*(self: Controller, account: string, amount: Uint256, token: string, disabledFromChainIDs, disabledToChainIDs, preferredChainIDs: seq[int], sendType: int, lockedInAmounts: string): string =
proc suggestedRoutes*(self: Controller, account: string, amount: Uint256, token: string, disabledFromChainIDs, disabledToChainIDs, preferredChainIDs: seq[int], sendType: SendType, lockedInAmounts: string): string =
let suggestedRoutes = self.transactionService.suggestedRoutes(account, amount, token, disabledFromChainIDs, disabledToChainIDs, preferredChainIDs, sendType, lockedInAmounts)
return suggestedRoutes.toJson()
proc transfer*(self: Controller, from_addr: string, to_addr: string, tokenSymbol: string,
value: string, uuid: string, selectedRoutes: seq[TransactionPathDto], password: string, sendType: int) =
value: string, uuid: string, selectedRoutes: seq[TransactionPathDto], password: string, sendType: SendType) =
self.transactionService.transfer(from_addr, to_addr, tokenSymbol, value, uuid, selectedRoutes, password, sendType)
proc areTestNetworksEnabled*(self: Controller): bool =

View File

@ -23,14 +23,14 @@ method refreshWalletAccounts*(self: AccessInterface) {.base.} =
method getTokenBalanceOnChain*(self: AccessInterface, address: string, chainId: int, symbol: string): CurrencyAmount {.base.} =
raise newException(ValueError, "No implementation available")
method suggestedRoutes*(self: AccessInterface, account: string, amount: UInt256, token: string, disabledFromChainIDs, disabledToChainIDs, preferredChainIDs: seq[int], sendType: int, lockedInAmounts: string): string {.base.} =
method suggestedRoutes*(self: AccessInterface, account: string, amount: UInt256, token: string, disabledFromChainIDs, disabledToChainIDs, preferredChainIDs: seq[int], sendType: SendType, lockedInAmounts: string): string {.base.} =
raise newException(ValueError, "No implementation available")
method suggestedRoutesReady*(self: AccessInterface, suggestedRoutes: SuggestedRoutesDto) {.base.} =
raise newException(ValueError, "No implementation available")
method authenticateAndTransfer*(self: AccessInterface, from_addr: string, to_addr: string,
tokenSymbol: string, value: string, uuid: string, sendType: int) {.base.} =
tokenSymbol: string, value: string, uuid: string, sendType: SendType) {.base.} =
raise newException(ValueError, "No implementation available")
method onUserAuthenticated*(self: AccessInterface, password: string) {.base.} =

View File

@ -30,7 +30,7 @@ type TmpSendTransactionDetails = object
value: string
paths: seq[TransactionPathDto]
uuid: string
sendType: int
sendType: SendType
type
Module* = ref object of io_interface.AccessInterface
@ -242,7 +242,7 @@ method viewDidLoad*(self: Module) =
method getTokenBalanceOnChain*(self: Module, address: string, chainId: int, symbol: string): CurrencyAmount =
return self.controller.getTokenBalanceOnChain(address, chainId, symbol)
method authenticateAndTransfer*(self: Module, from_addr: string, to_addr: string, tokenSymbol: string, value: string, uuid: string, sendType: int) =
method authenticateAndTransfer*(self: Module, from_addr: string, to_addr: string, tokenSymbol: string, value: string, uuid: string, sendType: SendType) =
self.tmpSendTransactionDetails.fromAddr = from_addr
self.tmpSendTransactionDetails.toAddr = to_addr
self.tmpSendTransactionDetails.tokenSymbol = tokenSymbol
@ -290,7 +290,7 @@ method onUserAuthenticated*(self: Module, password: string) =
method transactionWasSent*(self: Module, chainId: int, txHash, uuid, error: string) =
self.view.transactionWasSent(chainId, txHash, uuid, error)
method suggestedRoutes*(self: Module, account: string, amount: UInt256, token: string, disabledFromChainIDs, disabledToChainIDs, preferredChainIDs: seq[int], sendType: int, lockedInAmounts: string): string =
method suggestedRoutes*(self: Module, account: string, amount: UInt256, token: string, disabledFromChainIDs, disabledToChainIDs, preferredChainIDs: seq[int], sendType: SendType, lockedInAmounts: string): string =
return self.controller.suggestedRoutes(account, amount, token, disabledFromChainIDs, disabledToChainIDs, preferredChainIDs, sendType, lockedInAmounts)
method suggestedRoutesReady*(self: Module, suggestedRoutes: SuggestedRoutesDto) =

View File

@ -4,6 +4,7 @@ import ./io_interface, ./accounts_model, ./account_item, ./network_model, ./netw
import app/modules/shared_models/token_model
import app/modules/shared_models/collectibles_model as collectibles
import app/modules/shared_models/collectibles_nested_model as nested_collectibles
import app_service/service/transaction/dto as transaction_dto
QtObject:
type
@ -22,6 +23,8 @@ QtObject:
transactionRoutes: TransactionRoutes
selectedAssetSymbol: string
showUnPreferredChains: bool
sendType: transaction_dto.SendType
selectedRecipient: string
# for receive modal
selectedReceiveAccount: AccountItem
@ -143,6 +146,28 @@ QtObject:
read = getShowUnPreferredChains
notify = showUnPreferredChainsChanged
proc sendTypeChanged*(self: View) {.signal.}
proc getSendType(self: View): int {.slot.} =
return ord(self.sendType)
proc setSendType(self: View, sendType: int) {.slot.} =
self.sendType = (SendType)sendType
self.sendTypeChanged()
QtProperty[int] sendType:
write = setSendType
read = getSendType
notify = sendTypeChanged
proc selectedRecipientChanged*(self: View) {.signal.}
proc getSelectedRecipient(self: View): string {.slot.} =
return self.selectedRecipient
proc setSelectedRecipient(self: View, selectedRecipient: string) {.slot.} =
self.selectedRecipient = selectedRecipient
self.selectedRecipientChanged()
QtProperty[string] selectedRecipient:
read = getSelectedRecipient
write = setSelectedRecipient
notify = selectedRecipientChanged
proc updateNetworksDisabledChains(self: View) =
# if the setting to show unpreferred chains is toggled, add all unpreferred chains to disabled chains list
if not self.showUnPreferredChains:
@ -172,15 +197,14 @@ QtObject:
proc transactionWasSent*(self: View, chainId: int, txHash: string, uuid: string, error: string) {.slot} =
self.transactionSent(chainId, txHash, uuid, error)
proc authenticateAndTransfer*(self: View, from_addr: string, to_addr: string, tokenSymbol: string,
value: string, uuid: string, sendType: int) {.slot.} =
self.delegate.authenticateAndTransfer(from_addr, to_addr, tokenSymbol, value, uuid, sendType)
proc authenticateAndTransfer*(self: View, value: string, uuid: string) {.slot.} =
self.delegate.authenticateAndTransfer(self.selectedSenderAccount.address(), self.selectedRecipient, self.selectedAssetSymbol, value, uuid, self.sendType)
proc suggestedRoutesReady*(self: View, suggestedRoutes: QVariant) {.signal.}
proc setTransactionRoute*(self: View, routes: TransactionRoutes) =
self.transactionRoutes = routes
self.suggestedRoutesReady(newQVariant(self.transactionRoutes))
proc suggestedRoutes*(self: View, amount: string, sendType: int): string {.slot.} =
proc suggestedRoutes*(self: View, amount: string): string {.slot.} =
var parsedAmount = stint.u256(0)
try:
parsedAmount = amount.parse(Uint256)
@ -189,7 +213,7 @@ QtObject:
return self.delegate.suggestedRoutes(self.selectedSenderAccount.address(),
parsedAmount, self.selectedAssetSymbol, self.fromNetworksModel.getRouteDisabledNetworkChainIds(),
self.toNetworksModel.getRouteDisabledNetworkChainIds(), self.toNetworksModel.getRoutePreferredNetworkChainIds(), sendType, self.fromNetworksModel.getRouteLockedChainIds())
self.toNetworksModel.getRouteDisabledNetworkChainIds(), self.toNetworksModel.getRoutePreferredNetworkChainIds(), self.sendType, self.fromNetworksModel.getRouteLockedChainIds())
proc switchSenderAccountByAddress*(self: View, address: string) =
let (account, index) = self.senderAccounts.getItemByAddress(address)
@ -235,6 +259,8 @@ QtObject:
self.toNetworksModel.updateToNetworks(path)
proc resetStoredProperties*(self: View) {.slot.} =
self.sendType = transaction_dto.SendType.Transfer
self.selectedRecipient = ""
self.fromNetworksModel.reset()
self.toNetworksModel.reset()
self.transactionRoutes = newTransactionRoutes()

View File

@ -20,7 +20,7 @@ type
disabledFromChainIDs: seq[int]
disabledToChainIDs: seq[int]
preferredChainIDs: seq[int]
sendType: int
sendType: SendType
lockedInAmounts: string
proc getGasEthValue*(gweiValue: float, gasLimit: uint64): float =
@ -88,12 +88,12 @@ const getSuggestedRoutesTask*: Task = proc(argEncoded: string) {.gcsafe, nimcall
except:
discard
let response = eth.suggestedRoutes(arg.account, amountAsHex, arg.token, arg.disabledFromChainIDs, arg.disabledToChainIDs, arg.preferredChainIDs, arg.sendType, lockedInAmounts).result
let response = eth.suggestedRoutes(arg.account, amountAsHex, arg.token, arg.disabledFromChainIDs, arg.disabledToChainIDs, arg.preferredChainIDs, ord(arg.sendType), lockedInAmounts).result
var bestPaths = response["Best"].getElems().map(x => x.toTransactionPathDto())
# retry along with unpreferred chains incase no route is possible with preferred chains
if(bestPaths.len == 0 and arg.preferredChainIDs.len > 0):
let response = eth.suggestedRoutes(arg.account, amountAsHex, arg.token, arg.disabledFromChainIDs, arg.disabledToChainIDs, @[], arg.sendType, lockedInAmounts).result
let response = eth.suggestedRoutes(arg.account, amountAsHex, arg.token, arg.disabledFromChainIDs, arg.disabledToChainIDs, @[], ord(arg.sendType), lockedInAmounts).result
bestPaths = response["Best"].getElems().map(x => x.toTransactionPathDto())
bestPaths.sort(sortAsc[TransactionPathDto])

View File

@ -310,10 +310,10 @@ QtObject:
uuid: string,
routes: seq[TransactionPathDto],
password: string,
sendType: int
sendType: SendType
) =
try:
let isERC721Transfer = sendType == ord(ERC721Transfer)
let isERC721Transfer = sendType == ERC721Transfer
var paths: seq[TransactionBridgeDto] = @[]
var chainID = 0
@ -387,7 +387,7 @@ QtObject:
uuid: string,
selectedRoutes: seq[TransactionPathDto],
password: string,
sendType: int
sendType: SendType
) =
try:
var chainID = 0
@ -424,7 +424,7 @@ QtObject:
error "error handling suggestedRoutesReady response", errDesription=e.msg
self.events.emit(SIGNAL_SUGGESTED_ROUTES_READY, SuggestedRoutesArgs(suggestedRoutes: suggestedRoutesDto))
proc suggestedRoutes*(self: Service, account: string, amount: Uint256, token: string, disabledFromChainIDs, disabledToChainIDs, preferredChainIDs: seq[int], sendType: int, lockedInAmounts: string): SuggestedRoutesDto =
proc suggestedRoutes*(self: Service, account: string, amount: Uint256, token: string, disabledFromChainIDs, disabledToChainIDs, preferredChainIDs: seq[int], sendType: SendType, lockedInAmounts: string): SuggestedRoutesDto =
let arg = GetSuggestedRoutesTaskArg(
tptr: cast[ByteAddress](getSuggestedRoutesTask),
vptr: cast[ByteAddress](self.vptr),

View File

@ -63,7 +63,6 @@ StatusSectionLayout {
property Component sendTransactionModalComponent: SendModal {
anchors.centerIn: parent
selectedAccount: WalletStore.dappBrowserAccount
preSelectedHolding: store.getAsset(WalletStore.dappBrowserAccount.assets, "ETH")
preSelectedHoldingType: Constants.HoldingType.Asset
}

View File

@ -118,7 +118,7 @@ Item {
id: releaseEnsModal
modalHeader: qsTr("Release your username")
interactive: false
sendType: Constants.SendType.ENSRelease
preSelectedSendType: Constants.SendType.ENSRelease
preSelectedRecipient: root.ensUsernamesStore.getEnsRegisteredAddress()
preDefinedAmountToSend: LocaleUtils.numberToLocaleString(0)
preSelectedHolding: store.getAsset(releaseEnsModal.store.assets, Constants.ethToken)
@ -131,7 +131,7 @@ Item {
root.ensUsernamesStore.authenticateAndReleaseEns(
root.chainId,
root.username,
selectedAccount.address,
store.selectedSenderAccount.address,
path.gasAmount,
eip1559Enabled ? "" : path.gasFees.gasPrice,
eip1559Enabled ? path.gasFees.maxPriorityFeePerGas : "",

View File

@ -63,7 +63,7 @@ Item {
id: connectEnsModal
modalHeader: qsTr("Connect username with your pubkey")
interactive: false
sendType: Constants.SendType.ENSSetPubKey
preSelectedSendType: Constants.SendType.ENSSetPubKey
preSelectedRecipient: root.ensUsernamesStore.getEnsRegisteredAddress()
preDefinedAmountToSend: LocaleUtils.numberToLocaleString(0)
preSelectedHolding: store.getAsset(connectEnsModal.store.assets, Constants.ethToken)
@ -75,7 +75,7 @@ Item {
root.ensUsernamesStore.authenticateAndSetPubKey(
root.ensUsernamesStore.chainId,
ensUsername.text + (isStatus ? ".stateofus.eth" : "" ),
selectedAccount.address,
store.selectedSenderAccount.address,
path.gasAmount,
eip1559Enabled ? "" : path.gasFees.gasPrice,
"",

View File

@ -48,7 +48,7 @@ Item {
sourceComponent: SendModal {
id: buyEnsModal
interactive: false
sendType: Constants.SendType.ENSRegister
preSelectedSendType: Constants.SendType.ENSRegister
preSelectedRecipient: root.ensUsernamesStore.getEnsRegisteredAddress()
preDefinedAmountToSend: LocaleUtils.numberToLocaleString(10)
preSelectedHolding: store.getAsset(buyEnsModal.store.assets, JSON.parse(root.stickersStore.getStatusToken()).symbol)
@ -61,7 +61,7 @@ Item {
root.ensUsernamesStore.authenticateAndRegisterEns(
root.ensUsernamesStore.chainId,
username,
selectedAccount.address,
store.selectedSenderAccount.address,
path.gasAmount,
eip1559Enabled ? "" : path.gasFees.gasPrice,
eip1559Enabled ? path.gasFees.maxPriorityFeePerGas : "",

View File

@ -150,14 +150,14 @@ Item {
networkConnectionStore: root.networkConnectionStore
onLaunchShareAddressModal: Global.openPopup(receiveModalComponent)
onLaunchSendModal: {
root.sendModalPopup.sendType = Constants.SendType.Transfer
root.sendModalPopup.preSelectedSendType = Constants.SendType.Transfer
root.sendModalPopup.preSelectedHoldingID = walletStore.currentViewedHoldingID
root.sendModalPopup.preSelectedHoldingType = walletStore.currentViewedHoldingType
root.sendModalPopup.onlyAssets = false
root.sendModalPopup.open()
}
onLaunchBridgeModal: {
root.sendModalPopup.sendType = Constants.SendType.Bridge
root.sendModalPopup.preSelectedSendType = Constants.SendType.Bridge
root.sendModalPopup.preSelectedHoldingID = walletStore.currentViewedHoldingID
root.sendModalPopup.preSelectedHoldingType = walletStore.currentViewedHoldingType
root.sendModalPopup.onlyAssets = true

View File

@ -1328,38 +1328,32 @@ Item {
id: sendModal
active: false
function open(address = "") {
function open() {
this.active = true
this.item.addressText = address;
this.item.open()
}
function closed() {
// this.sourceComponent = undefined // kill an opened instance
this.active = false
}
property var selectedAccount
property var preSelectedHolding
property string preSelectedHoldingID
property int preSelectedHoldingType
property int sendType: -1
property int preSelectedSendType: Constants.SendType.Unknown
property bool onlyAssets: false
sourceComponent: SendModal {
onlyAssets: sendModal.onlyAssets
onClosed: {
sendModal.closed()
sendModal.sendType = -1
sendModal.preSelectedSendType = Constants.SendType.Unknown
sendModal.preSelectedHoldingID = ""
sendModal.preSelectedHoldingType = Constants.HoldingType.Unknown
sendModal.preSelectedHolding = undefined
sendModal.selectedAccount = undefined
}
}
onLoaded: {
if (!!sendModal.selectedAccount) {
item.selectedAccount = sendModal.selectedAccount
}
if(sendModal.sendType >= 0) {
item.sendType = sendModal.sendType
if(sendModal.preSelectedSendType !== Constants.SendType.Unknown) {
item.preSelectedSendType = sendModal.preSelectedSendType
}
if(preSelectedHoldingType !== Constants.HoldingType.Unknown) {
item.preSelectedHoldingID = sendModal.preSelectedHoldingID

View File

@ -29,6 +29,7 @@ StatusDialog {
property var preSelectedHolding
property string preSelectedHoldingID
property int preSelectedHoldingType
property int preSelectedSendType
property bool interactive: true
property alias onlyAssets: holdingSelector.onlyAssets
@ -36,13 +37,10 @@ StatusDialog {
property TransactionStore store: TransactionStore {}
property CurrenciesStore currencyStore: store.currencyStore
property var selectedAccount: store.selectedSenderAccount
property var collectiblesModel: store.collectiblesModel
property var nestedCollectiblesModel: store.nestedCollectiblesModel
property var bestRoutes
property alias addressText: recipientLoader.addressText
property bool isLoading: false
property int sendType: Constants.SendType.Transfer
property MessageDialog sendingError: MessageDialog {
id: sendingError
@ -52,24 +50,15 @@ StatusDialog {
}
property var sendTransaction: function() {
let recipientAddress = Utils.isValidAddress(popup.addressText) ? popup.addressText : recipientLoader.resolvedENSAddress
d.isPendingTx = true
popup.store.authenticateAndTransfer(
popup.selectedAccount.address,
recipientAddress,
d.selectedSymbol,
amountToSendInput.cryptoValueToSend,
d.uuid,
sendType)
popup.store.authenticateAndTransfer(amountToSendInput.cryptoValueToSend, d.uuid)
}
property var recalculateRoutesAndFees: Backpressure.debounce(popup, 600, function() {
if(!!popup.selectedAccount && !!holdingSelector.selectedItem
if(!!store.selectedSenderAccount && !!holdingSelector.selectedItem
&& recipientLoader.ready && amountToSendInput.inputNumberValid) {
popup.isLoading = true
popup.store.suggestedRoutes(d.isERC721Transfer ? "1" : amountToSendInput.cryptoValueToSend,
popup.sendType)
popup.store.suggestedRoutes(d.isERC721Transfer ? "1" : amountToSendInput.cryptoValueToSend)
}
})
@ -82,16 +71,15 @@ StatusDialog {
readonly property double maxFiatBalance: isSelectedHoldingValidAsset ? selectedHolding.totalCurrencyBalance.amount : 0
readonly property double maxCryptoBalance: isSelectedHoldingValidAsset ? selectedHolding.totalBalance.amount : 0
readonly property double maxInputBalance: amountToSendInput.inputIsFiat ? maxFiatBalance : maxCryptoBalance
readonly property string selectedSymbol: store.selectedAssetSymbol
readonly property string inputSymbol: amountToSendInput.inputIsFiat ? popup.currencyStore.currentCurrency : selectedSymbol
readonly property string inputSymbol: amountToSendInput.inputIsFiat ? popup.currencyStore.currentCurrency : store.selectedAssetSymbol
readonly property bool errorMode: popup.isLoading || !recipientLoader.ready ? false : errorType !== Constants.NoError || networkSelector.errorMode || !amountToSendInput.inputNumberValid
readonly property string uuid: Utils.uuid()
property bool isPendingTx: false
property string totalTimeEstimate
property double totalFeesInFiat
property double totalAmountToReceive
readonly property bool isBridgeTx: popup.sendType === Constants.SendType.Bridge
readonly property bool isERC721Transfer: popup.sendType === Constants.SendType.ERC721Transfer
readonly property bool isBridgeTx: store.sendType === Constants.SendType.Bridge
readonly property bool isERC721Transfer: store.sendType === Constants.SendType.ERC721Transfer
property var selectedHolding: null
property var selectedHoldingType: Constants.HoldingType.Unknown
readonly property bool isSelectedHoldingValidAsset: !!selectedHolding && selectedHoldingType === Constants.HoldingType.Asset
@ -125,11 +113,11 @@ StatusDialog {
onSelectedHoldingChanged: {
if (d.selectedHoldingType === Constants.HoldingType.Asset) {
if(popup.sendType !== Constants.SendType.Bridge)
popup.sendType = Constants.SendType.Transfer
if(store.sendType !== Constants.SendType.Bridge)
store.setSendType(Constants.SendType.Transfer)
store.setSelectedAssetSymbol(selectedHolding.symbol)
} else if (d.selectedHoldingType === Constants.HoldingType.Collectible) {
popup.sendType = Constants.SendType.ERC721Transfer
store.setSendType(Constants.SendType.ERC721Transfer)
amountToSendInput.input.text = 1
store.setSelectedAssetSymbol(selectedHolding.contractAddress+":"+selectedHolding.tokenId)
store.setRouteEnabledFromChains(selectedHolding.chainId)
@ -148,11 +136,13 @@ StatusDialog {
color: Theme.palette.baseColor3
}
onSelectedAccountChanged: popup.recalculateRoutesAndFees()
onOpened: {
amountToSendInput.input.input.edit.forceActiveFocus()
if(popup.preSelectedSendType !== Constants.SendType.Unknown) {
store.setSendType(popup.preSelectedSendType)
}
if (popup.preSelectedHoldingType !== Constants.HoldingType.Unknown) {
tokenListRect.browsingHoldingType = popup.preSelectedHoldingType
if(!!popup.preSelectedHolding) {
@ -173,7 +163,7 @@ StatusDialog {
if(d.isBridgeTx) {
recipientLoader.selectedRecipientType = TabAddressSelectorView.Type.Address
recipientLoader.selectedRecipient = {address: popup.selectedAccount.address}
recipientLoader.selectedRecipient = {address: store.selectedSenderAccount.address}
}
}
@ -187,9 +177,13 @@ StatusDialog {
sorters: RoleSorter { roleName: "position"; sortOrder: Qt.AscendingOrder }
}
selectedAccount: !!popup.selectedAccount ? popup.selectedAccount: {}
selectedAccount: !!store.selectedSenderAccount ? store.selectedSenderAccount: {}
getNetworkShortNames: function(chainIds) {return store.getNetworkShortNames(chainIds)}
onSelectedIndexChanged: store.switchSenderAccount(selectedIndex)
onSelectedIndexChanged: {
store.switchSenderAccount(selectedIndex)
d.setSelectedHoldingId(d.selectedHolding.symbol, d.selectedHoldingType)
popup.recalculateRoutesAndFees()
}
}
@ -249,8 +243,8 @@ StatusDialog {
id: holdingSelector
Layout.fillWidth: true
Layout.fillHeight: true
assetsModel: popup.selectedAccount && popup.selectedAccount.assets ? popup.selectedAccount.assets : null
collectiblesModel: popup.selectedAccount ? popup.nestedCollectiblesModel : null
assetsModel:store.selectedSenderAccount && store.selectedSenderAccount.assets ? store.selectedSenderAccount.assets : null
collectiblesModel: store.selectedSenderAccount ? popup.nestedCollectiblesModel : null
currentCurrencySymbol: RootStore.currencyStore.currentCurrencySymbol
visible: (!!d.selectedHolding && d.selectedHoldingType !== Constants.HoldingType.Unknown) ||
(!!d.hoveredHolding && d.hoveredHoldingType !== Constants.HoldingType.Unknown)
@ -294,7 +288,7 @@ StatusDialog {
Layout.fillWidth: true
isBridgeTx: d.isBridgeTx
interactive: popup.interactive
selectedSymbol: d.selectedSymbol
selectedSymbol: store.selectedAssetSymbol
maxInputBalance: d.maxInputBalance
currentCurrency: popup.currencyStore.currentCurrency
@ -324,7 +318,7 @@ StatusDialog {
visible: !!popup.bestRoutes && popup.bestRoutes !== undefined &&
popup.bestRoutes.count > 0 && amountToSendInput.inputNumberValid
isLoading: popup.isLoading
selectedSymbol: d.selectedSymbol
selectedSymbol: store.selectedAssetSymbol
isBridgeTx: d.isBridgeTx
cryptoValueToReceive: d.totalAmountToReceive
inputIsFiat: amountToSendInput.inputIsFiat
@ -376,8 +370,8 @@ StatusDialog {
anchors.rightMargin: Style.current.bigPadding
visible: !d.selectedHolding
assets: popup.selectedAccount && popup.selectedAccount.assets ? popup.selectedAccount.assets : null
collectibles: popup.selectedAccount ? popup.nestedCollectiblesModel : null
assets: store.selectedSenderAccount && store.selectedSenderAccount.assets ? store.selectedSenderAccount.assets : null
collectibles: store.selectedSenderAccount ? popup.nestedCollectiblesModel : null
onlyAssets: holdingSelector.onlyAssets
searchTokenSymbolByAddressFn: function (address) {
return store.findTokenSymbolByAddress(address)
@ -422,6 +416,7 @@ StatusDialog {
selectedAsset: d.selectedHolding
onIsLoading: popup.isLoading = true
onRecalculateRoutesAndFees: popup.recalculateRoutesAndFees()
onAddressTextChanged: store.setSelectedRecipient(addressText)
}
}
@ -432,7 +427,7 @@ StatusDialog {
anchors.leftMargin: Style.current.bigPadding
anchors.rightMargin: Style.current.bigPadding
store: popup.store
selectedAccount: popup.selectedAccount
selectedAccount: store.selectedSenderAccount
onRecipientSelected: {
recipientLoader.selectedRecipientType = type
recipientLoader.selectedRecipient = recipient
@ -449,7 +444,7 @@ StatusDialog {
anchors.rightMargin: Style.current.bigPadding
store: popup.store
interactive: popup.interactive
selectedAccount: popup.selectedAccount
selectedAccount: store.selectedSenderAccount
ensAddressOrEmpty: recipientLoader.resolvedENSAddress
amountToSend: amountToSendInput.cryptoValueToSendFloat
minSendCryptoDecimals: amountToSendInput.minSendCryptoDecimals
@ -470,7 +465,7 @@ StatusDialog {
anchors.leftMargin: Style.current.bigPadding
anchors.rightMargin: Style.current.bigPadding
visible: recipientLoader.ready && !!d.selectedHolding && networkSelector.advancedOrCustomMode && amountToSendInput.inputNumberValid
selectedTokenSymbol: d.selectedSymbol
selectedTokenSymbol: store.selectedAssetSymbol
isLoading: popup.isLoading
bestRoutes: popup.bestRoutes
store: popup.store

View File

@ -200,7 +200,7 @@ Item {
required property string packId
interactive: false
sendType: Constants.SendType.StickersBuy
preSelectedSendType: Constants.SendType.StickersBuy
preSelectedRecipient: root.store.stickersStore.getStickersMarketAddress()
preDefinedAmountToSend: LocaleUtils.numberToLocaleString(parseFloat(price))
preSelectedHolding: store.getAsset(buyStickersModal.store.assets, JSON.parse(root.store.stickersStore.getStatusToken()).symbol)
@ -211,7 +211,7 @@ Item {
let eip1559Enabled = path.gasFees.eip1559Enabled
let maxFeePerGas = path.gasFees.maxFeePerGasM
root.store.stickersStore.authenticateAndBuy(packId,
selectedAccount.address,
store.selectedSenderAccount.address,
path.gasAmount,
eip1559Enabled ? "" : path.gasFees.gasPrice,
eip1559Enabled ? path.gasFees.maxPriorityFeePerGas : "",

View File

@ -69,7 +69,7 @@ ModalPopup {
SendModal {
id: buyStickersPackModal
interactive: false
sendType: Constants.SendType.StickersBuy
preSelectedSendType: Constants.SendType.StickersBuy
preSelectedRecipient: stickerPackDetailsPopup.store.stickersStore.getStickersMarketAddress()
preDefinedAmountToSend: LocaleUtils.numberToLocaleString(parseFloat(price))
preSelectedHolding: store.getAsset(buyStickersPackModal.store.assets, JSON.parse(stickerPackDetailsPopup.store.stickersStore.getStatusToken()).symbol)
@ -80,7 +80,7 @@ ModalPopup {
let eip1559Enabled = path.gasFees.eip1559Enabled
let maxFeePerGas = path.gasFees.maxFeePerGasM
stickerPackDetailsPopup.store.stickersStore.authenticateAndBuy(packId,
selectedAccount.address,
store.selectedSenderAccount.address,
path.gasAmount,
eip1559Enabled ? "" : path.gasFees.gasPrice,
eip1559Enabled ? path.gasFees.maxPriorityFeePerGas : "",

View File

@ -37,6 +37,16 @@ QtObject {
}
property string selectedAssetSymbol: walletSectionSendInst.selectedAssetSymbol
property bool showUnPreferredChains: walletSectionSendInst.showUnPreferredChains
property int sendType: walletSectionSendInst.sendType
property string selectedRecipient: walletSectionSendInst.selectedRecipient
function setSendType(sendType) {
walletSectionSendInst.setSendType(sendType)
}
function setSelectedRecipient(recipientAddress) {
walletSectionSendInst.setSelectedRecipient(recipientAddress)
}
function getEtherscanLink(chainID) {
return networksModule.all.getBlockExplorerURL(chainID)
@ -46,12 +56,12 @@ QtObject {
globalUtils.copyToClipboard(text)
}
function authenticateAndTransfer(from, to, tokenSymbol, amount, uuid, sendType) {
walletSectionSendInst.authenticateAndTransfer(from, to, tokenSymbol, amount, uuid, sendType)
function authenticateAndTransfer(amount, uuid) {
walletSectionSendInst.authenticateAndTransfer(amount, uuid)
}
function suggestedRoutes(amount, sendType) {
walletSectionSendInst.suggestedRoutes(amount, sendType)
function suggestedRoutes(amount) {
walletSectionSendInst.suggestedRoutes(amount)
}
function resolveENS(value) {

View File

@ -984,7 +984,8 @@ QtObject {
ENSSetPubKey,
StickersBuy,
Bridge,
ERC721Transfer
ERC721Transfer,
Unknown
}
enum ErrorType {