mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-16 16:47:24 +00:00
feat(@desktop/wallet): Apply flat assets model into SendModal
fixes #13016
This commit is contained in:
parent
21a33cabd9
commit
087601e28e
@ -18,6 +18,8 @@ import Storybook 1.0
|
|||||||
import Models 1.0
|
import Models 1.0
|
||||||
|
|
||||||
import AppLayouts.Wallet.views 1.0
|
import AppLayouts.Wallet.views 1.0
|
||||||
|
import AppLayouts.Wallet.stores 1.0
|
||||||
|
|
||||||
|
|
||||||
SplitView {
|
SplitView {
|
||||||
id: root
|
id: root
|
||||||
@ -56,13 +58,13 @@ SplitView {
|
|||||||
|
|
||||||
readonly property var currencyStore: CurrenciesStore {}
|
readonly property var currencyStore: CurrenciesStore {}
|
||||||
|
|
||||||
readonly property var groupedAccountsAssetsModel: GroupedAccountsAssetsModel {}
|
property WalletAssetsStore walletAssetStore: WalletAssetsStore {
|
||||||
readonly property var tokensBySymbolModel: TokensBySymbolModel {}
|
assetsWithFilteredBalances: d.assetsWithFilteredBalances
|
||||||
readonly property CommunitiesModel communityModel: CommunitiesModel {}
|
}
|
||||||
|
|
||||||
// Added this here simply because the network and address filtering wont work in Storybook applied in AssetsView
|
// Added this here simply because the network and address filtering wont work in Storybook applied in AssetsView
|
||||||
readonly property SubmodelProxyModel assetsWithFilteredBalances: SubmodelProxyModel {
|
readonly property SubmodelProxyModel assetsWithFilteredBalances: SubmodelProxyModel {
|
||||||
sourceModel: d.groupedAccountsAssetsModel
|
sourceModel: d.walletAssetStore.groupedAccountsAssetsModel
|
||||||
submodelRoleName: "balances"
|
submodelRoleName: "balances"
|
||||||
delegateModel: SortFilterProxyModel {
|
delegateModel: SortFilterProxyModel {
|
||||||
sourceModel: submodel
|
sourceModel: submodel
|
||||||
@ -71,36 +73,11 @@ SplitView {
|
|||||||
d.networksChainsCurrentlySelected
|
d.networksChainsCurrentlySelected
|
||||||
d.addressesSelected
|
d.addressesSelected
|
||||||
return d.networksChainsCurrentlySelected.split(":").includes(chainId+"") &&
|
return d.networksChainsCurrentlySelected.split(":").includes(chainId+"") &&
|
||||||
(!! d.addressesSelected ? d.addressesSelected.toUpperCase() === account.toUpperCase() : true)
|
(!!d.addressesSelected ? d.addressesSelected.toUpperCase() === account.toUpperCase() : true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// renaming tokens by symbol key so that can be used to join models
|
|
||||||
readonly property var renamedTokensBySymbolModel: RolesRenamingModel {
|
|
||||||
sourceModel: d.tokensBySymbolModel
|
|
||||||
mapping: [
|
|
||||||
RoleRename {
|
|
||||||
from: "key"
|
|
||||||
to: "tokensKey"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
// join account assets and tokens by symbol model
|
|
||||||
property LeftJoinModel jointModel: LeftJoinModel {
|
|
||||||
leftModel: d.assetsWithFilteredBalances
|
|
||||||
rightModel: d.renamedTokensBySymbolModel
|
|
||||||
joinRole: "tokensKey"
|
|
||||||
}
|
|
||||||
|
|
||||||
// combining community model with assets to get community meta data
|
|
||||||
property LeftJoinModel builtAccountAssetsModel: LeftJoinModel {
|
|
||||||
leftModel: d.jointModel
|
|
||||||
rightModel: d.communityModel
|
|
||||||
joinRole: "communityId"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Popups {
|
Popups {
|
||||||
@ -121,7 +98,7 @@ SplitView {
|
|||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
areAssetsLoading: loadingCheckbox.checked
|
areAssetsLoading: loadingCheckbox.checked
|
||||||
assets: d.builtAccountAssetsModel
|
assets: d.walletAssetStore.groupedAccountAssetsModel
|
||||||
filterVisible: ctrlFilterVisible.checked
|
filterVisible: ctrlFilterVisible.checked
|
||||||
currencyStore: d.currencyStore
|
currencyStore: d.currencyStore
|
||||||
networkFilters: d.networksChainsCurrentlySelected
|
networkFilters: d.networksChainsCurrentlySelected
|
||||||
|
@ -2,6 +2,7 @@ import QtQuick 2.15
|
|||||||
import QtQuick.Controls 2.15
|
import QtQuick.Controls 2.15
|
||||||
import QtQuick.Layouts 1.15
|
import QtQuick.Layouts 1.15
|
||||||
|
|
||||||
|
import StatusQ 0.1
|
||||||
import StatusQ.Core 0.1
|
import StatusQ.Core 0.1
|
||||||
import StatusQ.Controls 0.1
|
import StatusQ.Controls 0.1
|
||||||
|
|
||||||
@ -12,13 +13,33 @@ import shared.popups.send 1.0
|
|||||||
import shared.stores 1.0
|
import shared.stores 1.0
|
||||||
import shared.stores.send 1.0
|
import shared.stores.send 1.0
|
||||||
|
|
||||||
|
import SortFilterProxyModel 0.2
|
||||||
|
import AppLayouts.Wallet.stores 1.0
|
||||||
|
|
||||||
SplitView {
|
SplitView {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
orientation: Qt.Horizontal
|
orientation: Qt.Horizontal
|
||||||
|
|
||||||
|
property WalletAssetsStore walletAssetStore: WalletAssetsStore {
|
||||||
|
assetsWithFilteredBalances: root.assetsWithFilteredBalances
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
property SubmodelProxyModel assetsWithFilteredBalances: SubmodelProxyModel {
|
||||||
|
sourceModel: root.walletAssetStore.groupedAccountsAssetsModel
|
||||||
|
submodelRoleName: "balances"
|
||||||
|
delegateModel: SortFilterProxyModel {
|
||||||
|
sourceModel: submodel
|
||||||
|
filters: ExpressionFilter {
|
||||||
|
expression: txStore.selectedSenderAccount.address === account
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TransactionStore {
|
TransactionStore {
|
||||||
id: txStore
|
id: txStore
|
||||||
|
walletAssetStore: root.walletAssetStore
|
||||||
}
|
}
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
|
@ -13,7 +13,6 @@ ListModel {
|
|||||||
address: "0x7F47C2e18a4BBf5487E6fb082eC2D9Ab0E6d7240",
|
address: "0x7F47C2e18a4BBf5487E6fb082eC2D9Ab0E6d7240",
|
||||||
walletType: "",
|
walletType: "",
|
||||||
position: 0,
|
position: 0,
|
||||||
assets: assetsModel
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Hot wallet (generated)",
|
name: "Hot wallet (generated)",
|
||||||
@ -23,7 +22,6 @@ ListModel {
|
|||||||
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8881",
|
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8881",
|
||||||
walletType: Constants.generatedWalletType,
|
walletType: Constants.generatedWalletType,
|
||||||
position: 3,
|
position: 3,
|
||||||
assets: assetsModel
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Family (seed)",
|
name: "Family (seed)",
|
||||||
@ -33,7 +31,6 @@ ListModel {
|
|||||||
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8882",
|
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8882",
|
||||||
walletType: Constants.seedWalletType,
|
walletType: Constants.seedWalletType,
|
||||||
position: 1,
|
position: 1,
|
||||||
assets: assetsModel
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Tag Heuer (watch)",
|
name: "Tag Heuer (watch)",
|
||||||
@ -43,7 +40,6 @@ ListModel {
|
|||||||
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8883",
|
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8883",
|
||||||
walletType: Constants.watchWalletType,
|
walletType: Constants.watchWalletType,
|
||||||
position: 2,
|
position: 2,
|
||||||
assets: []
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Fab (key)",
|
name: "Fab (key)",
|
||||||
@ -53,7 +49,6 @@ ListModel {
|
|||||||
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8884",
|
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8884",
|
||||||
walletType: Constants.keyWalletType,
|
walletType: Constants.keyWalletType,
|
||||||
position: 4,
|
position: 4,
|
||||||
assets: assetsModel
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
import QtQuick 2.15
|
||||||
|
|
||||||
|
QtObject {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
property var tokensList
|
||||||
|
property var collectiblesList
|
||||||
|
property var savedAddressesModel
|
||||||
|
property var activityController
|
||||||
|
property bool areTestNetworksEnabled
|
||||||
|
}
|
5
storybook/stubs/AppLayouts/Wallet/stores/TokensStore.qml
Normal file
5
storybook/stubs/AppLayouts/Wallet/stores/TokensStore.qml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import QtQuick 2.15
|
||||||
|
|
||||||
|
QtObject {
|
||||||
|
id: root
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
import QtQuick 2.15
|
||||||
|
|
||||||
|
import SortFilterProxyModel 0.2
|
||||||
|
import StatusQ 0.1
|
||||||
|
import StatusQ.Core.Utils 0.1 as SQUtils
|
||||||
|
|
||||||
|
import Storybook 1.0
|
||||||
|
import Models 1.0
|
||||||
|
|
||||||
|
QtObject {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
property TokensStore walletTokensStore
|
||||||
|
|
||||||
|
readonly property var groupedAccountsAssetsModel: GroupedAccountsAssetsModel {}
|
||||||
|
property var assetsWithFilteredBalances
|
||||||
|
readonly property var tokensBySymbolModel: TokensBySymbolModel {}
|
||||||
|
readonly property CommunitiesModel communityModel: CommunitiesModel{}
|
||||||
|
|
||||||
|
// renaming tokens by symbol key so that can be used to join models
|
||||||
|
readonly property var renamedTokensBySymbolModel: RolesRenamingModel {
|
||||||
|
sourceModel: tokensBySymbolModel
|
||||||
|
mapping: [
|
||||||
|
RoleRename {
|
||||||
|
from: "key"
|
||||||
|
to: "tokensKey"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
// join account assets and tokens by symbol model
|
||||||
|
property LeftJoinModel jointModel: LeftJoinModel {
|
||||||
|
leftModel: assetsWithFilteredBalances
|
||||||
|
rightModel: renamedTokensBySymbolModel
|
||||||
|
joinRole: "tokensKey"
|
||||||
|
}
|
||||||
|
|
||||||
|
// combining community model with assets to get community meta data
|
||||||
|
property LeftJoinModel groupedAccountAssetsModel: LeftJoinModel {
|
||||||
|
leftModel: jointModel
|
||||||
|
rightModel: communityModel
|
||||||
|
joinRole: "communityId"
|
||||||
|
}
|
||||||
|
}
|
3
storybook/stubs/AppLayouts/Wallet/stores/qmldir
Normal file
3
storybook/stubs/AppLayouts/Wallet/stores/qmldir
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
WalletAssetsStore 1.0 WalletAssetsStore.qml
|
||||||
|
TokensStore 1.0 TokensStore.qml
|
||||||
|
ActivityFiltersStore 1.0 ActivityFiltersStore.qml
|
@ -2,8 +2,12 @@ import QtQuick 2.15
|
|||||||
|
|
||||||
import Models 1.0
|
import Models 1.0
|
||||||
import utils 1.0
|
import utils 1.0
|
||||||
import StatusQ.Core.Utils 0.1
|
import StatusQ 0.1
|
||||||
|
import StatusQ.Core.Utils 0.1 as SQUtils
|
||||||
import shared.stores 1.0
|
import shared.stores 1.0
|
||||||
|
import SortFilterProxyModel 0.2
|
||||||
|
|
||||||
|
import AppLayouts.Wallet.stores 1.0
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: root
|
id: root
|
||||||
@ -13,6 +17,9 @@ QtObject {
|
|||||||
Component.onCompleted: selectedSenderAccount = senderAccounts.get(0)
|
Component.onCompleted: selectedSenderAccount = senderAccounts.get(0)
|
||||||
}
|
}
|
||||||
property var accounts: senderAccounts
|
property var accounts: senderAccounts
|
||||||
|
|
||||||
|
property WalletAssetsStore walletAssetStore
|
||||||
|
|
||||||
property QtObject tmpActivityController: QtObject {
|
property QtObject tmpActivityController: QtObject {
|
||||||
property ListModel model: ListModel{}
|
property ListModel model: ListModel{}
|
||||||
}
|
}
|
||||||
@ -58,32 +65,32 @@ QtObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getAsset(assetsList, symbol) {
|
function getAsset(assetsList, symbol) {
|
||||||
const idx = ModelUtils.indexOf(assetsList, "symbol", symbol)
|
const idx = SQUtils.ModelUtils.indexOf(assetsList, "symbol", symbol)
|
||||||
if (idx < 0) {
|
if (idx < 0) {
|
||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
return ModelUtils.get(assetsList, idx)
|
return SQUtils.ModelUtils.get(assetsList, idx)
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCollectible(uid) {
|
function getCollectible(uid) {
|
||||||
const idx = ModelUtils.indexOf(collectiblesModel, "uid", uid)
|
const idx = SQUtils.ModelUtils.indexOf(collectiblesModel, "uid", uid)
|
||||||
if (idx < 0) {
|
if (idx < 0) {
|
||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
return ModelUtils.get(collectiblesModel, idx)
|
return SQUtils.ModelUtils.get(collectiblesModel, idx)
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSelectorCollectible(uid) {
|
function getSelectorCollectible(uid) {
|
||||||
const idx = ModelUtils.indexOf(nestedCollectiblesModel, "uid", uid)
|
const idx = SQUtils.ModelUtils.indexOf(nestedCollectiblesModel, "uid", uid)
|
||||||
if (idx < 0) {
|
if (idx < 0) {
|
||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
return ModelUtils.get(nestedCollectiblesModel, idx)
|
return SQUtils.ModelUtils.get(nestedCollectiblesModel, idx)
|
||||||
}
|
}
|
||||||
|
|
||||||
function getHolding(holdingId, holdingType) {
|
function getHolding(holdingId, holdingType) {
|
||||||
if (holdingType === Constants.TokenType.ERC20) {
|
if (holdingType === Constants.TokenType.ERC20) {
|
||||||
return getAsset(selectedSenderAccount.assets, holdingId)
|
return getAsset(walletAssetStore.groupedAccountAssetsModel, holdingId)
|
||||||
} else if (holdingType === Constants.TokenType.ERC721) {
|
} else if (holdingType === Constants.TokenType.ERC721) {
|
||||||
return getCollectible(holdingId)
|
return getCollectible(holdingId)
|
||||||
} else {
|
} else {
|
||||||
@ -93,7 +100,7 @@ QtObject {
|
|||||||
|
|
||||||
function getSelectorHolding(holdingId, holdingType) {
|
function getSelectorHolding(holdingId, holdingType) {
|
||||||
if (holdingType === Constants.TokenType.ERC20) {
|
if (holdingType === Constants.TokenType.ERC20) {
|
||||||
return getAsset(selectedSenderAccount.assets, holdingId)
|
return getAsset(walletAssetStore.groupedAccountAssetsModel, holdingId)
|
||||||
} else if (holdingType === Constants.TokenType.ERC721) {
|
} else if (holdingType === Constants.TokenType.ERC721) {
|
||||||
return getSelectorCollectible(holdingId)
|
return getSelectorCollectible(holdingId)
|
||||||
} else {
|
} else {
|
||||||
@ -118,9 +125,9 @@ QtObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function holdingToSelectorHolding(holding, holdingType) {
|
function holdingToSelectorHolding(holding, holdingType) {
|
||||||
if (holdingType === Constants.TokenType.Asset) {
|
if (holdingType === Constants.TokenType.ERC20) {
|
||||||
return assetToSelectorAsset(holding)
|
return assetToSelectorAsset(holding)
|
||||||
} else if (holdingType === Constants.TokenType.Collectible) {
|
} else if (holdingType === Constants.TokenType.ERC721) {
|
||||||
return collectibleToSelectorCollectible(holding)
|
return collectibleToSelectorCollectible(holding)
|
||||||
} else {
|
} else {
|
||||||
return {}
|
return {}
|
||||||
@ -179,7 +186,7 @@ QtObject {
|
|||||||
let listOfChains = chainIds.split(":")
|
let listOfChains = chainIds.split(":")
|
||||||
let listOfChainIds = []
|
let listOfChainIds = []
|
||||||
for (let k =0;k<listOfChains.length;k++) {
|
for (let k =0;k<listOfChains.length;k++) {
|
||||||
listOfChainIds.push(ModelUtils.getByKey(NetworksModel.allNetworks, "shortName", listOfChains[k], "chainId"))
|
listOfChainIds.push(SQUtils.ModelUtils.getByKey(NetworksModel.allNetworks, "shortName", listOfChains[k], "chainId"))
|
||||||
}
|
}
|
||||||
return listOfChainIds
|
return listOfChainIds
|
||||||
}
|
}
|
||||||
@ -249,6 +256,17 @@ QtObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getNetworkName(chainId) {
|
function getNetworkName(chainId) {
|
||||||
return ModelUtils.getByKey(NetworksModel.allNetworks, "chainId", chainId, "chainName")
|
return SQUtils.ModelUtils.getByKey(NetworksModel.allNetworks, "chainId", chainId, "chainName")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getCurrencyAmountFromBigInt(balance, symbol, decimals) {
|
||||||
|
let bigIntBalance = SQUtils.AmountsArithmetic.fromString(balance)
|
||||||
|
let balance123 = SQUtils.AmountsArithmetic.toNumber(bigIntBalance, decimals)
|
||||||
|
return currencyStore.getCurrencyAmount(balance123, symbol)
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCurrentCurrencyAmount(balance) {
|
||||||
|
return currencyStore.getCurrencyAmount(balance, currencyStore.currentCurrency)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ import shared.controls 1.0
|
|||||||
import shared 1.0
|
import shared 1.0
|
||||||
import shared.status 1.0
|
import shared.status 1.0
|
||||||
import shared.popups.send 1.0
|
import shared.popups.send 1.0
|
||||||
|
import shared.stores.send 1.0
|
||||||
|
|
||||||
import "popups"
|
import "popups"
|
||||||
import "controls"
|
import "controls"
|
||||||
@ -30,6 +31,7 @@ StatusSectionLayout {
|
|||||||
|
|
||||||
property var globalStore
|
property var globalStore
|
||||||
property var sendTransactionModal
|
property var sendTransactionModal
|
||||||
|
required property TransactionStore transactionStore
|
||||||
|
|
||||||
function openUrlInNewTab(url) {
|
function openUrlInNewTab(url) {
|
||||||
var tab = _internal.addNewTab()
|
var tab = _internal.addNewTab()
|
||||||
@ -65,6 +67,7 @@ StatusSectionLayout {
|
|||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
preSelectedHoldingID: "ETH"
|
preSelectedHoldingID: "ETH"
|
||||||
preSelectedHoldingType: Constants.TokenType.ERC20
|
preSelectedHoldingType: Constants.TokenType.ERC20
|
||||||
|
store: root.transactionStore
|
||||||
}
|
}
|
||||||
|
|
||||||
property Component signMessageModalComponent: SignMessageModal {}
|
property Component signMessageModalComponent: SignMessageModal {}
|
||||||
|
@ -4,6 +4,7 @@ import QtQuick.Layouts 1.14
|
|||||||
|
|
||||||
import utils 1.0
|
import utils 1.0
|
||||||
import shared.popups 1.0
|
import shared.popups 1.0
|
||||||
|
import shared.stores.send 1.0
|
||||||
|
|
||||||
import "views"
|
import "views"
|
||||||
import "stores"
|
import "stores"
|
||||||
@ -26,6 +27,7 @@ StackLayout {
|
|||||||
readonly property var permissionsStore: rootStore.permissionsStore
|
readonly property var permissionsStore: rootStore.permissionsStore
|
||||||
property var communitiesStore
|
property var communitiesStore
|
||||||
required property WalletStore.TokensStore tokensStore
|
required property WalletStore.TokensStore tokensStore
|
||||||
|
required property TransactionStore transactionStore
|
||||||
|
|
||||||
property var sectionItemModel
|
property var sectionItemModel
|
||||||
property var sendModalPopup
|
property var sendModalPopup
|
||||||
@ -139,6 +141,7 @@ StackLayout {
|
|||||||
stickersPopup: root.stickersPopup
|
stickersPopup: root.stickersPopup
|
||||||
contactsStore: root.contactsStore
|
contactsStore: root.contactsStore
|
||||||
rootStore: root.rootStore
|
rootStore: root.rootStore
|
||||||
|
transactionStore: root.transactionStore
|
||||||
createChatPropertiesStore: root.createChatPropertiesStore
|
createChatPropertiesStore: root.createChatPropertiesStore
|
||||||
communitiesStore: root.communitiesStore
|
communitiesStore: root.communitiesStore
|
||||||
sectionItemModel: root.sectionItemModel
|
sectionItemModel: root.sectionItemModel
|
||||||
@ -193,6 +196,7 @@ StackLayout {
|
|||||||
walletAccountsModel: WalletStore.RootStore.nonWatchAccounts
|
walletAccountsModel: WalletStore.RootStore.nonWatchAccounts
|
||||||
tokensStore: root.tokensStore
|
tokensStore: root.tokensStore
|
||||||
sendModalPopup: root.sendModalPopup
|
sendModalPopup: root.sendModalPopup
|
||||||
|
transactionStore: root.transactionStore
|
||||||
|
|
||||||
isPendingOwnershipRequest: root.isPendingOwnershipRequest
|
isPendingOwnershipRequest: root.isPendingOwnershipRequest
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import shared.panels 1.0
|
|||||||
import shared.popups 1.0
|
import shared.popups 1.0
|
||||||
import shared.status 1.0
|
import shared.status 1.0
|
||||||
import shared.views.chat 1.0
|
import shared.views.chat 1.0
|
||||||
|
import shared.stores.send 1.0
|
||||||
|
|
||||||
import StatusQ.Layout 0.1
|
import StatusQ.Layout 0.1
|
||||||
import StatusQ.Popups 0.1
|
import StatusQ.Popups 0.1
|
||||||
@ -29,6 +30,7 @@ StatusSectionLayout {
|
|||||||
property bool hasAddedContacts: contactsStore.myContactsModel.count > 0
|
property bool hasAddedContacts: contactsStore.myContactsModel.count > 0
|
||||||
|
|
||||||
property RootStore rootStore
|
property RootStore rootStore
|
||||||
|
required property TransactionStore transactionStore
|
||||||
property var createChatPropertiesStore
|
property var createChatPropertiesStore
|
||||||
property var communitiesStore
|
property var communitiesStore
|
||||||
property var sectionItemModel
|
property var sectionItemModel
|
||||||
@ -256,6 +258,7 @@ StatusSectionLayout {
|
|||||||
Component {
|
Component {
|
||||||
id: statusStickerPackClickPopup
|
id: statusStickerPackClickPopup
|
||||||
StatusStickerPackClickPopup{
|
StatusStickerPackClickPopup{
|
||||||
|
transactionStore: root.transactionStore
|
||||||
onClosed: {
|
onClosed: {
|
||||||
destroy();
|
destroy();
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ StatusSectionLayout {
|
|||||||
property var chatCommunitySectionModule
|
property var chatCommunitySectionModule
|
||||||
required property TokensStore tokensStore
|
required property TokensStore tokensStore
|
||||||
property var community
|
property var community
|
||||||
property var transactionStore: TransactionStore {}
|
required property var transactionStore
|
||||||
property bool communitySettingsDisabled
|
property bool communitySettingsDisabled
|
||||||
property var sendModalPopup
|
property var sendModalPopup
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import shared 1.0
|
|||||||
import shared.panels 1.0
|
import shared.panels 1.0
|
||||||
import shared.stores 1.0 as SharedStores
|
import shared.stores 1.0 as SharedStores
|
||||||
import shared.popups.keycard 1.0
|
import shared.popups.keycard 1.0
|
||||||
|
import shared.stores.send 1.0
|
||||||
|
|
||||||
import AppLayouts.Wallet.controls 1.0
|
import AppLayouts.Wallet.controls 1.0
|
||||||
import AppLayouts.Wallet.stores 1.0
|
import AppLayouts.Wallet.stores 1.0
|
||||||
@ -32,6 +33,7 @@ StatusSectionLayout {
|
|||||||
property var emojiPopup
|
property var emojiPopup
|
||||||
property var networkConnectionStore
|
property var networkConnectionStore
|
||||||
required property TokensStore tokensStore
|
required property TokensStore tokensStore
|
||||||
|
required property TransactionStore transactionStore
|
||||||
|
|
||||||
backButtonName: root.store.backButtonName
|
backButtonName: root.store.backButtonName
|
||||||
notificationCount: activityCenterStore.unreadNotificationsCount
|
notificationCount: activityCenterStore.unreadNotificationsCount
|
||||||
@ -159,6 +161,7 @@ StatusSectionLayout {
|
|||||||
contactsStore: root.store.contactsStore
|
contactsStore: root.store.contactsStore
|
||||||
stickersStore: root.store.stickersStore
|
stickersStore: root.store.stickersStore
|
||||||
networkConnectionStore: root.networkConnectionStore
|
networkConnectionStore: root.networkConnectionStore
|
||||||
|
transactionStore: root.transactionStore
|
||||||
profileContentWidth: d.contentWidth
|
profileContentWidth: d.contentWidth
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,11 +11,13 @@ import utils 1.0
|
|||||||
import shared.status 1.0
|
import shared.status 1.0
|
||||||
import shared.popups 1.0
|
import shared.popups 1.0
|
||||||
import shared.popups.send 1.0
|
import shared.popups.send 1.0
|
||||||
|
import shared.stores.send 1.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
property var ensUsernamesStore
|
property var ensUsernamesStore
|
||||||
property var contactsStore
|
property var contactsStore
|
||||||
|
required property TransactionStore transactionStore
|
||||||
property string username: ""
|
property string username: ""
|
||||||
property string chainId: ""
|
property string chainId: ""
|
||||||
property string walletAddress: "-"
|
property string walletAddress: "-"
|
||||||
@ -118,6 +120,7 @@ Item {
|
|||||||
id: releaseEnsModal
|
id: releaseEnsModal
|
||||||
modalHeader: qsTr("Release your username")
|
modalHeader: qsTr("Release your username")
|
||||||
interactive: false
|
interactive: false
|
||||||
|
store: root.transactionStore
|
||||||
preSelectedSendType: Constants.SendType.ENSRelease
|
preSelectedSendType: Constants.SendType.ENSRelease
|
||||||
preSelectedRecipient: root.ensUsernamesStore.getEnsRegisteredAddress()
|
preSelectedRecipient: root.ensUsernamesStore.getEnsRegisteredAddress()
|
||||||
preDefinedAmountToSend: LocaleUtils.numberToLocaleString(0)
|
preDefinedAmountToSend: LocaleUtils.numberToLocaleString(0)
|
||||||
|
@ -13,12 +13,14 @@ import shared.panels 1.0
|
|||||||
import shared.status 1.0
|
import shared.status 1.0
|
||||||
import shared.controls 1.0
|
import shared.controls 1.0
|
||||||
import shared.popups.send 1.0
|
import shared.popups.send 1.0
|
||||||
|
import shared.stores.send 1.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property var ensUsernamesStore
|
property var ensUsernamesStore
|
||||||
property var contactsStore
|
property var contactsStore
|
||||||
|
required property TransactionStore transactionStore
|
||||||
property int profileContentWidth
|
property int profileContentWidth
|
||||||
|
|
||||||
signal continueClicked(string output, string username)
|
signal continueClicked(string output, string username)
|
||||||
@ -63,6 +65,7 @@ Item {
|
|||||||
id: connectEnsModal
|
id: connectEnsModal
|
||||||
modalHeader: qsTr("Connect username with your pubkey")
|
modalHeader: qsTr("Connect username with your pubkey")
|
||||||
interactive: false
|
interactive: false
|
||||||
|
store: root.transactionStore
|
||||||
preSelectedSendType: Constants.SendType.ENSSetPubKey
|
preSelectedSendType: Constants.SendType.ENSSetPubKey
|
||||||
preSelectedRecipient: root.ensUsernamesStore.getEnsRegisteredAddress()
|
preSelectedRecipient: root.ensUsernamesStore.getEnsRegisteredAddress()
|
||||||
preDefinedAmountToSend: LocaleUtils.numberToLocaleString(0)
|
preDefinedAmountToSend: LocaleUtils.numberToLocaleString(0)
|
||||||
|
@ -7,6 +7,7 @@ import utils 1.0
|
|||||||
import shared.popups 1.0
|
import shared.popups 1.0
|
||||||
import shared.status 1.0
|
import shared.status 1.0
|
||||||
import shared.popups.send 1.0
|
import shared.popups.send 1.0
|
||||||
|
import shared.stores.send 1.0
|
||||||
|
|
||||||
import StatusQ.Core 0.1
|
import StatusQ.Core 0.1
|
||||||
import StatusQ.Core.Theme 0.1
|
import StatusQ.Core.Theme 0.1
|
||||||
@ -19,6 +20,7 @@ Item {
|
|||||||
property var ensUsernamesStore
|
property var ensUsernamesStore
|
||||||
property var contactsStore
|
property var contactsStore
|
||||||
property var stickersStore
|
property var stickersStore
|
||||||
|
required property TransactionStore transactionStore
|
||||||
property string username: ""
|
property string username: ""
|
||||||
|
|
||||||
signal backBtnClicked();
|
signal backBtnClicked();
|
||||||
@ -48,6 +50,7 @@ Item {
|
|||||||
sourceComponent: SendModal {
|
sourceComponent: SendModal {
|
||||||
id: buyEnsModal
|
id: buyEnsModal
|
||||||
interactive: false
|
interactive: false
|
||||||
|
store: root.transactionStore
|
||||||
preSelectedSendType: Constants.SendType.ENSRegister
|
preSelectedSendType: Constants.SendType.ENSRegister
|
||||||
preSelectedRecipient: root.ensUsernamesStore.getEnsRegisteredAddress()
|
preSelectedRecipient: root.ensUsernamesStore.getEnsRegisteredAddress()
|
||||||
preDefinedAmountToSend: LocaleUtils.numberToLocaleString(10)
|
preDefinedAmountToSend: LocaleUtils.numberToLocaleString(10)
|
||||||
|
@ -5,6 +5,7 @@ import QtQml.StateMachine 1.14 as DSM
|
|||||||
|
|
||||||
import utils 1.0
|
import utils 1.0
|
||||||
import shared 1.0
|
import shared 1.0
|
||||||
|
import shared.stores.send 1.0
|
||||||
|
|
||||||
import "../stores"
|
import "../stores"
|
||||||
|
|
||||||
@ -16,6 +17,7 @@ Item {
|
|||||||
property var contactsStore
|
property var contactsStore
|
||||||
property var stickersStore
|
property var stickersStore
|
||||||
property var networkConnectionStore
|
property var networkConnectionStore
|
||||||
|
required property TransactionStore transactionStore
|
||||||
|
|
||||||
property int profileContentWidth
|
property int profileContentWidth
|
||||||
property bool showSearchScreen: false
|
property bool showSearchScreen: false
|
||||||
@ -222,6 +224,7 @@ Item {
|
|||||||
EnsSearchView {
|
EnsSearchView {
|
||||||
ensUsernamesStore: ensView.ensUsernamesStore
|
ensUsernamesStore: ensView.ensUsernamesStore
|
||||||
contactsStore: ensView.contactsStore
|
contactsStore: ensView.contactsStore
|
||||||
|
transactionStore: ensView.transactionStore
|
||||||
profileContentWidth: ensView.profileContentWidth
|
profileContentWidth: ensView.profileContentWidth
|
||||||
onContinueClicked: {
|
onContinueClicked: {
|
||||||
if(output === "connected"){
|
if(output === "connected"){
|
||||||
@ -244,6 +247,7 @@ Item {
|
|||||||
ensUsernamesStore: ensView.ensUsernamesStore
|
ensUsernamesStore: ensView.ensUsernamesStore
|
||||||
contactsStore: ensView.contactsStore
|
contactsStore: ensView.contactsStore
|
||||||
stickersStore: ensView.stickersStore
|
stickersStore: ensView.stickersStore
|
||||||
|
transactionStore: ensView.transactionStore
|
||||||
username: selectedUsername
|
username: selectedUsername
|
||||||
onBackBtnClicked: back();
|
onBackBtnClicked: back();
|
||||||
onUsernameRegistered: done(userName);
|
onUsernameRegistered: done(userName);
|
||||||
@ -302,6 +306,7 @@ Item {
|
|||||||
EnsDetailsView {
|
EnsDetailsView {
|
||||||
ensUsernamesStore: ensView.ensUsernamesStore
|
ensUsernamesStore: ensView.ensUsernamesStore
|
||||||
contactsStore: ensView.contactsStore
|
contactsStore: ensView.contactsStore
|
||||||
|
transactionStore: ensView.transactionStore
|
||||||
username: selectedUsername
|
username: selectedUsername
|
||||||
chainId: selectedChainId
|
chainId: selectedChainId
|
||||||
onBackBtnClicked: back()
|
onBackBtnClicked: back()
|
||||||
|
@ -26,6 +26,7 @@ import shared.status 1.0
|
|||||||
import shared.stores 1.0
|
import shared.stores 1.0
|
||||||
import shared.popups.send 1.0
|
import shared.popups.send 1.0
|
||||||
import shared.popups.send.views 1.0
|
import shared.popups.send.views 1.0
|
||||||
|
import shared.stores.send 1.0
|
||||||
|
|
||||||
import StatusQ.Core.Theme 0.1
|
import StatusQ.Core.Theme 0.1
|
||||||
import StatusQ.Components 0.1
|
import StatusQ.Components 0.1
|
||||||
@ -71,6 +72,10 @@ Item {
|
|||||||
property CommunitiesStore communitiesStore: CommunitiesStore {}
|
property CommunitiesStore communitiesStore: CommunitiesStore {}
|
||||||
readonly property WalletStore.TokensStore tokensStore: WalletStore.RootStore.tokensStore
|
readonly property WalletStore.TokensStore tokensStore: WalletStore.RootStore.tokensStore
|
||||||
readonly property WalletStore.WalletAssetsStore walletAssetsStore: WalletStore.RootStore.walletAssetsStore
|
readonly property WalletStore.WalletAssetsStore walletAssetsStore: WalletStore.RootStore.walletAssetsStore
|
||||||
|
readonly property CurrenciesStore currencyStore: CurrenciesStore{}
|
||||||
|
readonly property TransactionStore transactionStore: TransactionStore{
|
||||||
|
walletAssetStore: appMain.walletAssetsStore
|
||||||
|
}
|
||||||
|
|
||||||
// set from main.qml
|
// set from main.qml
|
||||||
property var sysPalette
|
property var sysPalette
|
||||||
@ -488,6 +493,7 @@ Item {
|
|||||||
sourceComponent: StatusStickersPopup {
|
sourceComponent: StatusStickersPopup {
|
||||||
id: statusStickersPopup
|
id: statusStickersPopup
|
||||||
store: appMain.rootChatStore
|
store: appMain.rootChatStore
|
||||||
|
transactionStore: appMain.transactionStore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1198,6 +1204,7 @@ Item {
|
|||||||
}
|
}
|
||||||
createChatPropertiesStore: appMain.createChatPropertiesStore
|
createChatPropertiesStore: appMain.createChatPropertiesStore
|
||||||
tokensStore: appMain.tokensStore
|
tokensStore: appMain.tokensStore
|
||||||
|
transactionStore: appMain.transactionStore
|
||||||
emojiPopup: statusEmojiPopup.item
|
emojiPopup: statusEmojiPopup.item
|
||||||
stickersPopup: statusStickersPopupLoader.item
|
stickersPopup: statusStickersPopupLoader.item
|
||||||
|
|
||||||
@ -1270,6 +1277,7 @@ Item {
|
|||||||
sourceComponent: BrowserLayout {
|
sourceComponent: BrowserLayout {
|
||||||
globalStore: appMain.rootStore
|
globalStore: appMain.rootStore
|
||||||
sendTransactionModal: sendModal
|
sendTransactionModal: sendModal
|
||||||
|
transactionStore: appMain.transactionStore
|
||||||
}
|
}
|
||||||
// Loaders do not have access to the context, so props need to be set
|
// Loaders do not have access to the context, so props need to be set
|
||||||
// Adding a "_" to avoid a binding loop
|
// Adding a "_" to avoid a binding loop
|
||||||
@ -1292,6 +1300,7 @@ Item {
|
|||||||
emojiPopup: statusEmojiPopup.item
|
emojiPopup: statusEmojiPopup.item
|
||||||
networkConnectionStore: appMain.networkConnectionStore
|
networkConnectionStore: appMain.networkConnectionStore
|
||||||
tokensStore: appMain.tokensStore
|
tokensStore: appMain.tokensStore
|
||||||
|
transactionStore: appMain.transactionStore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1372,6 +1381,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
tokensStore: appMain.tokensStore
|
tokensStore: appMain.tokensStore
|
||||||
|
transactionStore: appMain.transactionStore
|
||||||
|
|
||||||
onProfileButtonClicked: {
|
onProfileButtonClicked: {
|
||||||
Global.changeAppSectionBySectionType(Constants.appSection.profile);
|
Global.changeAppSectionBySectionType(Constants.appSection.profile);
|
||||||
@ -1467,6 +1477,7 @@ Item {
|
|||||||
|
|
||||||
sourceComponent: SendModal {
|
sourceComponent: SendModal {
|
||||||
onlyAssets: sendModal.onlyAssets
|
onlyAssets: sendModal.onlyAssets
|
||||||
|
store: appMain.transactionStore
|
||||||
onClosed: {
|
onClosed: {
|
||||||
sendModal.closed()
|
sendModal.closed()
|
||||||
sendModal.preSelectedSendType = Constants.SendType.Unknown
|
sendModal.preSelectedSendType = Constants.SendType.Unknown
|
||||||
|
@ -8,6 +8,7 @@ import SortFilterProxyModel 0.2
|
|||||||
import utils 1.0
|
import utils 1.0
|
||||||
import shared.stores.send 1.0
|
import shared.stores.send 1.0
|
||||||
|
|
||||||
|
import StatusQ 0.1
|
||||||
import StatusQ.Components 0.1
|
import StatusQ.Components 0.1
|
||||||
import StatusQ.Controls 0.1
|
import StatusQ.Controls 0.1
|
||||||
import StatusQ.Controls.Validators 0.1
|
import StatusQ.Controls.Validators 0.1
|
||||||
@ -38,7 +39,7 @@ StatusDialog {
|
|||||||
|
|
||||||
property alias modalHeader: modalHeader.text
|
property alias modalHeader: modalHeader.text
|
||||||
|
|
||||||
property TransactionStore store: TransactionStore {}
|
required property TransactionStore store
|
||||||
property var nestedCollectiblesModel: store.nestedCollectiblesModel
|
property var nestedCollectiblesModel: store.nestedCollectiblesModel
|
||||||
property var bestRoutes
|
property var bestRoutes
|
||||||
property bool isLoading: false
|
property bool isLoading: false
|
||||||
@ -76,8 +77,9 @@ StatusDialog {
|
|||||||
(popup.bestRoutes && popup.bestRoutes.count === 0 &&
|
(popup.bestRoutes && popup.bestRoutes.count === 0 &&
|
||||||
!!amountToSendInput.input.text && recipientLoader.ready && !popup.isLoading) ?
|
!!amountToSendInput.input.text && recipientLoader.ready && !popup.isLoading) ?
|
||||||
Constants.NoRoute : Constants.NoError
|
Constants.NoRoute : Constants.NoError
|
||||||
readonly property double maxFiatBalance: isSelectedHoldingValidAsset ? selectedHolding.totalCurrencyBalance.amount : 0
|
readonly property double totalSelectedHoldingBalance: isSelectedHoldingValidAsset ? !d.selectedHolding.communityId ? selectedHoldingAggregator.value/(10 ** d.selectedHolding.decimals): selectedHoldingAggregator.value: 0
|
||||||
readonly property double maxCryptoBalance: isSelectedHoldingValidAsset ? selectedHolding.totalBalance.amount : 0
|
readonly property double maxFiatBalance: isSelectedHoldingValidAsset && selectedHolding.marketDetails ? totalSelectedHoldingBalance * selectedHolding.marketDetails.currencyPrice.amount : 0
|
||||||
|
readonly property double maxCryptoBalance: isSelectedHoldingValidAsset ? totalSelectedHoldingBalance : 0
|
||||||
readonly property double maxInputBalance: amountToSendInput.inputIsFiat ? maxFiatBalance : maxCryptoBalance
|
readonly property double maxInputBalance: amountToSendInput.inputIsFiat ? maxFiatBalance : maxCryptoBalance
|
||||||
readonly property string inputSymbol: amountToSendInput.inputIsFiat ? currencyStore.currentCurrency : store.selectedAssetSymbol
|
readonly property string inputSymbol: amountToSendInput.inputIsFiat ? currencyStore.currentCurrency : store.selectedAssetSymbol
|
||||||
readonly property bool errorMode: popup.isLoading || !recipientLoader.ready ? false : errorType !== Constants.NoError || networkSelector.errorMode || !amountToSendInput.inputNumberValid
|
readonly property bool errorMode: popup.isLoading || !recipientLoader.ready ? false : errorType !== Constants.NoError || networkSelector.errorMode || !amountToSendInput.inputNumberValid
|
||||||
@ -147,6 +149,21 @@ StatusDialog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SumAggregator {
|
||||||
|
id: selectedHoldingAggregator
|
||||||
|
model: SortFilterProxyModel {
|
||||||
|
sourceModel: d.isSelectedHoldingValidAsset ? d.selectedHolding.balances: d.isHoveredHoldingValidAsset && !!d.hoveredHolding.symbol ? d.hoveredHolding.balances: null
|
||||||
|
filters: FastExpressionFilter {
|
||||||
|
expression: {
|
||||||
|
store.selectedSenderAccount
|
||||||
|
return store.selectedSenderAccount.address === model.account
|
||||||
|
}
|
||||||
|
expectedRoles: ["account"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
roleName: "balance"
|
||||||
|
}
|
||||||
|
|
||||||
width: 556
|
width: 556
|
||||||
|
|
||||||
padding: 0
|
padding: 0
|
||||||
@ -201,7 +218,9 @@ StatusDialog {
|
|||||||
getNetworkShortNames: function(chainIds) {return store.getNetworkShortNames(chainIds)}
|
getNetworkShortNames: function(chainIds) {return store.getNetworkShortNames(chainIds)}
|
||||||
onSelectedIndexChanged: {
|
onSelectedIndexChanged: {
|
||||||
store.switchSenderAccount(selectedIndex)
|
store.switchSenderAccount(selectedIndex)
|
||||||
|
if (d.isSelectedHoldingValidAsset) {
|
||||||
d.setSelectedHoldingId(d.selectedHolding.symbol, d.selectedHoldingType)
|
d.setSelectedHoldingId(d.selectedHolding.symbol, d.selectedHoldingType)
|
||||||
|
}
|
||||||
popup.recalculateRoutesAndFees()
|
popup.recalculateRoutesAndFees()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -262,7 +281,8 @@ StatusDialog {
|
|||||||
id: holdingSelector
|
id: holdingSelector
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
assetsModel: popup.preSelectedAccount && popup.preSelectedAccount.assets ? popup.preSelectedAccount.assets : null
|
selectedSenderAccount: store.selectedSenderAccount.address
|
||||||
|
assetsModel: popup.store.walletAssetStore.groupedAccountAssetsModel
|
||||||
collectiblesModel: popup.preSelectedAccount ? popup.nestedCollectiblesModel : null
|
collectiblesModel: popup.preSelectedAccount ? popup.nestedCollectiblesModel : null
|
||||||
networksModel: popup.store.allNetworksModel
|
networksModel: popup.store.allNetworksModel
|
||||||
currentCurrencySymbol: d.currencyStore.currentCurrencySymbol
|
currentCurrencySymbol: d.currencyStore.currentCurrencySymbol
|
||||||
@ -271,6 +291,12 @@ StatusDialog {
|
|||||||
onItemSelected: {
|
onItemSelected: {
|
||||||
d.setSelectedHoldingId(holdingId, holdingType)
|
d.setSelectedHoldingId(holdingId, holdingType)
|
||||||
}
|
}
|
||||||
|
getCurrencyAmountFromBigInt: function(balance, symbol, decimals){
|
||||||
|
return store.getCurrencyAmountFromBigInt(balance, symbol, decimals)
|
||||||
|
}
|
||||||
|
getCurrentCurrencyAmount: function(balance){
|
||||||
|
return store.getCurrentCurrencyAmount(balance)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusListItemTag {
|
StatusListItemTag {
|
||||||
@ -280,20 +306,20 @@ StatusDialog {
|
|||||||
visible: d.isSelectedHoldingValidAsset || d.isHoveredHoldingValidAsset && !d.isERC721Transfer
|
visible: d.isSelectedHoldingValidAsset || d.isHoveredHoldingValidAsset && !d.isERC721Transfer
|
||||||
title: {
|
title: {
|
||||||
if(d.isHoveredHoldingValidAsset && !!d.hoveredHolding.symbol) {
|
if(d.isHoveredHoldingValidAsset && !!d.hoveredHolding.symbol) {
|
||||||
const input = amountToSendInput.inputIsFiat ? d.hoveredHolding.totalCurrencyBalance.amount : d.hoveredHolding.totalBalance.amount
|
let totalAmount = !d.hoveredHolding.communityId ? selectedHoldingAggregator.value/(10 ** d.hoveredHolding.decimals): selectedHoldingAggregator.value
|
||||||
|
const input = amountToSendInput.inputIsFiat ? totalAmount * d.hoveredHolding.marketDetails.currencyPrice.amount : totalAmount
|
||||||
const max = d.prepareForMaxSend(input, d.hoveredHolding.symbol)
|
const max = d.prepareForMaxSend(input, d.hoveredHolding.symbol)
|
||||||
if (max <= 0)
|
if (max <= 0)
|
||||||
return qsTr("No balances active")
|
return qsTr("No balances active")
|
||||||
|
|
||||||
const balance = d.currencyStore.formatCurrencyAmount(max , d.hoveredHolding.symbol)
|
const balance = d.currencyStore.formatCurrencyAmount(max , d.hoveredHolding.symbol)
|
||||||
return qsTr("Max: %1").arg(balance)
|
return qsTr("Max: %1").arg(balance.toString())
|
||||||
}
|
}
|
||||||
const max = d.prepareForMaxSend(d.maxInputBalance, d.inputSymbol)
|
const max = d.prepareForMaxSend(d.maxInputBalance, d.inputSymbol)
|
||||||
if (max <= 0)
|
if (max <= 0)
|
||||||
return qsTr("No balances active")
|
return qsTr("No balances active")
|
||||||
|
|
||||||
const balance = d.currencyStore.formatCurrencyAmount(max, d.inputSymbol)
|
const balance = d.currencyStore.formatCurrencyAmount(max, d.inputSymbol)
|
||||||
return qsTr("Max: %1").arg(balance)
|
return qsTr("Max: %1").arg(balance.toString())
|
||||||
}
|
}
|
||||||
tagClickable: true
|
tagClickable: true
|
||||||
closeButtonVisible: false
|
closeButtonVisible: false
|
||||||
@ -318,7 +344,7 @@ StatusDialog {
|
|||||||
maxInputBalance: d.maxInputBalance
|
maxInputBalance: d.maxInputBalance
|
||||||
currentCurrency: d.currencyStore.currentCurrency
|
currentCurrency: d.currencyStore.currentCurrency
|
||||||
|
|
||||||
multiplierIndex: holdingSelector.selectedItem
|
multiplierIndex: !!holdingSelector.selectedItem
|
||||||
? holdingSelector.selectedItem.decimals
|
? holdingSelector.selectedItem.decimals
|
||||||
: 0
|
: 0
|
||||||
|
|
||||||
@ -397,7 +423,8 @@ StatusDialog {
|
|||||||
anchors.rightMargin: Style.current.bigPadding
|
anchors.rightMargin: Style.current.bigPadding
|
||||||
|
|
||||||
visible: !d.selectedHolding
|
visible: !d.selectedHolding
|
||||||
assets: popup.preSelectedAccount && popup.preSelectedAccount.assets ? popup.preSelectedAccount.assets : null
|
selectedSenderAccount: store.selectedSenderAccount.address
|
||||||
|
assets: popup.store.walletAssetStore.groupedAccountAssetsModel
|
||||||
collectibles: popup.preSelectedAccount ? popup.nestedCollectiblesModel : null
|
collectibles: popup.preSelectedAccount ? popup.nestedCollectiblesModel : null
|
||||||
networksModel: popup.store.allNetworksModel
|
networksModel: popup.store.allNetworksModel
|
||||||
onlyAssets: holdingSelector.onlyAssets
|
onlyAssets: holdingSelector.onlyAssets
|
||||||
@ -415,6 +442,12 @@ StatusDialog {
|
|||||||
d.setHoveredHoldingId("", Constants.TokenType.Unknown)
|
d.setHoveredHoldingId("", Constants.TokenType.Unknown)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
getCurrencyAmountFromBigInt: function(balance, symbol, decimals){
|
||||||
|
return store.getCurrencyAmountFromBigInt(balance, symbol, decimals)
|
||||||
|
}
|
||||||
|
getCurrentCurrencyAmount: function(balance){
|
||||||
|
return store.getCurrentCurrencyAmount(balance)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
|
@ -1,17 +1,23 @@
|
|||||||
import QtQuick 2.13
|
import QtQuick 2.13
|
||||||
|
|
||||||
|
import StatusQ 0.1
|
||||||
import StatusQ.Core 0.1
|
import StatusQ.Core 0.1
|
||||||
import StatusQ.Components 0.1
|
import StatusQ.Components 0.1
|
||||||
import StatusQ.Core.Theme 0.1
|
import StatusQ.Core.Theme 0.1
|
||||||
|
import StatusQ.Core.Utils 0.1 as SQUtils
|
||||||
|
import SortFilterProxyModel 0.2
|
||||||
|
|
||||||
import utils 1.0
|
import utils 1.0
|
||||||
|
|
||||||
StatusListItem {
|
StatusListItem {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property var balancesModel
|
|
||||||
signal tokenSelected(var selectedToken)
|
signal tokenSelected(var selectedToken)
|
||||||
signal tokenHovered(var selectedToken, bool hovered)
|
signal tokenHovered(var selectedToken, bool hovered)
|
||||||
|
property var getCurrencyAmountFromBigInt: function(balance, symbol, decimals){}
|
||||||
|
property var getCurrentCurrencyAmount: function(balance){}
|
||||||
|
property var balancesModel
|
||||||
|
property string selectedSenderAccount
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: d
|
id: d
|
||||||
@ -21,16 +27,33 @@ StatusListItem {
|
|||||||
- compactRow.width) / statusListItemInlineTagsSlot.children[0].width) - 1
|
- compactRow.width) / statusListItemInlineTagsSlot.children[0].width) - 1
|
||||||
|
|
||||||
function selectToken() {
|
function selectToken() {
|
||||||
root.tokenSelected({name, symbol, totalRawBalance, totalBalance,
|
root.tokenSelected({name, symbol, balances, decimals})
|
||||||
totalCurrencyBalance, balances, decimals})
|
}
|
||||||
|
|
||||||
|
readonly property string balanceRoleName: "balance"
|
||||||
|
property string roleName: balanceRoleName
|
||||||
|
}
|
||||||
|
|
||||||
|
property var filteredBalances : SortFilterProxyModel {
|
||||||
|
sourceModel: root.balancesModel
|
||||||
|
filters: FastExpressionFilter {
|
||||||
|
expression: {
|
||||||
|
root.selectedSenderAccount
|
||||||
|
return root.selectedSenderAccount === model.account
|
||||||
|
}
|
||||||
|
expectedRoles: ["account"]
|
||||||
|
}
|
||||||
|
onCountChanged: {
|
||||||
|
// Added because the SumAggregator is not evaluated after the filters are applied
|
||||||
|
d.roleName = ""
|
||||||
|
d.roleName = d.balanceRoleName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: root.sensor
|
target: root.sensor
|
||||||
function onContainsMouseChanged() {
|
function onContainsMouseChanged() {
|
||||||
root.tokenHovered({name, symbol, totalRawBalance, totalBalance,
|
root.tokenHovered({name, symbol, balances, decimals},
|
||||||
totalCurrencyBalance, balances, decimals},
|
|
||||||
root.sensor.containsMouse)
|
root.sensor.containsMouse)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -40,7 +63,13 @@ StatusListItem {
|
|||||||
statusListItemTitleAside.font.pixelSize: 15
|
statusListItemTitleAside.font.pixelSize: 15
|
||||||
statusListItemTitleAside.width: statusListItemTitleArea.width - statusListItemTitle.width
|
statusListItemTitleAside.width: statusListItemTitleArea.width - statusListItemTitle.width
|
||||||
statusListItemTitleAside.elide: Text.ElideRight
|
statusListItemTitleAside.elide: Text.ElideRight
|
||||||
label: LocaleUtils.currencyAmountToLocaleString(totalCurrencyBalance)
|
label: {
|
||||||
|
if (!!model && !!model.marketDetails && !!model.marketDetails.currencyPrice) {
|
||||||
|
let totalCurrencyBalance = aggregator.value/(10 ** decimals) * model.marketDetails.currencyPrice.amount
|
||||||
|
return LocaleUtils.currencyAmountToLocaleString(root.getCurrentCurrencyAmount(totalCurrencyBalance))
|
||||||
|
}
|
||||||
|
return LocaleUtils.currencyAmountToLocaleString(root.getCurrentCurrencyAmount(0))
|
||||||
|
}
|
||||||
asset.name: symbol ? Style.png("tokens/" + symbol) : ""
|
asset.name: symbol ? Style.png("tokens/" + symbol) : ""
|
||||||
asset.isImage: true
|
asset.isImage: true
|
||||||
asset.width: 32
|
asset.width: 32
|
||||||
@ -48,13 +77,13 @@ StatusListItem {
|
|||||||
statusListItemLabel.anchors.verticalCenterOffset: -12
|
statusListItemLabel.anchors.verticalCenterOffset: -12
|
||||||
statusListItemLabel.color: Theme.palette.directColor1
|
statusListItemLabel.color: Theme.palette.directColor1
|
||||||
statusListItemInlineTagsSlot.spacing: 0
|
statusListItemInlineTagsSlot.spacing: 0
|
||||||
tagsModel: root.balancesModel
|
tagsModel: filteredBalances
|
||||||
tagsDelegate: expandedItem
|
tagsDelegate: expandedItem
|
||||||
statusListItemInlineTagsSlot.children: Row {
|
statusListItemInlineTagsSlot.children: Row {
|
||||||
id: compactRow
|
id: compactRow
|
||||||
spacing: -6
|
spacing: -6
|
||||||
Repeater {
|
Repeater {
|
||||||
model: root.balancesModel
|
model: filteredBalances
|
||||||
delegate: compactItem
|
delegate: compactItem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -64,13 +93,19 @@ StatusListItem {
|
|||||||
|
|
||||||
onClicked: d.selectToken()
|
onClicked: d.selectToken()
|
||||||
|
|
||||||
|
SumAggregator {
|
||||||
|
id: aggregator
|
||||||
|
model: filteredBalances
|
||||||
|
roleName: d.roleName
|
||||||
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: compactItem
|
id: compactItem
|
||||||
StatusRoundedImage {
|
StatusRoundedImage {
|
||||||
z: index + 1
|
z: index + 1
|
||||||
width: 16
|
width: 16
|
||||||
height: 16
|
height: 16
|
||||||
image.source: Style.svg("tiny/%1".arg(iconUrl))
|
image.source: Style.svg("tiny/%1".arg(model.iconUrl))
|
||||||
visible: !root.sensor.containsMouse || index > d.indexesThatCanBeShown
|
visible: !root.sensor.containsMouse || index > d.indexesThatCanBeShown
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -79,7 +114,7 @@ StatusListItem {
|
|||||||
StatusListItemTag {
|
StatusListItemTag {
|
||||||
height: 16
|
height: 16
|
||||||
leftPadding: 0
|
leftPadding: 0
|
||||||
title: LocaleUtils.currencyAmountToLocaleString(balance)
|
title: LocaleUtils.currencyAmountToLocaleString(root.getCurrencyAmountFromBigInt(balance, symbol, decimals))
|
||||||
titleText.font.pixelSize: 12
|
titleText.font.pixelSize: 12
|
||||||
closeButtonVisible: false
|
closeButtonVisible: false
|
||||||
bgColor: "transparent"
|
bgColor: "transparent"
|
||||||
|
@ -17,7 +17,9 @@ import "../controls"
|
|||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property var assetsModel
|
property var assetsModel
|
||||||
|
property string selectedSenderAccount
|
||||||
property var collectiblesModel
|
property var collectiblesModel
|
||||||
property var networksModel
|
property var networksModel
|
||||||
property string currentCurrencySymbol
|
property string currentCurrencySymbol
|
||||||
@ -29,6 +31,8 @@ Item {
|
|||||||
property var searchAssetSymbolByAddressFn: function (address) {
|
property var searchAssetSymbolByAddressFn: function (address) {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
property var getCurrencyAmountFromBigInt: function(balance, symbol, decimals){}
|
||||||
|
property var getCurrentCurrencyAmount: function(balance){}
|
||||||
|
|
||||||
signal itemHovered(string holdingId, var holdingType)
|
signal itemHovered(string holdingId, var holdingType)
|
||||||
signal itemSelected(string holdingId, var holdingType)
|
signal itemSelected(string holdingId, var holdingType)
|
||||||
@ -189,7 +193,7 @@ Item {
|
|||||||
// asset
|
// asset
|
||||||
property var symbol: model.symbol
|
property var symbol: model.symbol
|
||||||
property var totalBalance: model.totalBalance
|
property var totalBalance: model.totalBalance
|
||||||
property var totalCurrencyBalance: model.totalCurrencyBalance
|
property var marketDetails: model.marketDetails
|
||||||
property var decimals: model.decimals
|
property var decimals: model.decimals
|
||||||
property var balances: model.balances
|
property var balances: model.balances
|
||||||
// collectible
|
// collectible
|
||||||
@ -291,6 +295,7 @@ Item {
|
|||||||
TokenBalancePerChainDelegate {
|
TokenBalancePerChainDelegate {
|
||||||
objectName: "AssetSelector_ItemDelegate_" + symbol
|
objectName: "AssetSelector_ItemDelegate_" + symbol
|
||||||
width: holdingItemSelector.comboBoxControl.popup.width
|
width: holdingItemSelector.comboBoxControl.popup.width
|
||||||
|
selectedSenderAccount: root.selectedSenderAccount
|
||||||
balancesModel: LeftJoinModel {
|
balancesModel: LeftJoinModel {
|
||||||
leftModel: balances
|
leftModel: balances
|
||||||
rightModel: root.networksModel
|
rightModel: root.networksModel
|
||||||
@ -302,6 +307,12 @@ Item {
|
|||||||
root.itemSelected(selectedToken.symbol, Constants.TokenType.ERC20)
|
root.itemSelected(selectedToken.symbol, Constants.TokenType.ERC20)
|
||||||
holdingItemSelector.comboBoxControl.popup.close()
|
holdingItemSelector.comboBoxControl.popup.close()
|
||||||
}
|
}
|
||||||
|
getCurrencyAmountFromBigInt: function(balance, symbol, decimals){
|
||||||
|
return root.getCurrencyAmountFromBigInt(balance, symbol, decimals)
|
||||||
|
}
|
||||||
|
getCurrentCurrencyAmount: function(balance){
|
||||||
|
return root.getCurrentCurrencyAmount(balance)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ import "../controls"
|
|||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
property string selectedSenderAccount
|
||||||
property var assets: null
|
property var assets: null
|
||||||
property var collectibles: null
|
property var collectibles: null
|
||||||
property var networksModel
|
property var networksModel
|
||||||
@ -26,6 +27,8 @@ Item {
|
|||||||
}
|
}
|
||||||
property bool onlyAssets: false
|
property bool onlyAssets: false
|
||||||
property int browsingHoldingType: Constants.TokenType.ERC20
|
property int browsingHoldingType: Constants.TokenType.ERC20
|
||||||
|
property var getCurrencyAmountFromBigInt: function(balance, symbol, decimals){}
|
||||||
|
property var getCurrentCurrencyAmount: function(balance){}
|
||||||
|
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
if(!visible && root.collectibles)
|
if(!visible && root.collectibles)
|
||||||
@ -170,6 +173,7 @@ Item {
|
|||||||
id: tokenDelegate
|
id: tokenDelegate
|
||||||
TokenBalancePerChainDelegate {
|
TokenBalancePerChainDelegate {
|
||||||
width: ListView.view.width
|
width: ListView.view.width
|
||||||
|
selectedSenderAccount: root.selectedSenderAccount
|
||||||
balancesModel: LeftJoinModel {
|
balancesModel: LeftJoinModel {
|
||||||
leftModel: model.balances
|
leftModel: model.balances
|
||||||
rightModel: root.networksModel
|
rightModel: root.networksModel
|
||||||
@ -177,6 +181,12 @@ Item {
|
|||||||
}
|
}
|
||||||
onTokenSelected: root.tokenSelected(symbol, Constants.TokenType.ERC20)
|
onTokenSelected: root.tokenSelected(symbol, Constants.TokenType.ERC20)
|
||||||
onTokenHovered: root.tokenHovered(symbol, Constants.TokenType.ERC20, hovered)
|
onTokenHovered: root.tokenHovered(symbol, Constants.TokenType.ERC20, hovered)
|
||||||
|
getCurrencyAmountFromBigInt: function(balance, symbol, decimals){
|
||||||
|
return root.getCurrencyAmountFromBigInt(balance, symbol, decimals)
|
||||||
|
}
|
||||||
|
getCurrentCurrencyAmount: function(balance){
|
||||||
|
return root.getCurrentCurrencyAmount(balance)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Component {
|
Component {
|
||||||
|
@ -14,6 +14,7 @@ import shared.popups 1.0
|
|||||||
import shared.status 1.0
|
import shared.status 1.0
|
||||||
import shared.stores 1.0 as SharedStores
|
import shared.stores 1.0 as SharedStores
|
||||||
import shared.popups.send 1.0
|
import shared.popups.send 1.0
|
||||||
|
import shared.stores.send 1.0
|
||||||
|
|
||||||
//TODO remove this dependency!
|
//TODO remove this dependency!
|
||||||
import AppLayouts.Chat.stores 1.0
|
import AppLayouts.Chat.stores 1.0
|
||||||
@ -23,6 +24,7 @@ Item {
|
|||||||
|
|
||||||
property var store
|
property var store
|
||||||
property var stickerPacks: StickerPackData {}
|
property var stickerPacks: StickerPackData {}
|
||||||
|
required property TransactionStore transactionStore
|
||||||
property string packId
|
property string packId
|
||||||
property bool marketVisible
|
property bool marketVisible
|
||||||
|
|
||||||
@ -200,6 +202,7 @@ Item {
|
|||||||
required property string packId
|
required property string packId
|
||||||
|
|
||||||
interactive: false
|
interactive: false
|
||||||
|
store: root.transactionStore
|
||||||
preSelectedSendType: Constants.SendType.StickersBuy
|
preSelectedSendType: Constants.SendType.StickersBuy
|
||||||
preSelectedRecipient: root.store.stickersStore.getStickersMarketAddress()
|
preSelectedRecipient: root.store.stickersStore.getStickersMarketAddress()
|
||||||
preDefinedAmountToSend: LocaleUtils.numberToLocaleString(parseFloat(price))
|
preDefinedAmountToSend: LocaleUtils.numberToLocaleString(parseFloat(price))
|
||||||
|
@ -11,6 +11,7 @@ import shared.popups 1.0
|
|||||||
import shared.status 1.0
|
import shared.status 1.0
|
||||||
import shared.stores 1.0 as SharedStores
|
import shared.stores 1.0 as SharedStores
|
||||||
import shared.popups.send 1.0
|
import shared.popups.send 1.0
|
||||||
|
import shared.stores.send 1.0
|
||||||
|
|
||||||
//TODO remove this dependency!
|
//TODO remove this dependency!
|
||||||
import "../../../app/AppLayouts/Chat/stores"
|
import "../../../app/AppLayouts/Chat/stores"
|
||||||
@ -22,6 +23,7 @@ ModalPopup {
|
|||||||
property string packId
|
property string packId
|
||||||
|
|
||||||
property var store
|
property var store
|
||||||
|
required property TransactionStore transactionStore
|
||||||
property string thumbnail: ""
|
property string thumbnail: ""
|
||||||
property string name: ""
|
property string name: ""
|
||||||
property string author: ""
|
property string author: ""
|
||||||
@ -69,6 +71,7 @@ ModalPopup {
|
|||||||
SendModal {
|
SendModal {
|
||||||
id: buyStickersPackModal
|
id: buyStickersPackModal
|
||||||
interactive: false
|
interactive: false
|
||||||
|
store: stickerPackDetailsPopup.transactionStore
|
||||||
preSelectedSendType: Constants.SendType.StickersBuy
|
preSelectedSendType: Constants.SendType.StickersBuy
|
||||||
preSelectedRecipient: stickerPackDetailsPopup.store.stickersStore.getStickersMarketAddress()
|
preSelectedRecipient: stickerPackDetailsPopup.store.stickersStore.getStickersMarketAddress()
|
||||||
preDefinedAmountToSend: LocaleUtils.numberToLocaleString(parseFloat(price))
|
preDefinedAmountToSend: LocaleUtils.numberToLocaleString(parseFloat(price))
|
||||||
|
@ -5,6 +5,7 @@ import QtGraphicalEffects 1.0
|
|||||||
|
|
||||||
import utils 1.0
|
import utils 1.0
|
||||||
import shared.panels 1.0
|
import shared.panels 1.0
|
||||||
|
import shared.stores.send 1.0
|
||||||
|
|
||||||
import StatusQ.Core 0.1
|
import StatusQ.Core 0.1
|
||||||
import StatusQ.Core.Theme 0.1
|
import StatusQ.Core.Theme 0.1
|
||||||
@ -17,6 +18,7 @@ Popup {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
property var store
|
property var store
|
||||||
|
required property TransactionStore transactionStore
|
||||||
|
|
||||||
signal stickerSelected(string hashId, string packId, string url)
|
signal stickerSelected(string hashId, string packId, string url)
|
||||||
|
|
||||||
@ -95,6 +97,7 @@ Popup {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
store: root.store
|
store: root.store
|
||||||
|
transactionStore: root.transactionStore
|
||||||
stickerPacks: d.stickerPackList
|
stickerPacks: d.stickerPackList
|
||||||
packId: stickerPackListView.selectedPackId
|
packId: stickerPackListView.selectedPackId
|
||||||
marketVisible: d.stickerPacksLoaded && d.online
|
marketVisible: d.stickerPacksLoaded && d.online
|
||||||
|
@ -8,15 +8,17 @@ import utils 1.0
|
|||||||
|
|
||||||
import StatusQ.Core.Utils 0.1
|
import StatusQ.Core.Utils 0.1
|
||||||
|
|
||||||
|
import AppLayouts.Wallet.stores 1.0
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property CurrenciesStore currencyStore: CurrenciesStore {}
|
property CurrenciesStore currencyStore: CurrenciesStore {}
|
||||||
|
property WalletAssetsStore walletAssetStore
|
||||||
|
|
||||||
property var mainModuleInst: mainModule
|
property var mainModuleInst: mainModule
|
||||||
property var walletSectionSendInst: walletSectionSend
|
property var walletSectionSendInst: walletSectionSend
|
||||||
|
|
||||||
property var assets: walletSectionAssets.assets
|
|
||||||
property var fromNetworksModel: walletSectionSendInst.fromNetworksModel
|
property var fromNetworksModel: walletSectionSendInst.fromNetworksModel
|
||||||
property var toNetworksModel: walletSectionSendInst.toNetworksModel
|
property var toNetworksModel: walletSectionSendInst.toNetworksModel
|
||||||
property var allNetworksModel: networksModule.all
|
property var allNetworksModel: networksModule.all
|
||||||
@ -108,15 +110,15 @@ QtObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getAsset(assetsList, symbol) {
|
function getAsset(assetsList, symbol) {
|
||||||
for(var i=0; i< assetsList.count;i++) {
|
for(var i=0; i< assetsList.rowCount();i++) {
|
||||||
if(symbol === assetsList.rowData(i, "symbol")) {
|
let asset = ModelUtils.get(assetsList, i)
|
||||||
|
if(symbol === asset.symbol) {
|
||||||
return {
|
return {
|
||||||
name: assetsList.rowData(i, "name"),
|
name: asset.name,
|
||||||
symbol: assetsList.rowData(i, "symbol"),
|
symbol: asset.symbol,
|
||||||
totalBalance: JSON.parse(assetsList.rowData(i, "totalBalance")),
|
totalBalance: asset.totalBalance,
|
||||||
totalCurrencyBalance: JSON.parse(assetsList.rowData(i, "totalCurrencyBalance")),
|
balances: asset.balances,
|
||||||
balances: assetsList.rowData(i, "balances"),
|
decimals: asset.decimals
|
||||||
decimals: assetsList.rowData(i, "decimals")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -141,7 +143,7 @@ QtObject {
|
|||||||
|
|
||||||
function getHolding(holdingId, holdingType) {
|
function getHolding(holdingId, holdingType) {
|
||||||
if (holdingType === Constants.TokenType.ERC20) {
|
if (holdingType === Constants.TokenType.ERC20) {
|
||||||
return getAsset(selectedSenderAccount.assets, holdingId)
|
return getAsset(walletAssetStore.groupedAccountAssetsModel, holdingId)
|
||||||
} else if (holdingType === Constants.TokenType.ERC721) {
|
} else if (holdingType === Constants.TokenType.ERC721) {
|
||||||
return getCollectible(holdingId)
|
return getCollectible(holdingId)
|
||||||
} else {
|
} else {
|
||||||
@ -151,7 +153,7 @@ QtObject {
|
|||||||
|
|
||||||
function getSelectorHolding(holdingId, holdingType) {
|
function getSelectorHolding(holdingId, holdingType) {
|
||||||
if (holdingType === Constants.TokenType.ERC20) {
|
if (holdingType === Constants.TokenType.ERC20) {
|
||||||
return getAsset(selectedSenderAccount.assets, holdingId)
|
return getAsset(walletAssetStore.groupedAccountAssetsModel, holdingId)
|
||||||
} else if (holdingType === Constants.TokenType.ERC721) {
|
} else if (holdingType === Constants.TokenType.ERC721) {
|
||||||
return getSelectorCollectible(holdingId)
|
return getSelectorCollectible(holdingId)
|
||||||
} else {
|
} else {
|
||||||
@ -256,4 +258,14 @@ QtObject {
|
|||||||
function getShortChainIds(chainShortNames) {
|
function getShortChainIds(chainShortNames) {
|
||||||
return walletSectionSendInst.getShortChainIds(chainShortNames)
|
return walletSectionSendInst.getShortChainIds(chainShortNames)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getCurrencyAmountFromBigInt(balance, symbol, decimals) {
|
||||||
|
let bigIntBalance = AmountsArithmetic.fromString(balance)
|
||||||
|
let decimalBalance = AmountsArithmetic.toNumber(bigIntBalance, decimals)
|
||||||
|
return currencyStore.getCurrencyAmount(decimalBalance, symbol)
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCurrentCurrencyAmount(balance) {
|
||||||
|
return currencyStore.getCurrencyAmount(balance, currencyStore.currentCurrency)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user