Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion storybook/pages/AccountSelectorPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import shared.controls
import shared.stores

import AppLayouts.Wallet.stores
import AppLayouts.Wallet.storesmocks as WalletStoreMocks
import AppLayouts.Wallet.adaptors

import utils
Expand All @@ -25,7 +26,7 @@ SplitView {
readonly property var flatNetworks: NetworksModel.flatNetworks
readonly property var assetsStore: WalletAssetsStore {
id: thisWalletAssetStore
walletTokensStore: TokensStore {
walletTokensStore: WalletStoreMocks.TokensStore {
tokenGroupsModel: TokenGroupsModel {}
}
readonly property var baseGroupedAccountAssetModel: GroupedAccountsAssetsModel {}
Expand Down
3 changes: 2 additions & 1 deletion storybook/pages/AssetsDetailViewPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import QtQuick.Layouts

import AppLayouts.Wallet.views
import AppLayouts.Wallet.stores as WalletStores
import AppLayouts.Wallet.storesmocks as WalletStoreMocks

import shared.stores as SharedStores

Expand All @@ -17,7 +18,7 @@ Item {
AssetsDetailView {
anchors.fill: parent

tokensStore: WalletStores.TokensStore {}
tokensStore: WalletStoreMocks.TokensStore {}
currencyStore: SharedStores.CurrenciesStore {}
networkConnectionStore: SharedStores.NetworkConnectionStore {}

Expand Down
3 changes: 2 additions & 1 deletion storybook/pages/BuyCryptoModalPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import StatusQ.Core.Backpressure

import AppLayouts.Wallet.popups.buy
import AppLayouts.Wallet.stores
import AppLayouts.Wallet.storesmocks as WalletStoreMocks
import AppLayouts.Wallet.adaptors

import shared.stores
Expand Down Expand Up @@ -53,7 +54,7 @@ SplitView {
readonly property var currencyStore: CurrenciesStore {}
readonly property var assetsStore: WalletAssetsStore {
id: thisWalletAssetStore
walletTokensStore: TokensStore {
walletTokensStore: WalletStoreMocks.TokensStore {
tokenGroupsModel: TokenGroupsModel {}
}
readonly property var baseGroupedAccountAssetModel: GroupedAccountsAssetsModel {}
Expand Down
28 changes: 25 additions & 3 deletions storybook/pages/SendModalPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,31 @@ SplitView {
function resetData() {}

walletAssetStore: root.walletAssetStore
tokensStore.showCommunityAssetsInSend: showCommunityAssetsCheckBox.checked
tokensStore.displayAssetsBelowBalance: balanceThresholdCheckbox.checked
tokensStore.getDisplayAssetsBelowBalanceThresholdDisplayAmount: () => Number(balanceThresholdValue.text)
Component.onCompleted: {
if (tokensStore) {
tokensStore.showCommunityAssetsInSend = showCommunityAssetsCheckBox.checked
tokensStore.displayAssetsBelowBalance = balanceThresholdCheckbox.checked
tokensStore._displayAssetsBelowBalanceThresholdDisplayAmountFunc = () => Number(balanceThresholdValue.text)
}
}
}

Connections {
target: showCommunityAssetsCheckBox
function onCheckedChanged() {
if (txStore.tokensStore) {
txStore.tokensStore.showCommunityAssetsInSend = showCommunityAssetsCheckBox.checked
}
}
}

Connections {
target: balanceThresholdCheckbox
function onCheckedChanged() {
if (txStore.tokensStore) {
txStore.tokensStore.displayAssetsBelowBalance = balanceThresholdCheckbox.checked
}
}
}

NetworksStore {
Expand Down
5 changes: 3 additions & 2 deletions storybook/pages/SimpleSendModalPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import Storybook

import AppLayouts.Wallet.popups.simpleSend
import AppLayouts.Wallet.stores
import AppLayouts.Wallet.storesmocks as WalletStoreMocks
import AppLayouts.Wallet.adaptors

import utils
Expand All @@ -34,9 +35,9 @@ SplitView {
}

readonly property WalletAssetsStore walletAssetStore: WalletAssetsStore {
walletTokensStore: TokensStore {
walletTokensStore: WalletStoreMocks.TokensStore {
tokenGroupsModel: TokenGroupsModel{}
getDisplayAssetsBelowBalanceThresholdDisplayAmount: () => 0
_displayAssetsBelowBalanceThresholdDisplayAmountFunc: () => 0
}
}

Expand Down
3 changes: 2 additions & 1 deletion storybook/pages/SwapInputPanelPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import shared.stores
import shared.stores.send

import AppLayouts.Wallet.stores
import AppLayouts.Wallet.storesmocks as WalletStoreMocks
import AppLayouts.Wallet.panels
import AppLayouts.Wallet.controls

Expand Down Expand Up @@ -75,7 +76,7 @@ SplitView {
}
walletAssetsStore: WalletAssetsStore {
id: thisWalletAssetStore
walletTokensStore: TokensStore {
walletTokensStore: WalletStoreMocks.TokensStore {
tokenGroupsModel: TokenGroupsModel {}
}
readonly property var baseGroupedAccountAssetModel: GroupedAccountsAssetsModel {}
Expand Down
5 changes: 3 additions & 2 deletions storybook/pages/SwapModalPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import Models
import mainui
import AppLayouts.Wallet.popups.swap
import AppLayouts.Wallet.stores
import AppLayouts.Wallet.storesmocks as WalletStoreMocks
import AppLayouts.stores as AppLayoutStores
import shared.stores as SharedStores

Expand Down Expand Up @@ -115,10 +116,10 @@ SplitView {
signalName: "authenticateAndTransferSignal"
}

TokensStore {
WalletStoreMocks.TokensStore {
id: tokensStore
tokenGroupsModel: TokenGroupsModel {}
getDisplayAssetsBelowBalanceThresholdDisplayAmount: () => 0
_displayAssetsBelowBalanceThresholdDisplayAmountFunc: () => 0
}

SwapModalAdaptor {
Expand Down
3 changes: 2 additions & 1 deletion storybook/pages/WalletAccountsSelectorAdaptorPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import QtQuick.Layouts
import SortFilterProxyModel

import AppLayouts.Wallet.stores
import AppLayouts.Wallet.storesmocks as WalletStoreMocks
import AppLayouts.Wallet.adaptors

import Storybook
Expand Down Expand Up @@ -100,7 +101,7 @@ Item {

readonly property var assetsStore: WalletAssetsStore {
id: thisWalletAssetStore
walletTokensStore: TokensStore {
walletTokensStore: WalletStoreMocks.TokensStore {
tokenGroupsModel: TokenGroupsModel {}
}
readonly property var baseGroupedAccountAssetModel: GroupedAccountsAssetsModel {}
Expand Down
3 changes: 2 additions & 1 deletion storybook/qmlTests/tests/tst_BuyCryptoModal.qml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import utils

import AppLayouts.Wallet.popups.buy
import AppLayouts.Wallet.stores
import AppLayouts.Wallet.storesmocks as WalletStoreMocks

import shared.stores

Expand Down Expand Up @@ -92,7 +93,7 @@ Item {
}
readonly property var assetsStore: WalletAssetsStore {
id: thisWalletAssetStore
walletTokensStore: TokensStore {
walletTokensStore: WalletStoreMocks.TokensStore {
tokenGroupsModel: TokenGroupsModel {}
}
}
Expand Down
5 changes: 3 additions & 2 deletions storybook/qmlTests/tests/tst_DAppsWorkflow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import AppLayouts.Wallet.services.dapps.types
import AppLayouts.Profile.stores
import AppLayouts.Wallet.panels
import AppLayouts.Wallet.stores as WalletStore
import AppLayouts.Wallet.storesmocks as WalletStoreMocks
import AppLayouts.Wallet.popups.dapps

import shared.stores
Expand Down Expand Up @@ -313,7 +314,7 @@ Item {

WalletStore.WalletAssetsStore {
id: assetsStoreMock
walletTokensStore: WalletStore.TokensStore {
walletTokensStore: WalletStoreMocks.TokensStore {
tokenGroupsModel: TokenGroupsModel {}
}
}
Expand Down Expand Up @@ -581,7 +582,7 @@ Item {
session.params.request.expiryTimestamp = (Date.now() - 10000) / 1000

verify(session.params.request.expiryTimestamp < Date.now() / 1000, "expected expiryTimestamp to be in the past")

mockActiveSession(handler.accountsModel, handler.networksModel, sdk, topic)
sdk.sessionRequestEvent(session)

Expand Down
3 changes: 2 additions & 1 deletion storybook/qmlTests/tests/tst_SwapInputPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import StatusQ.Controls
import StatusQ.Core.Utils

import AppLayouts.Wallet.stores
import AppLayouts.Wallet.storesmocks as WalletStoreMocks
import AppLayouts.Wallet.panels
import AppLayouts.Wallet.popups.swap
import AppLayouts.Wallet.adaptors
Expand Down Expand Up @@ -36,7 +37,7 @@ Item {
readonly property var accounts: WalletAccountsModel {}
}
walletAssetsStore: WalletAssetsStore {
walletTokensStore: TokensStore {
walletTokensStore: WalletStoreMocks.TokensStore {
tokenGroupsModel: TokenGroupsModel {}
tokenGroupsForChainModel: TokenGroupsModel {
skipInitialLoad: true
Expand Down
7 changes: 4 additions & 3 deletions storybook/qmlTests/tests/tst_SwapModal.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import QtQuick
import QtQuick
import QtTest

import StatusQ.Core
Expand All @@ -15,6 +15,7 @@ import utils
import shared.stores
import AppLayouts.Wallet.popups.swap
import AppLayouts.Wallet.stores
import AppLayouts.Wallet.storesmocks as WalletStoreMocks
import AppLayouts.Wallet
import AppLayouts.Wallet.adaptors

Expand Down Expand Up @@ -52,7 +53,7 @@ Item {
currencyStore: CurrenciesStore {}
walletAssetsStore: WalletAssetsStore {
id: thisWalletAssetStore
walletTokensStore: TokensStore {
walletTokensStore: WalletStoreMocks.TokensStore {
tokenGroupsModel: TokenGroupsModel {}
tokenGroupsForChainModel: TokenGroupsModel {
skipInitialLoad: true
Expand All @@ -61,7 +62,7 @@ Item {
skipInitialLoad: true
tokenGroupsForChainModel: thisWalletAssetStore.walletTokensStore.tokenGroupsForChainModel
}
getDisplayAssetsBelowBalanceThresholdDisplayAmount: () => 0
_displayAssetsBelowBalanceThresholdDisplayAmountFunc: () => 0
}
readonly property var baseGroupedAccountAssetModel: GroupedAccountsAssetsModel {}
}
Expand Down
3 changes: 2 additions & 1 deletion storybook/qmlTests/tests/tst_TokenSelectorViewAdaptor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import StatusQ
import StatusQ.Core.Utils

import AppLayouts.Wallet.stores
import AppLayouts.Wallet.storesmocks as WalletStoreMocks
import AppLayouts.Wallet.adaptors

import QtModelsToolkit
Expand All @@ -26,7 +27,7 @@ Item {

readonly property var flatNetworks: NetworksModel.flatNetworks
readonly property var assetsStore: WalletAssetsStore {
walletTokensStore: TokensStore {
walletTokensStore: WalletStoreMocks.TokensStore {
tokenGroupsModel: TokenGroupsModel {}
tokenGroupsForChainModel: TokenGroupsModel {
skipInitialLoad: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import StatusQ
import StatusQ.Core.Utils

import AppLayouts.Wallet.stores
import AppLayouts.Wallet.storesmocks as WalletStoreMocks
import AppLayouts.Wallet.adaptors

import Models
Expand Down Expand Up @@ -109,7 +110,7 @@ Item {
readonly property var flatNetworks: NetworksModel.flatNetworks
readonly property var assetsStore: WalletAssetsStore {
id: thisWalletAssetStore
walletTokensStore: TokensStore {
walletTokensStore: WalletStoreMocks.TokensStore {
tokenGroupsModel: TokenGroupsModel {}
}
}
Expand Down
73 changes: 1 addition & 72 deletions storybook/stubs/AppLayouts/Wallet/stores/TokensStore.qml
Original file line number Diff line number Diff line change
@@ -1,74 +1,3 @@
import QtQuick

import StatusQ.Core.Utils

import QtModelsToolkit

QtObject {
id: root

property var tokenGroupsModel
property var tokenGroupsForChainModel
property var searchResultModel
property bool showCommunityAssetsInSend
property bool displayAssetsBelowBalance
property var getDisplayAssetsBelowBalanceThresholdDisplayAmount
property double tokenListUpdatedAt

function buildGroupsForChain(chainId) {
if (!root.tokenGroupsModel || chainId <= 0) {
console.warn("buildGroupsForChain: invalid parameters", chainId)
return
}

if (!root.tokenGroupsForChainModel) {
console.warn("buildGroupsForChain: tokenGroupsForChainModel is not set")
return
}

root.tokenGroupsForChainModel.clear()

for (let i = 0; i < root.tokenGroupsModel.ModelCount.count; i++) {
const group = ModelUtils.get(root.tokenGroupsModel, i)

if (!group.tokens || group.tokens.ModelCount.count === 0) {
continue
}

const tokensListModel = Qt.createQmlObject('import QtQuick; ListModel {}', root)
for (let j = 0; j < group.tokens.ModelCount.count; j++) {
const token = ModelUtils.get(group.tokens, j)
if (token.chainId === chainId) {
tokensListModel.append({
key: token.key,
groupKey: token.groupKey,
crossChainId: token.crossChainId,
chainId: token.chainId,
address: token.address,
name: token.name,
symbol: token.symbol,
decimals: token.decimals,
image: token.image,
customToken: token.customToken,
communityId: token.communityId
})
}
}

if (tokensListModel.count > 0) {
root.tokenGroupsForChainModel.append({
key: group.key,
symbol: group.symbol,
name: group.name,
decimals: group.decimals,
logoUri: group.logoUri,
tokens: tokensListModel,
communityId: group.communityId || "",
marketDetails: group.marketDetails || {},
detailsLoading: group.detailsLoading || false,
marketDetailsLoading: group.marketDetailsLoading || false
})
}
}
}
}
QtObject {}
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ import utils
import QtModelsToolkit
import SortFilterProxyModel

import AppLayouts.Wallet.stores
import AppLayouts.Wallet.storesmocks as WalletStoreMocks

QtObject {
id: root

property TokensStore walletTokensStore: TokensStore {}
property var walletTokensStore: WalletStoreMocks.TokensStore {}

property var baseGroupedAccountAssetModel: BaseGroupedAccountsAssetsModel {}

Expand Down
Loading